From pgsql-performance-owner@postgresql.org Tue Jul 1 00:22:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A0138310B0C for ; Tue, 1 Jul 2003 03:19:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 56298-06 for ; Tue, 1 Jul 2003 00:19:22 -0300 (ADT) Received: from unix03.wehi.EDU.AU (unix03.wehi.edu.au [128.250.252.86]) by svr1.postgresql.org (Postfix) with ESMTP id 77CE2310AD1 for ; Tue, 1 Jul 2003 00:19:20 -0300 (ADT) Received: from unix82.alpha.wehi.edu.au (unix82.alpha.wehi.edu.au [192.168.97.82]) by unix03.wehi.EDU.AU (8.12.9/8.12.9) with ESMTP id h613JIds000898 for ; Tue, 1 Jul 2003 13:19:18 +1000 (EST) Received: (from sargeant@localhost) by unix82.alpha.wehi.edu.au (8.11.6/8.11.6) id h613JOl31520 for pgsql-performance@postgresql.org; Tue, 1 Jul 2003 13:19:24 +1000 Date: Tue, 1 Jul 2003 13:19:23 +1000 From: Toby Sargeant To: pgsql-performance@postgresql.org Subject: excessive disk access during query Message-ID: <20030701031919.GC30242@wehi.edu.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8NvZYKFJsRX2Djef" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Archive-Number: 200307/1 X-Sequence-Number: 2294 --8NvZYKFJsRX2Djef Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I have a pretty trivial query that seems to take an excessive amount of time to run, and while doing so is only consuming 5-10% of CPU. It looks like the rest of the time is spent doing disk access (the hd is certainly grinding away a lot). I'm not sure whether this is able to be improved, and if it is, what to tweak. Admittedly the tables are pretty large, but a test using dd shows that I'm getting something like 30M/sec off disk (without hitting cache), and while the query is running the kernel has ~1.7G worth of cache available. The tables and indices in question appear to be around 200M each, which I would have thought would fit in cache quite nicely. The machine itself is a 3GHz P4 w/ 2G memory. I don't have root on it, so I haven't been able to play with hdparm too much, but I have requested that it be set up with hdparm -u1 -d1 -m16 (which is my default guess for disk tuning parameters). Thanks, Toby. The relevant data (sorry about the long lines) is: postgres config: shared_buffers = 32768 max_fsm_relations = 100 max_fsm_pages = 50000 sort_mem = 16384 vacuum_mem = 65536 effective_cache_size = 163840 table sizes: sargeant=> select relname, relpages from pg_class where relname like 'seq_text%' order by relpages desc; relname | relpages -----------------------------+---------- seq_text | 55764 seq_text_text_index | 30343 seq_text_text_lindex | 30343 seq_text_map | 28992 seq_text_map_seq_index | 22977 seq_text_pkey | 7528 seq_text_map_seq_text_index | 6478 seq_text_id_seq | 1 (8 rows) query: sargeant=> explain analyze select seq_md5sum, seq_alphabet from seq_text_map, seq_text where lower(text) like '%porin%' and seq_text.id = seq_text_map.seq_text_id; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=0.00..448139.41 rows=14786 width=52) (actual time=1582.24..125624.92 rows=2140 loops=1) Merge Cond: ("outer".seq_text_id = "inner".id) -> Index Scan using seq_text_map_seq_text_index on seq_text_map (cost=0.00..154974.74 rows=2957158 width=48) (actual time=23.04..110877.65 rows=2956147 loops=1) -> Index Scan using seq_text_pkey on seq_text (cost=0.00..285540.03 rows=17174 width=4) (actual time=71.51..12260.38 rows=3077 loops=1) Filter: (lower(text) ~~ '%porin%'::text) Total runtime: 125627.45 msec (6 rows) --8NvZYKFJsRX2Djef Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/AP23+/wZttnhWGYRAs9mAJ4i6SBqbFUtu3ODxDlG4LBb6UsE4gCfY/J3 QKlItez24wxsyAc4GxqJpoM= =BUCg -----END PGP SIGNATURE----- --8NvZYKFJsRX2Djef-- From pgsql-performance-owner@postgresql.org Tue Jul 1 04:45:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E448030F616 for ; Tue, 1 Jul 2003 07:45:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 98028-08 for ; Tue, 1 Jul 2003 04:45:09 -0300 (ADT) Received: from ns1.pe-muc.de (unknown [193.98.167.13]) by svr1.postgresql.org (Postfix) with ESMTP id 2FCCE310A54 for ; Tue, 1 Jul 2003 04:45:09 -0300 (ADT) Received: from pe-muc.de (tofana.pe-muc.de [193.98.167.253]) by ns1.pe-muc.de (PE Postfix Mail Server (Linux 7.3 i386)) with ESMTP id BA242F3882 for ; Tue, 1 Jul 2003 09:45:08 +0200 (CEST) Message-ID: <3F013C85.2060202@pe-muc.de> Date: Tue, 01 Jul 2003 09:47:17 +0200 From: Juraj Porada User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: de-de, de MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: slower with the time Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200307/2 X-Sequence-Number: 2295 I insert data every second in my table. Every minute I delete from the table some row to keep max 10000 rows in the table. At the beginning deletes consume about 20% CPU time. After 24 houts every delete needs up tu 100% CPU time (updates too). Vacuuming doesn't help. After I restart postmaster, it works again very quick. Any ideas? Thanks, Juraj Delete query: DELETE FROM tbl WHERE time_stamp >= 0.0 AND time_stamp < (SELECT max(time_stamp) FROM (SELECT time_stamp FROM tbl ORDER BY time_stamp, id_event_archive ASC LIMIT 222) AS t) PK: id_event_archive Index: time_stamp Postgres version: 7.3.3. OS: Solaris 2.8 From pgsql-performance-owner@postgresql.org Tue Jul 1 04:49:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 44DEB310B49 for ; Tue, 1 Jul 2003 07:49:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 97354-08 for ; Tue, 1 Jul 2003 04:48:57 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 4B779310AE8 for ; Tue, 1 Jul 2003 04:48:56 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h617mtM10159 for ; Tue, 1 Jul 2003 13:18:55 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h617mtg10154 for ; Tue, 1 Jul 2003 13:18:55 +0530 From: Shridhar Daithankar To: pgsql-performance@postgresql.org Subject: Re: slower with the time Date: Tue, 1 Jul 2003 13:18:00 +0530 User-Agent: KMail/1.5.2 References: <3F013C85.2060202@pe-muc.de> In-Reply-To: <3F013C85.2060202@pe-muc.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307011318.00824.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/3 X-Sequence-Number: 2296 On Tuesday 01 July 2003 13:17, Juraj Porada wrote: > I insert data every second in my table. Every minute I delete from the > table some row to keep max 10000 rows in the table. > At the beginning deletes consume about 20% CPU time. After 24 houts > every delete needs up tu 100% CPU time (updates too). > Vacuuming doesn't help. > After I restart postmaster, it works again very quick. > Any ideas? Postmaster does not consume CPU for simple things like this unless it does not have enough shared buffers. What is your shared buffer setting? Can you tune it according to available RAM, dataset size and type of workload? Shridhar From pgsql-performance-owner@postgresql.org Tue Jul 1 05:08:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 95F74310B7F for ; Tue, 1 Jul 2003 08:08:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 98290-09 for ; Tue, 1 Jul 2003 05:08:00 -0300 (ADT) Received: from ns1.pe-muc.de (unknown [193.98.167.13]) by svr1.postgresql.org (Postfix) with ESMTP id 1E978310B20 for ; Tue, 1 Jul 2003 05:08:00 -0300 (ADT) Received: from pe-muc.de (tofana.pe-muc.de [193.98.167.253]) by ns1.pe-muc.de (PE Postfix Mail Server (Linux 7.3 i386)) with ESMTP id B6445F3882; Tue, 1 Jul 2003 10:07:59 +0200 (CEST) Message-ID: <3F0141E0.50703@pe-muc.de> Date: Tue, 01 Jul 2003 10:10:08 +0200 From: Juraj Porada User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; rv:1.0.1) Gecko/20020823 Netscape/7.0 X-Accept-Language: de-de, de MIME-Version: 1.0 To: Shridhar Daithankar Cc: pgsql-performance@postgresql.org Subject: Re: slower with the time References: <3F013C85.2060202@pe-muc.de> <200307011318.00824.shridhar_daithankar@nospam.persistent.co.in> Content-Type: multipart/alternative; boundary="------------010106020508050605040009" X-Archive-Number: 200307/4 X-Sequence-Number: 2297 --------------010106020508050605040009 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit shared_buffers = 32 I don't have much experience in tuning the database, but I think there is a problem with a fragmentation of memory or so. I don't known backgrounds. Juraj Shridhar Daithankar schrieb: >On Tuesday 01 July 2003 13:17, Juraj Porada wrote: > > >>I insert data every second in my table. Every minute I delete from the >>table some row to keep max 10000 rows in the table. >>At the beginning deletes consume about 20% CPU time. After 24 houts >>every delete needs up tu 100% CPU time (updates too). >>Vacuuming doesn't help. >>After I restart postmaster, it works again very quick. >>Any ideas? >> >> > >Postmaster does not consume CPU for simple things like this unless it does not >have enough shared buffers. > >What is your shared buffer setting? Can you tune it according to available >RAM, dataset size and type of workload? > > Shridhar > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > > --------------010106020508050605040009 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit shared_buffers = 32

I don't have much experience in tuning the database, but I think there is a problem with a fragmentation of memory or so.
I don't known backgrounds.

Juraj

Shridhar Daithankar schrieb:
On Tuesday 01 July 2003 13:17, Juraj Porada wrote:
  
I insert data every second in my table. Every minute I delete from the
table some row to keep max 10000 rows in the table.
At the beginning deletes consume about 20% CPU time. After 24 houts
every delete needs up tu 100% CPU time (updates too).
Vacuuming doesn't help.
After I restart postmaster, it works again very quick.
Any ideas?
    

Postmaster does not consume CPU for simple things like this unless it does not 
have enough shared buffers. 

What is your shared buffer setting? Can you tune it according to available 
RAM, dataset size and type of workload?

 Shridhar


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

               http://archives.postgresql.org

  

--------------010106020508050605040009-- From pgsql-performance-owner@postgresql.org Tue Jul 1 05:18:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E694E30F616 for ; Tue, 1 Jul 2003 08:18:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 05080-03 for ; Tue, 1 Jul 2003 05:18:04 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id DB76F310B6E for ; Tue, 1 Jul 2003 05:18:02 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h618I2l15233 for ; Tue, 1 Jul 2003 13:48:02 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h618I1g15222 for ; Tue, 1 Jul 2003 13:48:02 +0530 From: Shridhar Daithankar To: pgsql-performance@postgresql.org Subject: Re: slower with the time Date: Tue, 1 Jul 2003 13:47:06 +0530 User-Agent: KMail/1.5.2 References: <3F013C85.2060202@pe-muc.de> <200307011318.00824.shridhar_daithankar@nospam.persistent.co.in> <3F0141E0.50703@pe-muc.de> In-Reply-To: <3F0141E0.50703@pe-muc.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307011347.06532.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/5 X-Sequence-Number: 2298 On Tuesday 01 July 2003 13:40, Juraj Porada wrote: > shared_buffers = 32 That is 32*8=256KB of memory. I thought default was 64. How much physical memory you have? I suggest you set it up something like 256 to start with. That may be too small as well but you haven't provided enough details to come up with a better one. > > I don't have much experience in tuning the database, but I think there > is a problem with a fragmentation of memory or so. > I don't known backgrounds. Read postgresql.conf and admin guide about runtime parameters. You need to tune shared buffers and effective_cache_size at least. Search performance archives about tuning these two. There is lot of material to cover in a single mail. HTH Shridhar From pgsql-performance-owner@postgresql.org Tue Jul 1 09:10:33 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B58FE310A2C for ; Tue, 1 Jul 2003 12:10:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 45804-10 for ; Tue, 1 Jul 2003 09:10:21 -0300 (ADT) Received: from lorraine.ipl.co.uk (lorraine.ipl.co.uk [195.112.52.123]) by svr1.postgresql.org (Postfix) with ESMTP id F0B38310A23 for ; Tue, 1 Jul 2003 09:10:19 -0300 (ADT) Received: from HFPORT.dmr.co.uk ([195.112.52.21]) by lorraine.ipl.co.uk (8.12.9/8.12.9) with ESMTP id h61CA28s020812 for ; Tue, 1 Jul 2003 13:10:04 +0100 Message-Id: <5.1.0.14.0.20030701125931.02040fa0@mailserver.ipl.co.uk> X-Sender: hf1@mailserver.ipl.co.uk X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 01 Jul 2003 13:10:08 +0100 To: pgsql-performance@postgresql.org From: Hilary Forbes Subject: Version 7 question Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Archive-Number: 200307/6 X-Sequence-Number: 2299 I'm just trying to improve performance on version 7 before doing some tests and hopefully upgrading to 7.3. At the moment we have B=64 (no of shared buffers) N=32 (no of connections) in postmaster.opt which I take it is the equivalent of the new postgresql.conf file. From all that is being written about later versions I suspect that this is far too low. Would I be fairly safe in making the no of shared buffers larger? Also is there an equivalent of effective_cache_size that I can set for version 7? Many thanks in advance Hilary Hilary Forbes ------------- DMR Computer Limited: http://www.dmr.co.uk/ Direct line: 01689 889950 Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 E-mail: hforbes@dmr.co.uk ********************************************************** From pgsql-performance-owner@postgresql.org Tue Jul 1 09:17:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0D7A430F536 for ; Tue, 1 Jul 2003 12:17:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 51636-05 for ; Tue, 1 Jul 2003 09:17:05 -0300 (ADT) Received: from mwinf0202.wanadoo.fr (smtp7.wanadoo.fr [193.252.22.29]) by svr1.postgresql.org (Postfix) with ESMTP id 44D8530F452 for ; Tue, 1 Jul 2003 09:17:05 -0300 (ADT) Received: from Paris (ABoulogne-110-1-3-43.w80-15.abo.wanadoo.fr [80.15.41.43]) by mwinf0202.wanadoo.fr (SMTP Server) with ESMTP id 64FCDA400116; Tue, 1 Jul 2003 14:17:04 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Hilary Forbes" , Subject: Re: Version 7 question Date: Tue, 1 Jul 2003 14:17:08 +0200 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <5.1.0.14.0.20030701125931.02040fa0@mailserver.ipl.co.uk> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/7 X-Sequence-Number: 2300 I have my shared buffers at 8192 and my effective cache at 64000 (which is 500 megs). Depends a lot on how much RAM you have. I have 1.5 gigs and I've been asking my boss for another 512megs for over a month now. I have no idea if my buffers are too high/low. Michael > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > Forbes > Sent: Tuesday, July 01, 2003 2:10 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] Version 7 question > > > I'm just trying to improve performance on version 7 before doing > some tests and hopefully upgrading to 7.3. > > At the moment we have > B=64 (no of shared buffers) > N=32 (no of connections) > in postmaster.opt which I take it is the equivalent of the new > postgresql.conf file. > > From all that is being written about later versions I suspect > that this is far too low. Would I be fairly safe in making the > no of shared buffers larger? Also is there an equivalent of > effective_cache_size that I can set for version 7? > > Many thanks in advance > Hilary > > > > > Hilary Forbes > ------------- > DMR Computer Limited: http://www.dmr.co.uk/ > Direct line: 01689 889950 > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > E-mail: hforbes@dmr.co.uk > > ********************************************************** > > > ---------------------------(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 Tue Jul 1 09:53:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C97C030FF25 for ; Tue, 1 Jul 2003 12:53:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 56227-04 for ; Tue, 1 Jul 2003 09:52:50 -0300 (ADT) Received: from localhost.localdomain (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id AC6D63106B8 for ; Tue, 1 Jul 2003 09:52:49 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h61DoO4i016885; Tue, 1 Jul 2003 09:50:24 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h61CqRZ13981; Tue, 1 Jul 2003 08:52:27 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id MTKBPTNK; Tue, 1 Jul 2003 08:52:25 -0400 Subject: Re: Version 7 question From: Robert Treat To: Hilary Forbes Cc: pgsql-performance@postgresql.org In-Reply-To: <5.1.0.14.0.20030701125931.02040fa0@mailserver.ipl.co.uk> References: <5.1.0.14.0.20030701125931.02040fa0@mailserver.ipl.co.uk> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 01 Jul 2003 08:52:26 -0400 Message-Id: <1057063946.24304.377.camel@camel> Mime-Version: 1.0 X-Archive-Number: 200307/8 X-Sequence-Number: 2301 On Tue, 2003-07-01 at 08:10, Hilary Forbes wrote: > I'm just trying to improve performance on version 7 before doing some tests and hopefully upgrading to 7.3. > > At the moment we have > B=64 (no of shared buffers) > N=32 (no of connections) > in postmaster.opt which I take it is the equivalent of the new postgresql.conf file. > > From all that is being written about later versions I suspect that >this is far too low. Would I be fairly safe in making the no of shared >buffers larger? yes, I'd say start with about 25% of RAM, then adjust from there. If 25% takes you over your SHMMAX then start at your SHMMAX. >Also is there an equivalent of effective_cache_size that I can set for >version 7? > If by 7 your mean 7.0.x then I don't believe so, been awhile though, I could be wrong. IMHO no amount of tuning you can do in 7.0 would be as effective as an upgrade, after setting your shared buffers up, I'd put your efforts into upgrading. (Note Beta test for 7.4 starts in 2 weeks) Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Tue Jul 1 10:03:38 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 610C7310AA2 for ; Tue, 1 Jul 2003 13:03:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 66352-01 for ; Tue, 1 Jul 2003 10:03:26 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id EE5E93106BE for ; Tue, 1 Jul 2003 10:03:24 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h61D1aQX016049; Tue, 1 Jul 2003 07:01:36 -0600 (MDT) Date: Tue, 1 Jul 2003 06:55:55 -0600 (MDT) From: "scott.marlowe" To: Michael Mattox Cc: Hilary Forbes , Subject: Re: Version 7 question In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/10 X-Sequence-Number: 2303 8192 is only 64 megs of RAM, not much, but a good number. Keep in mind that the kernel tends to be better at buffering huge amounts of disk, while postgresql is better left to use buffers that are large enough for the current working set (i.e. not your whole database, just the largest amount of data you're slinging about on a regular basis in one query.) On a machine with 1.5 gig of RAM, I've found settings as high as 32768 (256 megs of ram) to run well, but anything over that doesn't help. Of course, we don't toss around more than a hundred meg or so at a time. If our result sets were in the gigabyte range, I'd A: want more memory and B: Give more of it to postgresql. The original poster was, I believe running 7.0.x, which is way old, so no, I don't think there was an equivalent of effective_cache_size in that version. Upgrading would be far easier than performance tuning 7.0. since the query planner was much simpler (i.e. more prone to make bad decisions) in 7.0. On Tue, 1 Jul 2003, Michael Mattox wrote: > I have my shared buffers at 8192 and my effective cache at 64000 (which is > 500 megs). Depends a lot on how much RAM you have. I have 1.5 gigs and > I've been asking my boss for another 512megs for over a month now. I have > no idea if my buffers are too high/low. > > Michael > > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > Forbes > > Sent: Tuesday, July 01, 2003 2:10 PM > > To: pgsql-performance@postgresql.org > > Subject: [PERFORM] Version 7 question > > > > > > I'm just trying to improve performance on version 7 before doing > > some tests and hopefully upgrading to 7.3. > > > > At the moment we have > > B=64 (no of shared buffers) > > N=32 (no of connections) > > in postmaster.opt which I take it is the equivalent of the new > > postgresql.conf file. > > > > From all that is being written about later versions I suspect > > that this is far too low. Would I be fairly safe in making the > > no of shared buffers larger? Also is there an equivalent of > > effective_cache_size that I can set for version 7? > > > > Many thanks in advance > > Hilary > > > > > > > > > > Hilary Forbes > > ------------- > > DMR Computer Limited: http://www.dmr.co.uk/ > > Direct line: 01689 889950 > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > E-mail: hforbes@dmr.co.uk > > > > ********************************************************** > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > ---------------------------(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 Tue Jul 1 10:02:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0BC0E3106CD for ; Tue, 1 Jul 2003 13:02:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 64290-04 for ; Tue, 1 Jul 2003 10:02:16 -0300 (ADT) Received: from mwinf0203.wanadoo.fr (smtp7.wanadoo.fr [193.252.22.29]) by svr1.postgresql.org (Postfix) with ESMTP id 733A23106B8 for ; Tue, 1 Jul 2003 10:02:15 -0300 (ADT) Received: from Paris (ABoulogne-110-1-3-43.w80-15.abo.wanadoo.fr [80.15.41.43]) by mwinf0203.wanadoo.fr (SMTP Server) with ESMTP id 243FC1000156; Tue, 1 Jul 2003 15:02:15 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Robert Treat" Cc: Subject: Re: Version 7 question Date: Tue, 1 Jul 2003 15:02:21 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1057063946.24304.377.camel@camel> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/9 X-Sequence-Number: 2302 > yes, I'd say start with about 25% of RAM, then adjust from there. If 25% > takes you over your SHMMAX then start at your SHMMAX. You're the first person I've seen to suggest that many buffers. I've read that too many can slow down performance. I have 1.5 gigs of RAM on my server but I'm also running a few other java programs that take up probably 500 megs total of memory, leaving me 1gig for Postgres. Should I set my shared buffers to be 25% of 1gig? That would be 32768. Then what should my effective cache be? Right now I have it set to 64000 which would be 512megs. Between the buffers and cache that'd be a total of 768megs, leaving approximately 768 for my other java apps & the OS. Sounds reasonable to me. Michael From pgsql-performance-owner@postgresql.org Tue Jul 1 10:13:38 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 398C6310A79 for ; Tue, 1 Jul 2003 13:13:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 66259-06 for ; Tue, 1 Jul 2003 10:13:26 -0300 (ADT) Received: from lewexch.lewis-stores.com (mail.lewis-stores.com [196.31.249.242]) by svr1.postgresql.org (Postfix) with ESMTP id 5F05F310A4B for ; Tue, 1 Jul 2003 10:13:13 -0300 (ADT) Received: by LEWEXCH with Internet Mail Service (5.5.2653.19) id ; Tue, 1 Jul 2003 15:06:39 +0200 Message-ID: From: Howard Oblowitz To: pgsql-performance@postgresql.org Subject: FW: Version 7 question Date: Tue, 1 Jul 2003 15:06:04 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Archive-Number: 200307/11 X-Sequence-Number: 2304 What would be the best value range for effective_cache_size on Postgres 7.3.2, assuming say 1.5 GB of RAM and shared_buffers set to 8192, and shmmax set to 750mb? And what are the most important factors one should take into account in determining the value? > -----Original Message----- > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > Sent: 01 July 2003 02:56 > To: Michael Mattox > Cc: Hilary Forbes; pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Version 7 question > > 8192 is only 64 megs of RAM, not much, but a good number. Keep in mind > that the kernel tends to be better at buffering huge amounts of disk, > while postgresql is better left to use buffers that are large enough for > the current working set (i.e. not your whole database, just the largest > amount of data you're slinging about on a regular basis in one query.) > > On a machine with 1.5 gig of RAM, I've found settings as high as 32768 > (256 megs of ram) to run well, but anything over that doesn't help. Of > course, we don't toss around more than a hundred meg or so at a time. If > > our result sets were in the gigabyte range, I'd A: want more memory and B: > > Give more of it to postgresql. > > The original poster was, I believe running 7.0.x, which is way old, so no, > > I don't think there was an equivalent of effective_cache_size in that > version. Upgrading would be far easier than performance tuning 7.0. since > > the query planner was much simpler (i.e. more prone to make bad decisions) > > in 7.0. > > On Tue, 1 Jul 2003, Michael Mattox wrote: > > > I have my shared buffers at 8192 and my effective cache at 64000 (which > is > > 500 megs). Depends a lot on how much RAM you have. I have 1.5 gigs and > > I've been asking my boss for another 512megs for over a month now. I > have > > no idea if my buffers are too high/low. > > > > Michael > > > > > -----Original Message----- > > > From: pgsql-performance-owner@postgresql.org > > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > > Forbes > > > Sent: Tuesday, July 01, 2003 2:10 PM > > > To: pgsql-performance@postgresql.org > > > Subject: [PERFORM] Version 7 question > > > > > > > > > I'm just trying to improve performance on version 7 before doing > > > some tests and hopefully upgrading to 7.3. > > > > > > At the moment we have > > > B=64 (no of shared buffers) > > > N=32 (no of connections) > > > in postmaster.opt which I take it is the equivalent of the new > > > postgresql.conf file. > > > > > > From all that is being written about later versions I suspect > > > that this is far too low. Would I be fairly safe in making the > > > no of shared buffers larger? Also is there an equivalent of > > > effective_cache_size that I can set for version 7? > > > > > > Many thanks in advance > > > Hilary > > > > > > > > > > > > > > > Hilary Forbes > > > ------------- > > > DMR Computer Limited: http://www.dmr.co.uk/ > > > Direct line: 01689 889950 > > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > > E-mail: hforbes@dmr.co.uk > > > > > > ********************************************************** > > > > > > > > > ---------------------------(end of > broadcast)--------------------------- > > > TIP 5: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Tue Jul 1 10:32:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 22FE730FE1D for ; Tue, 1 Jul 2003 13:31:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 67051-04 for ; Tue, 1 Jul 2003 10:31:23 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id AE3DC30F616 for ; Tue, 1 Jul 2003 10:31:21 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h61DPHQX018636; Tue, 1 Jul 2003 07:25:17 -0600 (MDT) Date: Tue, 1 Jul 2003 07:19:31 -0600 (MDT) From: "scott.marlowe" To: Howard Oblowitz Cc: Subject: Re: FW: Version 7 question In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/12 X-Sequence-Number: 2305 The best way to set it is to let the machine run under normal load for a while, then look at the cache / buffer usage using top (or some other program, top works fine for this). My server with 1.5 gig ram shows 862328K cache right now. So, just divide by page size (usually 8192) and I get ~ 100,000 blocks. On Tue, 1 Jul 2003, Howard Oblowitz wrote: > What would be the best value range for effective_cache_size > on Postgres 7.3.2, assuming say 1.5 GB of RAM and > shared_buffers set to 8192, and shmmax set to 750mb? > > And what are the most important factors one should take > into account in determining the value? > > > > > -----Original Message----- > > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > > Sent: 01 July 2003 02:56 > > To: Michael Mattox > > Cc: Hilary Forbes; pgsql-performance@postgresql.org > > Subject: Re: [PERFORM] Version 7 question > > > > 8192 is only 64 megs of RAM, not much, but a good number. Keep in mind > > that the kernel tends to be better at buffering huge amounts of disk, > > while postgresql is better left to use buffers that are large enough for > > the current working set (i.e. not your whole database, just the largest > > amount of data you're slinging about on a regular basis in one query.) > > > > On a machine with 1.5 gig of RAM, I've found settings as high as 32768 > > (256 megs of ram) to run well, but anything over that doesn't help. Of > > course, we don't toss around more than a hundred meg or so at a time. If > > > > our result sets were in the gigabyte range, I'd A: want more memory and B: > > > > Give more of it to postgresql. > > > > The original poster was, I believe running 7.0.x, which is way old, so no, > > > > I don't think there was an equivalent of effective_cache_size in that > > version. Upgrading would be far easier than performance tuning 7.0. since > > > > the query planner was much simpler (i.e. more prone to make bad decisions) > > > > in 7.0. > > > > On Tue, 1 Jul 2003, Michael Mattox wrote: > > > > > I have my shared buffers at 8192 and my effective cache at 64000 (which > > is > > > 500 megs). Depends a lot on how much RAM you have. I have 1.5 gigs and > > > I've been asking my boss for another 512megs for over a month now. I > > have > > > no idea if my buffers are too high/low. > > > > > > Michael > > > > > > > -----Original Message----- > > > > From: pgsql-performance-owner@postgresql.org > > > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > > > Forbes > > > > Sent: Tuesday, July 01, 2003 2:10 PM > > > > To: pgsql-performance@postgresql.org > > > > Subject: [PERFORM] Version 7 question > > > > > > > > > > > > I'm just trying to improve performance on version 7 before doing > > > > some tests and hopefully upgrading to 7.3. > > > > > > > > At the moment we have > > > > B=64 (no of shared buffers) > > > > N=32 (no of connections) > > > > in postmaster.opt which I take it is the equivalent of the new > > > > postgresql.conf file. > > > > > > > > From all that is being written about later versions I suspect > > > > that this is far too low. Would I be fairly safe in making the > > > > no of shared buffers larger? Also is there an equivalent of > > > > effective_cache_size that I can set for version 7? > > > > > > > > Many thanks in advance > > > > Hilary > > > > > > > > > > > > > > > > > > > > Hilary Forbes > > > > ------------- > > > > DMR Computer Limited: http://www.dmr.co.uk/ > > > > Direct line: 01689 889950 > > > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > > > E-mail: hforbes@dmr.co.uk > > > > > > > > ********************************************************** > > > > > > > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 5: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > ---------------------------(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 Jul 1 10:43:06 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 97BBA310A9C for ; Tue, 1 Jul 2003 13:43:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 67864-06 for ; Tue, 1 Jul 2003 10:42:54 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 73DBD310A9E for ; Tue, 1 Jul 2003 10:42:53 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h61DgrQQ002501; Tue, 1 Jul 2003 09:42:54 -0400 (EDT) To: Toby Sargeant Cc: pgsql-performance@postgresql.org Subject: Re: excessive disk access during query In-reply-to: <20030701031919.GC30242@wehi.edu.au> References: <20030701031919.GC30242@wehi.edu.au> Comments: In-reply-to Toby Sargeant message dated "Tue, 01 Jul 2003 13:19:23 +1000" Date: Tue, 01 Jul 2003 09:42:53 -0400 Message-ID: <2500.1057066973@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/13 X-Sequence-Number: 2306 Toby Sargeant writes: > Merge Join (cost=0.00..448139.41 rows=14786 width=52) (actual time=1582.24..125624.92 rows=2140 loops=1) > Merge Cond: ("outer".seq_text_id = "inner".id) > -> Index Scan using seq_text_map_seq_text_index on seq_text_map (cost=0.00..154974.74 rows=2957158 width=48) (actual time=23.04..110877.65 rows=2956147 loops=1) > -> Index Scan using seq_text_pkey on seq_text (cost=0.00..285540.03 rows=17174 width=4) (actual time=71.51..12260.38 rows=3077 loops=1) > Filter: (lower(text) ~~ '%porin%'::text) > Total runtime: 125627.45 msec I'm surprised it doesn't try to use a hash join instead. Are the datatypes of seq_text_id and id different (if so, can you make them the same?) What sorts of plans and timings do you get if you flip enable_mergejoin and/or enable_indexscan? regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jul 1 10:57:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D53AE310CC4 for ; Tue, 1 Jul 2003 13:57:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 72395-04 for ; Tue, 1 Jul 2003 10:57:07 -0300 (ADT) Received: from lewexch.lewis-stores.com (mail.lewis-stores.com [196.31.249.242]) by svr1.postgresql.org (Postfix) with ESMTP id C245131098D for ; Tue, 1 Jul 2003 10:56:59 -0300 (ADT) Received: by LEWEXCH with Internet Mail Service (5.5.2653.19) id ; Tue, 1 Jul 2003 15:50:25 +0200 Message-ID: From: Howard Oblowitz To: "scott.marlowe" Cc: pgsql-performance@postgresql.org Subject: Effective Cache Size Date: Tue, 1 Jul 2003 15:50:14 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" X-Archive-Number: 200307/15 X-Sequence-Number: 2308 Thanks. Some theoretical questions. The documentation says that Effective Cache Size "sets the optimizer's assumption about the effective size of the disk cache ( that is, the portion of the kernel's disk cache that will be used for PostgreSQL data files ). What then will be the effect of setting this too high? And too low? How does it impact on other applications eg Java ? > -----Original Message----- > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > Sent: 01 July 2003 03:20 > To: Howard Oblowitz > Cc: pgsql-performance@postgresql.org > Subject: Re: FW: [PERFORM] Version 7 question > > The best way to set it is to let the machine run under normal load for a > while, then look at the cache / buffer usage using top (or some other > program, top works fine for this). > > My server with 1.5 gig ram shows 862328K cache right now. So, just divide > > by page size (usually 8192) and I get ~ 100,000 blocks. > > On Tue, 1 Jul 2003, Howard Oblowitz wrote: > > > What would be the best value range for effective_cache_size > > on Postgres 7.3.2, assuming say 1.5 GB of RAM and > > shared_buffers set to 8192, and shmmax set to 750mb? > > > > And what are the most important factors one should take > > into account in determining the value? > > > > > > > > > -----Original Message----- > > > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > > > Sent: 01 July 2003 02:56 > > > To: Michael Mattox > > > Cc: Hilary Forbes; pgsql-performance@postgresql.org > > > Subject: Re: [PERFORM] Version 7 question > > > > > > 8192 is only 64 megs of RAM, not much, but a good number. Keep in > mind > > > that the kernel tends to be better at buffering huge amounts of disk, > > > while postgresql is better left to use buffers that are large enough > for > > > the current working set (i.e. not your whole database, just the > largest > > > amount of data you're slinging about on a regular basis in one query.) > > > > > > On a machine with 1.5 gig of RAM, I've found settings as high as 32768 > > > > (256 megs of ram) to run well, but anything over that doesn't help. > Of > > > course, we don't toss around more than a hundred meg or so at a time. > If > > > > > > our result sets were in the gigabyte range, I'd A: want more memory > and B: > > > > > > Give more of it to postgresql. > > > > > > The original poster was, I believe running 7.0.x, which is way old, so > no, > > > > > > I don't think there was an equivalent of effective_cache_size in that > > > version. Upgrading would be far easier than performance tuning 7.0. > since > > > > > > the query planner was much simpler (i.e. more prone to make bad > decisions) > > > > > > in 7.0. > > > > > > On Tue, 1 Jul 2003, Michael Mattox wrote: > > > > > > > I have my shared buffers at 8192 and my effective cache at 64000 > (which > > > is > > > > 500 megs). Depends a lot on how much RAM you have. I have 1.5 gigs > and > > > > I've been asking my boss for another 512megs for over a month now. > I > > > have > > > > no idea if my buffers are too high/low. > > > > > > > > Michael > > > > > > > > > -----Original Message----- > > > > > From: pgsql-performance-owner@postgresql.org > > > > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > > > > Forbes > > > > > Sent: Tuesday, July 01, 2003 2:10 PM > > > > > To: pgsql-performance@postgresql.org > > > > > Subject: [PERFORM] Version 7 question > > > > > > > > > > > > > > > I'm just trying to improve performance on version 7 before doing > > > > > some tests and hopefully upgrading to 7.3. > > > > > > > > > > At the moment we have > > > > > B=64 (no of shared buffers) > > > > > N=32 (no of connections) > > > > > in postmaster.opt which I take it is the equivalent of the new > > > > > postgresql.conf file. > > > > > > > > > > From all that is being written about later versions I suspect > > > > > that this is far too low. Would I be fairly safe in making the > > > > > no of shared buffers larger? Also is there an equivalent of > > > > > effective_cache_size that I can set for version 7? > > > > > > > > > > Many thanks in advance > > > > > Hilary > > > > > > > > > > > > > > > > > > > > > > > > > Hilary Forbes > > > > > ------------- > > > > > DMR Computer Limited: http://www.dmr.co.uk/ > > > > > Direct line: 01689 889950 > > > > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > > > > E-mail: hforbes@dmr.co.uk > > > > > > > > > > ********************************************************** > > > > > > > > > > > > > > > ---------------------------(end of > > > broadcast)--------------------------- > > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > > > > > > > > > ---------------------------(end of > broadcast)--------------------------- > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > ---------------------------(end of > broadcast)--------------------------- > > > TIP 6: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > > > ---------------------------(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 Jul 1 10:55:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id F238B310B19 for ; Tue, 1 Jul 2003 13:55:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 69042-08 for ; Tue, 1 Jul 2003 10:55:20 -0300 (ADT) Received: from mwinf0204.wanadoo.fr (smtp7.wanadoo.fr [193.252.22.29]) by svr1.postgresql.org (Postfix) with ESMTP id AE620310CD9 for ; Tue, 1 Jul 2003 10:55:16 -0300 (ADT) Received: from Paris (ABoulogne-110-1-3-43.w80-15.abo.wanadoo.fr [80.15.41.43]) by mwinf0204.wanadoo.fr (SMTP Server) with ESMTP id 59856A00004E; Tue, 1 Jul 2003 15:55:16 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Howard Oblowitz" , Subject: Re: Version 7 question Date: Tue, 1 Jul 2003 15:55:22 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/14 X-Sequence-Number: 2307 My understanding is to use as much effect cache as possible, so figure out how much ram you need for your other applications & OS and then give the rest to postgres as effective cache. What I learned to day is the shared_buffers 25% of RAM guideline. Michael > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Howard > Oblowitz > Sent: Tuesday, July 01, 2003 3:06 PM > To: pgsql-performance@postgresql.org > Subject: FW: [PERFORM] Version 7 question > > > What would be the best value range for effective_cache_size > on Postgres 7.3.2, assuming say 1.5 GB of RAM and > shared_buffers set to 8192, and shmmax set to 750mb? > > And what are the most important factors one should take > into account in determining the value? > > > > > -----Original Message----- > > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > > Sent: 01 July 2003 02:56 > > To: Michael Mattox > > Cc: Hilary Forbes; pgsql-performance@postgresql.org > > Subject: Re: [PERFORM] Version 7 question > > > > 8192 is only 64 megs of RAM, not much, but a good number. Keep in mind > > that the kernel tends to be better at buffering huge amounts of disk, > > while postgresql is better left to use buffers that are large > enough for > > the current working set (i.e. not your whole database, just the largest > > amount of data you're slinging about on a regular basis in one query.) > > > > On a machine with 1.5 gig of RAM, I've found settings as high as 32768 > > (256 megs of ram) to run well, but anything over that doesn't help. Of > > course, we don't toss around more than a hundred meg or so at a > time. If > > > > our result sets were in the gigabyte range, I'd A: want more > memory and B: > > > > Give more of it to postgresql. > > > > The original poster was, I believe running 7.0.x, which is way > old, so no, > > > > I don't think there was an equivalent of effective_cache_size in that > > version. Upgrading would be far easier than performance tuning > 7.0. since > > > > the query planner was much simpler (i.e. more prone to make bad > decisions) > > > > in 7.0. > > > > On Tue, 1 Jul 2003, Michael Mattox wrote: > > > > > I have my shared buffers at 8192 and my effective cache at > 64000 (which > > is > > > 500 megs). Depends a lot on how much RAM you have. I have > 1.5 gigs and > > > I've been asking my boss for another 512megs for over a month now. I > > have > > > no idea if my buffers are too high/low. > > > > > > Michael > > > > > > > -----Original Message----- > > > > From: pgsql-performance-owner@postgresql.org > > > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > > > Forbes > > > > Sent: Tuesday, July 01, 2003 2:10 PM > > > > To: pgsql-performance@postgresql.org > > > > Subject: [PERFORM] Version 7 question > > > > > > > > > > > > I'm just trying to improve performance on version 7 before doing > > > > some tests and hopefully upgrading to 7.3. > > > > > > > > At the moment we have > > > > B=64 (no of shared buffers) > > > > N=32 (no of connections) > > > > in postmaster.opt which I take it is the equivalent of the new > > > > postgresql.conf file. > > > > > > > > From all that is being written about later versions I suspect > > > > that this is far too low. Would I be fairly safe in making the > > > > no of shared buffers larger? Also is there an equivalent of > > > > effective_cache_size that I can set for version 7? > > > > > > > > Many thanks in advance > > > > Hilary > > > > > > > > > > > > > > > > > > > > Hilary Forbes > > > > ------------- > > > > DMR Computer Limited: http://www.dmr.co.uk/ > > > > Direct line: 01689 889950 > > > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > > > E-mail: hforbes@dmr.co.uk > > > > > > > > ********************************************************** > > > > > > > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > > > > ---------------------------(end of > broadcast)--------------------------- > > > TIP 5: Have you checked our extensive FAQ? > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > ---------------------------(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 Jul 1 16:48:53 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CF9B7310D28 for ; Tue, 1 Jul 2003 19:46:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 13741-06 for ; Tue, 1 Jul 2003 16:46:43 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 05E31310D0C for ; Tue, 1 Jul 2003 16:46:14 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by www.postgresql.com (Postfix) with ESMTP id 21A40CF6D41 for ; Tue, 1 Jul 2003 11:08:43 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h61E3i904421 for ; Tue, 1 Jul 2003 19:33:44 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h61E3iQ04415 for ; Tue, 1 Jul 2003 19:33:44 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Tue, 01 Jul 2003 19:32:49 +0530 MIME-Version: 1.0 Subject: Re: Effective Cache Size Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F01E1E1.16493.F1FF6A@localhost> In-reply-to: X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Archive-Number: 200307/20 X-Sequence-Number: 2313 On 1 Jul 2003 at 15:50, Howard Oblowitz wrote: > The documentation says that Effective Cache Size "sets the optimizer's > assumption > about the effective size of the disk cache ( that is, the portion of the > kernel's disk > cache that will be used for PostgreSQL data files ). > > What then will be the effect of setting this too high? > > And too low? Let's say postgresql is preparing a plan for a scan and it estimates data set size as 100MB whereas your shared buffers+effective cache is 80M. So postgresql would deduce that it would be better off with sequential scan rather than index scan. Where in fact you have much more memory to make a file system cache and the machine can afford index scan. There is nothing too low or too high of a setting. This isn't exactly performance tuning paramter as other. This is more of information to postgresql. The closer it gets to truer, the plans produced would get optimal. About how to set this parameter, it is roughly effective cache size= (Physical RAM size-shared buffers-requirement for other apps) * 0.8 This is very very rough. You need to make sure that some setting does not trigger a swap avelanche HTH Bye Shridhar -- Slous' Contention: If you do a job too well, you'll get stuck with it. From pgsql-performance-owner@postgresql.org Tue Jul 1 16:18:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 98FB2310D5F for ; Tue, 1 Jul 2003 19:13:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 03420-06 for ; Tue, 1 Jul 2003 16:13:12 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id C0FAC310CC1 for ; Tue, 1 Jul 2003 16:12:47 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id 5219ECF749D for ; Tue, 1 Jul 2003 11:34:35 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h61EOGQX024263; Tue, 1 Jul 2003 08:24:16 -0600 (MDT) Date: Tue, 1 Jul 2003 08:18:34 -0600 (MDT) From: "scott.marlowe" To: Howard Oblowitz Cc: Subject: Re: Effective Cache Size In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/18 X-Sequence-Number: 2311 Good questions. Basically, telling postgresql it has a larger disk cache makes it favor index operations, smaller makes it favor seq scans. If your machine has super fast I/O then you may want it to favor seq scans, whereas if you have more CPU power than I/O bandwidth then you'd likely want it to favor index operations. Note that even if you are running java and it is using a few hundred megs of ram, it's quite likely that postgresql is still using most of the disk cache, as the memory java is using is likely allocated to hold its created data structures, not stuff loaded from disk. On Tue, 1 Jul 2003, Howard Oblowitz wrote: > Thanks. > > Some theoretical questions. > > The documentation says that Effective Cache Size "sets the optimizer's > assumption > about the effective size of the disk cache ( that is, the portion of the > kernel's disk > cache that will be used for PostgreSQL data files ). > > What then will be the effect of setting this too high? > > And too low? > > How does it impact on other applications eg Java ? > > > > -----Original Message----- > > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > > Sent: 01 July 2003 03:20 > > To: Howard Oblowitz > > Cc: pgsql-performance@postgresql.org > > Subject: Re: FW: [PERFORM] Version 7 question > > > > The best way to set it is to let the machine run under normal load for a > > while, then look at the cache / buffer usage using top (or some other > > program, top works fine for this). > > > > My server with 1.5 gig ram shows 862328K cache right now. So, just divide > > > > by page size (usually 8192) and I get ~ 100,000 blocks. > > > > On Tue, 1 Jul 2003, Howard Oblowitz wrote: > > > > > What would be the best value range for effective_cache_size > > > on Postgres 7.3.2, assuming say 1.5 GB of RAM and > > > shared_buffers set to 8192, and shmmax set to 750mb? > > > > > > And what are the most important factors one should take > > > into account in determining the value? > > > > > > > > > > > > > -----Original Message----- > > > > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > > > > Sent: 01 July 2003 02:56 > > > > To: Michael Mattox > > > > Cc: Hilary Forbes; pgsql-performance@postgresql.org > > > > Subject: Re: [PERFORM] Version 7 question > > > > > > > > 8192 is only 64 megs of RAM, not much, but a good number. Keep in > > mind > > > > that the kernel tends to be better at buffering huge amounts of disk, > > > > while postgresql is better left to use buffers that are large enough > > for > > > > the current working set (i.e. not your whole database, just the > > largest > > > > amount of data you're slinging about on a regular basis in one query.) > > > > > > > > On a machine with 1.5 gig of RAM, I've found settings as high as 32768 > > > > > > (256 megs of ram) to run well, but anything over that doesn't help. > > Of > > > > course, we don't toss around more than a hundred meg or so at a time. > > If > > > > > > > > our result sets were in the gigabyte range, I'd A: want more memory > > and B: > > > > > > > > Give more of it to postgresql. > > > > > > > > The original poster was, I believe running 7.0.x, which is way old, so > > no, > > > > > > > > I don't think there was an equivalent of effective_cache_size in that > > > > version. Upgrading would be far easier than performance tuning 7.0. > > since > > > > > > > > the query planner was much simpler (i.e. more prone to make bad > > decisions) > > > > > > > > in 7.0. > > > > > > > > On Tue, 1 Jul 2003, Michael Mattox wrote: > > > > > > > > > I have my shared buffers at 8192 and my effective cache at 64000 > > (which > > > > is > > > > > 500 megs). Depends a lot on how much RAM you have. I have 1.5 gigs > > and > > > > > I've been asking my boss for another 512megs for over a month now. > > I > > > > have > > > > > no idea if my buffers are too high/low. > > > > > > > > > > Michael > > > > > > > > > > > -----Original Message----- > > > > > > From: pgsql-performance-owner@postgresql.org > > > > > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > > > > > Forbes > > > > > > Sent: Tuesday, July 01, 2003 2:10 PM > > > > > > To: pgsql-performance@postgresql.org > > > > > > Subject: [PERFORM] Version 7 question > > > > > > > > > > > > > > > > > > I'm just trying to improve performance on version 7 before doing > > > > > > some tests and hopefully upgrading to 7.3. > > > > > > > > > > > > At the moment we have > > > > > > B=64 (no of shared buffers) > > > > > > N=32 (no of connections) > > > > > > in postmaster.opt which I take it is the equivalent of the new > > > > > > postgresql.conf file. > > > > > > > > > > > > From all that is being written about later versions I suspect > > > > > > that this is far too low. Would I be fairly safe in making the > > > > > > no of shared buffers larger? Also is there an equivalent of > > > > > > effective_cache_size that I can set for version 7? > > > > > > > > > > > > Many thanks in advance > > > > > > Hilary > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hilary Forbes > > > > > > ------------- > > > > > > DMR Computer Limited: http://www.dmr.co.uk/ > > > > > > Direct line: 01689 889950 > > > > > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > > > > > E-mail: hforbes@dmr.co.uk > > > > > > > > > > > > ********************************************************** > > > > > > > > > > > > > > > > > > ---------------------------(end of > > > > broadcast)--------------------------- > > > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > > TIP 6: Have you searched our list archives? > > > > > > > > http://archives.postgresql.org > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 2: you can get off all lists at once with the unregister command > > > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Tue Jul 1 16:17:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 1B407310CA5 for ; Tue, 1 Jul 2003 19:13:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 03424-04 for ; Tue, 1 Jul 2003 16:13:36 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id B373E310CBC for ; Tue, 1 Jul 2003 16:12:47 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id 5EB3DCF74BD for ; Tue, 1 Jul 2003 11:35:26 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h61EP2QX024291; Tue, 1 Jul 2003 08:25:02 -0600 (MDT) Date: Tue, 1 Jul 2003 08:19:20 -0600 (MDT) From: "scott.marlowe" To: Michael Mattox Cc: Howard Oblowitz , Subject: Re: Version 7 question In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/17 X-Sequence-Number: 2310 I think you're confusing effect_cache_size with shared_buffers. effective_cache_size tells the planner about how much disk cache the OS is using for postgresql behind its back, so to speak. On Tue, 1 Jul 2003, Michael Mattox wrote: > My understanding is to use as much effect cache as possible, so figure out > how much ram you need for your other applications & OS and then give the > rest to postgres as effective cache. > > What I learned to day is the shared_buffers 25% of RAM guideline. > > Michael > > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Howard > > Oblowitz > > Sent: Tuesday, July 01, 2003 3:06 PM > > To: pgsql-performance@postgresql.org > > Subject: FW: [PERFORM] Version 7 question > > > > > > What would be the best value range for effective_cache_size > > on Postgres 7.3.2, assuming say 1.5 GB of RAM and > > shared_buffers set to 8192, and shmmax set to 750mb? > > > > And what are the most important factors one should take > > into account in determining the value? > > > > > > > > > -----Original Message----- > > > From: scott.marlowe [SMTP:scott.marlowe@ihs.com] > > > Sent: 01 July 2003 02:56 > > > To: Michael Mattox > > > Cc: Hilary Forbes; pgsql-performance@postgresql.org > > > Subject: Re: [PERFORM] Version 7 question > > > > > > 8192 is only 64 megs of RAM, not much, but a good number. Keep in mind > > > that the kernel tends to be better at buffering huge amounts of disk, > > > while postgresql is better left to use buffers that are large > > enough for > > > the current working set (i.e. not your whole database, just the largest > > > amount of data you're slinging about on a regular basis in one query.) > > > > > > On a machine with 1.5 gig of RAM, I've found settings as high as 32768 > > > (256 megs of ram) to run well, but anything over that doesn't help. Of > > > course, we don't toss around more than a hundred meg or so at a > > time. If > > > > > > our result sets were in the gigabyte range, I'd A: want more > > memory and B: > > > > > > Give more of it to postgresql. > > > > > > The original poster was, I believe running 7.0.x, which is way > > old, so no, > > > > > > I don't think there was an equivalent of effective_cache_size in that > > > version. Upgrading would be far easier than performance tuning > > 7.0. since > > > > > > the query planner was much simpler (i.e. more prone to make bad > > decisions) > > > > > > in 7.0. > > > > > > On Tue, 1 Jul 2003, Michael Mattox wrote: > > > > > > > I have my shared buffers at 8192 and my effective cache at > > 64000 (which > > > is > > > > 500 megs). Depends a lot on how much RAM you have. I have > > 1.5 gigs and > > > > I've been asking my boss for another 512megs for over a month now. I > > > have > > > > no idea if my buffers are too high/low. > > > > > > > > Michael > > > > > > > > > -----Original Message----- > > > > > From: pgsql-performance-owner@postgresql.org > > > > > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Hilary > > > > > Forbes > > > > > Sent: Tuesday, July 01, 2003 2:10 PM > > > > > To: pgsql-performance@postgresql.org > > > > > Subject: [PERFORM] Version 7 question > > > > > > > > > > > > > > > I'm just trying to improve performance on version 7 before doing > > > > > some tests and hopefully upgrading to 7.3. > > > > > > > > > > At the moment we have > > > > > B=64 (no of shared buffers) > > > > > N=32 (no of connections) > > > > > in postmaster.opt which I take it is the equivalent of the new > > > > > postgresql.conf file. > > > > > > > > > > From all that is being written about later versions I suspect > > > > > that this is far too low. Would I be fairly safe in making the > > > > > no of shared buffers larger? Also is there an equivalent of > > > > > effective_cache_size that I can set for version 7? > > > > > > > > > > Many thanks in advance > > > > > Hilary > > > > > > > > > > > > > > > > > > > > > > > > > Hilary Forbes > > > > > ------------- > > > > > DMR Computer Limited: http://www.dmr.co.uk/ > > > > > Direct line: 01689 889950 > > > > > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > > > > > E-mail: hforbes@dmr.co.uk > > > > > > > > > > ********************************************************** > > > > > > > > > > > > > > > ---------------------------(end of > > > broadcast)--------------------------- > > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > > > > > > > > > ---------------------------(end of > > broadcast)--------------------------- > > > > TIP 5: Have you checked our extensive FAQ? > > > > > > > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > > > > > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 6: Have you searched our list archives? > > > > > > http://archives.postgresql.org > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 2: you can get off all lists at once with the unregister command > > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Tue Jul 1 16:16:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 826FD310CA8 for ; Tue, 1 Jul 2003 19:14:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 03407-07 for ; Tue, 1 Jul 2003 16:13:56 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 7DB50310D0E for ; Tue, 1 Jul 2003 16:12:51 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id C51E2CF74ED for ; Tue, 1 Jul 2003 11:37:31 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h61ES9QX024585; Tue, 1 Jul 2003 08:28:09 -0600 (MDT) Date: Tue, 1 Jul 2003 08:22:28 -0600 (MDT) From: "scott.marlowe" To: Michael Mattox Cc: Howard Oblowitz , Subject: Re: Version 7 question In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/16 X-Sequence-Number: 2309 On Tue, 1 Jul 2003, Michael Mattox wrote: > My understanding is to use as much effect cache as possible, so figure out > how much ram you need for your other applications & OS and then give the > rest to postgres as effective cache. > > What I learned to day is the shared_buffers 25% of RAM guideline. Note that the best guideline is the one that your testing shows you makes the most sense. If you never access more than a few megs at a time, then there's no need to have 25% of a machine with 1 gig given over to the database's shared buffers, it's better to let the machine cache that for you. If you access hundreds of megs at a time, then 25% of RAM is a good idea. Usually 25% of RAM is about the max that gives good results, but in some corner cases, using more still makes sense. Usually at that point, you've also increased sort_mem up a bit too, but be careful, sort_mem is PER SORT, not per backend or per database cluster, so it can add up very quickly and make the machine run out of RAM. Setting these settings is a lot like playing Jenga (the game with the wooden blocks stacked up where you pull one out and put them on top one at a time.) Everything seems just fine, the machine's getting faster and faster, everybody's loving life, then you crank one up a little too high, cause a swap storm, and the whole thing slows to a crawl. From pgsql-performance-owner@postgresql.org Tue Jul 1 17:02:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id F0E8B310699 for ; Tue, 1 Jul 2003 20:02:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 16061-07 for ; Tue, 1 Jul 2003 17:02:45 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 74575310CF0 for ; Tue, 1 Jul 2003 17:02:45 -0300 (ADT) Received: from email06.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.75]) by www.postgresql.com (Postfix) with SMTP id 0B087CF797B for ; Tue, 1 Jul 2003 15:02:42 -0300 (ADT) Received: (qmail 82342 invoked from network); 1 Jul 2003 18:01:40 -0000 Received: from m162p030.dipool.highway.telekom.at (HELO cantor) ([62.46.10.62]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 1 Jul 2003 18:01:40 -0000 From: Manfred Koizar To: Cc: "Robert Treat" , Subject: Re: Version 7 question Date: Tue, 01 Jul 2003 20:01:54 +0200 Message-ID: References: <1057063946.24304.377.camel@camel> In-Reply-To: X-Mailer: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200307/21 X-Sequence-Number: 2314 On Tue, 1 Jul 2003 15:02:21 +0200, "Michael Mattox" wrote: >I have 1.5 gigs of RAM on my >server but I'm also running a few other java programs that take up probably >500 megs total of memory, leaving me 1gig for Postgres. Should I set my >shared buffers to be 25% of 1gig? That would be 32768. Then what should my >effective cache be? Right now I have it set to 64000 which would be >512megs. Between the buffers and cache that'd be a total of 768megs, >leaving approximately 768 for my other java apps & the OS. Michael, by setting effective_cache_size you do not allocate anything. This configuration variable is just a *hint* to the planner how much RAM is used for caching on your system (as shown by top or free). Servus Manfred From pgsql-performance-owner@postgresql.org Tue Jul 1 16:30:28 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0EAF4310D40 for ; Tue, 1 Jul 2003 19:30:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 11673-10 for ; Tue, 1 Jul 2003 16:30:00 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 54436310CFD for ; Tue, 1 Jul 2003 16:29:28 -0300 (ADT) Received: from email02.aon.at (WARSL402PIP7.highway.telekom.at [195.3.96.94]) by www.postgresql.com (Postfix) with SMTP id A0A18CF6F90 for ; Tue, 1 Jul 2003 15:27:20 -0300 (ADT) Received: (qmail 456152 invoked from network); 1 Jul 2003 18:21:59 -0000 Received: from m162p030.dipool.highway.telekom.at (HELO cantor) ([62.46.10.62]) (envelope-sender ) by qmail2rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 1 Jul 2003 18:21:59 -0000 From: Manfred Koizar To: Howard Oblowitz Cc: "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: Effective Cache Size Date: Tue, 01 Jul 2003 20:22:13 +0200 Message-ID: References: In-Reply-To: X-Mailer: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200307/19 X-Sequence-Number: 2312 On Tue, 1 Jul 2003 15:50:14 +0200 , Howard Oblowitz wrote: >What then will be the effect of setting this too high? The planner might choose an index scan where a sequential scan would be faster. >And too low? The planner might choose a sequential scan where an index scan would be faster. >How does it impact on other applications eg Java ? It doesn't -- at least not directly. (There could be very subtle effects when Postgres does a sequential scan over a large relation thus pushing everything else out of the cache, where an index scan would have read only a small number of pages. Or when a large index scan turns your machine from CPU bound to I/O bound.) Servus Manfred From pgsql-performance-owner@postgresql.org Tue Jul 1 22:25:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6552C310B40 for ; Wed, 2 Jul 2003 01:24:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 68051-02 for ; Tue, 1 Jul 2003 22:24:49 -0300 (ADT) Received: from houston.familyhealth.com.au (unknown [203.59.48.253]) by svr1.postgresql.org (Postfix) with ESMTP id C139E310705 for ; Tue, 1 Jul 2003 22:24:47 -0300 (ADT) Received: from mars (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (8.12.9/8.12.9) with SMTP id h621Oaxa084903; Wed, 2 Jul 2003 09:24:38 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Message-ID: <04b601c3403a$877ef0b0$2800a8c0@mars> From: "Christopher Kings-Lynne" To: , "Hilary Forbes" References: <5.1.0.14.0.20030701125931.02040fa0@mailserver.ipl.co.uk> Subject: Re: Version 7 question Date: Wed, 2 Jul 2003 09:37:19 +0800 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/22 X-Sequence-Number: 2315 Hi Hillary, I'd suggest around 1000 to 2000 shared buffers and bump your max connections to at least 64. Make sure you're kernel allowed enough shared memory for the above (2000 * 8k = 16MB) Chris ----- Original Message ----- From: "Hilary Forbes" To: Sent: Tuesday, July 01, 2003 8:10 PM Subject: [PERFORM] Version 7 question > I'm just trying to improve performance on version 7 before doing some tests and hopefully upgrading to 7.3. > > At the moment we have > B=64 (no of shared buffers) > N=32 (no of connections) > in postmaster.opt which I take it is the equivalent of the new postgresql.conf file. > > From all that is being written about later versions I suspect that this is far too low. Would I be fairly safe in making the no of shared buffers larger? Also is there an equivalent of effective_cache_size that I can set for version 7? > > Many thanks in advance > Hilary > > > > > Hilary Forbes > ------------- > DMR Computer Limited: http://www.dmr.co.uk/ > Direct line: 01689 889950 > Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 > E-mail: hforbes@dmr.co.uk > > ********************************************************** > > > ---------------------------(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 Wed Jul 2 07:24:38 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id ADC47310E6F for ; Wed, 2 Jul 2003 10:24:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27217-09 for ; Wed, 2 Jul 2003 07:24:26 -0300 (ADT) Received: from mwinf0104.wanadoo.fr (smtp8.wanadoo.fr [193.252.22.30]) by svr1.postgresql.org (Postfix) with ESMTP id E050D31013F for ; Wed, 2 Jul 2003 07:24:25 -0300 (ADT) Received: from Paris (ABoulogne-110-1-2-97.w80-13.abo.wanadoo.fr [80.13.94.97]) by mwinf0104.wanadoo.fr (SMTP Server) with ESMTP id 21E5B1BFFFB6; Wed, 2 Jul 2003 12:24:24 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Postgresql Performance" Cc: "Rod Taylor" Subject: Re: How to optimize monstrous query, sorts instead of Date: Wed, 2 Jul 2003 12:24:23 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1056551304.25587.52.camel@jester> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/23 X-Sequence-Number: 2316 > Try this: Rod, you improved my query last week (thank you very much) but I'm not sure why but my performance is getting worse. I think I know what happened, when I did my load testing I created data that all had the same date, so sorting on the date was very fast. But now I've been running the system for a few weeks I've got a range of dates and now the sort is very costly. I'm curious if it's possible to optimize this with an index? I've tried creating some indexes but they're never used. explain analyze SELECT mx.idx , ms.averageconnecttimex AS ms_averageconnecttime , ms.averagedurationx AS ms_averageduration , ms.datex AS ms_date , ms.idx AS ms_id , ms.statusstringx AS ms_statusstring , ms.statusx AS ms_status , msi.actualcontentx AS msi_actualcontent , msi.connecttimex AS msi_connecttime , msi.correctcontentx AS msi_correctcontent , msi.datex AS msi_date , msi.descriptionx AS msi_description , msi.durationx AS msi_duration , msi.errorcontentx AS msi_errorcontent , msi.idx AS msi_id , msi.monitorlocationx AS msi_monitorlocation , msi.statusstringx AS msi_statusstring , msi.statusx AS msi_status FROM monitorstatusx AS ms , monitorstatusitemx AS msi , monitorx AS mx , monitorstatus_statusitemsx AS mssisx , monitorstatusitemlistd8ea58a5x AS litem WHERE ms.jdoidx = mssisx.jdoidx AND mssisx.statusitemsx = litem.jdoidx AND litem.statusitemlistx = msi.jdoidx AND mx.jdoidx = ms.monitorx AND ms.datex BETWEEN '2003-07-01 00:00:00.000000+01' AND '2003-07-01 23:59:59.000000+01' AND mx.idx = 'M-TEST_150-TEST_01_10560776551771895174239' ORDER BY ms.datex DESC; QUERY PLAN ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ----------------------------------- Sort (cost=6882.84..6883.08 rows=97 width=827) (actual time=16712.46..16712.65 rows=225 loops=1) Sort Key: ms.datex -> Nested Loop (cost=0.00..6879.66 rows=97 width=827) (actual time=4413.12..16711.62 rows=225 loops=1) -> Nested Loop (cost=0.00..6587.53 rows=97 width=162) (actual time=4406.06..15941.16 rows=225 loops=1) -> Nested Loop (cost=0.00..6295.38 rows=97 width=146) (actual time=4383.59..15424.96 rows=225 loops=1) -> Nested Loop (cost=0.00..6003.22 rows=97 width=130) (actual time=4383.53..14938.02 rows=225 loops=1) -> Index Scan using monitorx_id_index on monitorx mx (cost=0.00..5.01 rows=1 width=46) (actual time=0.13..0.21 rows=1 loops=1) Index Cond: (idx = 'M-TEST_150-TEST_01_10560776551771895174239'::character varying) -> Index Scan using monitorstatusxmonitori on monitorstatusx ms (cost=0.00..5996.18 rows=163 width=84) (actual time=4383.38..14936.39 rows=225 loops=1) Index Cond: ("outer".jdoidx = ms.monitorx) Filter: ((datex >= '2003-07-01 00:00:00'::timestamp without time zone) AND (datex <= '2003-07-01 23:59:59'::timestamp without time zone)) -> Index Scan using monitorstatus_stjdoidb742c9b3i on monitorstatus_statusitemsx mssisx (cost=0.00..3.01 rows=1 width=16) (actual time=2.15..2.15 rows=1 loops=225) Index Cond: ("outer".jdoidx = mssisx.jdoidx) -> Index Scan using monitorstatusitejdoid7db0befci on monitorstatusitemlistd8ea58a5x litem (cost=0.00..3.01 rows=1 width=16) (actual time=2.28..2.28 rows=1 loops=225) Index Cond: ("outer".statusitemsx = litem.jdoidx) -> Index Scan using monitorstatusitemx_pkey on monitorstatusitemx msi (cost=0.00..3.01 rows=1 width=665) (actual time=3.41..3.41 rows=1 loops=225) Index Cond: ("outer".statusitemlistx = msi.jdoidx) Total runtime: 16713.25 msec (18 rows) As you can see it takes 16 seconds to return only 18 rows. The monitorstatusx table has over 7 million rows, and for each monitor status there's one row in each of the monitorstatusitemx and the join tables. So I think the size of the database is just too high for this sort. I run my reports offline, but what I'm finding is that at 16 seconds per report, the reports aren't finished by morning. My postgresql.conf is attached in case I have it configured incorrectly. Thanks, Michael From pgsql-performance-owner@postgresql.org Wed Jul 2 07:28:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0EB4D310E90 for ; Wed, 2 Jul 2003 10:28:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 40017-01 for ; Wed, 2 Jul 2003 07:28:12 -0300 (ADT) Received: from mwinf0101.wanadoo.fr (smtp8.wanadoo.fr [193.252.22.30]) by svr1.postgresql.org (Postfix) with ESMTP id CA42231013F for ; Wed, 2 Jul 2003 07:28:11 -0300 (ADT) Received: from Paris (ABoulogne-110-1-2-97.w80-13.abo.wanadoo.fr [80.13.94.97]) by mwinf0101.wanadoo.fr (SMTP Server) with ESMTP id C575EC000132; Wed, 2 Jul 2003 12:28:10 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Postgresql Performance" Cc: "Rod Taylor" Subject: Re: How to optimize monstrous query, sorts instead of Date: Wed, 2 Jul 2003 12:28:10 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_000C_01C34095.65E66A90" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/24 X-Sequence-Number: 2317 This is a multi-part message in MIME format. ------=_NextPart_000_000C_01C34095.65E66A90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > My postgresql.conf is attached in case I have it configured incorrectly. Forgot my postgres.conf.. ------=_NextPart_000_000C_01C34095.65E66A90 Content-Type: application/octet-stream; name="postgresql.conf" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="postgresql.conf" # # PostgreSQL configuration file # ----------------------------- # # This file consists of lines of the form: # # name =3D value # # (The '=3D' is optional.) White space may be used. Comments are introduced # with '#' anywhere on a line. The complete list of option names and # allowed values can be found in the PostgreSQL documentation. The # commented-out settings shown in this file represent the default values. # # Any option can also be given as a command line switch to the # postmaster, e.g. 'postmaster -c log_connections=3Don'. Some options # can be changed at run-time with the 'SET' SQL command. # # This file is read on postmaster startup and when the postmaster # receives a SIGHUP. If you edit the file on a running system, you have=20 # to SIGHUP the postmaster for the changes to take effect, or use=20 # "pg_ctl reload". #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D # # Connection Parameters # tcpip_socket =3D true #ssl =3D false max_connections =3D 200 #superuser_reserved_connections =3D 2 port =3D 5432=20 #hostname_lookup =3D false #show_source_port =3D false #unix_socket_directory =3D '' #unix_socket_group =3D '' #unix_socket_permissions =3D 0777 # octal #virtual_host =3D '' #krb_server_keyfile =3D '' # # Shared Memory Size # shared_buffers =3D 32768 # min max_connections*2 or 16, 8KB each max_fsm_relations =3D 4000 # min 10, fsm is free space map, ~40 bytes max_fsm_pages =3D 20000 # min 1000, fsm is free space map, ~6 bytes #max_locks_per_transaction =3D 64 # min 10 wal_buffers =3D 20 # min 4, typically 8KB each # # Non-shared Memory Sizes # sort_mem =3D 25600 # min 64, size in KB vacuum_mem =3D 51200 # min 1024, size in KB # # Write-ahead log (WAL) # #checkpoint_segments =3D 3 # in logfile segments, min 1, 16MB each #checkpoint_timeout =3D 300 # range 30-3600, in seconds # #commit_delay =3D 0 # range 0-100000, in microseconds #commit_siblings =3D 5 # range 1-1000 # #fsync =3D true #wal_sync_method =3D fsync # the default varies across platforms: # # fsync, fdatasync, open_sync, or open_datasync #wal_debug =3D 0 # range 0-16 # # Optimizer Parameters # #enable_seqscan =3D true #enable_indexscan =3D true #enable_tidscan =3D true #enable_sort =3D true #enable_nestloop =3D true #enable_mergejoin =3D true #enable_hashjoin =3D true effective_cache_size =3D 32768 # typically 8KB each random_page_cost =3D 1.5 # units are one sequential page fetch cost #cpu_tuple_cost =3D 0.01 # (same) #cpu_index_tuple_cost =3D 0.001 # (same) #cpu_operator_cost =3D 0.0025 # (same) #default_statistics_target =3D 10 # range 1-1000 # # GEQO Optimizer Parameters # #geqo =3D true #geqo_selection_bias =3D 2.0 # range 1.5-2.0 #geqo_threshold =3D 11 #geqo_pool_size =3D 0 # default based on tables in statement,=20 # range 128-1024 #geqo_effort =3D 1 #geqo_generations =3D 0 #geqo_random_seed =3D -1 # auto-compute seed # # Message display # server_min_messages =3D log # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, log, fatal, # panic client_min_messages =3D log # Values, in order of decreasing detail: # debug5, debug4, debug3, debug2, debug1, # log, info, notice, warning, error silent_mode =3D false log_connections =3D true #log_pid =3D false log_statement =3D true log_duration =3D true log_timestamp =3D true log_min_error_statement =3D info # Values in order of increasing severity: # debug5, debug4, debug3, debug2, debug1, # info, notice, warning, error, panic(off) #debug_print_parse =3D false #debug_print_rewritten =3D false #debug_print_plan =3D false #debug_pretty_print =3D false #explain_pretty_print =3D true # requires USE_ASSERT_CHECKING #debug_assertions =3D true # # Syslog # #syslog =3D 0 # range 0-2 #syslog_facility =3D 'LOCAL0' #syslog_ident =3D 'postgres' # # Statistics # #show_parser_stats =3D false #show_planner_stats =3D false #show_executor_stats =3D false #show_statement_stats =3D false # requires BTREE_BUILD_STATS #show_btree_build_stats =3D false # # Access statistics collection # #stats_start_collector =3D true #stats_reset_on_server_start =3D true #stats_command_string =3D false #stats_row_level =3D false #stats_block_level =3D false # # Lock Tracing # #trace_notify =3D false # requires LOCK_DEBUG #trace_locks =3D false #trace_userlocks =3D false #trace_lwlocks =3D false #debug_deadlocks =3D false #trace_lock_oidmin =3D 16384 #trace_lock_table =3D 0 # # Misc # #autocommit =3D true #dynamic_library_path =3D '$libdir' #search_path =3D '$user,public' #datestyle =3D 'iso, us' #timezone =3D unknown # actually, defaults to TZ environment setting #australian_timezones =3D false #client_encoding =3D sql_ascii # actually, defaults to database encoding #authentication_timeout =3D 60 # 1-600, in seconds #deadlock_timeout =3D 1000 # in milliseconds #default_transaction_isolation =3D 'read committed' #max_expr_depth =3D 10000 # min 10 #max_files_per_process =3D 1000 # min 25 #password_encryption =3D true #sql_inheritance =3D true #transform_null_equals =3D false #statement_timeout =3D 0 # 0 is disabled, in milliseconds #db_user_namespace =3D false =20 # # Locale settings # # (initialized by initdb -- may be changed) LC_MESSAGES =3D 'en_GB.UTF-8' LC_MONETARY =3D 'en_GB.UTF-8' LC_NUMERIC =3D 'en_GB.UTF-8' LC_TIME =3D 'en_GB.UTF-8' ------=_NextPart_000_000C_01C34095.65E66A90-- From pgsql-performance-owner@postgresql.org Wed Jul 2 09:45:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 09E3230FEEC for ; Wed, 2 Jul 2003 12:45:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 51526-08 for ; Wed, 2 Jul 2003 09:45:06 -0300 (ADT) Received: from tomts14-srv.bellnexxia.net (tomts14.bellnexxia.net [209.226.175.35]) by svr1.postgresql.org (Postfix) with ESMTP id 80309310D3A for ; Wed, 2 Jul 2003 09:45:04 -0300 (ADT) Received: from [192.168.1.200] ([216.209.81.133]) by tomts14-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030702124503.UNVS23441.tomts14-srv.bellnexxia.net@[192.168.1.200]>; Wed, 2 Jul 2003 08:45:03 -0400 Subject: Re: How to optimize monstrous query, sorts instead of From: Rod Taylor To: michael.mattox@verideon.com Cc: Postgresql Performance In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-tT26ztHAzhPs8q6G2Gq/" Message-Id: <1057149922.28657.163.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 02 Jul 2003 12:45:23 +0000 X-Archive-Number: 200307/25 X-Sequence-Number: 2318 --=-tT26ztHAzhPs8q6G2Gq/ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2003-07-02 at 10:28, Michael Mattox wrote: > > My postgresql.conf is attached in case I have it configured incorrectly. >=20 > Forgot my postgres.conf.. Shared buffers is probably too high. How much memory in this machine?=20 Is there anything else running aside from PostgreSQL? What does top say about cached / buffered data (number) I see you reduced the random_page_cost to 1.5. Why did you do this (how is your disk subsystem configured)? --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-tT26ztHAzhPs8q6G2Gq/ Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/AtPi6DETLow6vwwRAsiWAJwLEyLgRI0SLYE6JZioxSL+y5gx9QCfSFK4 5lrT/S64ysAz/MRIHzYKvkA= =ee5y -----END PGP SIGNATURE----- --=-tT26ztHAzhPs8q6G2Gq/-- From pgsql-performance-owner@postgresql.org Wed Jul 2 09:51:47 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B624630FCB4 for ; Wed, 2 Jul 2003 12:51:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 54837-05 for ; Wed, 2 Jul 2003 09:51:34 -0300 (ADT) Received: from tomts26-srv.bellnexxia.net (tomts26.bellnexxia.net [209.226.175.189]) by svr1.postgresql.org (Postfix) with ESMTP id B775130FC55 for ; Wed, 2 Jul 2003 09:51:33 -0300 (ADT) Received: from [192.168.1.200] ([216.209.81.133]) by tomts26-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030702125132.TTSG22067.tomts26-srv.bellnexxia.net@[192.168.1.200]>; Wed, 2 Jul 2003 08:51:32 -0400 Subject: Re: How to optimize monstrous query, sorts instead of From: Rod Taylor To: michael.mattox@verideon.com Cc: Postgresql Performance In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-6snf1FxRhqL+C8ELDExW" Message-Id: <1057150311.28657.172.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 02 Jul 2003 12:51:51 +0000 X-Archive-Number: 200307/26 X-Sequence-Number: 2319 --=-6snf1FxRhqL+C8ELDExW Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2003-07-02 at 10:24, Michael Mattox wrote: > > Try this: >=20 > Rod, you improved my query last week (thank you very much) but I'm not su= re > why but my performance is getting worse. I think I know what happened, w= hen > I did my load testing I created data that all had the same date, so sorti= ng > on the date was very fast. But now I've been running the system for a few > weeks I've got a range of dates and now the sort is very costly. I'm > curious if it's possible to optimize this with an index? I've tried > creating some indexes but they're never used. Standard questions, did you VACUUM? Regularly? Want to try again and send us the output from VACUUM VERBOSE? Sounds like you created a ton of test data, then removed a bunch? Did you REINDEX that table? During normal use, what is your query spread like? Mostly selects with some inserts? Any updates or deletes? How often to updates or deletes come in, and how many rows do they effect? > -> Index Scan using monitorstatusxmonitori on > monitorstatusx ms (cost=3D0.00..5996.18 rows=3D163 width=3D84) (actual > time=3D4383.38..14936.39 rows=3D225 loops=3D1) > Index Cond: ("outer".jdoidx =3D ms.monit= orx) > Filter: ((datex >=3D '2003-07-01 > 00:00:00'::timestamp without time zone) AND (datex <=3D '2003-07-01 > 23:59:59'::timestamp without time zone)) The above index scan is taking a vast majority of the time (nearly 15 seconds of the 16 second total -- stop thinking about sorts!).. What happened to the index on monitorx and datex? --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-6snf1FxRhqL+C8ELDExW Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/AtVm6DETLow6vwwRAmnIAJ0ajEOElGfbnDDWCgnyZ5p936OFLgCeK4xk kI/IwhqyvKWhLBMYGGi+4Og= =ocCw -----END PGP SIGNATURE----- --=-6snf1FxRhqL+C8ELDExW-- From pgsql-performance-owner@postgresql.org Wed Jul 2 10:46:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6D3E0310C54 for ; Wed, 2 Jul 2003 13:46:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 59685-05 for ; Wed, 2 Jul 2003 10:46:40 -0300 (ADT) Received: from mwinf0101.wanadoo.fr (smtp8.wanadoo.fr [193.252.22.30]) by svr1.postgresql.org (Postfix) with ESMTP id 84191310129 for ; Wed, 2 Jul 2003 10:46:39 -0300 (ADT) Received: from Paris (ABoulogne-110-1-2-97.w80-13.abo.wanadoo.fr [80.13.94.97]) by mwinf0101.wanadoo.fr (SMTP Server) with ESMTP id 22DCEC000135; Wed, 2 Jul 2003 15:46:38 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Rod Taylor" Cc: "Postgresql Performance" Subject: Re: How to optimize monstrous query, sorts instead of Date: Wed, 2 Jul 2003 15:46:36 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0025_01C340B1.1EA82170" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1057149922.28657.163.camel@jester> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/27 X-Sequence-Number: 2320 This is a multi-part message in MIME format. ------=_NextPart_000_0025_01C340B1.1EA82170 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > Shared buffers is probably too high. How much memory in this machine? > Is there anything else running aside from PostgreSQL? What does top say > about cached / buffered data (number) I was using the 25% of RAM guideline posted recently. The machine has 1.5gig but it also has a couple other java applications running on it including tomcat. 1:56pm up 6 days, 2:58, 6 users, load average: 2.60, 2.07, 1.78 193 processes: 191 sleeping, 2 running, 0 zombie, 0 stopped CPU0 states: 14.0% user, 9.0% system, 0.0% nice, 75.1% idle CPU1 states: 31.0% user, 0.1% system, 0.0% nice, 67.0% idle CPU2 states: 5.0% user, 0.1% system, 0.1% nice, 93.0% idle CPU3 states: 0.0% user, 0.1% system, 0.1% nice, 98.0% idle Mem: 1547572K av, 1537848K used, 9724K free, 0K shrd, 25104K buff Swap: 1044216K av, 51352K used, 992864K free 1245460K cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND 10184 veriguar 9 0 94760 83M 2612 S 36.5 5.5 13:29 java 8990 postgres 17 0 54864 53M 53096 R 11.5 3.5 0:00 postmaster 8988 veriguar 11 0 1164 1164 836 R 1.9 0.0 0:00 top 10161 veriguar 13 5 69504 60M 2600 S N 0.9 3.9 13:11 java 10206 veriguar 13 5 27952 23M 2580 S N 0.9 1.5 7:21 java 10699 postgres 9 0 31656 30M 30396 S 0.9 2.0 0:02 postmaster total used free shared buffers cached Mem: 1547572 1532024 15548 0 23820 1239024 -/+ buffers/cache: 269180 1278392 Swap: 1044216 51368 992848 > I see you reduced the random_page_cost to 1.5. Why did you do this (how > is your disk subsystem configured)? Someone suggested I lower it to 1.5 or 1.0, not sure what the reasoning was. The disks are both SCSI 10,000 RPM. My data directory is on one disk by itself, and the pg_xlog is on the other disk as well as the operating system and everything else. I was told it's best to have them on seperate disks, however I'm wondering because my system only has two disks and the one with the operating system isn't big enough to hold my database therefore I must put my DB on the 2nd disk and if pg_xlog is to be separate, it has to be with the OS & Java apps. > Standard questions, did you VACUUM? Regularly? Want to try again and > send us the output from VACUUM VERBOSE? I vacuum the monitor table every 5 minutes and I do a vacuum full analyze every night at midnight (cron job). I just did a vacuum verbose, output is attached. > Sounds like you created a ton of test data, then removed a bunch? Did > you REINDEX that table? I haven't deleted any of the data, I've been continuously adding new data. I added about 6 million rows at once, and they all had the same date. Since then my application has been stress testing over about 2 weeks now so there's now 7693057 rows in monitorstatusx and monitorstatusitemx as well as the necessary rows for the join tables. > During normal use, what is your query spread like? Mostly selects with > some inserts? Any updates or deletes? How often to updates or deletes > come in, and how many rows do they effect? There is a query on monitorx by datex every 10 seconds (monitors are updated every 5 minutes, so every 10 seconds I get the monitors that are due for an update). Each monitor is then saved with its status field modified, and a new status item is inserted. This happens every 5 minutes. There are 8-16 monitors being run in parallel, although typically it's 8 or less. This is the main application. The reporting application does a few queries but nothing major except the query that is the subject of this email. It's the reporting app that is slow due to this one big query. Finally the web app executes the same query as the reporting app, except there is a lot less data to be returned since it's only for the current day. > > -> Index Scan using > monitorstatusxmonitori on > > monitorstatusx ms (cost=0.00..5996.18 rows=163 width=84) (actual > > time=4383.38..14936.39 rows=225 loops=1) > > Index Cond: ("outer".jdoidx = > ms.monitorx) > > Filter: ((datex >= '2003-07-01 > > 00:00:00'::timestamp without time zone) AND (datex <= '2003-07-01 > > 23:59:59'::timestamp without time zone)) > > The above index scan is taking a vast majority of the time (nearly 15 > seconds of the 16 second total -- stop thinking about sorts!).. What > happened to the index on monitorx and datex? I just did reindex table monitorstatux; which didn't help, in fact query times went up. I then did create index monitorstatus_monitor_date_i on monitorstatusx(monitorx, datex); and this seemed to help a little: QUERY PLAN ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------- Sort (cost=1133.13..1133.38 rows=98 width=827) (actual time=9754.06..9754.25 rows=226 loops=1) Sort Key: ms.datex -> Nested Loop (cost=0.00..1129.90 rows=98 width=827) (actual time=50.81..9753.17 rows=226 loops=1) -> Nested Loop (cost=0.00..833.47 rows=98 width=162) (actual time=50.74..7149.28 rows=226 loops=1) -> Nested Loop (cost=0.00..537.04 rows=98 width=146) (actual time=50.67..4774.45 rows=226 loops=1) -> Nested Loop (cost=0.00..240.44 rows=98 width=130) (actual time=50.61..1515.10 rows=226 loops=1) -> Index Scan using monitorx_id_index on monitorx mx (cost=0.00..3.45 rows=1 width=46) (actual time=0.09..0.11 rows=1 loops=1) Index Cond: (idx = 'M-TEST_170-TEST_00_10560857890510173779233'::character varying) -> Index Scan using monitorstatus_monitor_date_i on monitorstatusx ms (cost=0.00..234.93 rows=165 width=84) (actual time=50.51..1513.21 rows=226 loops=1) Index Cond: (("outer".jdoidx = ms.monitorx) AND (ms.datex >= '2003-07-01 00:00:00'::timestamp without time zone) AND (ms.datex <= '2003-07-01 23:59:59'::timestamp without time zone)) -> Index Scan using monitorstatus_stjdoidb742c9b3i on monitorstatus_statusitemsx mssisx (cost=0.00..3.01 rows=1 width=16) (actual time=14.40..14.41 rows=1 loops=226) Index Cond: ("outer".jdoidx = mssisx.jdoidx) -> Index Scan using monitorstatusitejdoid7db0befci on monitorstatusitemlistd8ea58a5x litem (cost=0.00..3.01 rows=1 width=16) (actual time=10.49..10.49 rows=1 loops=226) Index Cond: ("outer".statusitemsx = litem.jdoidx) -> Index Scan using monitorstatusitemx_pkey on monitorstatusitemx msi (cost=0.00..3.01 rows=1 width=665) (actual time=11.50..11.50 rows=1 loops=226) Index Cond: ("outer".statusitemlistx = msi.jdoidx) Total runtime: 9754.64 msec (17 rows) Before I guess the index with monitorx,datex didn't do much because all the data had the same date. But now that I have over 2 weeks of real data, it makes a difference. Thanks, Michael ------=_NextPart_000_0025_01C340B1.1EA82170 Content-Type: text/plain; name="vacuum.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vacuum.txt" LOG: query: vacuum verbose; INFO: --Relation pg_catalog.pg_description-- LOG: statement: vacuum verbose; INFO: Pages 12: Changed 0, Empty 0; Tup 1390: Vac 0, Keep 0, UnUsed 1. Total CPU 0.00s/0.00u sec elapsed 0.11 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_16416-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_group-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_1261-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_proc-- LOG: statement: vacuum verbose; INFO: Pages 58: Changed 0, Empty 0; Tup 1492: Vac 0, Keep 0, UnUsed 165. Total CPU 0.00s/0.01u sec elapsed 0.13 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_1255-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_rewrite-- LOG: statement: vacuum verbose; INFO: Pages 4: Changed 0, Empty 0; Tup 29: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_16410-- LOG: statement: vacuum verbose; INFO: Pages 4: Changed 0, Empty 0; Tup 16: Vac 0, Keep 0, UnUsed 1. Total CPU 0.00s/0.00u sec elapsed 0.03 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_type-- LOG: statement: vacuum verbose; INFO: Pages 4: Changed 0, Empty 0; Tup 195: Vac 0, Keep 0, UnUsed 2. Total CPU 0.00s/0.00u sec elapsed 0.02 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_attribute-- LOG: statement: vacuum verbose; INFO: Pages 19: Changed 0, Empty 0; Tup 1140: Vac 0, Keep 0, UnUsed 19. Total CPU 0.00s/0.00u sec elapsed 0.05 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_class-- LOG: statement: vacuum verbose; INFO: Pages 4: Changed 0, Empty 0; Tup 180: Vac 0, Keep 0, UnUsed 32. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_inherits-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_index-- LOG: statement: vacuum verbose; INFO: Pages 3: Changed 0, Empty 0; Tup 94: Vac 0, Keep 0, UnUsed 3. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_operator-- LOG: statement: vacuum verbose; INFO: Pages 13: Changed 0, Empty 0; Tup 643: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_opclass-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 51: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_am-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 4: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_amop-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 180: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_amproc-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 57: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_language-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 3: Vac 0, Keep 0, UnUsed 3. Total CPU 0.00s/0.00u sec elapsed 0.02 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_largeobject-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_aggregate-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 60: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.02 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_trigger-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 2: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_listener-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_cast-- LOG: statement: vacuum verbose; INFO: Pages 2: Changed 0, Empty 0; Tup 174: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.01 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_namespace-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 4: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_shadow-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 1: Vac 0, Keep 0, UnUsed 1. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_1260-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_conversion-- LOG: statement: vacuum verbose; INFO: Pages 2: Changed 0, Empty 0; Tup 114: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.02 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_depend-- LOG: statement: vacuum verbose; INFO: Pages 21: Changed 0, Empty 0; Tup 2903: Vac 0, Keep 0, UnUsed 8. Total CPU 0.00s/0.00u sec elapsed 0.10 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_attrdef-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_16384-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_constraint-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 9: Vac 0, Keep 0, UnUsed 1. Total CPU 0.00s/0.00u sec elapsed 0.01 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_16386-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_database-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 3: Vac 0, Keep 0, UnUsed 4. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_1262-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.01s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.customeraccountx-- LOG: statement: vacuum verbose; INFO: Pages 14: Changed 0, Empty 0; Tup 589: Vac 0, Keep 0, UnUsed 16. Total CPU 0.00s/0.00u sec elapsed 0.08 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_17044-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorx-- LOG: statement: vacuum verbose; INFO: Index monitorx_pkey: Pages 1200; Tuples 1662: Deleted 2. CPU 0.01s/0.00u sec elapsed 0.01 sec. LOG: statement: vacuum verbose; INFO: Index monitorxstatusi: Pages 10636; Tuples 1662: Deleted 2. CPU 0.04s/0.06u sec elapsed 0.09 sec. LOG: statement: vacuum verbose; INFO: Index monitorx_id_index: Pages 4252; Tuples 1662: Deleted 2. CPU 0.02s/0.01u sec elapsed 0.03 sec. LOG: statement: vacuum verbose; INFO: Index monitorx_nextdate_enabled_index: Pages 7715; Tuples 1662: Dele= ted 2. CPU 0.03s/0.02u sec elapsed 0.05 sec. LOG: statement: vacuum verbose; INFO: Removed 2 tuples in 2 pages. CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: Pages 141: Changed 1, Empty 0; Tup 1662: Vac 2, Keep 160, UnUsed 234= 2. Total CPU 0.10s/0.09u sec elapsed 0.19 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_17006-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorstatusx-- LOG: statement: vacuum verbose; INFO: Pages 165468: Changed 122, Empty 0; Tup 7693113: Vac 0, Keep 0, UnUs= ed 11. Total CPU 7.86s/1.35u sec elapsed 245.53 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_16995-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorgroup_monitorsx-- LOG: statement: vacuum verbose; INFO: Pages 10: Changed 0, Empty 0; Tup 1503: Vac 0, Keep 0, UnUsed 47. Total CPU 0.00s/0.00u sec elapsed 0.48 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_catalog.pg_statistic-- LOG: statement: vacuum verbose; INFO: Index pg_statistic_relid_att_index: Pages 33; Tuples 242: Deleted 28= 39. CPU 0.00s/0.00u sec elapsed 0.15 sec. LOG: statement: vacuum verbose; INFO: Removed 2839 tuples in 149 pages. CPU 0.00s/0.03u sec elapsed 0.02 sec. LOG: statement: vacuum verbose; INFO: Pages 151: Changed 11, Empty 0; Tup 242: Vac 2839, Keep 0, UnUsed 57. Total CPU 0.06s/0.03u sec elapsed 2.11 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_16408-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitor_monitorlocationsx-- LOG: statement: vacuum verbose; INFO: Pages 14: Changed 0, Empty 0; Tup 2089: Vac 0, Keep 0, UnUsed 19. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorgroupx-- LOG: statement: vacuum verbose; INFO: Pages 14: Changed 0, Empty 0; Tup 589: Vac 0, Keep 0, UnUsed 18. Total CPU 0.00s/0.00u sec elapsed 0.36 sec. LOG: statement: vacuum verbose; INFO: --Relation public.companycontactx-- LOG: statement: vacuum verbose; INFO: Pages 14: Changed 0, Empty 0; Tup 589: Vac 0, Keep 0, UnUsed 9. Total CPU 0.00s/0.00u sec elapsed 0.22 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_17030-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorstatusitemx-- LOG: statement: vacuum verbose; INFO: Pages 174853: Changed 2521, Empty 0; Tup 7691779: Vac 0, Keep 0, Un= Used 1. Total CPU 7.99s/1.25u sec elapsed 270.45 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_17037-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.addressx-- LOG: statement: vacuum verbose; INFO: Pages 10: Changed 0, Empty 0; Tup 589: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.07 sec. LOG: statement: vacuum verbose; INFO: --Relation pg_toast.pg_toast_17014-- LOG: statement: vacuum verbose; INFO: Pages 0: Changed 0, Empty 0; Tup 0: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorstatusitemlistx-- LOG: statement: vacuum verbose; INFO: Pages 122108: Changed 1763, Empty 0; Tup 7692430: Vac 0, Keep 0, UnU= sed 0. Total CPU 5.95s/1.07u sec elapsed 186.32 sec. LOG: statement: vacuum verbose; INFO: --Relation public.companyx-- LOG: statement: vacuum verbose; INFO: Pages 10: Changed 0, Empty 0; Tup 589: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.03 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorstatusitemlistd8ea58a5x-- LOG: statement: vacuum verbose; INFO: Pages 45258: Changed 655, Empty 0; Tup 7692657: Vac 0, Keep 0, UnUse= d 0. Total CPU 2.08s/0.67u sec elapsed 53.04 sec. LOG: statement: vacuum verbose; INFO: --Relation public.monitorstatus_statusitemsx-- LOG: statement: vacuum verbose; INFO: Pages 56572: Changed 812, Empty 0; Tup 7692865: Vac 0, Keep 0, UnUse= d 0. Total CPU 2.58s/0.75u sec elapsed 72.08 sec. LOG: statement: vacuum verbose; INFO: --Relation public.companycontact_rncies9688bceax-- LOG: statement: vacuum verbose; INFO: Pages 1: Changed 0, Empty 0; Tup 10: Vac 0, Keep 0, UnUsed 0. Total CPU 0.00s/0.00u sec elapsed 0.00 sec. LOG: statement: vacuum verbose; LOG: duration: 851.708818 sec VACUUM veriguard=3D# ------=_NextPart_000_0025_01C340B1.1EA82170-- From pgsql-performance-owner@postgresql.org Thu Jul 3 13:25:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E43CAB43A42 for ; Thu, 3 Jul 2003 15:59:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 30887-06 for ; Thu, 3 Jul 2003 12:58:46 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 07A40B43A45 for ; Thu, 3 Jul 2003 12:57:55 -0300 (ADT) Received: from curry.tmsl.demon.co.uk (tmsl-adsl.demon.co.uk [80.177.114.181]) by www.postgresql.com (Postfix) with ESMTP id C9F52CF7558 for ; Thu, 3 Jul 2003 05:48:48 -0300 (ADT) Received: from bacon.tmsl.demon.co.uk (bacon.tmsl.demon.co.uk [192.168.7.102]) by curry.tmsl.demon.co.uk (8.11.6/8.11.6) with ESMTP id h638llR14741; Thu, 3 Jul 2003 09:47:47 +0100 Date: Thu, 3 Jul 2003 09:47:44 +0100 From: Paul Thomas To: Matthew Hixson Cc: "pgsql-performance @ postgresql . org" Subject: Re: raise or lower transaction timeout? Message-ID: <20030703094744.A6212@bacon> References: <60DAC973-ACC8-11D7-9D40-000393669C1A@poindextrose.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <60DAC973-ACC8-11D7-9D40-000393669C1A@poindextrose.org>; from hixson@poindextrose.org on Wed, Jul 02, 2003 at 21:04:24 +0100 X-Mailer: Balsa 1.2.3 Lines: 35 X-Archive-Number: 200307/28 X-Sequence-Number: 2321 On 02/07/2003 21:04 Matthew Hixson wrote: > We currently have a public website that is serving customers, or at > least trying to. This machine is underpowered but we are going to be > upgrading soon. In the meantime we need to keep the current site alive. > We are running a Java application server. It is receiving > 'transaction timed out' SQLExceptions from the JDBC driver. I am > wondering if it would be better to raise the transaction timeout or to > lower it. On one hand it seems like raising it might improve things. > It might let the transactions complete, even though it would make the > user experience less enjoyable having to wait longer. On the other hand > I could see raising the transaction timeout just cause there to be more > transactions in process which would thereby degrade performance since > the machine would have even more work to do. Would, in fact, lowering > the transaction timeout at least cause the machine to fail fast and > return either an error or the page in a more timely manner on a per-user > level? I'd like to keep people visiting the site while at the same time > relieving some stress from the machine. > We have also done little to no performance tuning of Postgres' > configuration. We do have indexes on all of the important columns and > we have reindexed. Any pointers would be greatly appreciated. As well as the tuning postgresql advice which others have given, there's another thing you could try: Assuming you're using connection pooling, try reducing the maximum number of connections. This will take some of the stress off the database. -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 3 13:52:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B755BB43A58 for ; Thu, 3 Jul 2003 15:58:33 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 26736-06 for ; Thu, 3 Jul 2003 12:58:11 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 2870CB43A3B for ; Thu, 3 Jul 2003 12:57:24 -0300 (ADT) Received: from tomts24-srv.bellnexxia.net (tomts24.bellnexxia.net [209.226.175.187]) by www.postgresql.com (Postfix) with ESMTP id 8FBA2CF7835 for ; Thu, 3 Jul 2003 09:29:31 -0300 (ADT) Received: from [192.168.1.200] ([216.209.81.133]) by tomts24-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030703122545.HKXZ23872.tomts24-srv.bellnexxia.net@[192.168.1.200]>; Thu, 3 Jul 2003 08:25:45 -0400 Subject: Re: How to optimize monstrous query, sorts instead of From: Rod Taylor To: Ang Chin Han Cc: michael.mattox@verideon.com, Postgresql Performance In-Reply-To: <3F038DF5.70602@bytecraft.com.my> References: <3F038DF5.70602@bytecraft.com.my> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-W3k13ytIy3LZGIZSI2A3" Message-Id: <1057235173.30368.32.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 03 Jul 2003 08:26:13 -0400 X-Archive-Number: 200307/29 X-Sequence-Number: 2322 --=-W3k13ytIy3LZGIZSI2A3 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > CREATE VIEW foo AS {complex_slow_query}; >=20 > SET random_page_cost =3D 1.5; EXPLAIN ANALYZE SELECT * FROM foo; >=20 > Note the time taken. Repeat a few times to get the average. You pulled everything off disk and tossed it into memory with the first run so the results will NOT match your normal situation (some data on disk, some cached in memory) for your second run and further runs unless there is a LONG timeframe between runs. That said, if you test with several other queries and get the same results, it's probably good enough for your system. --=-W3k13ytIy3LZGIZSI2A3 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BCDk6DETLow6vwwRAqHkAJoCRGyPk7aylVX2+kk9MWAuWCTxIgCePDc3 rlGhTwLwMtbOSgqCW/lS3K4= =TJrl -----END PGP SIGNATURE----- --=-W3k13ytIy3LZGIZSI2A3-- From pgsql-performance-owner@postgresql.org Thu Jul 3 16:48:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 14972B43848 for ; Thu, 3 Jul 2003 19:05:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27919-07 for ; Thu, 3 Jul 2003 16:05:03 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 71222B43A4F for ; Thu, 3 Jul 2003 16:05:02 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id C1C5220F00; Thu, 3 Jul 2003 12:05:02 -0700 (PDT) Date: Thu, 3 Jul 2003 12:05:02 -0700 From: Sean Chittenden To: pgsql-performance@postgresql.org Subject: Moving postgresql.conf tunables into 2003... Message-ID: <20030703190502.GR72567@perrin.int.nxad.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/30 X-Sequence-Number: 2323 What are the odds of going through and revamping some of the tunables in postgresql.conf for the 7.4 release? I was just working with someone on IRC and on their 7800 RPM IDE drives, their random_page_cost was ideally suited to be 0.32: a far cry from 4. Doing so has been a win across the board and the problem query went from about 40sec (seq scan) down to 0.25ms (using idx, higher than 0.32 resulted in a query time jump to 2sec, and at 0.4 it went back up to a full seq scan at 40sec). I know Josh is working on revamping the postgresql.conf file, but would it be possible to include suggested values for various bits of hardware and then solicit contributions from admins on this list who have tuned their DB correctly? ## random_page_cost -- units are one sequential page fetch cost #random_page_cost = 4 # default - very conservative #random_page_cost = 0.9 # IDE 5200 RPM, 8MB disk cache #random_page_cost = 0.3 # IDE 7800 RPM, 4MB disk cache #random_page_cost = 0.1 # SCSI RAID 5, 10,000RPM, 64MB cache #random_page_cost = 0.05 # SCSI RAID 1+0, 15,000RPM, 128MB cache #... ## next_hardware_dependent_tunable.... #hardware_dependent_tunable I know these tables could get somewhat lengthy or organized differently, but given the file is read _once_ at _startup_, seen by thousands of DBAs, is visited at least once for every installation (at the least to turn on TCP connections), is often the only file other than pg_hba.conf that gets modified or looked at, this could be a very nice way of introducing DBAs to tuning PostgreSQL and reducing the number of people crying "PostgreSQL's slow." Having postgresql.conf a clearing house for tunable values for various bits of hardware would be a huge win for the community and would hopefully radically change this database's perception. At the top of the file, it would be useful to include a blurb to the effect of: # The default values for PostgreSQL are extremely conservative and are # likely far from ideal for a site's needs. Included in this # configuration, however, are _suggested_ values to help aid in # tuning. The values below are not authoritative, merely contributed # suggestions from PostgreSQL DBAs and committers who have # successfully tuned their databases. Please take these values as # advisory only and remember that they will very likely have to be # adjusted according to your site's specific needs. If you have a # piece of hardware that isn't mentioned below and have tuned your # configuration aptly and have found a suggested value that the # PostgreSQL community would benefit from, please send a description # of the hardware, the name of the tunable, and the tuned value to # performance@PostgreSQL.org to be considered for inclusion in future # releases. # # It should also go without saying that the PostgreSQL Global # Development Group and its community of committers, contributors, # administrators, and commercial supporters are absolved from any # responsibility or liability with regards to the use of its software # (see this software's license for details). Any data loss, # corruption, or performance degradation is the responsibility of the # individual or group of individuals using/managing this installation. # # Hints to DBAs: # # *) Setup a regular backup schedule (hint: pg_dump(1)/pg_dumpall(1) + # cron(8)) # # *) Tuning: Use psql(1) to test out values before changing values for # the entire database. In psql(1), type: # # 1) SHOW [tunabe_name]; # 2) SET [tunable_name] = [value]; # 3) [run query] # 4) [repeat adjustments as necessary before setting a value here in # the postgresql.conf]. # 5) [Send a SIGHUP signal to the backend to have the config values # re-read] # # *) Never use kill -9 on the backend to shut it down. # # *) VACUUM ANALYZE your databases regularly. # # *) Use EXPLAIN ANALYZE [query] to tune queries. # # *) Read the online documentation at: # http://www.postgresql.org/docs/ # # -- PostgreSQL Global Development Group Just a thought. A bit lengthy, but given that out of the box most every value is set to be extremely conservative (detrimentally so, esp since the majority of users aren't running PostgreSQL in embedded devices, are on reasonably new hardware > 3 years old), and the config is only read in once and generally the only file viewed by DBAs, it'd make PostgreSQL more competitive in the performance dept if there were some kind of suggested values for various tunables. Having someone whine, "my PostgreSQL database is slow" is really getting old when its really not and it's a lack of tuning that is at fault, lowering the bar to a successful and speedy PostgreSQL installation would be a win for everyone. The person who I was helping also had the same data, schema, and query running on MySQL and the fastest it could go was 2.7s (about 40M rows in the table). -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Thu Jul 3 17:26:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7E4B9B439CD for ; Thu, 3 Jul 2003 20:21:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 70898-08 for ; Thu, 3 Jul 2003 17:21:31 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 5E610B43A5D for ; Thu, 3 Jul 2003 17:21:31 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h63KKZVG009785; Thu, 3 Jul 2003 14:20:35 -0600 (MDT) Date: Thu, 3 Jul 2003 14:14:37 -0600 (MDT) From: "scott.marlowe" To: Sean Chittenden Cc: Subject: Re: Moving postgresql.conf tunables into 2003... In-Reply-To: <20030703190502.GR72567@perrin.int.nxad.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200307/32 X-Sequence-Number: 2325 On Thu, 3 Jul 2003, Sean Chittenden wrote: > What are the odds of going through and revamping some of the tunables > in postgresql.conf for the 7.4 release? I was just working with > someone on IRC and on their 7800 RPM IDE drives, their > random_page_cost was ideally suited to be 0.32: a far cry from 4. > Doing so has been a win across the board and the problem query went > from about 40sec (seq scan) down to 0.25ms (using idx, higher than > 0.32 resulted in a query time jump to 2sec, and at 0.4 it went back up > to a full seq scan at 40sec). I'm the guy who advocates settings of 1 to 2, and that still sounds low to me. :-) I'm wondering if the effective_cache_size was set properly, as well as there be enough buffers allocated. I generally set effective cache size to 100,000 pages (800 megs or so) on my box, which is where it sits most days. with this setting I've found that settings of under 1 are not usually necessary to force the planner to take the path of righteousness (i.e. the fastest one :-) 1.2 to 1.4 are optimal to me. Since theoretically a random page of of 1 means no penalty to move the heads around, and there's ALWAYS a penalty for moving the heads around, we have to assume: 1: That either the planner is making poor decisions on some other variable, and we can whack the planner in the head with a really low random page count. OR 2: The other settings are suboptimal (buffers, sort_mem, effective_cache_size, etc...) and lowering random page costs helps there. I've always wondered if most performance issues aren't a bit of both. The answer, of course, is fixing the planner so that a random_page_cost of anything less than 1 would never be needed, since by design, anything under 1 represents a computer that likely doesn't exist (in theory of course.) A 1 would be a machine that was using solid state hard drives and had the same cost in terms of OS paths to do random accesses as sequential. What constants in the planner, and / or formulas would be the likely culprits I wonder? I've wandered through that page and wasn't sure what to play with. > I know Josh is working on revamping the postgresql.conf file, but > would it be possible to include suggested values for various bits of > hardware and then solicit contributions from admins on this list who > have tuned their DB correctly? > > ## random_page_cost -- units are one sequential page fetch cost > #random_page_cost = 4 # default - very conservative > #random_page_cost = 0.9 # IDE 5200 RPM, 8MB disk cache > #random_page_cost = 0.3 # IDE 7800 RPM, 4MB disk cache > #random_page_cost = 0.1 # SCSI RAID 5, 10,000RPM, 64MB cache > #random_page_cost = 0.05 # SCSI RAID 1+0, 15,000RPM, 128MB cache > #... > > ## next_hardware_dependent_tunable.... > #hardware_dependent_tunable > > I know these tables could get somewhat lengthy or organized > differently, but given the file is read _once_ at _startup_, seen by > thousands of DBAs, is visited at least once for every installation (at > the least to turn on TCP connections), is often the only file other > than pg_hba.conf that gets modified or looked at, this could be a very > nice way of introducing DBAs to tuning PostgreSQL and reducing the > number of people crying "PostgreSQL's slow." Having postgresql.conf a > clearing house for tunable values for various bits of hardware would > be a huge win for the community and would hopefully radically change > this database's perception. At the top of the file, it would be > useful to include a blurb to the effect of: > > # The default values for PostgreSQL are extremely conservative and are > # likely far from ideal for a site's needs. Included in this > # configuration, however, are _suggested_ values to help aid in > # tuning. The values below are not authoritative, merely contributed > # suggestions from PostgreSQL DBAs and committers who have > # successfully tuned their databases. Please take these values as > # advisory only and remember that they will very likely have to be > # adjusted according to your site's specific needs. If you have a > # piece of hardware that isn't mentioned below and have tuned your > # configuration aptly and have found a suggested value that the > # PostgreSQL community would benefit from, please send a description > # of the hardware, the name of the tunable, and the tuned value to > # performance@PostgreSQL.org to be considered for inclusion in future > # releases. > # > # It should also go without saying that the PostgreSQL Global > # Development Group and its community of committers, contributors, > # administrators, and commercial supporters are absolved from any > # responsibility or liability with regards to the use of its software > # (see this software's license for details). Any data loss, > # corruption, or performance degradation is the responsibility of the > # individual or group of individuals using/managing this installation. > # > # Hints to DBAs: > # > # *) Setup a regular backup schedule (hint: pg_dump(1)/pg_dumpall(1) + > # cron(8)) > # > # *) Tuning: Use psql(1) to test out values before changing values for > # the entire database. In psql(1), type: > # > # 1) SHOW [tunabe_name]; > # 2) SET [tunable_name] = [value]; > # 3) [run query] > # 4) [repeat adjustments as necessary before setting a value here in > # the postgresql.conf]. > # 5) [Send a SIGHUP signal to the backend to have the config values > # re-read] > # > # *) Never use kill -9 on the backend to shut it down. > # > # *) VACUUM ANALYZE your databases regularly. > # > # *) Use EXPLAIN ANALYZE [query] to tune queries. > # > # *) Read the online documentation at: > # http://www.postgresql.org/docs/ > # > # -- PostgreSQL Global Development Group > > Just a thought. A bit lengthy, but given that out of the box most > every value is set to be extremely conservative (detrimentally so, esp > since the majority of users aren't running PostgreSQL in embedded > devices, are on reasonably new hardware > 3 years old), and the config > is only read in once and generally the only file viewed by DBAs, it'd > make PostgreSQL more competitive in the performance dept if there were > some kind of suggested values for various tunables. Having someone > whine, "my PostgreSQL database is slow" is really getting old when its > really not and it's a lack of tuning that is at fault, lowering the > bar to a successful and speedy PostgreSQL installation would be a win > for everyone. The person who I was helping also had the same data, > schema, and query running on MySQL and the fastest it could go was > 2.7s (about 40M rows in the table). > > -sc > > From pgsql-performance-owner@postgresql.org Thu Jul 3 17:28:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 56ED3B439FF for ; Thu, 3 Jul 2003 20:17:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 70898-01 for ; Thu, 3 Jul 2003 17:17:41 -0300 (ADT) Received: from mwinf0602.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.25]) by svr1.postgresql.org (Postfix) with ESMTP id 70C85B43A5C for ; Thu, 3 Jul 2003 17:17:40 -0300 (ADT) Received: from Paris (ABoulogne-110-1-4-48.w81-49.abo.wanadoo.fr [81.49.7.48]) by mwinf0602.wanadoo.fr (SMTP Server) with ESMTP id 55A835400291; Thu, 3 Jul 2003 22:17:40 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Sean Chittenden" , Subject: Re: Moving postgresql.conf tunables into 2003... Date: Thu, 3 Jul 2003 22:17:42 +0200 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <20030703190502.GR72567@perrin.int.nxad.com> Importance: Normal X-Archive-Number: 200307/33 X-Sequence-Number: 2326 I don't have much to add because I'm pretty new to Postgres and have been soliciting advice here recently, but I totally agree with everything you said. I don't mind if it's in the postgres.conf file or in a faq that is easy to find, I just would like it to be in one place. A good example of the need for this is when I was tuning "effective_cache" I thought that was creating a cache for Postgres when in fact as it was pointed out to me, it's just hinting to postgres the size of the OS cache. Lots of ways for people to get really confused here. Also some people have said I should have used MySQL and to be honest I did consider trying it out. Because Postgres is hard to tune a lot of people think it's slower than MySQL. So anything that improves the quality of the documentation and makes it easier to tune will improve Postgres' reputation which will in turn encourage more people to use it! Michael > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Sean > Chittenden > Sent: Thursday, July 03, 2003 9:05 PM > To: pgsql-performance@postgresql.org > Subject: [PERFORM] Moving postgresql.conf tunables into 2003... > > > What are the odds of going through and revamping some of the tunables > in postgresql.conf for the 7.4 release? I was just working with > someone on IRC and on their 7800 RPM IDE drives, their > random_page_cost was ideally suited to be 0.32: a far cry from 4. > Doing so has been a win across the board and the problem query went > from about 40sec (seq scan) down to 0.25ms (using idx, higher than > 0.32 resulted in a query time jump to 2sec, and at 0.4 it went back up > to a full seq scan at 40sec). > > I know Josh is working on revamping the postgresql.conf file, but > would it be possible to include suggested values for various bits of > hardware and then solicit contributions from admins on this list who > have tuned their DB correctly? > > ## random_page_cost -- units are one sequential page fetch cost > #random_page_cost = 4 # default - very conservative > #random_page_cost = 0.9 # IDE 5200 RPM, 8MB disk cache > #random_page_cost = 0.3 # IDE 7800 RPM, 4MB disk cache > #random_page_cost = 0.1 # SCSI RAID 5, 10,000RPM, 64MB cache > #random_page_cost = 0.05 # SCSI RAID 1+0, 15,000RPM, 128MB cache > #... > > ## next_hardware_dependent_tunable.... > #hardware_dependent_tunable > > I know these tables could get somewhat lengthy or organized > differently, but given the file is read _once_ at _startup_, seen by > thousands of DBAs, is visited at least once for every installation (at > the least to turn on TCP connections), is often the only file other > than pg_hba.conf that gets modified or looked at, this could be a very > nice way of introducing DBAs to tuning PostgreSQL and reducing the > number of people crying "PostgreSQL's slow." Having postgresql.conf a > clearing house for tunable values for various bits of hardware would > be a huge win for the community and would hopefully radically change > this database's perception. At the top of the file, it would be > useful to include a blurb to the effect of: > > # The default values for PostgreSQL are extremely conservative and are > # likely far from ideal for a site's needs. Included in this > # configuration, however, are _suggested_ values to help aid in > # tuning. The values below are not authoritative, merely contributed > # suggestions from PostgreSQL DBAs and committers who have > # successfully tuned their databases. Please take these values as > # advisory only and remember that they will very likely have to be > # adjusted according to your site's specific needs. If you have a > # piece of hardware that isn't mentioned below and have tuned your > # configuration aptly and have found a suggested value that the > # PostgreSQL community would benefit from, please send a description > # of the hardware, the name of the tunable, and the tuned value to > # performance@PostgreSQL.org to be considered for inclusion in future > # releases. > # > # It should also go without saying that the PostgreSQL Global > # Development Group and its community of committers, contributors, > # administrators, and commercial supporters are absolved from any > # responsibility or liability with regards to the use of its software > # (see this software's license for details). Any data loss, > # corruption, or performance degradation is the responsibility of the > # individual or group of individuals using/managing this installation. > # > # Hints to DBAs: > # > # *) Setup a regular backup schedule (hint: pg_dump(1)/pg_dumpall(1) + > # cron(8)) > # > # *) Tuning: Use psql(1) to test out values before changing values for > # the entire database. In psql(1), type: > # > # 1) SHOW [tunabe_name]; > # 2) SET [tunable_name] = [value]; > # 3) [run query] > # 4) [repeat adjustments as necessary before setting a value here in > # the postgresql.conf]. > # 5) [Send a SIGHUP signal to the backend to have the config values > # re-read] > # > # *) Never use kill -9 on the backend to shut it down. > # > # *) VACUUM ANALYZE your databases regularly. > # > # *) Use EXPLAIN ANALYZE [query] to tune queries. > # > # *) Read the online documentation at: > # http://www.postgresql.org/docs/ > # > # -- PostgreSQL Global Development Group > > Just a thought. A bit lengthy, but given that out of the box most > every value is set to be extremely conservative (detrimentally so, esp > since the majority of users aren't running PostgreSQL in embedded > devices, are on reasonably new hardware > 3 years old), and the config > is only read in once and generally the only file viewed by DBAs, it'd > make PostgreSQL more competitive in the performance dept if there were > some kind of suggested values for various tunables. Having someone > whine, "my PostgreSQL database is slow" is really getting old when its > really not and it's a lack of tuning that is at fault, lowering the > bar to a successful and speedy PostgreSQL installation would be a win > for everyone. The person who I was helping also had the same data, > schema, and query running on MySQL and the fastest it could go was > 2.7s (about 40M rows in the table). > > -sc > > -- > Sean Chittenden > > ---------------------------(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 Thu Jul 3 17:25:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4DB86B439B9 for ; Thu, 3 Jul 2003 20:23:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 71615-10 for ; Thu, 3 Jul 2003 17:23:32 -0300 (ADT) Received: from tomts24-srv.bellnexxia.net (tomts24.bellnexxia.net [209.226.175.187]) by svr1.postgresql.org (Postfix) with ESMTP id 53021B439CD for ; Thu, 3 Jul 2003 17:23:32 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts24-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030703202333.ZGGE23872.tomts24-srv.bellnexxia.net@[10.0.2.11]>; Thu, 3 Jul 2003 16:23:33 -0400 Subject: Re: Moving postgresql.conf tunables into 2003... From: Rod Taylor To: Sean Chittenden Cc: Postgresql Performance In-Reply-To: <20030703190502.GR72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-lHCdP7uPlLotCBY9vcdR" Message-Id: <1057263840.31736.22.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 03 Jul 2003 20:24:01 +0000 X-Archive-Number: 200307/31 X-Sequence-Number: 2324 --=-lHCdP7uPlLotCBY9vcdR Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2003-07-03 at 19:05, Sean Chittenden wrote: > What are the odds of going through and revamping some of the tunables > in postgresql.conf for the 7.4 release? I was just working with > someone on IRC and on their 7800 RPM IDE drives, their > random_page_cost was ideally suited to be 0.32: a far cry from 4. I find it very very hard to believe a random read was cheaper than a sequential read. Something is shifty in your testing. --=-lHCdP7uPlLotCBY9vcdR Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BJDg6DETLow6vwwRAt6pAJ0W3Xcya6HUsEBfnLUw/H7MFUkEbwCfVDda mld3HVRx4w/UHCE9/KeijGc= =Ktom -----END PGP SIGNATURE----- --=-lHCdP7uPlLotCBY9vcdR-- From pgsql-performance-owner@postgresql.org Thu Jul 3 17:32:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 73F70B43A05 for ; Thu, 3 Jul 2003 20:28:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 73038-07 for ; Thu, 3 Jul 2003 17:28:12 -0300 (ADT) Received: from silmaril.syscor.priv (h24-77-52-251.sbm.shawcable.net [24.77.52.251]) by svr1.postgresql.org (Postfix) with ESMTP id C1324B439BB for ; Thu, 3 Jul 2003 17:28:10 -0300 (ADT) Received: from syscor.com (strider.syscor.priv [192.168.1.3]) by silmaril.syscor.priv (8.12.8/8.12.8) with ESMTP id h63KSGCg017497 for ; Thu, 3 Jul 2003 13:28:16 -0700 Message-ID: <3F0491E5.1030806@syscor.com> Date: Thu, 03 Jul 2003 13:28:21 -0700 From: Ron User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... References: <20030703190502.GR72567@perrin.int.nxad.com> In-Reply-To: <20030703190502.GR72567@perrin.int.nxad.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200307/34 X-Sequence-Number: 2327 Hear, hear! Well said Sean. I know that there has been disagreement about this in the past (recommending settings, with some very good reasons), however as a programmer/part-time DBA, something like this would be extremely useful. Our company recently developed a web-based app for a client who is very happy with their product (we used postgresql db) and we are just beginning to revive a standalone app using postgresql instead of db2 as the database. As I'm the DBA only on a part-time basis it is really time consuming to have to 1) find all relevant documentation and 2) learn it sufficiently to try to tune the db properly and 3) forget about most of it until we set up a new project in another year. I like postgresql and have convinced two of our clients to use it, but if I could fine tune it so it could 'fly', it would be easier for me (and others) to get more people to use it. Ron St.Pierre BTW I'm looking forward to Josh's configuration doc. Sean Chittenden wrote: >What are the odds of going through and revamping some of the tunables >in postgresql.conf for the 7.4 release? I was just working with >someone on IRC and on their 7800 RPM IDE drives, their >random_page_cost was ideally suited to be 0.32: a far cry from 4. >Doing so has been a win across the board and the problem query went >from about 40sec (seq scan) down to 0.25ms (using idx, higher than >0.32 resulted in a query time jump to 2sec, and at 0.4 it went back up >to a full seq scan at 40sec). > >I know Josh is working on revamping the postgresql.conf file, but >would it be possible to include suggested values for various bits of >hardware and then solicit contributions from admins on this list who >have tuned their DB correctly? > >## random_page_cost -- units are one sequential page fetch cost >#random_page_cost = 4 # default - very conservative >#random_page_cost = 0.9 # IDE 5200 RPM, 8MB disk cache >#random_page_cost = 0.3 # IDE 7800 RPM, 4MB disk cache >#random_page_cost = 0.1 # SCSI RAID 5, 10,000RPM, 64MB cache >#random_page_cost = 0.05 # SCSI RAID 1+0, 15,000RPM, 128MB cache >#... > >## next_hardware_dependent_tunable.... >#hardware_dependent_tunable > >I know these tables could get somewhat lengthy or organized >differently, but given the file is read _once_ at _startup_, seen by >thousands of DBAs, is visited at least once for every installation (at >the least to turn on TCP connections), is often the only file other >than pg_hba.conf that gets modified or looked at, this could be a very >nice way of introducing DBAs to tuning PostgreSQL and reducing the >number of people crying "PostgreSQL's slow." Having postgresql.conf a >clearing house for tunable values for various bits of hardware would >be a huge win for the community and would hopefully radically change >this database's perception. At the top of the file, it would be >useful to include a blurb to the effect of: > ># The default values for PostgreSQL are extremely conservative and are ># likely far from ideal for a site's needs. Included in this ># configuration, however, are _suggested_ values to help aid in ># tuning. The values below are not authoritative, merely contributed ># suggestions from PostgreSQL DBAs and committers who have ># successfully tuned their databases. Please take these values as ># advisory only and remember that they will very likely have to be ># adjusted according to your site's specific needs. If you have a ># piece of hardware that isn't mentioned below and have tuned your ># configuration aptly and have found a suggested value that the ># PostgreSQL community would benefit from, please send a description ># of the hardware, the name of the tunable, and the tuned value to ># performance@PostgreSQL.org to be considered for inclusion in future ># releases. ># ># It should also go without saying that the PostgreSQL Global ># Development Group and its community of committers, contributors, ># administrators, and commercial supporters are absolved from any ># responsibility or liability with regards to the use of its software ># (see this software's license for details). Any data loss, ># corruption, or performance degradation is the responsibility of the ># individual or group of individuals using/managing this installation. ># ># Hints to DBAs: ># ># *) Setup a regular backup schedule (hint: pg_dump(1)/pg_dumpall(1) + ># cron(8)) ># ># *) Tuning: Use psql(1) to test out values before changing values for ># the entire database. In psql(1), type: ># ># 1) SHOW [tunabe_name]; ># 2) SET [tunable_name] = [value]; ># 3) [run query] ># 4) [repeat adjustments as necessary before setting a value here in ># the postgresql.conf]. ># 5) [Send a SIGHUP signal to the backend to have the config values ># re-read] ># ># *) Never use kill -9 on the backend to shut it down. ># ># *) VACUUM ANALYZE your databases regularly. ># ># *) Use EXPLAIN ANALYZE [query] to tune queries. ># ># *) Read the online documentation at: ># http://www.postgresql.org/docs/ ># ># -- PostgreSQL Global Development Group > >Just a thought. A bit lengthy, but given that out of the box most >every value is set to be extremely conservative (detrimentally so, esp >since the majority of users aren't running PostgreSQL in embedded >devices, are on reasonably new hardware > 3 years old), and the config >is only read in once and generally the only file viewed by DBAs, it'd >make PostgreSQL more competitive in the performance dept if there were >some kind of suggested values for various tunables. Having someone >whine, "my PostgreSQL database is slow" is really getting old when its >really not and it's a lack of tuning that is at fault, lowering the >bar to a successful and speedy PostgreSQL installation would be a win >for everyone. The person who I was helping also had the same data, >schema, and query running on MySQL and the fastest it could go was >2.7s (about 40M rows in the table). > > -sc > > > From pgsql-performance-owner@postgresql.org Thu Jul 3 17:39:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3155FB43A0A for ; Thu, 3 Jul 2003 20:39:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 78166-01 for ; Thu, 3 Jul 2003 17:38:55 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id EBADEB439BB for ; Thu, 3 Jul 2003 17:38:54 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h63KctQQ002423; Thu, 3 Jul 2003 16:38:55 -0400 (EDT) To: Sean Chittenden Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-reply-to: <20030703190502.GR72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> Comments: In-reply-to Sean Chittenden message dated "Thu, 03 Jul 2003 12:05:02 -0700" Date: Thu, 03 Jul 2003 16:38:55 -0400 Message-ID: <2422.1057264735@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/35 X-Sequence-Number: 2328 Sean Chittenden writes: > What are the odds of going through and revamping some of the tunables > in postgresql.conf for the 7.4 release? I was arguing awhile back for bumping the default shared_buffers up, but the discussion trailed off with no real resolution. > I was just working with > someone on IRC and on their 7800 RPM IDE drives, their > random_page_cost was ideally suited to be 0.32: a far cry from 4. It is not physically sensible for random_page_cost to be less than one. The system only lets you set it there for experimental purposes; there is no way that postgresql.conf.sample will recommend it. If you needed to push it below one to force indexscans, there is some other problem that needs to be solved. (I'd wonder about index correlation myself; we know that that equation is pretty bogus.) > I know Josh is working on revamping the postgresql.conf file, but > would it be possible to include suggested values for various bits of > hardware and then solicit contributions from admins on this list who > have tuned their DB correctly? I think such material belongs in the SGML docs, not hidden away in a config file that people may not look at... regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 3 18:33:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 31D46B439B2 for ; Thu, 3 Jul 2003 21:33:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 95846-08 for ; Thu, 3 Jul 2003 18:33:38 -0300 (ADT) Received: from homer.berkhirt.com (homer.berkhirt.com [207.88.49.100]) by svr1.postgresql.org (Postfix) with ESMTP id 93738B439D4 for ; Thu, 3 Jul 2003 18:33:37 -0300 (ADT) Received: from mobygames.com (fwbhirt.independence.net [204.144.177.199]) (authenticated bits=0) by homer.berkhirt.com (8.12.9/8.12.9) with ESMTP id h63LXTAg031689 (version=TLSv1/SSLv3 cipher=DES-CBC3-SHA bits=168 verify=NO); Thu, 3 Jul 2003 16:33:30 -0500 Date: Thu, 3 Jul 2003 15:33:34 -0600 Subject: Re: Moving postgresql.conf tunables into 2003... Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: Sean Chittenden , To: "scott.marlowe" From: Brian Hirt In-Reply-To: Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) X-Archive-Number: 200307/36 X-Sequence-Number: 2329 I'm curious how many of the configuration values can be determined automatically, or with the help of some script. It seem like there could be some perl script in contrib that could help figure this out. Possibly you are asked a bunch of questions and then the values are computed based on that. Something like: How many tables will the system have? How much memory will be available to the postmaster? How many backends will there typically be? What is the avg seek time of the drive? What's the transfer rate of the drive? Seems to me that a lot of reasonable default values can be figure out from these basic questions. FSM settings, Sort Mem, Random Page Cost, Effective Cache Size, Shared Memor, etc, etc. On Thursday, July 3, 2003, at 02:14 PM, scott.marlowe wrote: > On Thu, 3 Jul 2003, Sean Chittenden wrote: > >> What are the odds of going through and revamping some of the tunables >> in postgresql.conf for the 7.4 release? I was just working with >> someone on IRC and on their 7800 RPM IDE drives, their >> random_page_cost was ideally suited to be 0.32: a far cry from 4. >> Doing so has been a win across the board and the problem query went >> from about 40sec (seq scan) down to 0.25ms (using idx, higher than >> 0.32 resulted in a query time jump to 2sec, and at 0.4 it went back up >> to a full seq scan at 40sec). > > I'm the guy who advocates settings of 1 to 2, and that still sounds > low to > me. :-) I'm wondering if the effective_cache_size was set properly, as > well as there be enough buffers allocated. > > I generally set effective cache size to 100,000 pages (800 megs or so) > on > my box, which is where it sits most days. with this setting I've found > that settings of under 1 are not usually necessary to force the > planner to > take the path of righteousness (i.e. the fastest one :-) 1.2 to 1.4 are > optimal to me. > > Since theoretically a random page of of 1 means no penalty to move the > heads around, and there's ALWAYS a penalty for moving the heads > around, we > have to assume: > > 1: That either the planner is making poor decisions on some > other variable, and we can whack the planner in the head with a really > low > random page count. > > OR > > 2: The other settings are suboptimal (buffers, sort_mem, > effective_cache_size, etc...) and lowering random page costs helps > there. > > I've always wondered if most performance issues aren't a bit of both. > > The answer, of course, is fixing the planner so that a > random_page_cost of > anything less than 1 would never be needed, since by design, anything > under 1 represents a computer that likely doesn't exist (in theory of > course.) A 1 would be a machine that was using solid state hard drives > and had the same cost in terms of OS paths to do random accesses as > sequential. > > What constants in the planner, and / or formulas would be the likely > culprits I wonder? I've wandered through that page and wasn't sure > what > to play with. > >> I know Josh is working on revamping the postgresql.conf file, but >> would it be possible to include suggested values for various bits of >> hardware and then solicit contributions from admins on this list who >> have tuned their DB correctly? >> >> ## random_page_cost -- units are one sequential page fetch cost >> #random_page_cost = 4 # default - very conservative >> #random_page_cost = 0.9 # IDE 5200 RPM, 8MB disk cache >> #random_page_cost = 0.3 # IDE 7800 RPM, 4MB disk cache >> #random_page_cost = 0.1 # SCSI RAID 5, 10,000RPM, 64MB cache >> #random_page_cost = 0.05 # SCSI RAID 1+0, 15,000RPM, 128MB >> cache >> #... >> >> ## next_hardware_dependent_tunable.... >> #hardware_dependent_tunable >> >> I know these tables could get somewhat lengthy or organized >> differently, but given the file is read _once_ at _startup_, seen by >> thousands of DBAs, is visited at least once for every installation (at >> the least to turn on TCP connections), is often the only file other >> than pg_hba.conf that gets modified or looked at, this could be a very >> nice way of introducing DBAs to tuning PostgreSQL and reducing the >> number of people crying "PostgreSQL's slow." Having postgresql.conf a >> clearing house for tunable values for various bits of hardware would >> be a huge win for the community and would hopefully radically change >> this database's perception. At the top of the file, it would be >> useful to include a blurb to the effect of: >> >> # The default values for PostgreSQL are extremely conservative and are >> # likely far from ideal for a site's needs. Included in this >> # configuration, however, are _suggested_ values to help aid in >> # tuning. The values below are not authoritative, merely contributed >> # suggestions from PostgreSQL DBAs and committers who have >> # successfully tuned their databases. Please take these values as >> # advisory only and remember that they will very likely have to be >> # adjusted according to your site's specific needs. If you have a >> # piece of hardware that isn't mentioned below and have tuned your >> # configuration aptly and have found a suggested value that the >> # PostgreSQL community would benefit from, please send a description >> # of the hardware, the name of the tunable, and the tuned value to >> # performance@PostgreSQL.org to be considered for inclusion in future >> # releases. >> # >> # It should also go without saying that the PostgreSQL Global >> # Development Group and its community of committers, contributors, >> # administrators, and commercial supporters are absolved from any >> # responsibility or liability with regards to the use of its software >> # (see this software's license for details). Any data loss, >> # corruption, or performance degradation is the responsibility of the >> # individual or group of individuals using/managing this installation. >> # >> # Hints to DBAs: >> # >> # *) Setup a regular backup schedule (hint: pg_dump(1)/pg_dumpall(1) + >> # cron(8)) >> # >> # *) Tuning: Use psql(1) to test out values before changing values for >> # the entire database. In psql(1), type: >> # >> # 1) SHOW [tunabe_name]; >> # 2) SET [tunable_name] = [value]; >> # 3) [run query] >> # 4) [repeat adjustments as necessary before setting a value here >> in >> # the postgresql.conf]. >> # 5) [Send a SIGHUP signal to the backend to have the config values >> # re-read] >> # >> # *) Never use kill -9 on the backend to shut it down. >> # >> # *) VACUUM ANALYZE your databases regularly. >> # >> # *) Use EXPLAIN ANALYZE [query] to tune queries. >> # >> # *) Read the online documentation at: >> # http://www.postgresql.org/docs/ >> # >> # -- PostgreSQL Global Development Group >> >> Just a thought. A bit lengthy, but given that out of the box most >> every value is set to be extremely conservative (detrimentally so, esp >> since the majority of users aren't running PostgreSQL in embedded >> devices, are on reasonably new hardware > 3 years old), and the config >> is only read in once and generally the only file viewed by DBAs, it'd >> make PostgreSQL more competitive in the performance dept if there were >> some kind of suggested values for various tunables. Having someone >> whine, "my PostgreSQL database is slow" is really getting old when its >> really not and it's a lack of tuning that is at fault, lowering the >> bar to a successful and speedy PostgreSQL installation would be a win >> for everyone. The person who I was helping also had the same data, >> schema, and query running on MySQL and the fastest it could go was >> 2.7s (about 40M rows in the table). >> >> -sc >> >> > > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend From pgsql-performance-owner@postgresql.org Thu Jul 3 20:24:05 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3BF8AB439EB for ; Thu, 3 Jul 2003 23:24:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 30386-07 for ; Thu, 3 Jul 2003 20:23:49 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 4A3A0B439DE for ; Thu, 3 Jul 2003 20:23:49 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id BB14920F00; Thu, 3 Jul 2003 16:23:51 -0700 (PDT) Date: Thu, 3 Jul 2003 16:23:51 -0700 From: Sean Chittenden To: "scott.marlowe" Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030703232351.GS72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/37 X-Sequence-Number: 2330 > > What are the odds of going through and revamping some of the > > tunables in postgresql.conf for the 7.4 release? I was just > > working with someone on IRC and on their 7800 RPM IDE drives, > > their random_page_cost was ideally suited to be 0.32: a far cry > > from 4. Doing so has been a win across the board and the problem > > query went from about 40sec (seq scan) down to 0.25ms (using idx, > > higher than 0.32 resulted in a query time jump to 2sec, and at 0.4 > > it went back up to a full seq scan at 40sec). > > I'm the guy who advocates settings of 1 to 2, and that still sounds > low to me. :-) I'm wondering if the effective_cache_size was set > properly, as well as there be enough buffers allocated. > > I generally set effective cache size to 100,000 pages (800 megs or > so) on my box, which is where it sits most days. with this setting > I've found that settings of under 1 are not usually necessary to > force the planner to take the path of righteousness (i.e. the > fastest one :-) 1.2 to 1.4 are optimal to me. This is a nightly report that's run, cache sizes won't impact performance of the query at all. The planner was consistently choosing a sequential scan over using the index until the random_page_cost was set to 0.32. After adjustment, the query just flies (0.25ms@0.32 vs 0.350s@0.33 vs. 40s@>0.4). Since it's a nightly report that only gets performed once a day and data is COPY'ed in once every few minutes, there's a huge amount of data that's not cached nor should it be. > Since theoretically a random page of of 1 means no penalty to move > the heads around, and there's ALWAYS a penalty for moving the heads > around, we have to assume: > > 1: That either the planner is making poor decisions on some other > variable, and we can whack the planner in the head with a really low > random page count. By all accounts of having played with this query+data, this is the correct assumption from what I can tell. > OR > > 2: The other settings are suboptimal (buffers, sort_mem, > effective_cache_size, etc...) and lowering random page costs helps > there. None of those other than possibly sort_mem had any impact on the query, but even then, lower sort_mem doesn't help until the data's been picked out of the table. Sorting ~16k of rows is quicker with more sort_mem. Higher sort_mem has zero impact on fetching ~16K rows out of a table with 40M rows of data. Getting the planner to pick using the index to filter out data inserted in the last 3 days over doing a seq scan... well, I don't know how you could do that without changing the random_page_cost. A good thump to the side of the head would be welcome too if I'm wrong, just make sure it's a good thump with the appropriate clue-bat. > I've always wondered if most performance issues aren't a bit of both. Eh, in my experience, it's generally that random_page_cost needs to be adjusted to match the hardware and this value every year with new hardware, seems to be getting lower. > The answer, of course, is fixing the planner so that a > random_page_cost of anything less than 1 would never be needed, > since by design, anything under 1 represents a computer that likely > doesn't exist (in theory of course.) A 1 would be a machine that > was using solid state hard drives and had the same cost in terms of > OS paths to do random accesses as sequential. Well, this could be a bug then, but I'm skeptical. What's odd to me is that hanging the value between 0.32, 0.33, and 0.4 all radically change the performance of the query. > What constants in the planner, and / or formulas would be the likely > culprits I wonder? I've wandered through that page and wasn't sure > what to play with. random_page_cost should be proportional to the seek time necessary for the disk to find a page of data on its platters. It makes sense that this value, as time progresses, gets smaller as hardware gets faster. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Thu Jul 3 20:25:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 695E9B439DE for ; Thu, 3 Jul 2003 23:25:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 28069-10 for ; Thu, 3 Jul 2003 20:25:32 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id B17CEB439F3 for ; Thu, 3 Jul 2003 20:25:32 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 8093320F00; Thu, 3 Jul 2003 16:25:35 -0700 (PDT) Date: Thu, 3 Jul 2003 16:25:35 -0700 From: Sean Chittenden To: Brian Hirt Cc: "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030703232535.GT72567@perrin.int.nxad.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/38 X-Sequence-Number: 2331 > I'm curious how many of the configuration values can be determined > automatically, or with the help of some script. It seem like there > could be some perl script in contrib that could help figure this out. > Possibly you are asked a bunch of questions and then the values are > computed based on that. Something like: > > How many tables will the system have? > How much memory will be available to the postmaster? > How many backends will there typically be? > What is the avg seek time of the drive? > What's the transfer rate of the drive? > > Seems to me that a lot of reasonable default values can be figure out > from these basic questions. FSM settings, Sort Mem, Random Page Cost, > Effective Cache Size, Shared Memor, etc, etc. Someone was working on a thing called pg_autotune or some such program that'd do exactly what you're thinking of. http://archives.postgresql.org/pgsql-performance/2002-10/msg00101.php http://gborg.postgresql.org/project/pgautotune/projdisplay.php -- Sean Chittenden From pgsql-performance-owner@postgresql.org Thu Jul 3 20:32:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B3058B439EF for ; Thu, 3 Jul 2003 23:32:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 48127-02 for ; Thu, 3 Jul 2003 20:32:36 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 1A480B439EC for ; Thu, 3 Jul 2003 20:32:36 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id D0F5220F00; Thu, 3 Jul 2003 16:32:38 -0700 (PDT) Date: Thu, 3 Jul 2003 16:32:38 -0700 From: Sean Chittenden To: Rod Taylor Cc: Postgresql Performance Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030703233238.GU72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <1057263840.31736.22.camel@jester> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="v9Ux+11Zm5mwPlX6" Content-Disposition: inline In-Reply-To: <1057263840.31736.22.camel@jester> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/39 X-Sequence-Number: 2332 --v9Ux+11Zm5mwPlX6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > What are the odds of going through and revamping some of the > > tunables in postgresql.conf for the 7.4 release? I was just > > working with someone on IRC and on their 7800 RPM IDE drives, > > their random_page_cost was ideally suited to be 0.32: a far cry > > from 4. >=20 > I find it very very hard to believe a random read was cheaper than a > sequential read. Something is shifty in your testing. This is the procedure used to zero in on the number: SET random_page_cost =3D 3; [run query three times] SET random_page_cost =3D 2; [run query three times] SET random_page_cost =3D 1; [run query three times] SET random_page_cost =3D 0.01; -- verify that this tunable would make -- a difference eventually [run query three times] SET random_page_cost =3D 0.5; [run query three times] SET random_page_cost =3D 0.2; -- this was the 1st query that didn't -- do a seq scan [run query three times] SET random_page_cost =3D 0.4; -- back to a seq scan [run query three times] SET random_page_cost =3D 0.3; -- idx scan, how high can I push the rpc? [run query three times] SET random_page_cost =3D 0.35; -- interesting, the query time jumped to -- about 0.2s... better than 40s, but not as -- nice as the 0.25ms when the rpc was at 0.3 [run query three times] SET random_page_cost =3D 0.32; -- Sweet, 0.25ms for the query [run query three times] SET random_page_cost =3D 0.33; -- Bah, back up to 0.2s [run query three times] SET random_page_cost =3D 0.31; -- Down to 0.25ms, too low [run query three times] SET random_page_cost =3D 0.33; -- Double check that it wasn't an errant -- performance at 0.33 [run query three times] SET random_page_cost =3D 0.32; -- Double check that 0.32 is the magic numb= er [run query three times] [edit postgresql.conf && killall -SIGHUP postmaster] -sc --=20 Sean Chittenden --v9Ux+11Zm5mwPlX6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Comment: Sean Chittenden iD8DBQE/BL0W3ZnjH7yEs0ERAijwAJ9UCE17D4AbscQJFfm0BdYcxL2zZQCeL3c9 xTXEsej5iClj3TGdwfJIy2o= =DHzM -----END PGP SIGNATURE----- --v9Ux+11Zm5mwPlX6-- From pgsql-performance-owner@postgresql.org Thu Jul 3 21:09:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B27B1B439B8 for ; Fri, 4 Jul 2003 00:06:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47220-10 for ; Thu, 3 Jul 2003 21:06:44 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id EE0D0B439AC for ; Thu, 3 Jul 2003 21:06:43 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id EFABE20F00; Thu, 3 Jul 2003 17:06:46 -0700 (PDT) Date: Thu, 3 Jul 2003 17:06:46 -0700 From: Sean Chittenden To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030704000646.GV72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <2422.1057264735@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2422.1057264735@sss.pgh.pa.us> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/40 X-Sequence-Number: 2333 > > What are the odds of going through and revamping some of the tunables > > in postgresql.conf for the 7.4 release? > > I was arguing awhile back for bumping the default shared_buffers up, > but the discussion trailed off with no real resolution. > > > I was just working with someone on IRC and on their 7800 RPM IDE > > drives, their random_page_cost was ideally suited to be 0.32: a > > far cry from 4. > > It is not physically sensible for random_page_cost to be less than > one. The system only lets you set it there for experimental > purposes; there is no way that postgresql.conf.sample will recommend > it. If you needed to push it below one to force indexscans, there > is some other problem that needs to be solved. (I'd wonder about > index correlation myself; we know that that equation is pretty > bogus.) Could be. I had him create a multi-column index on the date and a non-unique highly redundant id. This is a production machine so the load times are heavier now than they were earlier. The stats sample was increased to 1000 too to see if that made any difference in the planners estimations. mss_masterlog=> SHOW random_page_cost; random_page_cost ------------------ 4 (1 row) mss_masterlog=> EXPLAIN ANALYZE SELECT srca, COUNT(srca) FROM mss_fwevent WHERE mss_masterlog-> sensorid = 7 AND evtime > (now() - '6 hours'::INTERVAL) mss_masterlog-> AND NOT action GROUP BY srca ORDER BY COUNT DESC LIMIT 20; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (cost=240384.69..240384.74 rows=20 width=12) (actual time=24340.04..24340.39 rows=20 loops=1) -> Sort (cost=240384.69..240426.80 rows=16848 width=12) (actual time=24340.02..24340.14 rows=21 loops=1) Sort Key: count(srca) -> Aggregate (cost=237938.36..239201.95 rows=16848 width=12) (actual time=24322.84..24330.73 rows=23 loops=1) -> Group (cost=237938.36..238780.75 rows=168478 width=12) (actual time=24322.57..24328.45 rows=320 loops=1) -> Sort (cost=237938.36..238359.55 rows=168478 width=12) (actual time=24322.55..24324.34 rows=320 loops=1) Sort Key: srca -> Seq Scan on mss_fwevent (cost=0.00..223312.60 rows=168478 width=12) (actual time=24253.66..24319.87 rows=320 loops=1) Filter: ((sensorid = 7) AND (evtime > (now() - '06:00'::interval)) AND (NOT "action")) Total runtime: 24353.67 msec (10 rows) mss_masterlog=> SET enable_seqscan = false; SET mss_masterlog=> EXPLAIN ANALYZE SELECT srca, COUNT(srca) FROM mss_fwevent WHERE mss_masterlog-> sensorid = 7 AND evtime > (now() - '6 hours'::INTERVAL) mss_masterlog-> AND NOT action GROUP BY srca ORDER BY COUNT DESC LIMIT 20; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Limit (cost=2459596.79..2459596.84 rows=20 width=12) (actual time=162.92..163.25 rows=20 loops=1) -> Sort (cost=2459596.79..2459638.91 rows=16848 width=12) (actual time=162.90..163.01 rows=21 loops=1) Sort Key: count(srca) -> Aggregate (cost=2457150.46..2458414.05 rows=16848 width=12) (actual time=135.62..143.46 rows=23 loops=1) -> Group (cost=2457150.46..2457992.85 rows=168478 width=12) (actual time=135.35..141.22 rows=320 loops=1) -> Sort (cost=2457150.46..2457571.66 rows=168478 width=12) (actual time=135.33..137.14 rows=320 loops=1) Sort Key: srca -> Index Scan using mss_fwevent_evtime_sensorid_idx on mss_fwevent (cost=0.00..2442524.70 rows=168478 width=12) (actual time=68.36..132.84 rows=320 loops=1) Index Cond: ((evtime > (now() - '06:00'::interval)) AND (sensorid = 7)) Filter: (NOT "action") Total runtime: 163.60 msec (11 rows) mss_masterlog=> SET enable_seqscan = true; SET mss_masterlog=> SET random_page_cost = 0.32; SET mss_masterlog=> EXPLAIN ANALYZE SELECT srca, COUNT(srca) FROM mss_fwevent WHERE mss_masterlog-> sensorid = 7 AND evtime > (now() - '6 hours'::INTERVAL) mss_masterlog-> AND NOT action GROUP BY srca ORDER BY COUNT DESC LIMIT 20; QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=227274.85..227274.90 rows=20 width=12) (actual time=28.42..28.75 rows=20 loops=1) -> Sort (cost=227274.85..227316.97 rows=16848 width=12) (actual time=28.41..28.52 rows=21 loops=1) Sort Key: count(srca) -> Aggregate (cost=224828.52..226092.11 rows=16848 width=12) (actual time=20.26..28.13 rows=23 loops=1) -> Group (cost=224828.52..225670.91 rows=168478 width=12) (actual time=19.99..25.86 rows=320 loops=1) -> Sort (cost=224828.52..225249.72 rows=168478 width=12) (actual time=19.98..21.76 rows=320 loops=1) Sort Key: srca -> Index Scan using mss_fwevent_evtime_sensorid_idx on mss_fwevent (cost=0.00..210202.76 rows=168478 width=12) (actual time=0.35..17.61 rows=320 loops=1) Index Cond: ((evtime > (now() - '06:00'::interval)) AND (sensorid = 7)) Filter: (NOT "action") Total runtime: 29.09 msec (11 rows) And there 'ya have it. The times are different from when I had him send me the queries this morning, but they're within an order of magnitude difference between each and show the point. Oh, today they did a bunch of pruning of old data (nuked June's data)... the runtime differences are basically the same though. > > I know Josh is working on revamping the postgresql.conf file, but > > would it be possible to include suggested values for various bits of > > hardware and then solicit contributions from admins on this list who > > have tuned their DB correctly? > > I think such material belongs in the SGML docs, not hidden away in a > config file that people may not look at... The config file isn't hidden though and is very visible in the tuning process and to DBAs. I don't know if a PostgreSQL distributions ship with TCP connections enabled by default (FreeBSD doesn't), so the config is always seen and viewed by DBAs. If it's not the TCP connections setting, it's the max connections setting or sort_mem, etc... having the values dup'ed in the SGML, however, would be good too, but it's of most practical relevance in the actual config: as an admin setting up a DB, I'd rather not have to fish around on postgresql.org to find a recommended setting, having it inline and just having to uncomment it is by far and away the most DBA friendly and likely to be used in the wild by admins. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Thu Jul 3 22:57:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 02ADFB439D5 for ; Fri, 4 Jul 2003 01:57:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 86026-07 for ; Thu, 3 Jul 2003 22:57:48 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 37FFFB435E9 for ; Thu, 3 Jul 2003 22:57:48 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h641vZQQ010561; Thu, 3 Jul 2003 21:57:36 -0400 (EDT) To: Sean Chittenden Cc: "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-reply-to: <20030703232351.GS72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <20030703232351.GS72567@perrin.int.nxad.com> Comments: In-reply-to Sean Chittenden message dated "Thu, 03 Jul 2003 16:23:51 -0700" Date: Thu, 03 Jul 2003 21:57:35 -0400 Message-ID: <10560.1057283855@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/41 X-Sequence-Number: 2334 Sean Chittenden writes: > Getting the planner to pick > using the index to filter out data inserted in the last 3 days over > doing a seq scan... well, I don't know how you could do that without > changing the random_page_cost. This sounds a *whole* lot like a correlation issue. If the data in question were scattered randomly in the table, it's likely that an indexscan would be a loser. The recently-inserted data is probably clustered near the end of the table (especially if they're doing VACUUM FULL after data purges; are they?). But the planner's correlation stats are much too crude to recognize that situation, if the rest of the table is not well-ordered. If their typical process involves a periodic data purge and then a VACUUM FULL, it might be worth experimenting with doing a CLUSTER on the timestamp index instead of the VACUUM FULL. The CLUSTER would reclaim space as effectively as VACUUM FULL + REINDEX, and it would leave the table with an unmistakable 1.0 correlation ... which should tilt the planner towards an indexscan without needing a physically impossible random_page_cost to do it. I think CLUSTER would probably be a little slower than VACUUM FULL but it's hard to be sure without trying. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 3 23:39:28 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 74589B439EA for ; Fri, 4 Jul 2003 02:39:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 95891-02 for ; Thu, 3 Jul 2003 23:39:15 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 83B4AB438DD for ; Thu, 3 Jul 2003 23:39:15 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3180471; Thu, 03 Jul 2003 19:39:27 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Sean Chittenden , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Date: Thu, 3 Jul 2003 19:38:15 -0700 User-Agent: KMail/1.4.3 References: <20030703190502.GR72567@perrin.int.nxad.com> In-Reply-To: <20030703190502.GR72567@perrin.int.nxad.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307031938.15357.josh@agliodbs.com> X-Archive-Number: 200307/42 X-Sequence-Number: 2335 Sean, Tom, Rod, Michael, Brian, Ron: I'm going to paste everything into one monumental response. So be prepared= to=20 scroll. Sean Asks: > What are the odds of going through and revamping some of the tunables > in postgresql.conf for the 7.4 release?=20=20 Poor. The time to do this would have been 3 weeks ago, when I announced t= hat=20 I was re-organizing them and that Bruce was changing many names. We're pas= t=20 Feature Freeze now, and we have a *lot* of bug-checking to do with the=20 back-end changes. > I know Josh is working on revamping the postgresql.conf file, but > would it be possible to include suggested values for various bits of > hardware and then solicit contributions from admins on this list who > have tuned their DB correctly? Sure, but this is not a short-term project. I started this list, and have= =20 100% of list e-mails archived, and I can tell you that there is little=20 agreement on many of the parameters ... plus I think we'd need about 15-25= =20 e-mails about the best way to implement it, as my ideas are different from= =20 yours and Tom's are different from both of us. I'd also suggest that this is a good thing to do *after* we have created a= =20 comprehensive benchmarking package that allows us to difinitively test the= =20 argued values for various parameters. Right now, the "conventional wisdom"= =20 we have is strictly anecdotal; for example, all of the discussions on this= =20 list about the value of shared_buffers encompasses only about 14 servers an= d=20 3 operating systems. > # The default values for PostgreSQL are extremely conservative and are > # likely far from ideal for a site's needs. Included in this > # configuration, however, are _suggested_ values to help aid in This sort of narrative belongs in the SGML docs, not in a CONF file. In fa= ct,=20 one could argue that we should take *all* commentary out of the CONF file i= n=20 order to force people to read the docs. Michael Says: > I don't have much to add because I'm pretty new to Postgres and have been > soliciting advice here recently, but I totally agree with everything you > said. I don't mind if it's in the postgres.conf file or in a faq that is > easy to find, I just would like it to be in one place.=20 I spent a bunch of hours this last period re-organizing the official docs s= o=20 that they are easier to read. Check them out in the 7.4 dev docs. To=20 further enhance this, Shridhar and I will be putting together a broad=20 commentary and putting it on one of the postgresql web sites. Eventually= =20 when recommendations are tested a lot of this commentary will make its way= =20 into the official docs. Ron Says: > the database. As I'm the DBA only on a part-time basis it is really time= =20 > consuming to have to 1) find all relevant documentation and 2) learn it= =20 > sufficiently to try to tune the db properly and 3) forget about most of= =20 > it until we set up a new project in another year. I like postgresql and= =20 > have convinced two of our clients to use it, but if I could fine tune it= =20 > so it could 'fly', it would be easier for me (and others) to get more=20 > people to use it. Database performance tuning will always be a "black art," as it necessitate= s a=20 broad knowledge of PostgreSQL, OS architecture, and computer hardware. So = I=20 doubt that we can post docs that would allow any 10% time DBA to make=20 PostgreSQL "fly", but hopefully over the next year we can make enough=20 knowledge public to allow anyone to make PostgreSQL "sprint". Tom Comments: > I was arguing awhile back for bumping the default shared_buffers up, > but the discussion trailed off with no real resolution. I think we ran up against the still far-too-low SHMMAX settings in most=20 *nixes. We could raise this default once we can supply a script which wil= l=20 help the user bump up the OS's memory settings at, say, initDB time. Brian Suggests: > I'm curious how many of the configuration values can be determined=20 > automatically, or with the help of some script. It seem like there=20 > could be some perl script in contrib that could help figure this out.=20= =20 > Possibly you are asked a bunch of questions and then the values are=20 > computed based on that. Something like: This would be great! Wanna be in charge of it? Sean Replies: > Someone was working on a thing called pg_autotune or some such program > that'd do exactly what you're thinking of.=20=20 Justin. Unfortunately, pg_autotune didn't get very far, plus its design is= =20 not very friendly to collaborative programming. So it's the right idea, bu= t=20 needs to be reworked from the whiteboard, probably in Perl. Kevin Brown and I followed that up by trying to build a downloadable publi= c=20 domain database that could be used for benchmarking. However, he got an FT= =20 job and I got distracted by prep for 7.4. So, a little help? --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 4 00:14:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 90BDCB439EA for ; Fri, 4 Jul 2003 03:13:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 09547-08 for ; Fri, 4 Jul 2003 00:13:15 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id B50A5B438DD for ; Fri, 4 Jul 2003 00:13:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h643DCQQ012412; Thu, 3 Jul 2003 23:13:12 -0400 (EDT) To: josh@agliodbs.com Cc: Sean Chittenden , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-reply-to: <200307031938.15357.josh@agliodbs.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 03 Jul 2003 19:38:15 -0700" Date: Thu, 03 Jul 2003 23:13:11 -0400 Message-ID: <12411.1057288391@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/43 X-Sequence-Number: 2336 Josh Berkus writes: > Kevin Brown and I followed that up by trying to build a downloadable public > domain database that could be used for benchmarking. However, he got an FT > job and I got distracted by prep for 7.4. So, a little help? BTW, OSDL (Linus' new home ;-)) is starting to release Postgres-friendly versions of some of the open-source benchmarks they've been working on. I wouldn't put all my faith in any one benchmark, but with a few to choose from we might start to get someplace. Also, for any of you who will be at O'Reilly next week, OSDL is just up the road and I'm expecting to meet with them Tuesday afternoon/evening. Anyone else interested in going? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 00:52:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E6E22B4388C for ; Fri, 4 Jul 2003 03:52:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 15228-08 for ; Fri, 4 Jul 2003 00:52:12 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id E877DB438A1 for ; Fri, 4 Jul 2003 00:52:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h643q9QQ012706; Thu, 3 Jul 2003 23:52:09 -0400 (EDT) To: josh@agliodbs.com Cc: Sean Chittenden , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-reply-to: <200307031938.15357.josh@agliodbs.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 03 Jul 2003 19:38:15 -0700" Date: Thu, 03 Jul 2003 23:52:09 -0400 Message-ID: <12705.1057290729@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/44 X-Sequence-Number: 2337 Josh Berkus writes: > Sean Asks: >> What are the odds of going through and revamping some of the tunables >> in postgresql.conf for the 7.4 release? > Poor. The time to do this would have been 3 weeks ago, when I > announced that I was re-organizing them and that Bruce was changing > many names. We're past Feature Freeze now, and we have a *lot* of > bug-checking to do with the back-end changes. FWIW, I think what Sean is suggesting would amount purely to a documentation change, and as such would be perfectly legitimate during beta. However, I quite agree with your point that we are far from having a consensus on good numbers to put in. To get to consensus will take a lot more work on benchmarking than we've done to date. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 07:43:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9AB46B43A4B for ; Fri, 4 Jul 2003 10:43:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 36149-08 for ; Fri, 4 Jul 2003 07:43:45 -0300 (ADT) Received: from trill.maridan.net (unknown [217.6.52.210]) by svr1.postgresql.org (Postfix) with ESMTP id EE0B2B43A4C for ; Fri, 4 Jul 2003 07:43:43 -0300 (ADT) Received: from prog-01.polonium.de ([212.121.156.162]) by trill.maridan.net (8.9.3p2/8.9.3) with ESMTP id MAA07468 for ; Fri, 4 Jul 2003 12:03:51 +0200 Message-Id: <5.2.0.9.0.20030704120150.02eafda8@mail.polonium.de> X-Sender: rafcio@mail.polonium.de X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Fri, 04 Jul 2003 12:03:03 +0200 To: pgsql-performance@postgresql.org From: Rafal Kedziorski Subject: PostgreSQL vs. MySQL Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Archive-Number: 200307/45 X-Sequence-Number: 2338 Hi, has anybody tested PostgreSQL 7.3.x tables agains MySQL 4.0.12/13 with InnoDB? Regards, Rafal From pgsql-performance-owner@postgresql.org Fri Jul 4 08:12:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 983CAB439AE for ; Fri, 4 Jul 2003 11:12:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 45554-07 for ; Fri, 4 Jul 2003 08:12:27 -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 01903B43A18 for ; Fri, 4 Jul 2003 08:12:27 -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.36 #2) id 19YOUO-0004ED-0Z; Fri, 04 Jul 2003 12:12:29 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id D1CD11628C; Fri, 4 Jul 2003 12:12:27 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 358A816285; Fri, 4 Jul 2003 12:12:27 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Rafal Kedziorski , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 12:12:25 +0100 User-Agent: KMail/1.4.3 References: <5.2.0.9.0.20030704120150.02eafda8@mail.polonium.de> In-Reply-To: <5.2.0.9.0.20030704120150.02eafda8@mail.polonium.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307041212.25289.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Archive-Number: 200307/47 X-Sequence-Number: 2340 On Friday 04 Jul 2003 11:03 am, Rafal Kedziorski wrote: > Hi, > > has anybody tested PostgreSQL 7.3.x tables agains MySQL 4.0.12/13 with > InnoDB? Lots of people probably. The big problem is that unless the tester's setup= =20 matches your intended usage the results are of little worth. For the tests to be meaningful, you need the same: - hardware - OS - query complexity - usage patterns - tuning options I'd suggest running your own tests with real data where possible. Just to m= ake=20 the situation more interesting, the best way to solve a problem in PG isn't= =20 necessarily the same in MySQL. From my experience and general discussion on the lists, I'd say MySQL can w= in=20 for: - simple selects - some aggregates (e.g. count(*)) PG wins for: - complex queries - large numbers of clients - stored procedures/functions - SQL compliance --=20 Richard Huxton From pgsql-performance-owner@postgresql.org Fri Jul 4 09:28:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id F1096B438DC for ; Fri, 4 Jul 2003 12:28:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 61570-02 for ; Fri, 4 Jul 2003 09:28:30 -0300 (ADT) Received: from TheWorld.com (pcls1.std.com [199.172.62.103]) by svr1.postgresql.org (Postfix) with ESMTP id 61479B438A3 for ; Fri, 4 Jul 2003 09:28:29 -0300 (ADT) Received: from trouble (pool-151-203-213-193.bos.east.verizon.net [151.203.213.193]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h64COPLx006864; Fri, 4 Jul 2003 08:25:23 -0400 From: "Brian Tarbox" To: "Rafal Kedziorski" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 08:27:36 -0400 Message-ID: <01af01c34227$a6cff470$01000001@trouble> 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 IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Importance: Normal In-Reply-To: <5.2.0.9.0.20030704120150.02eafda8@mail.polonium.de> X-Archive-Number: 200307/48 X-Sequence-Number: 2341 I recently took a system from MySQL to Postgres. Same HW, SW, same data. The major operations where moderately complex queries (joins on 8 tables). The results we got was that Postgres was fully 3 times slower than MySql. We were on this list a fair bit looking for answers and tried all the standard answers. It was still much much much slower. Brian Tarbox -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Rafal Kedziorski Sent: Friday, July 04, 2003 6:03 AM To: pgsql-performance@postgresql.org Subject: [PERFORM] PostgreSQL vs. MySQL Hi, has anybody tested PostgreSQL 7.3.x tables agains MySQL 4.0.12/13 with InnoDB? Regards, Rafal ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org From pgsql-performance-owner@postgresql.org Fri Jul 4 09:29:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 36143B439E3 for ; Fri, 4 Jul 2003 12:29:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 57349-07 for ; Fri, 4 Jul 2003 09:28:49 -0300 (ADT) Received: from tomts22-srv.bellnexxia.net (tomts22.bellnexxia.net [209.226.175.184]) by svr1.postgresql.org (Postfix) with ESMTP id 4FADFB439C6 for ; Fri, 4 Jul 2003 09:28:44 -0300 (ADT) Received: from [192.168.1.200] ([216.209.81.133]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704122843.FUSC24487.tomts22-srv.bellnexxia.net@[192.168.1.200]>; Fri, 4 Jul 2003 08:28:43 -0400 Subject: Re: Moving postgresql.conf tunables into 2003... From: Rod Taylor To: Sean Chittenden Cc: Tom Lane , Postgresql Performance In-Reply-To: <20030704000646.GV72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <2422.1057264735@sss.pgh.pa.us> <20030704000646.GV72567@perrin.int.nxad.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-7gQdAbF3dl1jBQyJzY7J" Message-Id: <1057321743.32874.28.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 08:29:04 -0400 X-Archive-Number: 200307/49 X-Sequence-Number: 2342 --=-7gQdAbF3dl1jBQyJzY7J Content-Type: text/plain Content-Transfer-Encoding: quoted-printable That's one heck of a poor estimate for the number of rows returned. > -> Seq Scan on mss_fwevent (cost=3D0.00..223312.60 rows=3D168478 width= =3D12) (actual time=3D24253.66..24319.87 rows=3D320 loops=3D1) --=-7gQdAbF3dl1jBQyJzY7J Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BXMP6DETLow6vwwRAnpiAJ9UDs1UX+jUWI65HnFkamf5GWnMdwCeKVqm +Lt9GwH4LeL2U0f1+sckx1w= =C9FG -----END PGP SIGNATURE----- --=-7gQdAbF3dl1jBQyJzY7J-- From pgsql-performance-owner@postgresql.org Fri Jul 4 09:36:10 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 63196B43A75 for ; Fri, 4 Jul 2003 12:36:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 64750-01 for ; Fri, 4 Jul 2003 09:35:56 -0300 (ADT) Received: from mwinf0604.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.25]) by svr1.postgresql.org (Postfix) with ESMTP id 827C8B439E3 for ; Fri, 4 Jul 2003 09:35:56 -0300 (ADT) Received: from Paris (ABoulogne-110-1-4-48.w81-49.abo.wanadoo.fr [81.49.7.48]) by mwinf0604.wanadoo.fr (SMTP Server) with ESMTP id 773CD28000D5; Fri, 4 Jul 2003 14:35:59 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Brian Tarbox" , "Rafal Kedziorski" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 14:36:00 +0200 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <01af01c34227$a6cff470$01000001@trouble> Importance: Normal X-Archive-Number: 200307/50 X-Sequence-Number: 2343 > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > > The results we got was that Postgres was fully 3 times slower than MySql. > We were on this list a fair bit looking for answers and tried all the > standard answers. It was still much much much slower. I'm curious what the usage was. How many concurrent processes were performing the complex queries? I've heard that Postgres does better when the number of concurrent users is high and MySQL does better when the number is low. I have no idea if that is true or not. Michael From pgsql-performance-owner@postgresql.org Fri Jul 4 09:41:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 42ED3B438BB for ; Fri, 4 Jul 2003 12:41:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 64750-04 for ; Fri, 4 Jul 2003 09:41:10 -0300 (ADT) Received: from TheWorld.com (pcls1.std.com [199.172.62.103]) by svr1.postgresql.org (Postfix) with ESMTP id 7FF25B438AC for ; Fri, 4 Jul 2003 09:41:10 -0300 (ADT) Received: from trouble (pool-151-203-213-193.bos.east.verizon.net [151.203.213.193]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h64CfALv023870; Fri, 4 Jul 2003 08:41:11 -0400 From: "Brian Tarbox" To: , "Rafal Kedziorski" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 08:43:24 -0400 Message-ID: <01b401c34229$dbab6100$01000001@trouble> 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 IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Importance: Normal In-Reply-To: X-Archive-Number: 200307/51 X-Sequence-Number: 2344 I'm actually leaving this list but I can answer this question. Our results were with a single user and we were running Inodb. We were running on RedHat 8.0 / 9.0 with vanilla linux settings. Brian -----Original Message----- From: Michael Mattox [mailto:michael.mattox@verideon.com] Sent: Friday, July 04, 2003 8:36 AM To: Brian Tarbox; Rafal Kedziorski; pgsql-performance@postgresql.org Subject: RE: [PERFORM] PostgreSQL vs. MySQL > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > > The results we got was that Postgres was fully 3 times slower than MySql. > We were on this list a fair bit looking for answers and tried all the > standard answers. It was still much much much slower. I'm curious what the usage was. How many concurrent processes were performing the complex queries? I've heard that Postgres does better when the number of concurrent users is high and MySQL does better when the number is low. I have no idea if that is true or not. Michael From pgsql-performance-owner@postgresql.org Fri Jul 4 09:46:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 18E2AB438B5 for ; Fri, 4 Jul 2003 12:46:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 64750-07 for ; Fri, 4 Jul 2003 09:46:11 -0300 (ADT) Received: from mwinf0604.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.25]) by svr1.postgresql.org (Postfix) with ESMTP id 853B8B438A3 for ; Fri, 4 Jul 2003 09:46:11 -0300 (ADT) Received: from Paris (ABoulogne-110-1-4-48.w81-49.abo.wanadoo.fr [81.49.7.48]) by mwinf0604.wanadoo.fr (SMTP Server) with ESMTP id 8CC3128000FE; Fri, 4 Jul 2003 14:46:14 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Brian Tarbox" , "Rafal Kedziorski" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 14:46:15 +0200 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <01b401c34229$dbab6100$01000001@trouble> Importance: Normal X-Archive-Number: 200307/52 X-Sequence-Number: 2345 > I'm actually leaving this list but I can answer this question. > Our results > were with a single user and we were running Inodb. We were running on > RedHat 8.0 / 9.0 with vanilla linux settings. That's funny, you make a statement that Postgres was 3 times slower than MySQL and then you promptly leave the list! Just kidding. It'd be interesting to see what happens if you test your system with a hundred users. If it's a webapp you can use JMeter to do this really easily. Michael From pgsql-performance-owner@postgresql.org Fri Jul 4 09:54:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 00838B438AC for ; Fri, 4 Jul 2003 12:52:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 68623-05 for ; Fri, 4 Jul 2003 09:52:19 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 467D5B438A3 for ; Fri, 4 Jul 2003 09:52:17 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64CqLs00529 for ; Fri, 4 Jul 2003 18:22:21 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64CqKQ00524 for ; Fri, 4 Jul 2003 18:22:20 +0530 From: Shridhar Daithankar To: Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 18:21:26 +0530 User-Agent: KMail/1.5.2 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307041821.26455.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/53 X-Sequence-Number: 2346 On Friday 04 July 2003 18:16, Michael Mattox wrote: > > I'm actually leaving this list but I can answer this question. > > Our results > > were with a single user and we were running Inodb. We were running on > > RedHat 8.0 / 9.0 with vanilla linux settings. > > That's funny, you make a statement that Postgres was 3 times slower than > MySQL and then you promptly leave the list! Just kidding. > > It'd be interesting to see what happens if you test your system with a > hundred users. If it's a webapp you can use JMeter to do this really > easily. Hundred users is a later scenario. I am curious about "vanilla linux settings" What does that mean. Postgresql communmity would always like to help who need it but this thread so far gives me impression that OP isn't willing to provide sufficient information.. Shridhar From pgsql-performance-owner@postgresql.org Fri Jul 4 09:54:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E4E7AB438BB for ; Fri, 4 Jul 2003 12:54:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 68691-02 for ; Fri, 4 Jul 2003 09:54:32 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 3A8B3B438AC for ; Fri, 4 Jul 2003 09:54:30 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64CsXO00772 for ; Fri, 4 Jul 2003 18:24:33 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64CsXQ00767 for ; Fri, 4 Jul 2003 18:24:33 +0530 From: Shridhar Daithankar To: Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 18:23:40 +0530 User-Agent: KMail/1.5.2 References: <01af01c34227$a6cff470$01000001@trouble> In-Reply-To: <01af01c34227$a6cff470$01000001@trouble> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/54 X-Sequence-Number: 2347 On Friday 04 July 2003 17:57, Brian Tarbox wrote: > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > > The results we got was that Postgres was fully 3 times slower than MySql. > We were on this list a fair bit looking for answers and tried all the > standard answers. It was still much much much slower. This invites the slew of questions thereof. Can you provide more information on 1. Hardware 2. Postgresql version 3. Postgresql tuning you did 4. data size 5. nature of queries 6. mysql benchmarks to rate against. Unless you provide these, it's difficult to help.. Shridhar From pgsql-performance-owner@postgresql.org Fri Jul 4 10:11:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4FCBEB438DC for ; Fri, 4 Jul 2003 13:10:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 72321-07 for ; Fri, 4 Jul 2003 10:10:47 -0300 (ADT) Received: from tomts13-srv.bellnexxia.net (tomts13.bellnexxia.net [209.226.175.34]) by svr1.postgresql.org (Postfix) with ESMTP id 5AD49B438B5 for ; Fri, 4 Jul 2003 10:10:47 -0300 (ADT) Received: from [192.168.1.200] ([216.209.81.133]) by tomts13-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704131049.EPLT23042.tomts13-srv.bellnexxia.net@[192.168.1.200]>; Fri, 4 Jul 2003 09:10:49 -0400 Subject: Re: PostgreSQL vs. MySQL From: Rod Taylor To: Shridhar Daithankar Cc: Postgresql Performance In-Reply-To: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> References: <01af01c34227$a6cff470$01000001@trouble> <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-xyaWqf/PgIWs7Lq0E76M" Message-Id: <1057324269.32874.35.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 09:11:10 -0400 X-Archive-Number: 200307/55 X-Sequence-Number: 2348 --=-xyaWqf/PgIWs7Lq0E76M Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Unless you provide these, it's difficult to help.. http://archives.postgresql.org/pgsql-performance/2003-05/msg00299.php Note the thread with Tom and Brian. --=-xyaWqf/PgIWs7Lq0E76M Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BXzt6DETLow6vwwRAh79AJ0SQOu4uONctCnPi8uRMdEdkUNUiQCdE48M UVNp+NedY3FEMuux3SgQAmE= =W9e1 -----END PGP SIGNATURE----- --=-xyaWqf/PgIWs7Lq0E76M-- From pgsql-performance-owner@postgresql.org Fri Jul 4 10:21:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 8BB5AB438B8 for ; Fri, 4 Jul 2003 13:21:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 70126-09 for ; Fri, 4 Jul 2003 10:21:10 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 366D4B438BD for ; Fri, 4 Jul 2003 10:21:09 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64DLDs03897 for ; Fri, 4 Jul 2003 18:51:13 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64DLCQ03891 for ; Fri, 4 Jul 2003 18:51:13 +0530 From: "Shridhar Daithankar" To: Postgresql Performance Date: Fri, 04 Jul 2003 18:50:19 +0530 MIME-Version: 1.0 Subject: Re: PostgreSQL vs. MySQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F05CC6B.23813.161542@localhost> In-reply-to: <1057324269.32874.35.camel@jester> References: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> 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-Archive-Number: 200307/56 X-Sequence-Number: 2349 On 4 Jul 2003 at 9:11, Rod Taylor wrote: > > Unless you provide these, it's difficult to help.. > > http://archives.postgresql.org/pgsql-performance/2003-05/msg00299.php Well, even in that thread there wasn't enough information I asked for in other mail. It was bit too vague to be a comfortable DB tuning problem. Am I reading the thread wrong? Please correct me. Bye Shridhar -- Ahead warp factor one, Mr. Sulu. From pgsql-performance-owner@postgresql.org Fri Jul 4 10:26:33 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 695CDB439C0 for ; Fri, 4 Jul 2003 13:26:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 82011-01 for ; Fri, 4 Jul 2003 10:26:21 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 94C3FB438BB for ; Fri, 4 Jul 2003 10:26:10 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64DQE604588 for ; Fri, 4 Jul 2003 18:56:14 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64DQEQ04583 for ; Fri, 4 Jul 2003 18:56:14 +0530 From: "Shridhar Daithankar" To: Postgresql Performance Date: Fri, 04 Jul 2003 18:55:21 +0530 MIME-Version: 1.0 Subject: Re: can multiple vacuums gain speed? Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F05CD99.2125.1AAF2D@localhost> In-reply-to: <3F02E98E.8070001@kling.nu> 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-Archive-Number: 200307/57 X-Sequence-Number: 2350 On 2 Jul 2003 at 16:17, Mats Kling wrote: > > Hi all! > > I have a big trouble with a database and hope you can help out on how to > improve the time vacuum takes. > > The database grovs to ~60Gb and after a 'vacuum full' it's ~31Gb, after > about a week the database it up to 55-60Gb again and i have to do a > 'vacuum alalyze full' to gain disk (the disk is 70Gb so I'm living on > the edge here ;( > I have a maintenancewindow once a week but vacuuming this database takes > around 10-14 hours and I really wanna cut that time down. > Since the disk is >85% full i tried to vacuum table by table instead of > doing the whole database and my feeling was that i think I gained a > speedup if I vacuumed the tables that takes most disk first (so the rest > of the tables have more disk to work on).. > can this be true or was it just a feeling? I know this is a very late reply but it might be of some help. 1. What is nature of your updates/deletes? Do you have many deletes or few updates or other way round. 2. Have you tried using pgavd? If your load involves lot's of updates, pgavd can definitely help you. HTH Bye Shridhar -- Bumper sticker: All the parts falling off this car are of the very finest British manufacture. From pgsql-performance-owner@postgresql.org Fri Jul 4 10:45:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7060CB4316B for ; Fri, 4 Jul 2003 13:45:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 88503-05 for ; Fri, 4 Jul 2003 10:44:59 -0300 (ADT) Received: from tomts19-srv.bellnexxia.net (tomts19.bellnexxia.net [209.226.175.73]) by svr1.postgresql.org (Postfix) with ESMTP id C2F8DB43173 for ; Fri, 4 Jul 2003 10:44:56 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts19-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704134500.YYVE10532.tomts19-srv.bellnexxia.net@[10.0.2.11]>; Fri, 4 Jul 2003 09:45:00 -0400 Subject: Re: PostgreSQL vs. MySQL From: Rod Taylor To: shridhar_daithankar@persistent.co.in Cc: Postgresql Performance In-Reply-To: <3F05CC6B.23813.161542@localhost> References: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> <3F05CC6B.23813.161542@localhost> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-gNH/x6zMW9mEgU1zHYZ2" Message-Id: <1057326329.40425.1.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 09:45:30 -0400 X-Archive-Number: 200307/58 X-Sequence-Number: 2351 --=-gNH/x6zMW9mEgU1zHYZ2 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2003-07-04 at 09:20, Shridhar Daithankar wrote: > On 4 Jul 2003 at 9:11, Rod Taylor wrote: >=20 > > > Unless you provide these, it's difficult to help.. > >=20 > > http://archives.postgresql.org/pgsql-performance/2003-05/msg00299.php >=20 > Well, even in that thread there wasn't enough information I asked for in = other=20 > mail. It was bit too vague to be a comfortable DB tuning problem. Completely too little information, and it stopped with Tom asking for additional information. I don't think Brian has any interest in being helped. Many here would be more than happy to do so if the information were to flow. --=-gNH/x6zMW9mEgU1zHYZ2 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BYT56DETLow6vwwRAnCRAJ9l9HdfZkPlwGsPJVaefbXEWMHIMQCfaQRx wL/32ZHzVug8JLMxLykf79g= =CtXl -----END PGP SIGNATURE----- --=-gNH/x6zMW9mEgU1zHYZ2-- From pgsql-performance-owner@postgresql.org Fri Jul 4 10:50:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 843F4B43171 for ; Fri, 4 Jul 2003 13:50:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 88862-09 for ; Fri, 4 Jul 2003 10:50:32 -0300 (ADT) Received: from houston.familyhealth.com.au (unknown [203.59.48.253]) by svr1.postgresql.org (Postfix) with ESMTP id A195EB43168 for ; Fri, 4 Jul 2003 10:50:29 -0300 (ADT) Received: from houston.familyhealth.com.au (chriskl@localhost [127.0.0.1]) by houston.familyhealth.com.au (8.12.9/8.12.9) with ESMTP id h64DoRm3012490; Fri, 4 Jul 2003 21:50:27 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Received: from localhost (chriskl@localhost) by houston.familyhealth.com.au (8.12.9/8.12.9/Submit) with ESMTP id h64DoQAo012487; Fri, 4 Jul 2003 21:50:26 +0800 (WST) X-Authentication-Warning: houston.familyhealth.com.au: chriskl owned process doing -bs Date: Fri, 4 Jul 2003 21:50:26 +0800 (WST) From: Christopher Kings-Lynne To: Brian Tarbox Cc: Rafal Kedziorski , Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <01af01c34227$a6cff470$01000001@trouble> Message-ID: <20030704214951.L12459-100000@houston.familyhealth.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200307/59 X-Sequence-Number: 2352 > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > > The results we got was that Postgres was fully 3 times slower than MySql. > We were on this list a fair bit looking for answers and tried all the > standard answers. It was still much much much slower. I have never found a query in MySQL that was faster than one in PostgreSQL. Chris From pgsql-performance-owner@postgresql.org Fri Jul 4 10:59:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 80B7DB4316A for ; Fri, 4 Jul 2003 13:59:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 92286-08 for ; Fri, 4 Jul 2003 10:59:16 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id A5D69B43164 for ; Fri, 4 Jul 2003 10:59:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h64DxDQQ015242; Fri, 4 Jul 2003 09:59:14 -0400 (EDT) To: "Brian Tarbox" Cc: "Rafal Kedziorski" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL In-reply-to: <01af01c34227$a6cff470$01000001@trouble> References: <01af01c34227$a6cff470$01000001@trouble> Comments: In-reply-to "Brian Tarbox" message dated "Fri, 04 Jul 2003 08:27:36 -0400" Date: Fri, 04 Jul 2003 09:59:13 -0400 Message-ID: <15241.1057327153@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/60 X-Sequence-Number: 2353 "Brian Tarbox" writes: > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > The results we got was that Postgres was fully 3 times slower than MySql. > We were on this list a fair bit looking for answers and tried all the > standard answers. It was still much much much slower. Could we see the details? It's not very fair to not give us a chance to learn about problems. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 11:09:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AD165B43164 for ; Fri, 4 Jul 2003 14:09:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 92445-08 for ; Fri, 4 Jul 2003 11:09:15 -0300 (ADT) Received: from svr4.postgresql.org (svr4.postgresql.org [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 1B43CB43169 for ; Fri, 4 Jul 2003 11:09:13 -0300 (ADT) Received: from TheWorld.com (pcls2.std.com [199.172.62.104]) by svr4.postgresql.org (Postfix) with ESMTP id E933BB2851E for ; Fri, 4 Jul 2003 14:09:10 +0000 (GMT) Received: from trouble (pool-151-203-213-193.bos.east.verizon.net [151.203.213.193]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h64E5W8C032583; Fri, 4 Jul 2003 10:05:33 -0400 From: "Brian Tarbox" To: "Shridhar Daithankar" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 10:07:46 -0400 Message-ID: <01bf01c34235$a4c8aa60$01000001@trouble> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Importance: Normal In-Reply-To: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/61 X-Sequence-Number: 2354 Ok, I'll give more data :-) Under both MySql and Postgres the tests were run on a variety of systems, all with similar results. My own personal testing was done on a P4 2.4Mhz, 512 mb memory, latest production versions of each database. By vanilla RedHat I mean that I installed RH on a clean system, said install everything and did no customization of RH settings. We had about 40 tables in the db, with joined queries on about 8-12 tables. Some tables had 10,000 records, some 1000 records, other tables had dozens of records. There were indexes on all join fields, and all join fields were listed as foriegn keys. All join fields were unique primary keys in their home table (so the index distribution would be very spread out). I'm not permitted to post the actual tables as per company policy. I did no tuning of MySql. The only tuning for PG was to vacuum and vacuum analyze. I'll also mention that comments like this one are not productive: >I don't think Brian has any interest in being helped. Please understand the limits of how much information a consultant can submit to an open list like this about a client's confidential information. I've answered every question I _can_ answer and when I get hostility in response all I can do is sigh and move on. I'm sorry if Shridhar is upset that I can't validate his favorite db but ad hominin comments aren't helpful. Brian -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Shridhar Daithankar Sent: Friday, July 04, 2003 8:54 AM To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] PostgreSQL vs. MySQL On Friday 04 July 2003 17:57, Brian Tarbox wrote: > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > > The results we got was that Postgres was fully 3 times slower than MySql. > We were on this list a fair bit looking for answers and tried all the > standard answers. It was still much much much slower. This invites the slew of questions thereof. Can you provide more information on 1. Hardware 2. Postgresql version 3. Postgresql tuning you did 4. data size 5. nature of queries 6. mysql benchmarks to rate against. Unless you provide these, it's difficult to help.. Shridhar ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Fri Jul 4 11:22:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 495A2B43164 for ; Fri, 4 Jul 2003 14:22:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 99105-04 for ; Fri, 4 Jul 2003 11:22:21 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 92E75B43163 for ; Fri, 4 Jul 2003 11:22:19 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64EMO011748 for ; Fri, 4 Jul 2003 19:52:24 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64EMNQ11743; Fri, 4 Jul 2003 19:52:23 +0530 From: "Shridhar Daithankar" To: , "Brian Tarbox" Date: Fri, 04 Jul 2003 19:51:30 +0530 MIME-Version: 1.0 Subject: Re: PostgreSQL vs. MySQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F05DAC2.16867.4E1820@localhost> In-reply-to: <01bf01c34235$a4c8aa60$01000001@trouble> References: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> 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-Archive-Number: 200307/62 X-Sequence-Number: 2355 On 4 Jul 2003 at 10:07, Brian Tarbox wrote: > Ok, I'll give more data :-) > > Under both MySql and Postgres the tests were run on a variety of systems, > all with similar results. My own personal testing was done on a P4 2.4Mhz, > 512 mb memory, latest production versions of each database. By vanilla > RedHat I mean that I installed RH on a clean system, said install everything > and did no customization of RH settings. > We had about 40 tables in the db, with joined queries on about 8-12 tables. > Some tables had 10,000 records, some 1000 records, other tables had dozens > of records. There were indexes on all join fields, and all join fields were > listed as foriegn keys. All join fields were unique primary keys in their > home table (so the index distribution would be very spread out). I'm not > permitted to post the actual tables as per company policy. > > I did no tuning of MySql. The only tuning for PG was to vacuum and vacuum > analyze. No wonder pg bombed out so badly. In fact I am surprised it was slower only by factor of 3. Rule of thumb is if you have more than 1K records in any table, you got to tune postgresql.conf. I don't think I need to elaborate what difference tuning in postgresql.conf can make. > > I'll also mention that comments like this one are not productive: > > >I don't think Brian has any interest in being helped. > > Please understand the limits of how much information a consultant can submit > to an open list like this about a client's confidential information. I've > answered every question I _can_ answer and when I get hostility in response > all I can do is sigh and move on. Well, definition of threshold of hostile response differ from person to person. That is understood but by internet standards, I don't think you have received any hostile response. But that's not the topic I would like to continue to discuss. What I would suggest you is to look at some other performance problem description submitted earlier. I don't think these guys have permission to disclose sensitive data either but they did everything they could in their limits. Look at, http://archives.postgresql.org/pgsql-performance/2003-06/msg00134.php and the thread thereof. You can reach there from http://archives.postgresql.org/pgsql-performance/2003-06/threads.php There is a reason why Michael got so many and so detailed responses. Within your limits, I am sure you could have posted more and earlier rather than posting details when original thread is long gone. > I'm sorry if Shridhar is upset that I can't validate his favorite db but ad > hominin comments aren't helpful. I have no problems personally if postgresql does not work with you. The very first reason I stick with postgresql is that it works best for me. The moment it does not work for somebody else, there is a potential problem which I would like to rectify ASAP. That is the idea of getting on lists and forums. It's not about product as much it is about helping each other. And certainly. I have posted weirder qeuries here and I disagree that you couldn't post more. However this is a judgement from what you have posted and by all chances it is wrong. Never mind that. At the end, it's the problem and solution that matters. Peace.. Bye Shridhar -- Murphy's Laws: (1) If anything can go wrong, it will. (2) Nothing is as easy as it looks. (3) Everything takes longer than you think it will. From pgsql-performance-owner@postgresql.org Fri Jul 4 11:23:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D2231B43168 for ; Fri, 4 Jul 2003 14:23:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 93094-09 for ; Fri, 4 Jul 2003 11:23:28 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D4C12B43164 for ; Fri, 4 Jul 2003 11:23:27 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h64ENOQQ015395; Fri, 4 Jul 2003 10:23:24 -0400 (EDT) To: Rod Taylor Cc: shridhar_daithankar@persistent.co.in, Postgresql Performance Subject: Re: PostgreSQL vs. MySQL In-reply-to: <1057326329.40425.1.camel@jester> References: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> <3F05CC6B.23813.161542@localhost> <1057326329.40425.1.camel@jester> Comments: In-reply-to Rod Taylor message dated "04 Jul 2003 09:45:30 -0400" Date: Fri, 04 Jul 2003 10:23:24 -0400 Message-ID: <15394.1057328604@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/63 X-Sequence-Number: 2356 Rod Taylor writes: >> It was bit too vague to be a comfortable DB tuning problem. > Completely too little information, and it stopped with Tom asking for > additional information. There was something awfully fishy about that. Brian was saying that he got a seqscan plan out of "WHERE foo = 100", where foo is an integer primary key. That's just not real credible, at least not once you get past the couple of standard issues that were mentioned in the thread. And we never did get word one of information about his join problems. > I don't think Brian has any interest in being helped. I suspect he'd made up his mind already. Which is his privilege, but it'd be nice to have some clue what the problem was ... regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 11:27:47 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 28C8FB43163 for ; Fri, 4 Jul 2003 14:27:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 99105-07 for ; Fri, 4 Jul 2003 11:27:35 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 9FFCFB43164 for ; Fri, 4 Jul 2003 11:27:33 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19YRXG-00068c-00 for ; Fri, 04 Jul 2003 10:27:38 -0400 Received: by dba2 (Postfix, from userid 1019) id E93A1D75A; Fri, 4 Jul 2003 10:28:00 -0400 (EDT) Date: Fri, 4 Jul 2003 10:28:00 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030704142800.GC4592@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <200307041823.40101.shridhar_daithankar@nospam.persistent.co.in> <01bf01c34235$a4c8aa60$01000001@trouble> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01bf01c34235$a4c8aa60$01000001@trouble> User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/64 X-Sequence-Number: 2357 On Fri, Jul 04, 2003 at 10:07:46AM -0400, Brian Tarbox wrote: > 512 mb memory, latest production versions of each database. By vanilla > RedHat I mean that I installed RH on a clean system, said install everything > and did no customization of RH settings. Does that include no customization of the Postgres settings? > We had about 40 tables in the db, with joined queries on about 8-12 tables. SELECTs only? because. . . > of records. There were indexes on all join fields, and all join fields were > listed as foriegn keys. All join fields were unique primary keys in their . . .you know that FK constraints in Postgres are not cheap, right? > I did no tuning of MySql. The only tuning for PG was to vacuum and vacuum > analyze. This appears to be a "yes" answer to my question above. Out of the box, PostgreSQL is set up to be able to run on a 1992-vintage SGI Indy with 8 M of RAM (ok, I may be exaggerating, but only by a bit); it is not tuned for performance. Running without even tweaking the shared buffers is guaranteed to get you lousy performance. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Jul 4 11:33:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 872B6B43164 for ; Fri, 4 Jul 2003 14:33:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 94485-09 for ; Fri, 4 Jul 2003 11:33:47 -0300 (ADT) Received: from tomts22-srv.bellnexxia.net (tomts22.bellnexxia.net [209.226.175.184]) by svr1.postgresql.org (Postfix) with ESMTP id 857F6B43163 for ; Fri, 4 Jul 2003 11:33:46 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704143350.JSPV24487.tomts22-srv.bellnexxia.net@[10.0.2.11]>; Fri, 4 Jul 2003 10:33:50 -0400 Subject: Re: PostgreSQL vs. MySQL From: Rod Taylor To: Brian Tarbox Cc: Shridhar Daithankar , Postgresql Performance In-Reply-To: <01bf01c34235$a4c8aa60$01000001@trouble> References: <01bf01c34235$a4c8aa60$01000001@trouble> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-KA8R7YuMEd13qi/0nsXf" Message-Id: <1057329259.40425.36.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 10:34:20 -0400 X-Archive-Number: 200307/65 X-Sequence-Number: 2358 --=-KA8R7YuMEd13qi/0nsXf Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Please understand the limits of how much information a consultant can sub= mit > to an open list like this about a client's confidential information. I've > answered every question I _can_ answer and when I get hostility in respon= se > all I can do is sigh and move on. Is there any chance you could show us an EXPLAIN ANALYZE output of the poor performing query in question? > I'm sorry if Shridhar is upset that I can't validate his favorite db but = ad > hominin comments aren't helpful. It was me who gave the comment based upon previous threads which requested information that had gone unanswered (not even a response stating such information could not be provided). The database you describe is quite small, so I'm not surprised MySQL does well with it. That said, it isn't normal to experience poor performance with PostgreSQL unless you've stumbled upon a poor spot (IN based sub-queries used to be poor performing, aggregates can be slow, mismatched datatypes, etc.). Output of EXPLAIN ANALYZE of a contrived query representative of the type of work done (that demonstrates the problem) with renamed tables and columns would go a long way to helping us help you. --=-KA8R7YuMEd13qi/0nsXf Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BZBr6DETLow6vwwRAnOpAJ9xZ6rIl9tjq/veG23AN7oqatn0yACeLToJ OaYe7NtmzbK+iYWU6HoD5gc= =kttR -----END PGP SIGNATURE----- --=-KA8R7YuMEd13qi/0nsXf-- From pgsql-performance-owner@postgresql.org Fri Jul 4 11:35:10 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E0545B43163 for ; Fri, 4 Jul 2003 14:35:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 07618-01 for ; Fri, 4 Jul 2003 11:34:59 -0300 (ADT) Received: from mwinf0601.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.25]) by svr1.postgresql.org (Postfix) with ESMTP id 12160B4316A for ; Fri, 4 Jul 2003 11:34:58 -0300 (ADT) Received: from Paris (ABoulogne-110-1-4-48.w81-49.abo.wanadoo.fr [81.49.7.48]) by mwinf0601.wanadoo.fr (SMTP Server) with ESMTP id 126CD340012E; Fri, 4 Jul 2003 16:35:02 +0200 (CEST) Reply-To: From: "Michael Mattox" To: "Andrew Sullivan" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 16:35:03 +0200 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <20030704142800.GC4592@libertyrms.info> Importance: Normal X-Archive-Number: 200307/66 X-Sequence-Number: 2359 > This appears to be a "yes" answer to my question above. Out of the > box, PostgreSQL is set up to be able to run on a 1992-vintage SGI > Indy with 8 M of RAM (ok, I may be exaggerating, but only by a bit); > it is not tuned for performance. Running without even tweaking the > shared buffers is guaranteed to get you lousy performance. I see this as a major problem. How many people run postgres, decide it's too slow and give up without digging into the documentation or coming to this group? This seems to be pretty common. Even worst, they tell 10 others how slow Postgres is and then it gets a bad reputation. In my opinion the defaults should be set up for a typical database server machine. Michael From pgsql-performance-owner@postgresql.org Fri Jul 4 11:36:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 5CA97B43164 for ; Fri, 4 Jul 2003 14:36:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 00995-08 for ; Fri, 4 Jul 2003 11:35:55 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 88B14B43163 for ; Fri, 4 Jul 2003 11:35:55 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h64EZsQQ015475; Fri, 4 Jul 2003 10:35:54 -0400 (EDT) To: "Brian Tarbox" Cc: "Shridhar Daithankar" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL In-reply-to: <01bf01c34235$a4c8aa60$01000001@trouble> References: <01bf01c34235$a4c8aa60$01000001@trouble> Comments: In-reply-to "Brian Tarbox" message dated "Fri, 04 Jul 2003 10:07:46 -0400" Date: Fri, 04 Jul 2003 10:35:54 -0400 Message-ID: <15474.1057329354@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/67 X-Sequence-Number: 2360 "Brian Tarbox" writes: > I'm not permitted to post the actual tables as per company policy. Nobody wants to see your data, only the table schemas and queries. If you feel that even that contains some sensitive information, just rename the table and field names to something meaningless. But the kinds of problems I am interested in finding out about require seeing the column datatypes and the form of the queries. The hardware and platform details you gave mean nothing to me (and probably not to anyone else either, given that you were comparing to MySQL on the same platform). > I did no tuning of MySql. The only tuning for PG was to vacuum and vacuum > analyze. If you didn't at least bump up shared_buffers, you were deliberately skewing the results against Postgres. Surely you can't have been subscribed to pgsql-performance very long without knowing that the default postgresql.conf settings are set up for a toy installation. > all I can do is sigh and move on. You're still looking for reasons not to answer our questions, aren't you? Do you actually want to find out what the problem was here? If not, you're wasting our list bandwidth. I'd like to find out, if only so I can try to fix it in future releases, but without useful information I'll just have to write this off as an unsubstantiated report. regards, tom lane From pgsql-hackers-owner@postgresql.org Fri Jul 4 11:48:41 2003 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 61FACB43168 for ; Fri, 4 Jul 2003 14:48:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 07913-08 for ; Fri, 4 Jul 2003 11:48:29 -0300 (ADT) Received: from tomts12-srv.bellnexxia.net (tomts12.bellnexxia.net [209.226.175.56]) by svr1.postgresql.org (Postfix) with ESMTP id 771A7B43166 for ; Fri, 4 Jul 2003 11:48:28 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts12-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704144830.ROKS27314.tomts12-srv.bellnexxia.net@[10.0.2.11]>; Fri, 4 Jul 2003 10:48:30 -0400 Subject: Re: PostgreSQL vs. MySQL From: Rod Taylor To: michael.mattox@verideon.com Cc: Andrew Sullivan , PostgreSQL Development In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-FI49U+F5/eUXaWD/6ann" Message-Id: <1057330140.40425.57.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 10:49:01 -0400 X-Archive-Number: 200307/123 X-Sequence-Number: 40728 --=-FI49U+F5/eUXaWD/6ann Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Moving to -hackers. > In my opinion the defaults should be set up for a typical database server > machine. Ok.. thats fair. The first problem would be to define typical for current PostgreSQL installations, and typical for non-postgresql installations (the folks we want to convert). After that, do we care if it works with the typical OS installation or with all default OS installations (think shared memory settings)? I agree, this is something we should tackle somewhere along the 7.5 timeline. --=-FI49U+F5/eUXaWD/6ann Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BZPc6DETLow6vwwRAjElAJ4lM9NtlCUIqB3wvUglSrwW5WMmcwCdHiiY Y/2dVR6HhLDVOT+XzH5+qGo= =EMoU -----END PGP SIGNATURE----- --=-FI49U+F5/eUXaWD/6ann-- From pgsql-performance-owner@postgresql.org Fri Jul 4 11:50:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E5C1CB43168 for ; Fri, 4 Jul 2003 14:50:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 08981-07 for ; Fri, 4 Jul 2003 11:50:06 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id DF317B4316A for ; Fri, 4 Jul 2003 11:50:04 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64Eo9r14883 for ; Fri, 4 Jul 2003 20:20:09 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64Eo9Q14878 for ; Fri, 4 Jul 2003 20:20:09 +0530 From: "Shridhar Daithankar" To: Date: Fri, 04 Jul 2003 20:19:16 +0530 MIME-Version: 1.0 Subject: Re: PostgreSQL vs. MySQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F05E144.10448.6784AB@localhost> In-reply-to: References: <20030704142800.GC4592@libertyrms.info> 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-Archive-Number: 200307/68 X-Sequence-Number: 2361 On 4 Jul 2003 at 16:35, Michael Mattox wrote: > I see this as a major problem. How many people run postgres, decide it's > too slow and give up without digging into the documentation or coming to > this group? This seems to be pretty common. Even worst, they tell 10 > others how slow Postgres is and then it gets a bad reputation. > > In my opinion the defaults should be set up for a typical database server > machine. Well, there are few major reasons defaults are the way they are and the reason it hurts the way they are 1. Postgresql expects to start on every machine on which it can run. Now some of the arcane platforms need kernel recompilation to raise SHMMAX and defaults to 1MB. 2. Postgresql uses shared memory being process based architecture. Mysql uses process memory being threaded application. It does not need kernel settings to work and usually works best it can. 3. We expect users/admins to be reading docs. If one does not read docs, it does not matter what defaults are. Sooner or later, it is going to fall on it's face. 4. Unlike likes of Oracle, postgresql does not pre-claim resources and starts hogging the system, replacing OS whereever possible. No it does not work that way.. One thing always strikes me. Lot of people(Not you Michael!..:-)) would complain that postgresql is slow and needs tweaking are not bothered by the fact that oracle needs almost same kind of and same amount of tweaking to get somewhere. Perception matterrs a lot. I would have whined for java as well but this is not the forum for that..:-) On a positive note, me and Josh are finishing a bare bone performance article that would answer lot of your questions. I am counting on you to provide valuable feedback. I expect it out tomorrow or on sunday..Josh will confirm that.. Bye Shridhar -- Theorem: a cat has nine tails.Proof: No cat has eight tails. A cat has one tail more than no cat. Therefore, a cat has nine tails. From pgsql-performance-owner@postgresql.org Fri Jul 4 11:56:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CC659B43166 for ; Fri, 4 Jul 2003 14:56:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 13050-05 for ; Fri, 4 Jul 2003 11:55:50 -0300 (ADT) Received: from trill.maridan.net (unknown [217.6.52.210]) by svr1.postgresql.org (Postfix) with ESMTP id A65ADB4316A for ; Fri, 4 Jul 2003 11:55:49 -0300 (ADT) Received: from prog-01.polonium.de ([212.121.156.162]) by trill.maridan.net (8.9.3p2/8.9.3) with ESMTP id QAA31129 for ; Fri, 4 Jul 2003 16:55:52 +0200 Message-Id: <5.2.0.9.0.20030704165428.00c66238@mail.polonium.de> X-Sender: rafcio@mail.polonium.de X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Fri, 04 Jul 2003 16:55:04 +0200 To: From: Rafal Kedziorski Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <3F05E144.10448.6784AB@localhost> References: <20030704142800.GC4592@libertyrms.info> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Archive-Number: 200307/69 X-Sequence-Number: 2362 hi, At 20:19 04.07.2003 +0530, Shridhar Daithankar wrote: [...] >On a positive note, me and Josh are finishing a bare bone performance article where will be this article published? >that would answer lot of your questions. I am counting on you to provide >valuable feedback. I expect it out tomorrow or on sunday..Josh will confirm >that.. Rafal From pgsql-performance-owner@postgresql.org Fri Jul 4 12:05:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 75B7DB4316D for ; Fri, 4 Jul 2003 15:05:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 14327-08 for ; Fri, 4 Jul 2003 12:05:35 -0300 (ADT) Received: from tomts5-srv.bellnexxia.net (tomts5.bellnexxia.net [209.226.175.25]) by svr1.postgresql.org (Postfix) with ESMTP id A4BAAB43169 for ; Fri, 4 Jul 2003 12:05:34 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704150533.QBMJ3367.tomts5-srv.bellnexxia.net@[10.0.2.11]>; Fri, 4 Jul 2003 11:05:33 -0400 Subject: Re: PostgreSQL vs. MySQL From: Rod Taylor To: shridhar_daithankar@persistent.co.in Cc: Postgresql Performance In-Reply-To: <3F05E144.10448.6784AB@localhost> References: <20030704142800.GC4592@libertyrms.info> <3F05E144.10448.6784AB@localhost> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-r/1V0UJGfDBh4LCQPRIG" Message-Id: <1057331162.40425.79.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 11:06:03 -0400 X-Archive-Number: 200307/70 X-Sequence-Number: 2363 --=-r/1V0UJGfDBh4LCQPRIG Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > 2. Postgresql uses shared memory being process based architecture. Mysql = uses=20 > process memory being threaded application. It does not need kernel setti= ngs to=20 > work and usually works best it can. MySQL has other issues with the kernel due to their threading choice=20 such as memory limits per process, or poor threaded SMP support on some platforms (inability for a single process to use more than one CPU at a=20 time regardless of thread count). Threads aren't an easy way around kernel limitations, which is probably why Apache has gone for a combination of the two -- but of course that adds complexity. --=-r/1V0UJGfDBh4LCQPRIG Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BZfa6DETLow6vwwRAkKgAJ4/2hla5cg/wWKXn/QtcB+8LBCg9ACfQqaf llZtDf7hMXsK/JcMyiH9qOw= =chdW -----END PGP SIGNATURE----- --=-r/1V0UJGfDBh4LCQPRIG-- From pgsql-performance-owner@postgresql.org Fri Jul 4 12:19:49 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7ABEBB43171 for ; Fri, 4 Jul 2003 15:19:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 20992-07 for ; Fri, 4 Jul 2003 12:19:35 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id D4086B4316D for ; Fri, 4 Jul 2003 12:19:33 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64FJXb16939 for ; Fri, 4 Jul 2003 20:49:33 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64FJWQ16934 for ; Fri, 4 Jul 2003 20:49:33 +0530 From: Shridhar Daithankar To: Postgresql Performance Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 20:48:39 +0530 User-Agent: KMail/1.5.2 References: <20030704142800.GC4592@libertyrms.info> <3F05E144.10448.6784AB@localhost> <1057331162.40425.79.camel@jester> In-Reply-To: <1057331162.40425.79.camel@jester> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307042048.39521.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/71 X-Sequence-Number: 2364 On Friday 04 July 2003 20:36, Rod Taylor wrote: > > 2. Postgresql uses shared memory being process based architecture. Mysql > > uses process memory being threaded application. It does not need kernel > > settings to work and usually works best it can. > > MySQL has other issues with the kernel due to their threading choice > such as memory limits per process, or poor threaded SMP support on some > platforms (inability for a single process to use more than one CPU at a > time regardless of thread count). > > Threads aren't an easy way around kernel limitations, which is probably > why Apache has gone for a combination of the two -- but of course that > adds complexity. Correct. It's not debate about whether threading is better or not. But it certainly affects the default way with which these two applications work. Shridhar From pgsql-performance-owner@postgresql.org Fri Jul 4 12:26:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0DCF8B4316F for ; Fri, 4 Jul 2003 15:26:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 23846-02 for ; Fri, 4 Jul 2003 12:25:59 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id DED8DB43166 for ; Fri, 4 Jul 2003 12:25:58 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19YSRh-00070l-00 for ; Fri, 04 Jul 2003 11:25:57 -0400 Received: by dba2 (Postfix, from userid 1019) id 5030FD75A; Fri, 4 Jul 2003 11:26:20 -0400 (EDT) Date: Fri, 4 Jul 2003 11:26:20 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030704152620.GA4707@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030704142800.GC4592@libertyrms.info> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/72 X-Sequence-Number: 2365 On Fri, Jul 04, 2003 at 04:35:03PM +0200, Michael Mattox wrote: > I see this as a major problem. How many people run postgres, decide it's > too slow and give up without digging into the documentation or coming to > this group? This seems to be pretty common. Even worst, they tell 10 > others how slow Postgres is and then it gets a bad reputation. There have been various proposals to do things of this sort. But there are always problems with it. For instance, on many OSes, Postgres would not run _at all_ when you first compiled it if its defaults were set more agressively. Then how many people would complain, "It just doesn't work," and move on without asking about it? I cannot, for the life of me, understand how anyone can install some software which is supposed to provide meaningful results under production conditions, and not bother to read even the basic "quickstart"-type stuff that is kicking around. There is _no secret_ that Postgres is configured as a toy out of the box. One presumes that DBAs are hired to do _some_ little bit of work. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Jul 4 12:29:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 79451B4390F for ; Fri, 4 Jul 2003 15:29:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 23912-05 for ; Fri, 4 Jul 2003 12:29:08 -0300 (ADT) Received: from www.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 5CA10B4317D for ; Fri, 4 Jul 2003 12:29:06 -0300 (ADT) Received: (from root@localhost) by www.pspl.co.in (8.11.6/8.11.6) id h64FT6S17679 for ; Fri, 4 Jul 2003 20:59:06 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) by www.pspl.co.in (8.11.6/8.11.0) with ESMTP id h64FT5Q17674 for ; Fri, 4 Jul 2003 20:59:06 +0530 From: Shridhar Daithankar To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 20:58:12 +0530 User-Agent: KMail/1.5.2 References: <20030704142800.GC4592@libertyrms.info> <20030704152620.GA4707@libertyrms.info> In-Reply-To: <20030704152620.GA4707@libertyrms.info> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307042058.12373.shridhar_daithankar@nospam.persistent.co.in> X-Archive-Number: 200307/73 X-Sequence-Number: 2366 On Friday 04 July 2003 20:56, Andrew Sullivan wrote: > On Fri, Jul 04, 2003 at 04:35:03PM +0200, Michael Mattox wrote: > > I see this as a major problem. How many people run postgres, decide it's > > too slow and give up without digging into the documentation or coming to > > this group? This seems to be pretty common. Even worst, they tell 10 > > others how slow Postgres is and then it gets a bad reputation. > > There have been various proposals to do things of this sort. But > there are always problems with it. For instance, on many OSes, > Postgres would not run _at all_ when you first compiled it if its > defaults were set more agressively. Then how many people would > complain, "It just doesn't work," and move on without asking about > it? There was a proposal to ship various postgresql.conf.sample like one for large servers, one for medium, one for update intensive purpose etc. I was thinking over it. Actaully we could tweak initdb script to be interactiev and get inputs from users and tune it accordingly. Of course it would be nowhere near the admin reading the docs. but at least it won't fall flat on performance groundas the way falls now. Shridhar From pgsql-performance-owner@postgresql.org Fri Jul 4 12:43:10 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 2FAC2B4316E for ; Fri, 4 Jul 2003 15:43:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27599-07 for ; Fri, 4 Jul 2003 12:42:53 -0300 (ADT) Received: from relay.netcetra.com (unknown [198.65.147.132]) by svr1.postgresql.org (Postfix) with ESMTP id 0119DB43166 for ; Fri, 4 Jul 2003 12:42:53 -0300 (ADT) Received: from WORKSTATION (frsc-dsldyna-66-228-146-148.advantexcom.net [66.228.146.148]) by relay.netcetra.com (8.11.6/8.11.6) with SMTP id h64FYVO15008 for ; Fri, 4 Jul 2003 11:34:32 -0400 (EDT) Message-ID: <016b01c34242$f16504b0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" To: References: <20030704142800.GC4592@libertyrms.info> <20030704152620.GA4707@libertyrms.info> <200307042058.12373.shridhar_daithankar@nospam.persistent.co.in> Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 10:42:52 -0500 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.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/74 X-Sequence-Number: 2367 That would be something that I'd like to see. Being new to PostgreSQL some of the basics of tuning the database were a little hard to find. The reason people go with MySQL is because it's fast and easy to use. That's why I had been using it for years. Then when a problem came along and I couldn't use MySQL I checked out PostgreSQL and found that it would fill the gap, but I had been able to get by on doing very little in terms of administration for MySQL (which performed well for me) and I was expecting PostgreSQL to be similar. As with many people I have the hat of DB admin, server admin, programmer and designer and the less I have to do in any of those areas makes my life a lot easier. When I first started using PostgreSQL I installed it and entered my data without any thought of having to tune it because I never had to before. If there were some program that could be inserted to the end of the make process or something it might help dimwits like me :-) realize that there was more that needs to be done once the installation has been completed. Kevin ----- Original Message ----- From: "Shridhar Daithankar" To: Sent: Friday, July 04, 2003 10:28 AM Subject: Re: [PERFORM] PostgreSQL vs. MySQL > On Friday 04 July 2003 20:56, Andrew Sullivan wrote: > > On Fri, Jul 04, 2003 at 04:35:03PM +0200, Michael Mattox wrote: > > > I see this as a major problem. How many people run postgres, decide it's > > > too slow and give up without digging into the documentation or coming to > > > this group? This seems to be pretty common. Even worst, they tell 10 > > > others how slow Postgres is and then it gets a bad reputation. > > > > There have been various proposals to do things of this sort. But > > there are always problems with it. For instance, on many OSes, > > Postgres would not run _at all_ when you first compiled it if its > > defaults were set more agressively. Then how many people would > > complain, "It just doesn't work," and move on without asking about > > it? > > There was a proposal to ship various postgresql.conf.sample like one for large > servers, one for medium, one for update intensive purpose etc. > > I was thinking over it. Actaully we could tweak initdb script to be > interactiev and get inputs from users and tune it accordingly. Of course it > would be nowhere near the admin reading the docs. but at least it won't fall > flat on performance groundas the way falls now. > > Shridhar > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Fri Jul 4 13:08:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6E5F9B43E23 for ; Fri, 4 Jul 2003 16:08:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 37172-05 for ; Fri, 4 Jul 2003 13:08:46 -0300 (ADT) Received: from TheWorld.com (pcls2.std.com [199.172.62.104]) by svr1.postgresql.org (Postfix) with ESMTP id 52E41B43E21 for ; Fri, 4 Jul 2003 13:08:45 -0300 (ADT) Received: from trouble (pool-151-203-213-193.bos.east.verizon.net [151.203.213.193]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h64G8Vvs014191; Fri, 4 Jul 2003 12:08:32 -0400 From: "Brian Tarbox" To: "Tom Lane" , "Rod Taylor" Cc: , "Postgresql Performance" Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 12:10:46 -0400 Message-ID: <000301c34246$d3aadcc0$01000001@trouble> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 In-Reply-To: <15394.1057328604@sss.pgh.pa.us> Importance: Normal X-Archive-Number: 200307/75 X-Sequence-Number: 2368 > I don't think Brian has any interest in being helped. >I suspect he'd made up his mind already. With all due respect Tom, I don't think I'm the one demonstrating a closed mind. Rather than trying to figure out whats going on in my head, how about figuring out whats going on in my database? :-) I'm answering every question I can. I supplied HW info because someone asked, and then Tom said: "The hardware and platform details you gave mean nothing to me...". Which would you like guys?? I am not allowed to share schemas...sorry but thats what the contract says. The queries represent code, thus intellectual property, thus I can't post them. I posted an Explain output at some point and was told my database was too small to be fast. So, I added 10,000 records, vacummed, and my selects were still the same speed. How many people on this list have asked for a tuning/performance doc? I hear that there is one coming soon. Thats great. Saying RTM is fine too, if the manual is clear. Look at Michael Mattox's thread on this very topic on 6/24. Michael said: "I think the biggest area of confusion for me was that the various parameters are very briefly described and no context is given for their parameters.? Shridhar then suggested he change OSes, upgrade his kernel (with specific patches), get different HW, etc. That goes a bit beyond casual tuning. I'm not saying (and never did say) that postgres could not be fast. All I ever said was that with the same minimal effort applied to both DBs, postgres was slower. I really wasn't looking for battle this fine day....I'm going outside to BBQ! (and if you conclude from that that I'm not interested in this or that, there's nothing I can do about that. It is a beautiful day out and bbq does sound more fun than this list. sorry) Brian From pgsql-performance-owner@postgresql.org Fri Jul 4 08:08:47 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CDC9FB43A18 for ; Fri, 4 Jul 2003 11:08:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 40922-08 for ; Fri, 4 Jul 2003 08:08:33 -0300 (ADT) Received: from matrix.gatewaynet.com (unknown [217.19.69.50]) by svr1.postgresql.org (Postfix) with ESMTP id 09A40B43A72 for ; Fri, 4 Jul 2003 08:08:31 -0300 (ADT) Received: from matrix.gatewaynet.com (localhost [127.0.0.1]) by matrix.gatewaynet.com (8.12.5/8.12.5) with ESMTP id h64GE5p2011673; Fri, 4 Jul 2003 14:14:05 -0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.5/8.12.5/Submit) with ESMTP id h64GE2Ik011669; Fri, 4 Jul 2003 14:14:02 -0200 Date: Fri, 4 Jul 2003 14:14:02 -0200 (GMT+2) From: Achilleus Mantzios To: Rafal Kedziorski Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <5.2.0.9.0.20030704120150.02eafda8@mail.polonium.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200307/46 X-Sequence-Number: 2339 PostgreSQL (as being a really advanced RDBMS), generally requires some tuning in order to get the best performance. Your best bet is to try both. Also check to see IF mysql has -Referential integrity -subselects -transactions -(other usefull features like arrays,user defined types,etc..) (its probable that you will need some of the above) On Fri, 4 Jul 2003, Rafal Kedziorski wrote: > Hi, > > has anybody tested PostgreSQL 7.3.x tables agains MySQL 4.0.12/13 with InnoDB? > > > Regards, > Rafal > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- ================================================================== Achilleus Mantzios S/W Engineer IT dept Dynacom Tankers Mngmt Nikis 4, Glyfada Athens 16610 Greece tel: +30-210-8981112 fax: +30-210-8981877 email: achill at matrix dot gatewaynet dot com mantzios at softlab dot ece dot ntua dot gr From pgsql-performance-owner@postgresql.org Fri Jul 4 13:23:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0BFF1B43E26 for ; Fri, 4 Jul 2003 16:23:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 46764-02 for ; Fri, 4 Jul 2003 13:23:34 -0300 (ADT) Received: from ns1.gnw.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id E7AAFB43E25 for ; Fri, 4 Jul 2003 13:23:33 -0300 (ADT) Received: from ip97.85.1311c-cud12k-02.ish.de ([62.143.85.97] helo=mail.office.turtle-entertainment.de) by ns1.gnw.de with asmtp (Exim 3.22 #3 (Debian)) id 19YTLR-0003wc-00 for ; Fri, 04 Jul 2003 18:23:33 +0200 Received: from p5084b02c.dip.t-dialin.net ([80.132.176.44] helo=shock) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 19YTLP-00070v-00 for ; Fri, 04 Jul 2003 18:23:31 +0200 Message-ID: <026d01c34248$83f313d0$0564a8c0@shock> From: "Bjoern Metzdorf" To: "Postgresql Performance" References: <000301c34246$d3aadcc0$01000001@trouble> Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 18:22:43 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Scanner: exiscan *19YTLP-00070v-00*58mNCHupr36* http://duncanthrax.net/exiscan/ X-Archive-Number: 200307/76 X-Sequence-Number: 2369 > I'm not saying (and never did say) that postgres could not be fast. > All I ever said was that with the same minimal effort applied to both > DBs, postgres was slower. Afaik, your original posting said postgresql was 3 times slower than mysql and that you are going to leave this list now. This implied that you have made your decision between postgresql and mysql, taking mysql because it is faster. Now you say your testing setup has minimal effort applied. Well, it is not very surprising that mysql is faster in standard configurations. As Shridhar pointed out, postgresql has very conservative default values, so that it starts on nearly every machine. If I was your client and gave you the task to choose a suitable database for my application and you evaluated suitable databases this way, then something is seriously wrong with your work. Regards, Bjoern From pgsql-performance-owner@postgresql.org Fri Jul 4 13:40:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 5FED5B43E22 for ; Fri, 4 Jul 2003 16:40:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 50451-01 for ; Fri, 4 Jul 2003 13:39:51 -0300 (ADT) Received: from relay.netcetra.com (unknown [198.65.147.132]) by svr1.postgresql.org (Postfix) with ESMTP id 6E7D0B43A6B for ; Fri, 4 Jul 2003 13:39:51 -0300 (ADT) Received: from WORKSTATION (frsc-dsldyna-66-228-144-12.advantexcom.net [66.228.144.12]) by relay.netcetra.com (8.11.6/8.11.6) with SMTP id h64GVTO17143 for ; Fri, 4 Jul 2003 12:31:29 -0400 (EDT) Message-ID: <019f01c3424a$e6480ac0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" To: "Postgresql Performance" References: <000301c34246$d3aadcc0$01000001@trouble> <026d01c34248$83f313d0$0564a8c0@shock> Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 11:39:49 -0500 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.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Archive-Number: 200307/77 X-Sequence-Number: 2370 My goodness people!! If you are just going to bash people who are trying to learn PostgreSQL then you have no chance of ever getting new people using it! Cut out this crap and do what this list is meant to do, which is, I'm assuming, helping people figure out why their installations aren't running as fast as they would like. This is pathetic!! Kevin ----- Original Message ----- From: "Bjoern Metzdorf" To: "Postgresql Performance" Sent: Friday, July 04, 2003 11:22 AM Subject: Re: [PERFORM] PostgreSQL vs. MySQL > > I'm not saying (and never did say) that postgres could not be fast. > > All I ever said was that with the same minimal effort applied to both > > DBs, postgres was slower. > > Afaik, your original posting said postgresql was 3 times slower than mysql > and that you are going to leave this list now. This implied that you have > made your decision between postgresql and mysql, taking mysql because it is > faster. > > Now you say your testing setup has minimal effort applied. Well, it is not > very surprising that mysql is faster in standard configurations. As Shridhar > pointed out, postgresql has very conservative default values, so that it > starts on nearly every machine. > > If I was your client and gave you the task to choose a suitable database for > my application and you evaluated suitable databases this way, then something > is seriously wrong with your work. > > Regards, > Bjoern > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-advocacy-owner@postgresql.org Fri Jul 4 13:41:53 2003 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 11E18B43E2B for ; Fri, 4 Jul 2003 16:41:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 49074-06 for ; Fri, 4 Jul 2003 13:41:42 -0300 (ADT) Received: from hot.ee (mail.hot.ee [194.126.101.94]) by svr1.postgresql.org (Postfix) with ESMTP id 064E4B43E24 for ; Fri, 4 Jul 2003 13:41:42 -0300 (ADT) Received: from localhost (relay2 [127.0.0.1]) by hot.ee (Postfix) with ESMTP id 8BEF2109007 for ; Fri, 4 Jul 2003 19:41:41 +0300 (EEST) Received: from hot.ee ([127.0.0.1]) by localhost (relay2 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01345-05 for ; Fri, 4 Jul 2003 19:41:41 +0300 (EEST) Received: from future.ee (80-235-33-206-dsl.mus.estpak.ee [80.235.33.206]) by hot.ee (Postfix) with ESMTP id 1666D108E8B for ; Fri, 4 Jul 2003 19:41:41 +0300 (EEST) Message-ID: <3F05AF44.6080601@future.ee> Date: Fri, 04 Jul 2003 19:45:56 +0300 From: Kaarel User-Agent: Mozilla/5.0 (X11; U; Linux i686; et-EE; rv:1.3) Gecko/20030313 X-Accept-Language: et, en-gb MIME-Version: 1.0 To: pgsql-advocacy@postgresql.org Subject: About the default performance Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by mail.hot.ee X-Archive-Number: 200307/32 X-Sequence-Number: 1556 The problem is that people often benchmark the so called vanilla installation of PostgreSQL. I understand why the PostgreSQL team has decided to have an overly conservative default conf file. But no matter what the reason is or who's to blame that a tester has not tuned PostgreSQL configuration, the word is being spread that PostgreSQL is featurerich but _slow_. The ongoing discussion currently in performance list is just one example. I have seen it announce more than once: "we did not do any configuration tuning on the test systems". Take http://www.hwaci.com/sw/sqlite/speed.html as another example. "The PostgreSQL and MySQL servers used were as delivered by default on RedHat 7.2. (PostgreSQL version 7.1.3 and MySQL version 3.23.41.) No effort was made to tune these engines. Note in particular the the default MySQL configuration on RedHat 7.2 does not support transactions." I remember a discussion in the general list about having multiple default conf files to choose from. Ala low-end, average and high-end installations. A tool to read some system information and dynamically generating a proper configuration file was also mentioned. The other issue that a lot of new PostgreSQL users seem to have is the VACUUM ANALYZE. They just don't know about it. Perhaps some more active ones will read the documentation or ask for help in email lists. But a lot of them are surely leaving things and thinking of PostgreSQL as a slow system. Remember they too spread the word of their experience. I'm not an expert of PostgreSQL by any means I have just been reading PostgreSQL email lists for only about a month or so. So I believe I have read that there is a auto-vacuum being worked on? In my opinion this should be included in the main installation by default. This is just the kind of job that a machine should do...when a big portion of data has changed do VACUUM ANALYCE automagically. Is these improvements actually being implemented and how far are they? The technical side of these problems is not for this list of course. However the "side-effects" (reputation of being slow) of these problems direclty relate to advocacy and PostgreSQL popularity. Maybe these problems are already worked on or maybe I'm over exaggerating the situation but I do believe solving these issues would only benefit PostgreSQL. Just my 2 c Kaarel From pgsql-advocacy-owner@postgresql.org Fri Jul 4 14:00:22 2003 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 499F6B43E22; Fri, 4 Jul 2003 17:00:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 54415-10; Fri, 4 Jul 2003 14:00:10 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 0DDAAB43E21; Fri, 4 Jul 2003 14:00:10 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3181787; Fri, 04 Jul 2003 10:00:23 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Kaarel , pgsql-advocacy@postgresql.org Subject: Re: About the default performance Date: Fri, 4 Jul 2003 09:56:24 -0700 User-Agent: KMail/1.4.3 References: <3F05AF44.6080601@future.ee> In-Reply-To: <3F05AF44.6080601@future.ee> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307040956.24420.josh@agliodbs.com> X-Archive-Number: 200307/33 X-Sequence-Number: 1557 Kaarel: (cross-posted back to Performance because I don't want to post twice on the same topic) > The problem is that people often benchmark the so called vanilla > installation of PostgreSQL. > I remember a discussion in the general list about having multiple > default conf files to choose from. Ala low-end, average and high-end > installations. A tool to read some system information and dynamically > generating a proper configuration file was also mentioned. Yes. So far, only Justin, Kevin B., Shridhar and I have volunteered to do any work on that task -- and all of us have been swamped with 7.4-related stuff. I would like to see, before the end of the year, some if not all of the stuff that Kaarel is posting about. Obviously, my first task is to set up a framework so that everyone can contribute to the project. > I'm not an expert of PostgreSQL by any means I have just been reading > PostgreSQL email lists for only about a month or so. So I believe I have > read that there is a auto-vacuum being worked on? In my opinion this > should be included in the main installation by default. This is just the > kind of job that a machine should do...when a big portion of data has > changed do VACUUM ANALYCE automagically. > > Is these improvements actually being implemented and how far are they? The auto-vacuum daemon (pgavd) is finished. However, it will still require the user to turn it on; we don't want to run potentially RAM-sucking background processes without user invitiation. So obviously that needs to be part of a comprehensive "quick start" guide. So, Kaarel .... you want to write the "quick start" guide for 7.4? All of the detail material is available online, you mainly need to provide narrative and links of the form of ... first, read this: , then do this ... > The technical side of these problems is not for this list of course. > However the "side-effects" (reputation of being slow) of these problems > direclty relate to advocacy and PostgreSQL popularity. Maybe these > problems are already worked on or maybe I'm over exaggerating the > situation but I do believe solving these issues would only benefit > PostgreSQL. You're absolutely correct .... so let's do something about it. From my perspective, the first step is improved docs, becuase we can have those out by 7.4 release. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 4 14:06:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6715FB43E28 for ; Fri, 4 Jul 2003 17:06:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 54703-09 for ; Fri, 4 Jul 2003 14:05:57 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by svr1.postgresql.org (Postfix) with ESMTP id 8B126B43E21 for ; Fri, 4 Jul 2003 14:05:57 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1E287D6A1; Fri, 4 Jul 2003 10:05:57 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 13CCB5C0A; Fri, 4 Jul 2003 10:05:57 -0700 (PDT) Date: Fri, 4 Jul 2003 10:05:56 -0700 (PDT) From: Stephan Szabo To: Brian Tarbox Cc: Tom Lane , Rod Taylor , , Postgresql Performance Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <000301c34246$d3aadcc0$01000001@trouble> Message-ID: <20030704094307.B21273-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200307/79 X-Sequence-Number: 2372 On Fri, 4 Jul 2003, Brian Tarbox wrote: > > I don't think Brian has any interest in being helped. > >I suspect he'd made up his mind already. > > > With all due respect Tom, I don't think I'm the one demonstrating a closed > mind. > Rather than trying to figure out whats going on in my head, how about > figuring out whats going on in my database? :-) Well, in the case of getting a sequential scan on something like select * from foo where col=10; where col is a primary key, the things I can think of to check are does select * from foo where col='10'; give a different plan? In general for cases where you can't post queries or schema we're kinda stuck and not really able to give intelligent advice since it's often schema/query specific, so the general questions/comments are things like (which you've probably heard, but I think they should get put into this thread if only to move the thread towards usefulness) What is the relative costs/plan if you set enable_seqscan to false before explain analyzing the query? If there are places you think that it should be able to do an index scan and it still doesn't, make sure that there aren't cross datatype issues (especially with int constants). Also, using explain analyze, where is the time being taken, it's often not where the cost factor would expect it. Do the row estimates match reality in the explain analyze output, if not does analyzing help, if not does raising the statistics target (to say 50, 100, 1000) with alter table and then analyzing help? Does vacuuming help, what about vacuum full? If the latter does and the former doesn't, you may need to look at raising the fsm settings. If shared_buffers is less than 1000, does setting it to something between 1000-8000 raise performance? How much memory does the machine have that's being used for caching, if it's alot, try raising effective_cache_size to see if that helps the choice of plan by making a more reasonable guess as to cache hit rates. Are there any sorts in the query, if so, how large would expect the result set that's being sorted to be, can you afford to make sort_mem cover that (either permanently by changing conf files or before the query with a set command)? Is it possible to avoid some sorts in the plan with a multi-column index? For 7.3 and earlier, does the query use IN or =ANY, if so it might help to try to convert to an exists form. Does the query use any mix/max aggregates, it might help to look for a workaround, this is one case that is truly slow. PostgreSQL really does require more than minimal optimization at start, effective_cache_size, shared_buffers, sort_mem and the fsm settings really need to be set at a level for the machine/queries you have. Without the queries we can't be too specific. Big speed losses I can think of are the datatype mismatch confusion, followed quickly by row estimates that don't match reality (generally requiring a greater statistics target on the column) and issues with correlation (I'm not really sure there's a good solution for this currently, maybe someone will know -- I've not run into it really on anything I've looked at). From pgsql-performance-owner@postgresql.org Fri Jul 4 14:08:22 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 92295B43E21 for ; Fri, 4 Jul 2003 17:08:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 59356-01 for ; Fri, 4 Jul 2003 14:08:10 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id E6F45B43A6B for ; Fri, 4 Jul 2003 14:08:09 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19YU2c-0008Vy-00 for ; Fri, 04 Jul 2003 13:08:10 -0400 Received: by dba2 (Postfix, from userid 1019) id EBFF6D75A; Fri, 4 Jul 2003 13:08:32 -0400 (EDT) Date: Fri, 4 Jul 2003 13:08:32 -0400 From: Andrew Sullivan To: Postgresql Performance Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030704170832.GE4707@libertyrms.info> Mail-Followup-To: Andrew Sullivan , Postgresql Performance References: <15394.1057328604@sss.pgh.pa.us> <000301c34246$d3aadcc0$01000001@trouble> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000301c34246$d3aadcc0$01000001@trouble> User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/80 X-Sequence-Number: 2373 On Fri, Jul 04, 2003 at 12:10:46PM -0400, Brian Tarbox wrote: > I am not allowed to share schemas...sorry but thats what the contract says. > The queries represent code, thus intellectual property, thus I can't post > them. If you ask for help, but say, "I can't tell you anything," no-one will be able to help you. I think what people are reacting to angrily is that you complain that PostgreSQL is slow, it appears you haven't tuned it correctly, and you're not willing to share with anyone what you did. In that case, you shouldn't be reporting, "MySQL was faster that PostgreSQL for me." You should at most be reporting, "MySQL was faster than PostgreSQL for me, but I haven't any idea how to tune PostgreSQL, and didn't know how to learn to do so." That, at least, gives people a fighting chance to evaluate the utility of your report. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Jul 4 14:16:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 05AE9B43A6B for ; Fri, 4 Jul 2003 17:16:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 60181-02 for ; Fri, 4 Jul 2003 14:16:21 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 2E574B43E2B for ; Fri, 4 Jul 2003 14:16:21 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3181822; Fri, 04 Jul 2003 10:16:34 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Brian Tarbox" Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 10:12:36 -0700 User-Agent: KMail/1.4.3 Cc: "Postgresql Performance" References: <000301c34246$d3aadcc0$01000001@trouble> In-Reply-To: <000301c34246$d3aadcc0$01000001@trouble> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307041012.36317.josh@agliodbs.com> X-Archive-Number: 200307/81 X-Sequence-Number: 2374 Brian, Howdy! I'm Josh Berkus, I'm also on the Core Team for PostgreSQL, and I wanted to give some closure on your issue before you quit with a bad taste in your mouth. Your posting hit a sore point in the collective PostgreSQL community, so you got a strong reaction from several people on the list -- probably out of proportion to your posting. Or, to put it another way, you posted something intended to offend people out of your frustration, and got a very offended reaction back. > Rather than trying to figure out whats going on in my head, how about > figuring out whats going on in my database? :-) > I am not allowed to share schemas...sorry but thats what the contract says. > The queries represent code, thus intellectual property, thus I can't post > them. I think you recognize, now, that this list cannot help you under those circumstances? A significant portion of my income derives from clients who need tuning help under NDA. If, however, you don't need any capabilites that PostgreSQL has which MySQL doesn't, hiring a consultant would not be money well spent. > I really wasn't looking for battle this fine day....I'm going outside to > BBQ! (and if you conclude from that that I'm not interested in this or > that, there's nothing I can do about that. It is a beautiful day out and > bbq does sound more fun than this list. sorry) No arguments there ... wish I didn't have to work :-( -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 4 14:36:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6ADEDB43E23 for ; Fri, 4 Jul 2003 17:36:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 65819-07 for ; Fri, 4 Jul 2003 14:36:46 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 91992B43E21 for ; Fri, 4 Jul 2003 14:36:45 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h64HFIQQ027906; Fri, 4 Jul 2003 13:15:18 -0400 (EDT) To: josh@agliodbs.com Cc: Sean Chittenden , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-reply-to: <200307031938.15357.josh@agliodbs.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Thu, 03 Jul 2003 19:38:15 -0700" Date: Fri, 04 Jul 2003 13:15:17 -0400 Message-ID: <27905.1057338917@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/83 X-Sequence-Number: 2376 Josh Berkus writes: > Tom Comments: >> I was arguing awhile back for bumping the default shared_buffers up, >> but the discussion trailed off with no real resolution. > I think we ran up against the still far-too-low SHMMAX settings in most > *nixes. We could raise this default once we can supply a script which will > help the user bump up the OS's memory settings at, say, initDB time. Actually, I think it would not be hard to get initdb to test whether larger shared-memory settings would work. We could do something like try -B of 64, 256, 512, 1024, and insert into postgresql.conf the largest value that works. I would want it to top out at a few thousand at most, because I don't think a default installation should try to commandeer the whole machine, but if we could get the typical installation to be running with even 1000 buffers rather than 64, we'd be *way* better off. (See "Postgres vs MySQL" thread nearby.) We could possibly also have initdb print some kind of message if it's forced to use an unreasonably small value for shared_buffers, so that people might have a clue that they need to do kernel reconfiguration. Comments? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 14:21:53 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A7F7BB43E21 for ; Fri, 4 Jul 2003 17:21:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 61594-02 for ; Fri, 4 Jul 2003 14:21:42 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 081D6B43A6B for ; Fri, 4 Jul 2003 14:21:42 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19YUFi-0000GY-00 for ; Fri, 04 Jul 2003 13:21:42 -0400 Received: by dba2 (Postfix, from userid 1019) id 29D18D75A; Fri, 4 Jul 2003 13:22:05 -0400 (EDT) Date: Fri, 4 Jul 2003 13:22:05 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Strange result: UNIX vs. TCP/IP sockets Message-ID: <20030704172205.GH4707@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/82 X-Sequence-Number: 2375 Hi all, We're run into a rather odd problem here, and we're puzzling out what's going on. But while we do, I thought I'd see if anyone else has anything similar to report. This is for 7.2.4 on Solaris 8. We have a query for which EXPLAIN ANALYSE on a local psql connection always returns a time of between about 325 msec and 850 msec (depending on other load, whether the result is in cache, &c. -- this is an aggregates query involving min() and count()). If I connect using -h 127.0.0.1, however, I can _sometimes_ get the query to take as long as 1200 msec. The effect is sporadic (of course. If it were totally predictable, the computing gods wouldn't be having any fun with me), but it is certainly there off and on. (We discovered it because our application is regularly reporting times on this query roughly twice as long as I was able to get with psql, until I connected via TCP/IP.) I'll have more to report as we investigate further -- at the moment, this has cropped up on a production system, and so we're trying to reproduce it in our test environment. Naturally, we're looking at the TCP/IP stack configuration, among other stuff. In the meantime, however, I wondered if anyone knows which bits I ought to be prodding at to look for sub-optimal libraries, &c.; or whether anyone else has run into similar problems on Solaris or elsewhere. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Jul 4 14:37:14 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D13E7B43E21 for ; Fri, 4 Jul 2003 17:35:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 65819-06 for ; Fri, 4 Jul 2003 14:35:19 -0300 (ADT) Received: from mobile.hub.org (u134n133.eastlink.ca [24.224.134.133]) by svr1.postgresql.org (Postfix) with ESMTP id 78558B43A6B for ; Fri, 4 Jul 2003 14:35:18 -0300 (ADT) Received: by mobile.hub.org (Postfix, from userid 1001) id 5C637D48; Fri, 4 Jul 2003 14:35:18 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mobile.hub.org (Postfix) with ESMTP id 5720DD31; Fri, 4 Jul 2003 14:35:18 -0300 (ADT) Date: Fri, 4 Jul 2003 14:35:18 -0300 (ADT) From: The Hermit Hacker X-X-Sender: scrappy@hub.org To: Andrew Sullivan Cc: pgsql-performance@postgresql.org Subject: Re: Strange result: UNIX vs. TCP/IP sockets In-Reply-To: <20030704172205.GH4707@libertyrms.info> Message-ID: <20030704143143.U45926@hub.org> References: <20030704172205.GH4707@libertyrms.info> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200307/84 X-Sequence-Number: 2377 'K, this is based on "old information", I don't know if Sun changed it 'yet again' ... but, when I was working at the University, one of our IT directors gave me a report that deal with something Sun did (god, I'm so detailed here, eh?) to "mimic" how Microsoft broke the TCP/IP protocol ... the report was in relation to Web services, and how the change actually made Sun/Solaris appear to be slower then Microsoft ... And Sun made this the 'default' setting, but it was disablable in /etc/systems ... Sorry for being so vague, but if I recall correctly, it had something to do with adding an extra ACK to each packet ... maybe even as vague as the above is, it will jar a memory for someone else? On Fri, 4 Jul 2003, Andrew Sullivan wrote: > Hi all, > > We're run into a rather odd problem here, and we're puzzling out > what's going on. But while we do, I thought I'd see if anyone else > has anything similar to report. > > This is for 7.2.4 on Solaris 8. > > We have a query for which EXPLAIN ANALYSE on a local psql connection > always returns a time of between about 325 msec and 850 msec > (depending on other load, whether the result is in cache, &c. -- this > is an aggregates query involving min() and count()). > > If I connect using -h 127.0.0.1, however, I can _sometimes_ get the > query to take as long as 1200 msec. The effect is sporadic (of > course. If it were totally predictable, the computing gods wouldn't > be having any fun with me), but it is certainly there off and on. > (We discovered it because our application is regularly reporting > times on this query roughly twice as long as I was able to get with > psql, until I connected via TCP/IP.) > > I'll have more to report as we investigate further -- at the moment, > this has cropped up on a production system, and so we're trying to > reproduce it in our test environment. Naturally, we're looking at > the TCP/IP stack configuration, among other stuff. In the meantime, > however, I wondered if anyone knows which bits I ought to be prodding > at to look for sub-optimal libraries, &c.; or whether anyone else has > run into similar problems on Solaris or elsewhere. > > A > > -- > ---- > Andrew Sullivan 204-4141 Yonge Street > Liberty RMS Toronto, Ontario Canada > M2P 2A8 > +1 416 646 3304 x110 > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org From pgsql-performance-owner@postgresql.org Fri Jul 4 14:55:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D06BEB43E21 for ; Fri, 4 Jul 2003 17:55:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 69656-05 for ; Fri, 4 Jul 2003 14:55:14 -0300 (ADT) Received: from mail2.mediadesign.nl (md2.mediadesign.nl [212.19.205.67]) by svr1.postgresql.org (Postfix) with SMTP id 755CCB43A6B for ; Fri, 4 Jul 2003 14:55:13 -0300 (ADT) Received: (qmail 15629 invoked by uid 666); 4 Jul 2003 17:55:12 -0000 Date: Fri, 4 Jul 2003 19:55:12 +0200 From: Vincent van Leeuwen To: pgsql-performance@postgresql.org Subject: Re: Strange result: UNIX vs. TCP/IP sockets Message-ID: <20030704175512.GB24859@md2.mediadesign.nl> Mail-Followup-To: pgsql-performance@postgresql.org References: <20030704172205.GH4707@libertyrms.info> <20030704143143.U45926@hub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030704143143.U45926@hub.org> User-Agent: Mutt/1.3.28i X-Archive-Number: 200307/85 X-Sequence-Number: 2378 http://grotto11.com/blog/slash.html?+1039831658 Summary: IE and IIS cheat at TCP level by leaving out various SYN and ACK packets, thereby making IE requests from IIS servers blazingly fast, and making IE requests to non-IIS servers infuriatingly slow. But since this only relates to making and breaking TCP connections, I don't think this is relevant for a larger query time. It's probably normal for a TCP connection to be slightly slower than a unix socket, but I don't think that's wat Andrew is experiencing. On 2003-07-04 14:35:18 -0300, The Hermit Hacker wrote: > > 'K, this is based on "old information", I don't know if Sun changed it > 'yet again' ... but, when I was working at the University, one of our IT > directors gave me a report that deal with something Sun did (god, I'm so > detailed here, eh?) to "mimic" how Microsoft broke the TCP/IP protocol > ... the report was in relation to Web services, and how the change > actually made Sun/Solaris appear to be slower then Microsoft ... > > And Sun made this the 'default' setting, but it was disablable in > /etc/systems ... > > Sorry for being so vague, but if I recall correctly, it had something to > do with adding an extra ACK to each packet ... maybe even as vague as the > above is, it will jar a memory for someone else? > > > On Fri, 4 Jul 2003, Andrew Sullivan wrote: > > > Hi all, > > > > We're run into a rather odd problem here, and we're puzzling out > > what's going on. But while we do, I thought I'd see if anyone else > > has anything similar to report. > > > > This is for 7.2.4 on Solaris 8. > > > > We have a query for which EXPLAIN ANALYSE on a local psql connection > > always returns a time of between about 325 msec and 850 msec > > (depending on other load, whether the result is in cache, &c. -- this > > is an aggregates query involving min() and count()). > > > > If I connect using -h 127.0.0.1, however, I can _sometimes_ get the > > query to take as long as 1200 msec. The effect is sporadic (of > > course. If it were totally predictable, the computing gods wouldn't > > be having any fun with me), but it is certainly there off and on. > > (We discovered it because our application is regularly reporting > > times on this query roughly twice as long as I was able to get with > > psql, until I connected via TCP/IP.) > > > > I'll have more to report as we investigate further -- at the moment, > > this has cropped up on a production system, and so we're trying to > > reproduce it in our test environment. Naturally, we're looking at > > the TCP/IP stack configuration, among other stuff. In the meantime, > > however, I wondered if anyone knows which bits I ought to be prodding > > at to look for sub-optimal libraries, &c.; or whether anyone else has > > run into similar problems on Solaris or elsewhere. > > > > A > > > > -- > > ---- > > Andrew Sullivan 204-4141 Yonge Street > > Liberty RMS Toronto, Ontario Canada > > M2P 2A8 > > +1 416 646 3304 x110 > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 8: explain analyze is your friend > > > > Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy > Systems Administrator @ hub.org > primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org Vincent van Leeuwen Media Design - http://www.mediadesign.nl/ From pgsql-performance-owner@postgresql.org Fri Jul 4 15:07:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 622A9B43168 for ; Fri, 4 Jul 2003 18:07:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 70556-09 for ; Fri, 4 Jul 2003 15:07:16 -0300 (ADT) Received: from mailhost2.tudelft.nl (mailhost2.tudelft.nl [130.161.180.2]) by svr1.postgresql.org (Postfix) with ESMTP id 93236B43E23 for ; Fri, 4 Jul 2003 15:07:15 -0300 (ADT) Received: from 127.0.0.1 (localhost [127.0.0.1]) by rav.antivirus (Postfix) with SMTP id 7E730D76; Fri, 4 Jul 2003 20:07:14 +0200 (MEST) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (Postfix) with ESMTP id 6C83CD71; Fri, 4 Jul 2003 20:07:14 +0200 (MEST) Received: from acm (x193056-2.shuis-s.tudelft.nl [145.94.193.58]) by listserv.tudelft.nl (8.12.8p1/8.12.8) with ESMTP id h64I76km028290; Fri, 4 Jul 2003 20:07:15 +0200 (MEST) From: "Arjen van der Meijden" To: "'Andrew Sullivan'" , Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 20:07:18 +0200 Message-ID: <005001c34257$1f461360$3ac15e91@acm> 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.2627 In-Reply-To: <20030704152620.GA4707@libertyrms.info> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Archive-Number: 200307/87 X-Sequence-Number: 2380 > Andrew Sullivan wrote: > I cannot, for the life of me, understand how anyone can > install some software which is supposed to provide meaningful > results under production conditions, and not bother to read > even the basic "quickstart"-type stuff that is kicking > around. Then please point out where it sais, in the documentation, that the value for the shared_memory of 64 is too low and that 4000 is a nice value to start with? Please, also point out the part of the documentation that explains how high the fsm-settings should be, what the impact of a lower or higher sort_mem-setting is, what kind of value the effective_cache_size should have and the best way to determine that. If you can find the above in the default-documentation, like the "getting started"-documents or the administration documentation, than be so kind to give direct links or quotes to that. I was unable to find that, now in a 15 minute search in the docs themselves and I have read most part of them (in the past)... Especially in chapter 10 "Performance hints" I was surprised not to see such information, although it could be considered an administration task, but there it wasn't in chapter 10 (monitoring database usage) either. I'm sorry to put this in a such a confronting manner, but you simply can't expect people to search for information that they don't know the existence of... Actually, that doesn't appear to exist, at least not on the places you'd expect that information to be placed. I, myself, have read Bruce's document on performance tuning, but even that document doesn't provide the detail of information that can be read in this mailing-list. Having said that, this list only has 461 subscribers and I can hardly believe that that are _all_ users of postgresql, as long as it's not the default way of trying to gather data, it shouldn't be expected that anyone actually tries to find his information in this list. Anyway, I saw that there has been done some effort to create a document that does describe such parameters, I'd be happy to see and read that :) > There is _no secret_ that Postgres is configured as > a toy out of the box. One presumes that DBAs are hired to do > _some_ little bit of work. I don't see it on the frontpage, nor in the documentation. Anyway, see above :) Regards, Arjen Btw, I've tried to tune my postgresql database using the administration and tech documents, and saw quite a few queries run quite a lot faster on mysql, I'll try to set up a more useful test environment and supply this list with information to allow me to tune it to run more or less equal to mysql. I do see 3x runs, even with the shared memory and sort mem settings cranked up and having done little to none tuning on mysql :) From pgsql-performance-owner@postgresql.org Fri Jul 4 15:07:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7DC7AB43E27 for ; Fri, 4 Jul 2003 18:07:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 69413-10 for ; Fri, 4 Jul 2003 15:07:12 -0300 (ADT) Received: from tomts17-srv.bellnexxia.net (tomts17.bellnexxia.net [209.226.175.71]) by svr1.postgresql.org (Postfix) with ESMTP id 8C3E4B43E26 for ; Fri, 4 Jul 2003 15:07:11 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts17-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704180712.FEDH1990.tomts17-srv.bellnexxia.net@[10.0.2.11]>; Fri, 4 Jul 2003 14:07:12 -0400 Subject: Re: Strange result: UNIX vs. TCP/IP sockets From: Rod Taylor To: Andrew Sullivan Cc: Postgresql Performance In-Reply-To: <20030704172205.GH4707@libertyrms.info> References: <20030704172205.GH4707@libertyrms.info> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-WmE8C18zbeFoVicB1Nyf" Message-Id: <1057342057.40425.102.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 18:07:38 +0000 X-Archive-Number: 200307/86 X-Sequence-Number: 2379 --=-WmE8C18zbeFoVicB1Nyf Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > If I connect using -h 127.0.0.1, however, I can _sometimes_ get the > query to take as long as 1200 msec. The effect is sporadic (of SSL plays havoc with our system when using local loopback for the host=20 on both Solaris 7 and 8. It was probably key renegotiation which 7.4 has addressed. --=-WmE8C18zbeFoVicB1Nyf Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BcJp6DETLow6vwwRAlSZAJ9p88UIb5RFJaoQRBUHvoV2H6rxEACePRif Z4ZLWV5NcBIZHVW3BwVNQO8= =4lP0 -----END PGP SIGNATURE----- --=-WmE8C18zbeFoVicB1Nyf-- From pgsql-performance-owner@postgresql.org Fri Jul 4 15:15:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 1E1FFB43E23 for ; Fri, 4 Jul 2003 18:15:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 71968-10 for ; Fri, 4 Jul 2003 15:15:17 -0300 (ADT) Received: from mailhost2.tudelft.nl (mailhost2.tudelft.nl [130.161.180.2]) by svr1.postgresql.org (Postfix) with ESMTP id 96117B43E21 for ; Fri, 4 Jul 2003 15:15:17 -0300 (ADT) Received: from 127.0.0.1 (localhost [127.0.0.1]) by rav.antivirus (Postfix) with SMTP id 35024D85; Fri, 4 Jul 2003 20:15:17 +0200 (MEST) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (Postfix) with ESMTP id 2234DD80; Fri, 4 Jul 2003 20:15:17 +0200 (MEST) Received: from acm (x193056-2.shuis-s.tudelft.nl [145.94.193.58]) by listserv.tudelft.nl (8.12.8p1/8.12.8) with ESMTP id h64IF8km028354; Fri, 4 Jul 2003 20:15:17 +0200 (MEST) From: "Arjen van der Meijden" To: "'Stephan Szabo'" Cc: "'Postgresql Performance'" Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 20:15:21 +0200 Message-ID: <005201c34258$3f089c30$3ac15e91@acm> 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.2627 In-Reply-To: <20030704094307.B21273-100000@megazone23.bigpanda.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=BAYES_30, FORGED_RCVD_TRAIL, IN_REP_TO X-Spam-Level: * X-Archive-Number: 200307/88 X-Sequence-Number: 2381 Why is such a simple list of questions not somewhere in the documentation? :( Of course a few of your questions are relatively case-dependent, but the others are very general. Such information should be in the documentation and easy to access :) Regards, Arjen > Stephan Szabo wrote a nice list of helpful questions From pgsql-performance-owner@postgresql.org Fri Jul 4 15:28:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 551B2B439F5 for ; Fri, 4 Jul 2003 18:28:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 82192-02 for ; Fri, 4 Jul 2003 15:28:31 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 661F9B43A09 for ; Fri, 4 Jul 2003 15:28:30 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19YVIN-0001Cv-00 for ; Fri, 04 Jul 2003 14:28:31 -0400 Received: by dba2 (Postfix, from userid 1019) id F15E5D75A; Fri, 4 Jul 2003 14:28:53 -0400 (EDT) Date: Fri, 4 Jul 2003 14:28:53 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030704182853.GK4707@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030704152620.GA4707@libertyrms.info> <005001c34257$1f461360$3ac15e91@acm> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <005001c34257$1f461360$3ac15e91@acm> User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/89 X-Sequence-Number: 2382 On Fri, Jul 04, 2003 at 08:07:18PM +0200, Arjen van der Meijden wrote: > > Andrew Sullivan wrote: > > results under production conditions, and not bother to read > > even the basic "quickstart"-type stuff that is kicking > > around. > Then please point out where it sais, in the documentation, that the > value for the shared_memory of 64 is too low and that 4000 is a nice > value to start with? I think I did indeed speak too soon, as the criticism is a fair one: nowhere in the installation instructions or the "getting started" docs does it say that you really ought to do some tuning once you have the system installed. Can I suggest for the time being that something along these lines should go in 14.6.3, "Tuning the installation": ---snip--- By default, PostgreSQL is configured to run on minimal hardware. As a result, some tuning of your installation will be necessary before using it for anything other than extremely small databases. At the very least, it will probably be necessary to increase your shared buffers setting. See Chapter 16 for details on what tuning options are available to you. ---snip--- > I'm sorry to put this in a such a confronting manner, but you simply > can't expect people to search for information that they don't know the > existence of. No need to apologise; I think you're right. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Jul 4 15:40:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4333CB43A08 for ; Fri, 4 Jul 2003 18:40:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 83018-05 for ; Fri, 4 Jul 2003 15:40:03 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 75BA9B43A14 for ; Fri, 4 Jul 2003 15:39:52 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3181957; Fri, 04 Jul 2003 11:39:12 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 11:37:58 -0700 User-Agent: KMail/1.4.3 References: <20030704152620.GA4707@libertyrms.info> <005001c34257$1f461360$3ac15e91@acm> <20030704182853.GK4707@libertyrms.info> In-Reply-To: <20030704182853.GK4707@libertyrms.info> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307041137.59148.josh@agliodbs.com> X-Archive-Number: 200307/90 X-Sequence-Number: 2383 People: > I think I did indeed speak too soon, as the criticism is a fair one: > nowhere in the installation instructions or the "getting started" > docs does it say that you really ought to do some tuning once you > have the system installed. Can I suggest for the time being that > something along these lines should go in 14.6.3, "Tuning the > installation": >=20 > ---snip--- > By default, PostgreSQL is configured to run on minimal hardware. As > a result, some tuning of your installation will be necessary before > using it for anything other than extremely small databases. At the > very least, it will probably be necessary to increase your shared > buffers setting. See Chapter 16 for details on what tuning options > are available to you. > ---snip--- I think we actually need much more than this. Kaarel on the Advocacy list = has=20 volunteered to try to extend our "getting started" section to encompass som= e=20 basic tuning stuff. Of course, more people would be better. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 4 16:19:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A86D7B438AE for ; Fri, 4 Jul 2003 19:19:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 90337-06 for ; Fri, 4 Jul 2003 16:18:50 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D4417B438AC for ; Fri, 4 Jul 2003 16:18:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h64JIiQQ004396; Fri, 4 Jul 2003 15:18:44 -0400 (EDT) To: josh@agliodbs.com Cc: Andrew Sullivan , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. MySQL In-reply-to: <200307041137.59148.josh@agliodbs.com> References: <20030704152620.GA4707@libertyrms.info> <005001c34257$1f461360$3ac15e91@acm> <20030704182853.GK4707@libertyrms.info> <200307041137.59148.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Fri, 04 Jul 2003 11:37:58 -0700" Date: Fri, 04 Jul 2003 15:18:43 -0400 Message-ID: <4395.1057346323@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/91 X-Sequence-Number: 2384 Josh Berkus writes: >> ---snip--- >> By default, PostgreSQL is configured to run on minimal hardware. As >> a result, some tuning of your installation will be necessary before >> using it for anything other than extremely small databases. At the >> very least, it will probably be necessary to increase your shared >> buffers setting. See Chapter 16 for details on what tuning options >> are available to you. >> ---snip--- > I think we actually need much more than this. I am about to propose a patch that will cause the default shared_buffers to be more realistic, say 1000, on machines where the kernel will allow it. Not sure if people will let me get away with applying it post-feature-freeze, but if so that would change the terms of this debate noticeably. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 16:22:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 65BA2B43A22 for ; Fri, 4 Jul 2003 19:22:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 91777-02 for ; Fri, 4 Jul 2003 16:22:14 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 82A4EB438AE for ; Fri, 4 Jul 2003 16:22:13 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3182535; Fri, 04 Jul 2003 12:22:13 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Tom Lane Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 12:20:59 -0700 User-Agent: KMail/1.4.3 Cc: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030704152620.GA4707@libertyrms.info> <200307041137.59148.josh@agliodbs.com> <4395.1057346323@sss.pgh.pa.us> In-Reply-To: <4395.1057346323@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307041220.59185.josh@agliodbs.com> X-Archive-Number: 200307/92 X-Sequence-Number: 2385 Tom, > I am about to propose a patch that will cause the default shared_buffers > to be more realistic, say 1000, on machines where the kernel will allow > it. Not sure if people will let me get away with applying it > post-feature-freeze, but if so that would change the terms of this > debate noticeably. +1 --=20 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 4 16:29:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 46137B438A3 for ; Fri, 4 Jul 2003 19:29:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 90337-10 for ; Fri, 4 Jul 2003 16:29:12 -0300 (ADT) Received: from tomts14-srv.bellnexxia.net (tomts14.bellnexxia.net [209.226.175.35]) by svr1.postgresql.org (Postfix) with ESMTP id 51E27B4388D for ; Fri, 4 Jul 2003 16:29:12 -0300 (ADT) Received: from [10.0.2.11] ([216.208.117.7]) by tomts14-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030704192913.JVOG23441.tomts14-srv.bellnexxia.net@[10.0.2.11]>; Fri, 4 Jul 2003 15:29:13 -0400 Subject: Re: PostgreSQL vs. MySQL From: Rod Taylor To: Tom Lane Cc: Josh Berkus , Andrew Sullivan , Postgresql Performance In-Reply-To: <4395.1057346323@sss.pgh.pa.us> References: <20030704152620.GA4707@libertyrms.info> <005001c34257$1f461360$3ac15e91@acm> <20030704182853.GK4707@libertyrms.info> <200307041137.59148.josh@agliodbs.com> <4395.1057346323@sss.pgh.pa.us> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-LWZMl8182kqb7NbA2ILO" Message-Id: <1057346977.40425.108.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 04 Jul 2003 19:29:38 +0000 X-Archive-Number: 200307/93 X-Sequence-Number: 2386 --=-LWZMl8182kqb7NbA2ILO Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > I am about to propose a patch that will cause the default shared_buffers > to be more realistic, say 1000, on machines where the kernel will allow > it. Not sure if people will let me get away with applying it > post-feature-freeze, but if so that would change the terms of this > debate noticeably. It's not a feature change, it's a bug fix -- bug being an oversight. --=-LWZMl8182kqb7NbA2ILO Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/BdWh6DETLow6vwwRAs8VAJ9OM1cYbicqTSH2JUZ0rRa+RnJAdACcD+WP fMXhSSW1uDaQaq+7iXMJh/I= =pPnv -----END PGP SIGNATURE----- --=-LWZMl8182kqb7NbA2ILO-- From pgsql-hackers-owner@postgresql.org Fri Jul 4 17:31:51 2003 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id EF8EEB438AC for ; Fri, 4 Jul 2003 20:31:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 09173-08 for ; Fri, 4 Jul 2003 17:31:30 -0300 (ADT) Received: from phaedrusdeinus.org (dsl092-130-239.chi1.dsl.speakeasy.net [66.92.130.239]) by svr1.postgresql.org (Postfix) with SMTP id 730C4B43175 for ; Fri, 4 Jul 2003 17:31:29 -0300 (ADT) Received: (qmail 4015 invoked by uid 1001); 4 Jul 2003 20:39:57 -0000 Date: Fri, 4 Jul 2003 15:39:57 -0500 From: johnnnnnn To: Rod Taylor , pgsql-hackers@postgresql.org Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030704203957.GA51795@performics.com> References: <1057330140.40425.57.camel@jester> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1057330140.40425.57.camel@jester> User-Agent: Mutt/1.5.1i X-Archive-Number: 200307/138 X-Sequence-Number: 40743 On Fri, Jul 04, 2003 at 10:49:01AM -0400, Rod Taylor wrote: > > In my opinion the defaults should be set up for a typical database > > server machine. > > Ok.. thats fair. The first problem would be to define typical for > current PostgreSQL installations, and typical for non-postgresql > installations (the folks we want to convert). It's been a while since the last one of these discussions, so stop me if this has been suggested before, but... Do we actually want to have a default configuration file? Seriously, if we provide, say, 4 or 5 files based on various system assumptions (conf.MINIMAL, conf.AVERAGE, conf.MULTIDISK, or whatever), then we might be able to get away with not providing an actual default. Change the installation instructions to say >>> PostgreSQL requires a configuration file, which it expects to be located in $DIR. Provided are several example configurations (in $DIR/eg/). If you're just starting with PostrgreSQL, we recommend reading through those and selecting one which most closely matches your machine. If you're in doubt as to which file to use, try $AVERAGE. If you're still having difficulty getting PostgreSQL to run, try $MINIMAL. $MINIMAL should work on every supported platform, but is not optimized for modern hardware -- PostgreSQL will not run well in this configuration. <<< This makes the installation process slightly less simple, but only in the way that we want it to be. That is, it forces the end user to the realization that there actually is configuration to be done, and forces them into a minimally interactive way to deal with it. It also doesn't require any kernel-test coding, or really any development at all, so we should theoretically be able to get it finished and ready to go more quickly. Thoughts? -johnnnnnnnnnnn From pgsql-performance-owner@postgresql.org Fri Jul 4 18:11:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9C446B43175 for ; Fri, 4 Jul 2003 21:11:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 16379-06 for ; Fri, 4 Jul 2003 18:11:47 -0300 (ADT) Received: from TheWorld.com (pcls2.std.com [199.172.62.104]) by svr1.postgresql.org (Postfix) with ESMTP id B24D6B43A1C for ; Fri, 4 Jul 2003 18:11:46 -0300 (ADT) Received: from trouble (pool-151-203-213-193.bos.east.verizon.net [151.203.213.193]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h64LBjvs015359; Fri, 4 Jul 2003 17:11:46 -0400 From: "Brian Tarbox" To: "Bjoern Metzdorf" , "Postgresql Performance" Subject: Re: PostgreSQL vs. MySQL Date: Fri, 4 Jul 2003 17:14:01 -0400 Message-ID: <002301c34271$30afc870$01000001@trouble> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 In-Reply-To: <026d01c34248$83f313d0$0564a8c0@shock> Importance: Normal X-Archive-Number: 200307/94 X-Sequence-Number: 2387 >Afaik, your original posting said postgresql was 3 times slower than mysql >and that you are going to leave this list now. This implied that you have >made your decision between postgresql and mysql, taking mysql because it is >faster. Well, that shows what you get for making implications. The client is sticking with postgres and we are coding around the issue in other ways. >If I was your client and gave you the task to choose a suitable database for >my application and you evaluated suitable databases this way, then something >is seriously wrong with your work. > >Regards, >Bjoern Glad to see you're not getting personal with this. Ad hominin attacks are for folks with no better answers. Please go read the posts by Kevin Schroeder and Arjen va der Meijden before slinging any more 'help'. over and out. From pgsql-performance-owner@postgresql.org Fri Jul 4 18:20:40 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 01178B438DC for ; Fri, 4 Jul 2003 21:20:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 19991-07 for ; Fri, 4 Jul 2003 18:20:29 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 0F642B43175 for ; Fri, 4 Jul 2003 18:20:29 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19YXyp-0003U2-00 for ; Fri, 04 Jul 2003 17:20:31 -0400 Received: by dba2 (Postfix, from userid 1019) id E906FD75A; Fri, 4 Jul 2003 17:20:53 -0400 (EDT) Date: Fri, 4 Jul 2003 17:20:53 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Strange result: UNIX vs. TCP/IP sockets Message-ID: <20030704212053.GD5679@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030704172205.GH4707@libertyrms.info> <20030704143143.U45926@hub.org> <20030704175512.GB24859@md2.mediadesign.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030704175512.GB24859@md2.mediadesign.nl> User-Agent: Mutt/1.5.4i X-Archive-Number: 200307/95 X-Sequence-Number: 2388 On Fri, Jul 04, 2003 at 07:55:12PM +0200, Vincent van Leeuwen wrote: > But since this only relates to making and breaking TCP connections, > I don't think this is relevant for a larger query time. It's > probably normal for a TCP connection to be slightly slower than a > unix socket, but I don't think that's wat Andrew is experiencing. No, it's not. And my colleague Sorin Iszlai pointed out to me something else about it: we're getting different numbers reported by EXPLAIN ANALYSE itself. How is that even possible? If we try it here on a moderately-loaded Sun box, it seems we're able to reproduce it, as well. How could it be the transport affects the time for the query as reported by the back end? A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-hackers-owner@postgresql.org Sat Jul 5 22:10:04 2003 X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C7905B43164 for ; Fri, 4 Jul 2003 21:28:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 24268-06 for ; Fri, 4 Jul 2003 18:28:31 -0300 (ADT) Received: from external.timconrad.org (dsl081-195-122.nyc2.dsl.speakeasy.net [64.81.195.122]) by svr1.postgresql.org (Postfix) with ESMTP id C8E80B43175 for ; Fri, 4 Jul 2003 18:28:30 -0300 (ADT) Received: from external.timconrad.org (localhost [127.0.0.1]) by external.timconrad.org (Postfix) with ESMTP id 94F98ADC6 for ; Fri, 4 Jul 2003 17:28:32 -0400 (EDT) Received: (from conrad@localhost) by external.timconrad.org (8.12.6/8.12.6/Submit) id h64LSWgq095733 for pgsql-hackers@postgresql.org; Fri, 4 Jul 2003 17:28:32 -0400 (EDT) Date: Fri, 4 Jul 2003 17:28:32 -0400 From: Tim Conrad To: pgsql-hackers@postgresql.org Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030704212832.GA95706@external.timconrad.org> References: <1057330140.40425.57.camel@jester> <20030704203957.GA51795@performics.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030704203957.GA51795@performics.com> User-Agent: Mutt/1.4i X-Archive-Number: 200307/154 X-Sequence-Number: 40759 Being new to Postgres, I understand how frustrating tuning is. I've been working on some very basic queries, and trying to get some decent performance. I know the problem isn't with io on the system, since I can use other tests that far exceed the amount of data being written through postgres, so I can only assume that the rdbms needs to be tuned. even beyond doing different configuration files (as mysql does, fyi), just having 'guidelines' for where to start with tuning the various items in postresql.conf would be helpful. Something like foo_val = 100 # 0-1024; higher numbers for more complex queries I don't think that'd be too difficult. Anyone who's worked with a database of any type, understands that tuning needs to happen. Having the three different sizes of servers (as suggested below) would be helpful. MySQL does this, and i've used their default configurations in the past to help me troubleshoot probllems i was having with a complex query on sub-standard hardware. After changing some of the values around, the query ran slowly, but it actually ran, whereas before, it didn't. Slightly off subject, as I've been advocating use of Postgres, and people have been trying it, some of the quirks that one runs into when goinng from rdbms to rdbms are frustrating as well. Granted, these things happen with going from any rdbms to another, but it'd be nice if there were a guide to say something like, in MySQL, you use 'show tables from tablename', and in Postgres, you use \d tablename to achieve the same results. Just my $.02 worth. Tim On Fri, Jul 04, 2003 at 03:39:57PM -0500, johnnnnnn wrote: > On Fri, Jul 04, 2003 at 10:49:01AM -0400, Rod Taylor wrote: > > > In my opinion the defaults should be set up for a typical database > > > server machine. > > > > Ok.. thats fair. The first problem would be to define typical for > > current PostgreSQL installations, and typical for non-postgresql > > installations (the folks we want to convert). > > It's been a while since the last one of these discussions, so stop me > if this has been suggested before, but... > > Do we actually want to have a default configuration file? > > Seriously, if we provide, say, 4 or 5 files based on various system > assumptions (conf.MINIMAL, conf.AVERAGE, conf.MULTIDISK, or whatever), > then we might be able to get away with not providing an actual > default. Change the installation instructions to say > > >>> > PostgreSQL requires a configuration file, which it expects to be > located in $DIR. Provided are several example configurations (in > $DIR/eg/). If you're just starting with PostrgreSQL, we recommend > reading through those and selecting one which most closely matches > your machine. > > If you're in doubt as to which file to use, try $AVERAGE. If you're > still having difficulty getting PostgreSQL to run, try > $MINIMAL. $MINIMAL should work on every supported platform, but is not > optimized for modern hardware -- PostgreSQL will not run well in this > configuration. > <<< > > This makes the installation process slightly less simple, but only in > the way that we want it to be. That is, it forces the end user to the > realization that there actually is configuration to be done, and > forces them into a minimally interactive way to deal with it. > > It also doesn't require any kernel-test coding, or really any > development at all, so we should theoretically be able to get it > finished and ready to go more quickly. > > Thoughts? > > -johnnnnnnnnnnn > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Fri Jul 4 18:47:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7422EB439CA for ; Fri, 4 Jul 2003 21:47:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 29892-01 for ; Fri, 4 Jul 2003 18:47:30 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id AAADBB439C2 for ; Fri, 4 Jul 2003 18:47:29 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h64LlSQQ008909; Fri, 4 Jul 2003 17:47:30 -0400 (EDT) To: Andrew Sullivan Cc: pgsql-performance@postgresql.org Subject: Re: Strange result: UNIX vs. TCP/IP sockets In-reply-to: <20030704212053.GD5679@libertyrms.info> References: <20030704172205.GH4707@libertyrms.info> <20030704143143.U45926@hub.org> <20030704175512.GB24859@md2.mediadesign.nl> <20030704212053.GD5679@libertyrms.info> Comments: In-reply-to Andrew Sullivan message dated "Fri, 04 Jul 2003 17:20:53 -0400" Date: Fri, 04 Jul 2003 17:47:27 -0400 Message-ID: <8908.1057355247@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200307/96 X-Sequence-Number: 2389 Andrew Sullivan writes: > How could it be the transport affects the time for the query as > reported by the back end? How much data is being sent back by the query? Do you have SSL enabled? SSL encryption overhead is nontrivial, especially if any renegotiations happen. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 4 19:26:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 1B3B1B439CA for ; Fri, 4 Jul 2003 22:25:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 40586-03 for ; Fri, 4 Jul 2003 19:25:06 -0300 (ADT) Received: from ns1.gnw.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id B1258B43168 for ; Fri, 4 Jul 2003 19:25:05 -0300 (ADT) Received: from ip97.85.1311c-cud12k-02.ish.de ([62.143.85.97] helo=mail.office.turtle-entertainment.de) by ns1.gnw.de with asmtp (Exim 3.22 #3 (Debian)) id 19YYzE-0008Az-00; Sat, 05 Jul 2003 00:25:00 +0200 Received: from p5084b02c.dip.t-dialin.net ([80.132.176.44] helo=shock) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 19YYzB-0001iB-00; Sat, 05 Jul 2003 00:24:58 +0200 Message-ID: <032f01c3427b$031479b0$0564a8c0@shock> From: "Bjoern Metzdorf" To: "Brian Tarbox" , "Postgresql Performance" References: <002301c34271$30afc870$01000001@trouble> Subject: Re: PostgreSQL vs. MySQL Date: Sat, 5 Jul 2003 00:24:18 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Scanner: exiscan *19YYzB-0001iB-00*.dHzQKoPUNE* http://duncanthrax.net/exiscan/ X-Archive-Number: 200307/97 X-Sequence-Number: 2390 >> Afaik, your original posting said postgresql was 3 times slower than >> mysql and that you are going to leave this list now. This implied >> that you have made your decision between postgresql and mysql, >> taking mysql because it is faster. > > Well, that shows what you get for making implications. The client is > sticking with postgres and we are coding around the issue in other > ways. As many other guys here pointed out, there are numerous ways to tune postgresql for maximum performance. If you are willing to share more information about your particular project, we might be able to help you out and optimize your application, without the need to code around the issue as much as you may be doing right now. Even if it is not possible for you to share enough information, there are a lot of places where you can read about performance tuning (if not in the docs then in the archives). >> If I was your client and gave you the task to choose a suitable >> database for my application and you evaluated suitable databases >> this way, then something is seriously wrong with your work. >> > Glad to see you're not getting personal with this. Ad hominin attacks > are for folks with no better answers. Yep, you're right. Sorry for that, I didn't mean to get personal. I was somehow irritated that you come here, post your database comparison and want to leave right afterwards, without going into detail (what should be the case normally). Again our offer: Post (possibly obfuscated) schema information, and we will certainly be able to help you with performance tuning. Regards, Bjoern From pgsql-performance-owner@postgresql.org Sat Jul 5 15:32:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 63DC2B439B0 for ; Sat, 5 Jul 2003 18:32:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 20161-05 for ; Sat, 5 Jul 2003 15:32:35 -0300 (ADT) Received: from svr3.postgresql.org (gborg.postgresql.org [64.117.225.160]) by svr1.postgresql.org (Postfix) with ESMTP id 48553B439FF for ; Sat, 5 Jul 2003 15:32:03 -0300 (ADT) Received: from elbereth.noviforum.si ([193.189.169.66]) by svr3.postgresql.org (8.12.9/8.12.6) with ESMTP id h65GjuMB065682 for ; Sat, 5 Jul 2003 12:45:57 -0400 (EDT) (envelope-from gregab@elbereth.noviforum.si) Received: (from gregab@localhost) by elbereth.noviforum.si (8.11.4/8.11.4) id h65Gdbn15711; Sat, 5 Jul 2003 18:39:37 +0200 Date: Sat, 5 Jul 2003 18:39:37 +0200 From: Grega Bremec To: Postgresql Performance Cc: Brian Tarbox Subject: Re: PostgreSQL vs. MySQL Message-ID: <20030705183937.A15201@elbereth.noviforum.si> References: <002301c34271$30afc870$01000001@trouble> <032f01c3427b$031479b0$0564a8c0@shock> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <032f01c3427b$031479b0$0564a8c0@shock>; from bm@turtle-entertainment.de on Sat, Jul 05, 2003 at 12:24:18AM +0200 Organization: Noviforum, Ltd., Software & Media X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/98 X-Sequence-Number: 2391 ...and on Sat, Jul 05, 2003 at 12:24:18AM +0200, Bjoern Metzdorf used the keyboard: > >> Afaik, your original posting said postgresql was 3 times slower than > >> mysql and that you are going to leave this list now. This implied > >> that you have made your decision between postgresql and mysql, > >> taking mysql because it is faster. > > > > Well, that shows what you get for making implications. The client is > > sticking with postgres and we are coding around the issue in other > > ways. > > As many other guys here pointed out, there are numerous ways to tune > postgresql for maximum performance. If you are willing to share more > information about your particular project, we might be able to help you out > and optimize your application, without the need to code around the issue as > much as you may be doing right now. > Even if it is not possible for you to share enough information, there are a > lot of places where you can read about performance tuning (if not in the > docs then in the archives). > Also, I should think the clients would not be too offended if Brian posted some hint about the actual quantity of data involved here, both the total expected database size and some info about the estimated "working set" size, such as a sum of sizes of tables most commonly used in JOIN queries and the percentage of data being shuffled around in those. Are indexes big? Are there any multicolumn indexes in use? Lots of sorting expected? Lots of UPDATEs/INSERTs/DELETEs? Also, it would be helpful to know just how normalized the database is, to provide some advice about possible query optimization, which could again prove helpful in speeding the machinery up. Another useful piece of information would be the amount of memory consumed by other applications vs. the amount of memory reserved by the OS for cache, and the nature of those other applications running - are they big cache consumers, such as Apache with static content and a large load would be, or do they keep a low profile? I think this would, in combination with the information already posted, such as the amount of memory and I/O subsystem info, at least enable us to advise about the recommended shared_buffers, effective_cache_size, sort_mem, vacuum_mem, and others, without compromising the intellectual property of Brian's clients. > > over and out. I CC'd this post over to you, Brian, 'cause this signoff made me rather unsure as to whether or not you're still on the list. Hope you don't mind. Sincerely, -- Grega Bremec System Administration & Development Support grega.bremec-at-noviforum.si http://najdi.si/ http://www.noviforum.si/ From pgsql-performance-owner@postgresql.org Sat Jul 5 17:58:36 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A069FB43168 for ; Sat, 5 Jul 2003 20:58:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 53190-04 for ; Sat, 5 Jul 2003 17:57:49 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 2F453B430BF for ; Sat, 5 Jul 2003 17:57:49 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19Yu6S-0002tW-00 for ; Sat, 05 Jul 2003 16:57:52 -0400 Received: by dba2 (Postfix, from userid 1019) id 871C4D75A; Sat, 5 Jul 2003 16:58:15 -0400 (EDT) Date: Sat, 5 Jul 2003 16:58:15 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Strange result: UNIX vs. TCP/IP sockets Message-ID: <20030705205815.GA7713@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030704172205.GH4707@libertyrms.info> <20030704143143.U45926@hub.org> <20030704175512.GB24859@md2.mediadesign.nl> <20030704212053.GD5679@libertyrms.info> <8908.1057355247@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8908.1057355247@sss.pgh.pa.us> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/99 X-Sequence-Number: 2392 On Fri, Jul 04, 2003 at 05:47:27PM -0400, Tom Lane wrote: > Andrew Sullivan writes: > > How could it be the transport affects the time for the query as > > reported by the back end? > > How much data is being sent back by the query? In this case, it's an all-aggregate query: select count(*), min(id) from sometable where owner = int4; (Yeah, yeah, I know. I didn't write it.) But it's the EXPLAIN ANALYSE that's reporting different times depending on the transport. That's what I find so strange. > Do you have SSL enabled? SSL encryption overhead is nontrivial, > especially if any renegotiations happen. No. -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Sat Jul 5 18:05:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 5908BB430BF for ; Sat, 5 Jul 2003 21:05:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 60167-03 for ; Sat, 5 Jul 2003 18:04:45 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 8D7E2B439B8 for ; Sat, 5 Jul 2003 18:04:38 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 56C7820F00; Sat, 5 Jul 2003 14:04:41 -0700 (PDT) Date: Sat, 5 Jul 2003 14:04:41 -0700 From: Sean Chittenden To: Tom Lane , Rod Taylor Cc: "scott.marlowe" , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030705210441.GX72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <2422.1057264735@sss.pgh.pa.us> <20030704000646.GV72567@perrin.int.nxad.com> <1057321743.32874.28.camel@jester> <20030703190502.GR72567@perrin.int.nxad.com> <20030703232351.GS72567@perrin.int.nxad.com> <10560.1057283855@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1057321743.32874.28.camel@jester> <10560.1057283855@sss.pgh.pa.us> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/100 X-Sequence-Number: 2393 > Sean Chittenden writes: > > Getting the planner to pick > > using the index to filter out data inserted in the last 3 days over > > doing a seq scan... well, I don't know how you could do that without > > changing the random_page_cost. > > This sounds a *whole* lot like a correlation issue. If the data in > question were scattered randomly in the table, it's likely that an > indexscan would be a loser. The recently-inserted data is probably > clustered near the end of the table (especially if they're doing > VACUUM FULL after data purges; are they?). But the planner's > correlation stats are much too crude to recognize that situation, if > the rest of the table is not well-ordered. Data isn't scattered randomly from what I can tell and is basically already clustered just because the data is inserted linearly and based off of time. I don't think they're doing a VACUUM FULL after a purge, but I'll double check on that on Monday when they get in. Is there an easy way of determining or setting a planner stat to suggest that data is ordered around a column in a permanent way? CLUSTER has always been a one shot deal and its effects wear off quickly depending on the way that data is inserted. It seems as though that this would be a circumstance in which preallocated disk space would be a win (that way data wouldn't always be appended to the heap and could be inserted in order, of most use for non-time related data: ex, some non-unique ID). > If their typical process involves a periodic data purge and then a > VACUUM FULL, it might be worth experimenting with doing a CLUSTER on > the timestamp index instead of the VACUUM FULL. The CLUSTER would > reclaim space as effectively as VACUUM FULL + REINDEX, and it would > leave the table with an unmistakable 1.0 correlation ... which > should tilt the planner towards an indexscan without needing a > physically impossible random_page_cost to do it. I think CLUSTER > would probably be a little slower than VACUUM FULL but it's hard to > be sure without trying. Hrm, I understand what clustering does, I'm just not convinced that it'll "fix" this performance problem unless CLUSTER sets some kind of hint that ANALYZE uses to modify the way in which it collects statistics. Like I said, I'll let you know on Monday when they're back in the shop, but I'm not holding my breath. I know random_page_cost is set to something physically impossible, but in terms of performance, it's always been the biggest win for me to set this puppy quite low. Bug in the planner, or documentation surrounding what this knob does, I'm not sure, but setting this to a low value consistently yields good results for me. Faster the drive, the lower the random_page_cost value. *shrug* > That's one heck of a poor estimate for the number of rows returned. > > > -> Seq Scan on mss_fwevent (cost=0.00..223312.60 rows=168478 width=12) (actual time=24253.66..24319.87 rows=320 loops=1) The stats for the columns are already set to 1000 to aid with this... don't know what else I can do here. Having the planner off by as much as even half the actual size isn't uncommon in my experience. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Sat Jul 5 18:13:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id F1CA8B4316A for ; Sat, 5 Jul 2003 21:13:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 61083-04 for ; Sat, 5 Jul 2003 18:12:53 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id BFE1FB430BF for ; Sat, 5 Jul 2003 18:12:53 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 6845C20F00; Sat, 5 Jul 2003 14:12:56 -0700 (PDT) Date: Sat, 5 Jul 2003 14:12:56 -0700 From: Sean Chittenden To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030705211256.GY72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200307031938.15357.josh@agliodbs.com> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/101 X-Sequence-Number: 2394 > > # The default values for PostgreSQL are extremely conservative and > > # are likely far from ideal for a site's needs. Included in this > > # configuration, however, are _suggested_ values to help aid in > > > # > > This sort of narrative belongs in the SGML docs, not in a CONF file. > In fact, one could argue that we should take *all* commentary out of > the CONF file in order to force people to read the docs. The SGML docs aren't in the DBA's face and are way out of the way for DBAs rolling out a new system or who are tuning the system. SGML == Developer, conf == DBA. > Database performance tuning will always be a "black art," as it > necessitates a broad knowledge of PostgreSQL, OS architecture, and > computer hardware. So I doubt that we can post docs that would > allow any 10% time DBA to make PostgreSQL "fly", but hopefully over > the next year we can make enough knowledge public to allow anyone to > make PostgreSQL "sprint". I'm highly resistant to/disappointed in this attitude and firmly believe that there are well understood algorithms that DBAs use to diagnose and solve performance problems. It's only a black art because it hasn't been documented. Performance tuning isn't voodoo, it's adjusting constraints to align with the execution of applications and we know what the applications do, therefore the database can mold to the applications' needs. Some of those parameters are based on hardware constraints and should be pooled and organized as such. random_page_cost == avg cost of a random disk seek/read (eg: disk seek time) == constant integer for a given piece of hardware There are other settings that are RAM based as well, which should be formulaic and derived though a formula hasn't been defined to date. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Sat Jul 5 19:59:40 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9AD87B43183 for ; Sat, 5 Jul 2003 22:59:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 93963-03 for ; Sat, 5 Jul 2003 19:59:26 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id CF5B7B4316A for ; Sat, 5 Jul 2003 19:59:25 -0300 (ADT) Received: from [63.195.55.98] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3186164; Sat, 05 Jul 2003 15:59:43 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Sean Chittenden Subject: Re: Moving postgresql.conf tunables into 2003... Date: Sat, 5 Jul 2003 15:58:25 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-performance@postgresql.org References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> <20030705211256.GY72567@perrin.int.nxad.com> In-Reply-To: <20030705211256.GY72567@perrin.int.nxad.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307051558.25484.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/102 X-Sequence-Number: 2395 Sean, > The SGML docs aren't in the DBA's face and are way out of the way for > DBAs rolling out a new system or who are tuning the system. SGML =3D=3D > Developer, conf =3D=3D DBA. That's exactly my point. We cannot provide enough documentation in the CON= F=20 file without septupling its length. IF we remove all commentary, and inste= ad=20 provide a pointer to the documentation, more DBAs will read it. > Some of those parameters are based on > hardware constraints and should be pooled and organized as such. >=20 > random_page_cost =3D=3D > avg cost of a random disk seek/read (eg: disk seek time) =3D=3D > constant integer for a given piece of hardware But, you see, this is exactly what I'm talking about. random_page_cost is= n't=20 static to a specific piece of hardware ... it depends as well on what else = is=20 on the disk/array, concurrent disk activity, disk controller settings,=20 filesystem, OS, distribution of records and tables, and arrangment of the= =20 partitions on disk. One can certainly get a "good enough" value by=20 benchmarking the disk's random seek and calculating based on that ... but t= o=20 get an "ideal" value requires a long interactive session by someone with=20 experience and in-depth knowledge of the machine and database. > There are other settings that are RAM based as well, which should be > formulaic and derived though a formula hasn't been defined to date. You seem pretty passionate about this ... how about you help me an Kevin=20 define a benchmarking suite when I get back into the country (July 17)? I= f=20 we're going to define formulas, it requires that we have a near-comprehensi= ve=20 and consistent test database and test battery that we can run on a variety = of=20 machines and platforms. --=20 -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco From pgsql-performance-owner@postgresql.org Sat Jul 5 20:40:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D62F2B435BB for ; Sat, 5 Jul 2003 23:40:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 96504-04 for ; Sat, 5 Jul 2003 20:40:45 -0300 (ADT) Received: from mail.gmx.net (pop.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 1B7D5B43162 for ; Sat, 5 Jul 2003 20:40:44 -0300 (ADT) Received: (qmail 2084 invoked by uid 65534); 5 Jul 2003 23:40:47 -0000 Received: from 66-27-116-37.san.rr.com (EHLO gmx.net) (66.27.116.37) by mail.gmx.net (mp005) with SMTP; 06 Jul 2003 01:40:47 +0200 Date: Sat, 5 Jul 2003 16:40:52 -0700 Subject: Re: PostgreSQL vs. MySQL Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: "Shridhar Daithankar" , To: "Brian Tarbox" From: Hilmar Lapp In-Reply-To: <01bf01c34235$a4c8aa60$01000001@trouble> Message-Id: <1D2B4368-AF42-11D7-9143-000393B4BFF6@gmx.net> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/103 X-Sequence-Number: 2396 On Friday, July 4, 2003, at 07:07 AM, Brian Tarbox wrote: > We had about 40 tables in the db, with joined queries on about 8-12 > tables. > A while ago a tested a moderately complex schema on MySQL, Pg, and Oracle. I usually heavily normalize schemas and then define views as a denormalized API, which sends MySQL to the book of toys already. The views more often than not would join anywhere from 6-12 tables, using plain (as opposed to compound) foreign keys to primary key straight joins. I noticed that Pg was more than an order of magnitude slower for joins > 8 tables than Oracle. I won't claim that none of this can have been due to lack of tuning. My point is the following though. After I dug in it turned out that of the 4 secs Pg needed to execute the query it spent 3.9 secs in the planner. The execution plan Pg came up with was pretty good - it just needed an extraordinary amount of time to arrive at it, spoiling its own results. Asking this list I then learned how to tweak GEQO such that it would pick up the planning and do it faster than it would otherwise. I was able to get the planner time down to a quarter - still a multitude of the actual execution time. I was told on this list that query planning suffers from combinatorial explosion very quickly - and I completely buy that. It's just - Oracle planned the same query in a fraction of a second, using the cost-based optimizer, on a slower machine. I've seen it plan 15-table joins in much less than a second, and I have no idea how it would do that. In addition, once you've prepared a query in Oracle, the execution plan is pre-compiled. If I were a CS student I'd offer myself to the hall of humiliation and set out to write a fast query planner for Pg ... -hilmar -- ------------------------------------------------------------- Hilmar Lapp email: lapp at gnf.org GNF, San Diego, Ca. 92121 phone: +1-858-812-1757 ------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Sat Jul 5 21:13:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AB1D6B43162 for ; Sun, 6 Jul 2003 00:13:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 13734-07 for ; Sat, 5 Jul 2003 21:13:14 -0300 (ADT) Received: from fuji.krosing.net (unknown [194.204.44.118]) by svr1.postgresql.org (Postfix) with ESMTP id D37ADB430BF for ; Sat, 5 Jul 2003 21:13:13 -0300 (ADT) Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h660C1rP017564; Sun, 6 Jul 2003 03:12:02 +0300 Received: (from hannu@localhost) by fuji.krosing.net (8.12.8/8.12.8/Submit) id h660BxDr017562; Sun, 6 Jul 2003 03:11:59 +0300 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: PostgreSQL vs. MySQL From: Hannu Krosing To: Brian Tarbox Cc: Rafal Kedziorski , pgsql-performance@postgresql.org In-Reply-To: <01af01c34227$a6cff470$01000001@trouble> References: <01af01c34227$a6cff470$01000001@trouble> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1057450318.17490.8.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 06 Jul 2003 03:11:58 +0300 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/104 X-Sequence-Number: 2397 Brian Tarbox kirjutas R, 04.07.2003 kell 15:27: > I recently took a system from MySQL to Postgres. Same HW, SW, same data. > The major operations where moderately complex queries (joins on 8 tables). > The results we got was that Postgres was fully 3 times slower than MySql. For each and every query ?? > We were on this list a fair bit looking for answers and tried all the > standard answers. Could you post the list of "standard answers" you tried ? > It was still much much much slower. Was this with InnoDB ? what kind of joins were they (i.e "FROM a JOIN b on a.i=b.i" or "FROM a,b WHERE a.i = b.i" ? What was the ratio of planning time to actual execution time in pgsql? Where the queries originally optimized for MySQL ? ---------------- Hannu From pgsql-performance-owner@postgresql.org Sat Jul 5 21:24:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3E2C9B430D8 for ; Sun, 6 Jul 2003 00:24:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 30033-06 for ; Sat, 5 Jul 2003 21:24:09 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id BC4EBB438BB for ; Sat, 5 Jul 2003 21:24:08 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 4C5D520F00; Sat, 5 Jul 2003 17:24:13 -0700 (PDT) Date: Sat, 5 Jul 2003 17:24:13 -0700 From: Sean Chittenden To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030706002413.GZ72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> <20030705211256.GY72567@perrin.int.nxad.com> <200307051558.25484.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200307051558.25484.josh@agliodbs.com> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/105 X-Sequence-Number: 2398 > > The SGML docs aren't in the DBA's face and are way out of the way > > for DBAs rolling out a new system or who are tuning the system. > > SGML == Developer, conf == DBA. > > That's exactly my point. We cannot provide enough documentation in > the CONF file without septupling its length. IF we remove all > commentary, and instead provide a pointer to the documentation, more > DBAs will read it. Which I don't think would happen and why I think the terse bits that are included are worth while. :) > > Some of those parameters are based on hardware constraints and > > should be pooled and organized as such. > > > > random_page_cost == > > avg cost of a random disk seek/read (eg: disk seek time) == > > constant integer for a given piece of hardware > > But, you see, this is exactly what I'm talking about. > random_page_cost isn't static to a specific piece of hardware ... it > depends as well on what else is on: *) the disk/array translation: how fast data is accessed and over how many drives. *) concurrent disk activity A disk/database activity metric is different than the cost of a seek on the platters. :) Because PostgreSQL doesn't currently support such a disk concurrency metric doesn't mean that its definition should get rolled into a different number in an attempt to accommodate for a lack thereof. *) disk controller settings This class of settings falls into the same settings that affect random seeks on the platters/disk array(s). *) filesystem Again, this influences avg seek time *) OS Again, avg seek time *) distribution of records and tables This has nothing to do with PostgreSQL's random_page_cost setting other than that if data is fragmented on the platter, the disk is going to have to do a lot of seeking. This is a stat that should get set by ANALYZE, not by a human. *) arrangement of the partitions on disk Again, avg seek time. > One can certainly get a "good enough" value by benchmarking the > disk's random seek and calculating based on that ... but to get an > "ideal" value requires a long interactive session by someone with > experience and in-depth knowledge of the machine and database. An "ideal" value isn't obtained via guess and check. Checking is only the verification of some calculable set of settings....though right now those calculated settings are guessed, unfortunately. > > There are other settings that are RAM based as well, which should > > be formulaic and derived though a formula hasn't been defined to > > date. > > You seem pretty passionate about this ... how about you help me an > Kevin define a benchmarking suite when I get back into the country > (July 17)? If we're going to define formulas, it requires that we > have a near-comprehensive and consistent test database and test > battery that we can run on a variety of machines and platforms. Works for me, though a benchmark will be less valuable than adding a disk concurrency stat, improving data trend/distribution analysis, and using numbers that are concrete and obtainable through the OS kernel API or an admin manually plunking numbers in. I'm still recovering from my move from Cali to WA so with any luck, I'll be settled in by then. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Sat Jul 5 22:32:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9FD44B430AD for ; Sun, 6 Jul 2003 01:32:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 50715-03 for ; Sat, 5 Jul 2003 22:32:05 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 5B79EB427D9 for ; Sat, 5 Jul 2003 22:32:05 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3186415; Sat, 05 Jul 2003 18:32:24 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Sean Chittenden Subject: Re: Moving postgresql.conf tunables into 2003... Date: Sat, 5 Jul 2003 18:27:44 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-performance@postgresql.org References: <20030703190502.GR72567@perrin.int.nxad.com> <200307051558.25484.josh@agliodbs.com> <20030706002413.GZ72567@perrin.int.nxad.com> In-Reply-To: <20030706002413.GZ72567@perrin.int.nxad.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307051827.44848.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/106 X-Sequence-Number: 2399 Sean, > > That's exactly my point. We cannot provide enough documentation in > > the CONF file without septupling its length. IF we remove all > > commentary, and instead provide a pointer to the documentation, more > > DBAs will read it. > > Which I don't think would happen and why I think the terse bits that > are included are worth while. :) Depressingly enough, you are probably correct, unless we assemble a more user-friendly "getting started" guide. > *) concurrent disk activity > > A disk/database activity metric is different than the cost of a seek > on the platters. :) Because PostgreSQL doesn't currently support such > a disk concurrency metric doesn't mean that its definition should get > rolled into a different number in an attempt to accommodate for a lack > thereof. I was talking about concurrent activity by *other* applications. For example, if a DBA has a java app that is accessing XML on the same array as postgres 500 times/minute, then you'd need to adjust random_page_cost upwards to allow for the resource contest. > An "ideal" value isn't obtained via guess and check. Checking is only > the verification of some calculable set of settings....though right now > those calculated settings are guessed, unfortunately. > Works for me, though a benchmark will be less valuable than adding a > disk concurrency stat, improving data trend/distribution analysis, and > using numbers that are concrete and obtainable through the OS kernel > API or an admin manually plunking numbers in. I'm still recovering > from my move from Cali to WA so with any luck, I'll be settled in by > then. The idea is that for a lot of statistics, we're only going to be able to obtain valid numbers if you have something constant to check them against. Talk to you later this month! -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-novice-owner@postgresql.org Sun Jul 6 01:55:28 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CE6BEB438B1; Sun, 6 Jul 2003 04:55:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 13650-07; Sun, 6 Jul 2003 01:54:59 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id F1508B430AD; Sun, 6 Jul 2003 01:54:58 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h664swPu010499; Sat, 5 Jul 2003 22:54:59 -0600 (MDT) Message-ID: <3F07ABA1.2070100@ethereal-realms.org> Date: Sat, 05 Jul 2003 22:54:57 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Novice , PostgreSQL Performance Subject: Extreme high load averages Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/30 X-Sequence-Number: 7565 The only time that I have ever seen load averages of 30 or more under OpenBSD is when one of my scripts goes wild. However, I can say that I am also seeing these load averages under PostgreSQL 7.3.2 after a migration to it from MySQL. MySQL Statistics: Uptime: 1055352 Threads: 178 Questions: 75161710 Slow queries: 46 Opens: 1084 Flush tables: 1 Open tables: 206 Queries per second avg: 71.220 The above are statistics from older generation scripts that would make use of MySQL as to give an idea of what's going on. That generation of scripts would handle the referential integrity, since foreign key constraints are not enforced under that system. However, the system handled 250 concurrent users without a singular problem, while under Postgres with new scripts using functions, referential integrity, transactions and lighter code, the system starts to buckle at even less then 70 users. What I would like to know is. Why? The kernel has been compiled to handle the number of concurrent connections, the server may not be the best, but it should be able to handle the requests: PIII 1Ghz, 1GB SDRAM, 2 IDE 20GB drives. I have changed settings to take advantage of the memory. So the following settings are of interest: shared_buffers = 16384 wal_buffers = 256 sort_mem = 16384 vacuum_mem = 32768 Statistics gathering has now been disabled, and logging is done through syslog. I do not expect those settings to cripple system performance however. The scripts are heavy SELECTS with a fair dose of UPDATES and INSERTS. To get a concept of what these scripts done, you can look at Ethereal Realms (http://www.ethereal-realms.org) which are running the PostgreSQL script variants or consider that this is a chat site. Anyone have ideas? Is the use of connection pooling consider bad? Should flush be run more then once a day? I have no intention of going back to MySQL, and would like to make this new solution work. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-novice-owner@postgresql.org Sun Jul 6 15:57:32 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 286E4B42168; Sun, 6 Jul 2003 07:49:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 51140-02; Sun, 6 Jul 2003 04:49:02 -0300 (ADT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by svr1.postgresql.org (Postfix) with ESMTP id C4CB6B42000; Sun, 6 Jul 2003 04:49:01 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19Z4Gb-0002mQ-0U; Sun, 06 Jul 2003 08:49:02 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 4EA7117079; Sun, 6 Jul 2003 08:49:00 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id B07BC16497; Sun, 6 Jul 2003 08:48:59 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Martin Foster , PostgreSQL Novice , PostgreSQL Performance Subject: Re: [PERFORM] Extreme high load averages Date: Sun, 6 Jul 2003 08:49:00 +0100 User-Agent: KMail/1.4.3 References: <3F07ABA1.2070100@ethereal-realms.org> In-Reply-To: <3F07ABA1.2070100@ethereal-realms.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307060849.00544.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/36 X-Sequence-Number: 7571 On Sunday 06 Jul 2003 5:54 am, Martin Foster wrote: > The only time that I have ever seen load averages of 30 or more under > OpenBSD is when one of my scripts goes wild. However, I can say that > I am also seeing these load averages under PostgreSQL 7.3.2 after a > migration to it from MySQL. [snip] > However, the system > handled 250 concurrent users without a singular problem, while under > Postgres with new scripts using functions, referential integrity, > transactions and lighter code, the system starts to buckle at even less > then 70 users. [snip] > PIII 1Ghz, 1GB > SDRAM, 2 IDE 20GB drives. > > I have changed settings to take advantage of the memory. So the > following settings are of interest: > shared_buffers =3D 16384 > wal_buffers =3D 256 > sort_mem =3D 16384 > vacuum_mem =3D 32768 You do know that sort_mem is in kB per sort (not per connection, but per so= rt=20 being done by a connection). That's 16MB per sort you've allowed in main=20 memory, or for 70 concurrent sorts up to 1.1GB of memory allocated to=20 sorting. You're not going into swap by any chance? Might want to try halving shared_buffers too and see what happens. I don't know the *BSDs myself, but do you have the equivalent of iostat/vms= tat=20 output you could get for us? Also a snapshot of "top" output? People are=20 going to want to see: - overall memory usage (free/buffers/cache/swap) - memory usage per process - disk activity (blocks in/out) From that lot, someone will be able to point towards the issue, I'm sure. --=20 Richard Huxton From pgsql-performance-owner@postgresql.org Sun Jul 6 06:45:49 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 62643B4276B for ; Sun, 6 Jul 2003 09:45:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 80814-04 for ; Sun, 6 Jul 2003 06:45:17 -0300 (ADT) Received: from smtp.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 59AD4B42169 for ; Sun, 6 Jul 2003 06:45:15 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h669k5xh031359 for ; Sun, 6 Jul 2003 15:16:05 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h669k58B031346 for ; Sun, 6 Jul 2003 15:16:05 +0530 From: "Shridhar Daithankar" To: Postgresql Performance Date: Sun, 06 Jul 2003 15:14:18 +0530 MIME-Version: 1.0 Subject: Re: Extreme high load averages Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F083CCA.31144.7468C@localhost> In-reply-to: <3F07ABA1.2070100@ethereal-realms.org> 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-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/109 X-Sequence-Number: 2402 On 5 Jul 2003 at 22:54, Martin Foster wrote: > What I would like to know is. Why? The kernel has been compiled to > handle the number of concurrent connections, the server may not be the > best, but it should be able to handle the requests: PIII 1Ghz, 1GB > SDRAM, 2 IDE 20GB drives. > > I have changed settings to take advantage of the memory. So the > following settings are of interest: > shared_buffers = 16384 > wal_buffers = 256 > sort_mem = 16384 > vacuum_mem = 32768 As somebody else has already pointed out, your sort_mem is bit too high than required. Try lowering it. Secondly did you tune effective_cache_size? HTH Bye Shridhar -- Power, n.: The only narcotic regulated by the SEC instead of the FDA. From pgsql-performance-owner@postgresql.org Sun Jul 6 07:27:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A4352B430A6 for ; Sun, 6 Jul 2003 10:27:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 96074-10 for ; Sun, 6 Jul 2003 07:26:45 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 66B2EB430A9 for ; Sun, 6 Jul 2003 07:26:44 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h66AQNPu008093; Sun, 6 Jul 2003 04:26:23 -0600 (MDT) Message-ID: <3F07F94D.50406@ethereal-realms.org> Date: Sun, 06 Jul 2003 04:26:21 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgresql Performance Cc: "Shridhar Daithankar" Subject: Re: Extreme high load averages References: <3F083CCA.31144.7468C@localhost> In-Reply-To: <3F083CCA.31144.7468C@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/110 X-Sequence-Number: 2403 Shridhar Daithankar wrote: > On 5 Jul 2003 at 22:54, Martin Foster wrote: > >>What I would like to know is. Why? The kernel has been compiled to >>handle the number of concurrent connections, the server may not be the >>best, but it should be able to handle the requests: PIII 1Ghz, 1GB >>SDRAM, 2 IDE 20GB drives. >> >>I have changed settings to take advantage of the memory. So the >>following settings are of interest: >> shared_buffers = 16384 >> wal_buffers = 256 >> sort_mem = 16384 >> vacuum_mem = 32768 > > > As somebody else has already pointed out, your sort_mem is bit too high > than required. Try lowering it. > > Secondly did you tune effective_cache_size? > > HTH > Bye > Shridhar > > -- > Power, n.: The only narcotic regulated by the SEC instead of the FDA. > > > ---------------------------(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 I dropped the size of the sort_mem down to 8 megs. Since I am not swapping to cache at all this should not post much of a problem at that value. effective_cache_size seems interesting, though the description is somewhat lacking. Is this related to the swap partition and how much of it will be used by PostgreSQL? If I am correct, this should be fairly low? Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-novice-owner@postgresql.org Sun Jul 6 07:32:40 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A74D9B430A6; Sun, 6 Jul 2003 10:32:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 97598-07; Sun, 6 Jul 2003 07:32:01 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 393AFB4241A; Sun, 6 Jul 2003 07:32:00 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h66AVsPu003645; Sun, 6 Jul 2003 04:31:54 -0600 (MDT) Message-ID: <3F07FA98.70009@ethereal-realms.org> Date: Sun, 06 Jul 2003 04:31:52 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard Huxton Cc: PostgreSQL Novice , PostgreSQL Performance Subject: Re: [PERFORM] Extreme high load averages References: <3F07ABA1.2070100@ethereal-realms.org> <200307060849.00544.dev@archonet.com> In-Reply-To: <200307060849.00544.dev@archonet.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/32 X-Sequence-Number: 7567 Richard Huxton wrote: > On Sunday 06 Jul 2003 5:54 am, Martin Foster wrote: > >>The only time that I have ever seen load averages of 30 or more under >>OpenBSD is when one of my scripts goes wild. However, I can say that >>I am also seeing these load averages under PostgreSQL 7.3.2 after a >>migration to it from MySQL. > > [snip] > >>However, the system >>handled 250 concurrent users without a singular problem, while under >>Postgres with new scripts using functions, referential integrity, >>transactions and lighter code, the system starts to buckle at even less >>then 70 users. > > [snip] > >>PIII 1Ghz, 1GB >>SDRAM, 2 IDE 20GB drives. >> >>I have changed settings to take advantage of the memory. So the >>following settings are of interest: >> shared_buffers = 16384 >> wal_buffers = 256 >> sort_mem = 16384 >> vacuum_mem = 32768 > > > You do know that sort_mem is in kB per sort (not per connection, but per sort > being done by a connection). That's 16MB per sort you've allowed in main > memory, or for 70 concurrent sorts up to 1.1GB of memory allocated to > sorting. You're not going into swap by any chance? > > Might want to try halving shared_buffers too and see what happens. > > I don't know the *BSDs myself, but do you have the equivalent of iostat/vmstat > output you could get for us? Also a snapshot of "top" output? People are > going to want to see: > - overall memory usage (free/buffers/cache/swap) > - memory usage per process > - disk activity (blocks in/out) > >>From that lot, someone will be able to point towards the issue, I'm sure. Actually, no I did not. Which is probably why it was as high as it is. When looking at the PostgreSQL Hardware Performance Tuning page, it seems to imply that you should calculate based on RAM to give it an appropriate value. http://www.postgresql.org/docs/aw_pgsql_book/hw_performance/node8.html I dropped that value, and will see if that helps. The thing is, the system always indicated plenty of memory available. Even when at a 30 load level the free memory was still roughly 170MB. Tomorrow will be a good gage to see if the changes will actually help matters. And if they do not, I will include vmstat, iostat, and top as requested. Thanks! Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Sun Jul 6 07:36:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D2FC8B4276B for ; Sun, 6 Jul 2003 10:36:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 99386-05 for ; Sun, 6 Jul 2003 07:35:46 -0300 (ADT) Received: from smtp.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 12228B4241A for ; Sun, 6 Jul 2003 07:35:45 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h66AabI1001105 for ; Sun, 6 Jul 2003 16:06:37 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h66Aaa8B001092 for ; Sun, 6 Jul 2003 16:06:36 +0530 From: Shridhar Daithankar To: Postgresql Performance Subject: Re: Extreme high load averages Date: Sun, 6 Jul 2003 16:04:48 +0530 User-Agent: KMail/1.5.2 References: <3F083CCA.31144.7468C@localhost> <3F07F94D.50406@ethereal-realms.org> In-Reply-To: <3F07F94D.50406@ethereal-realms.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307061604.48919.shridhar_daithankar@nospam.persistent.co.in> X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/112 X-Sequence-Number: 2405 On Sunday 06 July 2003 15:56, Martin Foster wrote: > effective_cache_size seems interesting, though the description is > somewhat lacking. Is this related to the swap partition and how much of > it will be used by PostgreSQL? If I am correct, this should be fairly > low? Martin Foster It gives hint to psotgresql how much file system cache is available in the system. You have 1GB memory and your application requirement does not exceed 400MB. So OS can use roughly 600MB for file system cache. In that case you can set this parameter to 400MB cache to leave room for other application in FS cache. IIRC, BSD needs sysctl tuning to make more memory available for FS cache other wise they max out at 300MB. Roughly this setting should be (total memory -application requirement)*(0.7/0.8) I guess that high kernel load you are seeing due to increased interaction between postgresql and OS when data is swapped to/fro in shared memory. If OS cache does well, postgresql should reduce this interaction as well. BTW, since you have IDE disks, heavy disk activity can eat CPU as well. Is your disk bandwidth totally maxed out? Check with vmstat or whatever equivalent you have on BSD. Shridhar From pgsql-advocacy-owner@postgresql.org Sun Jul 6 10:05:26 2003 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A1A47B42001 for ; Sun, 6 Jul 2003 13:05:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 28042-03 for ; Sun, 6 Jul 2003 10:04:52 -0300 (ADT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by svr1.postgresql.org (Postfix) with ESMTP id C1833B4315F for ; Sun, 6 Jul 2003 10:04:51 -0300 (ADT) Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19Z9CJ-0002c4-00 for pgsql-advocacy@postgresql.org; Sun, 06 Jul 2003 15:04:55 +0200 Received: from [80.145.76.252] (helo=zwerg2000) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 19Z9CJ-0001o7-00 for pgsql-advocacy@postgresql.org; Sun, 06 Jul 2003 15:04:55 +0200 Message-ID: <000401c343bf$57d4bc40$e8ebfea9@zwerg2000> From: "Cornelia Boenigk" To: References: <3F05AF44.6080601@future.ee> <200307040956.24420.josh@agliodbs.com> Subject: PostgreSQL banner Date: Sun, 6 Jul 2003 15:05:37 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/35 X-Sequence-Number: 1559 Hi everybody Is there any 'official' PostgreSQL banner? Greetings Conni From pgsql-patches-owner@postgresql.org Sun Jul 6 11:12:03 2003 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 27E76B430A7 for ; Sun, 6 Jul 2003 14:12:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 37610-06 for ; Sun, 6 Jul 2003 11:11:30 -0300 (ADT) Received: from smtp.pspl.co.in (www.pspl.co.in [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id EE47CB42167 for ; Sun, 6 Jul 2003 11:11:28 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h66ECPHP010865 for ; Sun, 6 Jul 2003 19:42:25 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h66ECN8B010851; Sun, 6 Jul 2003 19:42:24 +0530 From: Shridhar Daithankar To: pgsql-patches@postgresql.org, pgsql-performance@postgresql.org Subject: Another POC initdb patch Date: Sun, 6 Jul 2003 19:40:32 +0530 User-Agent: KMail/1.5.2 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Y3CC/LKQkFAkdwL" Message-Id: <200307061940.32831.shridhar_daithankar@nospam.persistent.co.in> X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/26 X-Sequence-Number: 7613 --Boundary-00=_Y3CC/LKQkFAkdwL Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi all, In addition to Tom's patch, this patch asks tuning parameters right away, while doing initdb. I have also changed the notice displayed after initdb is done. Just an attempt to make defaults user friendly. I would also like to add other paramters to this approach, like fsync and random_page_cost but first I thought others should have look at these. And one more thing, can we get all the parameters in postgresql.conf to follow similar units? Some settings aer in 8KB pages, some in bytes etc. Can we haev all of them to follow say MB or KB? I tried but guc.h and guc.c were bit too much to be gulped at one go. I will try again. Shridhar --Boundary-00=_Y3CC/LKQkFAkdwL Content-Type: text/x-diff; charset="us-ascii"; name="postgresql.conf.sample.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="postgresql.conf.sample.patch" *** postgresql.conf.sample.orig Sun Jul 6 15:51:02 2003 --- postgresql.conf.sample Sun Jul 6 17:17:23 2003 *************** *** 57,63 **** # --------------------------------- # Memory ! #shared_buffers = 64 # 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 --- 57,64 ---- # --------------------------------- # Memory ! # min 16, at least max_connections*2, 8KB each ! #shared_buffers #sort_mem = 1024 # min 64, size in KB #vacuum_mem = 8192 # min 1024, size in KB *************** *** 105,111 **** # 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) --- 106,113 ---- # Planner Cost Constants ! # typically 8KB each ! #effective_cache_size #random_page_cost = 4 # units are one sequential page fetch cost #cpu_tuple_cost = 0.01 # (same) #cpu_index_tuple_cost = 0.001 # (same) --Boundary-00=_Y3CC/LKQkFAkdwL Content-Type: text/x-diff; charset="us-ascii"; name="initdb.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="initdb.patch" *** initdb.orig Sun Jul 6 15:51:22 2003 --- initdb Sun Jul 6 19:34:24 2003 *************** *** 71,76 **** --- 71,133 ---- echo "$ret" } + #Set the values to default + new_shared_buffers=" 64" + new_effective_cache=" 1000" + + #Get some good enough values for configuration + pg_getDefault_Config(){ + echo + echo + echo " Now I am going to ask you some question regarding your system. " + echo " These will help you in getting decent startup performance. " + echo " The answers you provide here would be reflected in generated " + echo " postgresql config file." + echo + read -p " Press any key to continue. " wvar + + echo + echo "Setting parameter: shared_buffers" + echo " Unit: 8KB" + echo " Type: Integer" + echo + echo " This parameter sets how much shared memory postgresql will use." + echo " Value of this parameter depends upon size of dataset handled at" + echo " a time and available memory." + echo + echo " This parameter is limited by maximum shared memory setting of the" + echo " system. You might need to tune your kernel for your requirement." + echo " Please refer to Administrator's guide for more details." + echo + echo " WARNING: Setting this parameter too high can cause loss of performance" + echo " or postgresql might not start at all. Please adhere to guideline shown " + echo " and apply your own judgement." + echo + echo " Description Memory Value" + echo " Workstation or test database 4MB 512 " + echo " Medium size database and 256-512 MB RAM 16-32MB 2048-4096" + echo " Large database and >1GB memory 64-256MB 8192-32768" + echo + read -p "Enter value of shared_buffers: " new_shared_buffers + + echo + echo "Setting paramter: effective_cache_size" + echo " Unit: 8KB" + echo " Type: Integer" + echo + + echo " Postgresql will perform better if it knows how much file cache OS has." + echo " This parameters gives hint to postgresql about the amount of file" + echo " system cache." + echo + echo " There is nothing high or low about this parameter. It should be set to" + echo " the correct value. Only change required is to account for memory" + echo " requirement of other applications running on same machie. Being bit" + echo " conservative on this parameter is recommended." + echo + read -p "Enter value of effective_cache_size: " new_effective_cache + + } CMDNAME=`basename $0` *************** *** 583,597 **** $ECHO_N "creating configuration files... "$ECHO_C cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely ( trigger="# These settings are initialized by initdb -- they may be changed" ! sed -n "1,/$trigger/p" "$POSTGRESQL_CONF_SAMPLE" for cat in MESSAGES MONETARY NUMERIC TIME; do ! echo "LC_$cat = '`pg_getlocale $cat`'" done ! sed -n "1,/$trigger/!p" "$POSTGRESQL_CONF_SAMPLE" ) > "$PGDATA"/postgresql.conf || exit_nicely chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \ --- 640,660 ---- $ECHO_N "creating configuration files... "$ECHO_C + #Get the database tuning options + pg_getDefault_Config + cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely cp "$PG_IDENT_SAMPLE" "$PGDATA"/pg_ident.conf || exit_nicely ( trigger="# These settings are initialized by initdb -- they may be changed" ! lcvars="" for cat in MESSAGES MONETARY NUMERIC TIME; do ! lcvars="$lcvars\nLC_$cat = '`pg_getlocale $cat`'"; done ! ! sed "s/#shared_buffers/shared_buffers = $new_shared_buffers/" "$POSTGRESQL_CONF_SAMPLE"| \ ! sed "s/#effective_cache_size/effective_cache_size = $new_effective_cache/" | \ ! sed "s/$trigger/$trigger$lcvars/" ) > "$PGDATA"/postgresql.conf || exit_nicely chmod 0600 "$PGDATA"/pg_hba.conf "$PGDATA"/pg_ident.conf \ *************** *** 1096,1102 **** # FINISHED echo ! echo "Success. You can now start the database server using:" echo "" echo " $PGPATH/postmaster -D $PGDATA" echo "or" --- 1159,1170 ---- # FINISHED echo ! echo "Success." ! echo ! echo "Now you should tune the postgresql configuration file, $PGDATA/postgresql.conf" ! echo "Refer to Administrators guide for any further assistance for tuning options." ! echo ! echo "After you are done with tuning the options, you can start the postgresql server using" echo "" echo " $PGPATH/postmaster -D $PGDATA" echo "or" --Boundary-00=_Y3CC/LKQkFAkdwL-- From pgsql-novice-owner@postgresql.org Sun Jul 6 12:20:27 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C77CDB42169; Sun, 6 Jul 2003 15:20:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 57182-02; Sun, 6 Jul 2003 12:19:51 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 1A34FB42167; Sun, 6 Jul 2003 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.9/8.12.9) with ESMTP id h66FJPQ3009919; Sun, 6 Jul 2003 11:19:25 -0400 (EDT) To: Martin Foster Cc: Richard Huxton , PostgreSQL Novice , PostgreSQL Performance Subject: Re: [PERFORM] Extreme high load averages In-reply-to: <3F07FA98.70009@ethereal-realms.org> References: <3F07ABA1.2070100@ethereal-realms.org> <200307060849.00544.dev@archonet.com> <3F07FA98.70009@ethereal-realms.org> Comments: In-reply-to Martin Foster message dated "Sun, 06 Jul 2003 04:31:52 -0600" Date: Sun, 06 Jul 2003 11:19:25 -0400 Message-ID: <9918.1057504765@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/34 X-Sequence-Number: 7569 Martin Foster writes: >> The only time that I have ever seen load averages of 30 or more under >> OpenBSD is when one of my scripts goes wild. Note also that "high load average" is not per se an indication that anything is wrong. In Postgres, if you have thirty queries waiting for disk I/O, that's thirty processes --- so if that's the average state then the kernel will report a load average of thirty. While I'm no MySQL expert, I believe that the equivalent condition in MySQL would be thirty threads blocked for I/O within one process. Depending on how your kernel is written, that might show as a load average of one ... but the difference is completely illusory, because what counts is the number of disk I/Os in flight, and that's the same. You didn't say whether you were seeing any real performance problems, like slow queries or performance dropping when query load rises, but that is the aspect to concentrate on. I concur with the nearby recommendations to drop your resource settings. The thing you have to keep in mind about Postgres is that it likes to have a lot of physical RAM available for kernel disk buffers (disk cache). In a correctly tuned system that's been up for any length of time, "free memory" should be nearly nada, and the amount of RAM used for disk buffers should be sizable (50% or more of RAM would be good IMHO). regards, tom lane From pgsql-patches-owner@postgresql.org Sun Jul 6 12:26:15 2003 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 2DA35B42169; Sun, 6 Jul 2003 15:26:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 51044-09; Sun, 6 Jul 2003 12:25:40 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id B0BB6B42166; Sun, 6 Jul 2003 12:25:39 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h66FPSQ3009958; Sun, 6 Jul 2003 11:25:28 -0400 (EDT) To: Shridhar Daithankar Cc: pgsql-patches@postgresql.org, pgsql-performance@postgresql.org Subject: Re: Another POC initdb patch In-reply-to: <200307061940.32831.shridhar_daithankar@nospam.persistent.co.in> References: <200307061940.32831.shridhar_daithankar@nospam.persistent.co.in> Comments: In-reply-to Shridhar Daithankar message dated "Sun, 06 Jul 2003 19:40:32 +0530" Date: Sun, 06 Jul 2003 11:25:28 -0400 Message-ID: <9957.1057505128@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/27 X-Sequence-Number: 7614 Shridhar Daithankar writes: > In addition to Tom's patch, this patch asks tuning parameters right away, > while doing initdb. Sorry, there is zero chance of putting any interactivity into initdb. Most RPM installations run it from the RPM install script and would be unable to cope with this. I disagree with the concept of expecting someone to supply useful values at install time anyway, since a newbie is the *least* likely to have any idea what to say at that time. Heck, the experts can hardly agree on what to use ... regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jul 6 17:16:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0AEC6B42166 for ; Sun, 6 Jul 2003 20:16:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 32773-10 for ; Sun, 6 Jul 2003 17:16:46 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 30453B42002 for ; Sun, 6 Jul 2003 17:16:46 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h66KGdPu010074; Sun, 6 Jul 2003 14:16:39 -0600 (MDT) Message-ID: <3F0883A5.5020301@ethereal-realms.org> Date: Sun, 06 Jul 2003 14:16:37 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Shridhar Daithankar , ostgresql Performance Subject: Re: Extreme high load averages References: <3F083CCA.31144.7468C@localhost> <3F07F94D.50406@ethereal-realms.org> <200307061604.48919.shridhar_daithankar@nospam.persistent.co.in> In-Reply-To: <200307061604.48919.shridhar_daithankar@nospam.persistent.co.in> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/116 X-Sequence-Number: 2409 Shridhar Daithankar wrote: > > It gives hint to psotgresql how much file system cache is available in the > system. > > You have 1GB memory and your application requirement does not exceed 400MB. So > OS can use roughly 600MB for file system cache. In that case you can set this > parameter to 400MB cache to leave room for other application in FS cache. > > IIRC, BSD needs sysctl tuning to make more memory available for FS cache other > wise they max out at 300MB. > > Roughly this setting should be (total memory -application > requirement)*(0.7/0.8) > > I guess that high kernel load you are seeing due to increased interaction > between postgresql and OS when data is swapped to/fro in shared memory. If OS > cache does well, postgresql should reduce this interaction as well. > > > BTW, since you have IDE disks, heavy disk activity can eat CPU as well. Is > your disk bandwidth totally maxed out? Check with vmstat or whatever > equivalent you have on BSD. > > Shridhar > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org I changed the value of effective_cache_size seems interesting to 512. The database restarted without any problems and load averages seem to be a bit lower as a result. Since people have been asking for it, I added in most of the stat command outputs that I could think of. All located below my signature block, this will show you what roughly 127 client connections with Postgre will generate. The numbers are a lot nicer to see then a 30 load level. Note, that the high number of connections is a side effect of connection pooling under Apache using Apache::DBI. This means that for every client on the http server there is a connection to Postgres even if the connection is idle. The above may be a factor of performance as well. As I had noticed that with an idle child setting being too high, that server would show very high load averages as well. Probably an indication that the system is continually forking new children trying to just keep the idle child count at the right level. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org vmstat: 2:09PM up 16:45, 1 user, load averages: 0.36, 0.30, 0.35 vmstat: procs memory r b w avm fre 1 0 0 234036 687548 page flt re pi po fr sr 621 0 0 0 0 0 faults cpu in sy cs us sy id 364 396 88 19 1 79 iostat: tty wd0 wd1 cpu tin tout KB/t t/s MB/s KB/t t/s MB/s us ni sy in id 0 1023 4.53 1 0.01 9.72 11 0.10 19 0 1 0 79 pstat -s: Device 512-blocks Used Avail Capacity Priority swap_device 4194288 0 4194288 0% 0 top header: load averages: 0.31, 0.35, 0.42 147 processes: 2 running, 145 idle CPU states: 32.9% user, 0.0% nice, 0.9% system, 0.0% interrupt, 66.2% idle Memory: Real: 263M/377M act/tot Free: 630M Swap: 0K/2048M used/tot ps -uax: USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND postgres 1561 0.0 0.5 2120 4812 p0 I 1:48PM 0:00.10 /usr/local/bin/postmaster (postgres) postgres 9935 0.0 2.8 3832 29744 p0 I 1:48PM 0:00.74 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 7436 0.0 0.6 3640 6636 p0 S 1:48PM 0:00.92 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 18814 0.0 7.0 3876 72904 p0 I 1:48PM 0:04.53 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 15346 0.0 4.1 3820 42468 p0 I 1:48PM 0:00.93 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 13621 0.0 6.9 3832 71824 p0 I 1:48PM 0:02.66 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 20916 0.0 4.7 3812 49164 p0 I 1:48PM 0:00.59 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 21684 0.0 2.2 3688 23356 p0 S 1:48PM 0:01.27 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 19472 0.0 6.9 3824 72452 p0 I 1:48PM 0:02.61 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 27361 0.0 0.7 3664 6976 p0 S 1:48PM 0:00.91 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 28925 0.0 2.8 3840 29528 p0 I 1:48PM 0:00.46 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 12790 0.0 2.7 3800 28080 p0 I 1:48PM 0:01.11 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 13957 0.0 6.8 3820 71476 p0 I 1:48PM 0:02.26 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 29129 0.0 2.8 3828 29096 p0 I 1:48PM 0:01.50 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 24279 0.0 2.7 3824 27992 p0 S 1:48PM 0:01.08 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 20382 0.0 0.6 3640 6748 p0 S 1:48PM 0:00.91 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 28258 0.0 6.9 3872 71912 p0 S 1:48PM 0:03.01 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 16961 0.0 0.6 3664 6612 p0 S 1:48PM 0:00.96 postmaster: ethereal ethereal 192.168.1.6 idle in tra postgres 8599 0.0 0.6 3664 6656 p0 S 1:48PM 0:00.90 postmaster: ethereal ethereal 192.168.1.6 idle in tra From pgsql-novice-owner@postgresql.org Sun Jul 6 17:29:26 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 56BE3B42166; Sun, 6 Jul 2003 20:29:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 36393-06; Sun, 6 Jul 2003 17:28:49 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id E8B35B42002; Sun, 6 Jul 2003 17:28:48 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h66KSnPu008566; Sun, 6 Jul 2003 14:28:50 -0600 (MDT) Message-ID: <3F088680.5070109@ethereal-realms.org> Date: Sun, 06 Jul 2003 14:28:48 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane , PostgreSQL Novice , PostgreSQL Performance Subject: Re: [PERFORM] Extreme high load averages References: <3F07ABA1.2070100@ethereal-realms.org> <200307060849.00544.dev@archonet.com> <3F07FA98.70009@ethereal-realms.org> <9918.1057504765@sss.pgh.pa.us> In-Reply-To: <9918.1057504765@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-Archive-Number: 200307/37 X-Sequence-Number: 7572 Tom Lane wrote: > Martin Foster writes: > >>>The only time that I have ever seen load averages of 30 or more under >>>OpenBSD is when one of my scripts goes wild. > > > Note also that "high load average" is not per se an indication that > anything is wrong. In Postgres, if you have thirty queries waiting > for disk I/O, that's thirty processes --- so if that's the average > state then the kernel will report a load average of thirty. While > I'm no MySQL expert, I believe that the equivalent condition in MySQL > would be thirty threads blocked for I/O within one process. Depending > on how your kernel is written, that might show as a load average of > one ... but the difference is completely illusory, because what counts > is the number of disk I/Os in flight, and that's the same. > > You didn't say whether you were seeing any real performance problems, > like slow queries or performance dropping when query load rises, but > that is the aspect to concentrate on. > > I concur with the nearby recommendations to drop your resource settings. > The thing you have to keep in mind about Postgres is that it likes to > have a lot of physical RAM available for kernel disk buffers (disk > cache). In a correctly tuned system that's been up for any length of > time, "free memory" should be nearly nada, and the amount of RAM used > for disk buffers should be sizable (50% or more of RAM would be good > IMHO). > > regards, tom lane Under a circumstance where we have 250 concurrent users, MySQL would report an uptime of 0.5 sometimes 0.8 depending on the tasks being performed. This would translate to wait times averaging less then a second, and under a heavy resource script 4 seconds. That system had less RAM however. This new system when showing a load average of 30, produced wait times of 12 seconds averages and about 30 seconds for the heavy resource script. The web server itself showed a load average of 0.5 showing that it was not heavy client interaction slowing things down. So there is a very noticeable loss of performance when the system skyrockets like that. All of the load as indicated by top is at user level, and not swap is even touched. This may help show why I was slightly concerned. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Sun Jul 6 23:11:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 08CF6B43897 for ; Mon, 7 Jul 2003 02:11:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 32275-03 for ; Sun, 6 Jul 2003 23:11:13 -0300 (ADT) Received: from ms-smtp-01.tampabay.rr.com (ms-smtp-01.tampabay.rr.com [65.32.1.43]) by svr1.postgresql.org (Postfix) with ESMTP id D21FEB43368 for ; Sun, 6 Jul 2003 23:11:12 -0300 (ADT) Received: from mattspc (169-52.34-65.tampabay.rr.com [65.34.52.169]) by ms-smtp-01.tampabay.rr.com (8.12.5/8.12.5) with ESMTP id h672BGqM008512 for ; Sun, 6 Jul 2003 22:11:16 -0400 (EDT) From: "Matthew Nuzum" To: Subject: Re: Moving postgresql.conf tunables into 2003... Date: Sun, 6 Jul 2003 22:11:06 -0400 Organization: Bearfruit.org Message-ID: <006801c3442d$06b30b00$a322fea9@mattspc> 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 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-reply-to: <200307031938.15357.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/118 X-Sequence-Number: 2411 > > Brian Suggests: > > I'm curious how many of the configuration values can be determined > > automatically, or with the help of some script. It seem like there > > could be some perl script in contrib that could help figure this out. > > Possibly you are asked a bunch of questions and then the values are > > computed based on that. Something like: > > This would be great! Wanna be in charge of it? > Is there a to-do list for this kind of stuff? Maybe there could be a "help wanted" sign on the website. Seems like there are lot's of good ideas that fly around here but never get followed up on. Additionally, I have an increasingly large production database that I would be willing to do some test-cases on. I don't really know how to do it though... If someone where able to give instructions I could run tests on three different platforms. 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 Sun Jul 6 23:33:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 67BFAB42167 for ; Mon, 7 Jul 2003 02:33:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 36236-07 for ; Sun, 6 Jul 2003 23:33:19 -0300 (ADT) Received: from ms-smtp-01.tampabay.rr.com (ms-smtp-01.tampabay.rr.com [65.32.1.43]) by svr1.postgresql.org (Postfix) with ESMTP id 3F409B42001 for ; Sun, 6 Jul 2003 23:33:19 -0300 (ADT) Received: from mattspc (169-52.34-65.tampabay.rr.com [65.34.52.169]) by ms-smtp-01.tampabay.rr.com (8.12.5/8.12.5) with ESMTP id h672XNqM020538 for ; Sun, 6 Jul 2003 22:33:23 -0400 (EDT) From: "Matthew Nuzum" To: Subject: Re: Moving postgresql.conf tunables into 2003... Date: Sun, 6 Jul 2003 22:33:13 -0400 Organization: Bearfruit.org Message-ID: <006901c34430$1da72c80$a322fea9@mattspc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-reply-to: <20030705211256.GY72567@perrin.int.nxad.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/119 X-Sequence-Number: 2412 > > This sort of narrative belongs in the SGML docs, not in a CONF file. > > In fact, one could argue that we should take *all* commentary out of > > the CONF file in order to force people to read the docs. >=20 > The SGML docs aren't in the DBA's face and are way out of the way for > DBAs rolling out a new system or who are tuning the system. SGML =3D=3D > Developer, conf =3D=3D DBA. >=20 > > Database performance tuning will always be a "black art," as it > > necessitates a broad knowledge of PostgreSQL, OS architecture, and > > computer hardware. So I doubt that we can post docs that would > > allow any 10% time DBA to make PostgreSQL "fly", but hopefully over > > the next year we can make enough knowledge public to allow anyone to > > make PostgreSQL "sprint". >=20 > I'm highly resistant to/disappointed in this attitude and firmly > believe that there are well understood algorithms that DBAs use to > diagnose and solve performance problems. It's only a black art > because it hasn't been documented. Performance tuning isn't voodoo, > it's adjusting constraints to align with the execution of applications > and we know what the applications do, therefore the database can mold > to the applications' needs.=20=20 I agree. We often seem to forget simple lessons in human nature. Expecting someone to spend 20 extra seconds to do something is often too much. In many cases, the only "manual" that a person will see is the .conf files. At the very least, if there is good documentation for these parameters, maybe the conf file should provide a link to this info.=20 About the documentation... The few times I've tried reading these sections of the docs it was like reading a dictionary. Bruce's book is a much better writing style because it starts out with a basic concept and then expands on it, sometimes several times until a thorough (but not exhaustive) example has been given. The exhaustive material in the docs is good when you know what you're looking for, and therefore is a critical piece of reference work. I don't want to belittle the authors of that material in any way. An illustration of this would be to compare the O'Reilly "... Nutshell" book series to something like the [fictitious] book "Learn PostgreSQL in 24 hours". To close this message, I would just like to add that one of the most successful open source projects of all time could be used as an example. The Apache httpd project is one of the few open source projects in wide spread use that holds more market share than all competing products combined. It uses a three phase (if not more) documentation level. The .conf file contains detailed instructions in an easy to read and not-to-jargon-ish structure. The docs provide detailed tutorials and papers that expand on configuration params in an easy to read format. Both of these refer to the thorough reference manual that breaks each possible option down into it's nitty gritty details so that a user can get more information if they so desire. 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 Mon Jul 7 00:19:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 395F9B42167 for ; Mon, 7 Jul 2003 03:11:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 43397-10 for ; Mon, 7 Jul 2003 00:11:23 -0300 (ADT) Received: from server1.techplant.com (unknown [209.61.173.33]) by svr1.postgresql.org (Postfix) with ESMTP id 62503B42001 for ; Mon, 7 Jul 2003 00:11:23 -0300 (ADT) Received: from localhost (michael@localhost) by server1.techplant.com (8.11.6/8.11.6) with ESMTP id h673D7J13300 for ; Sun, 6 Jul 2003 23:13:07 -0400 Date: Sun, 6 Jul 2003 23:13:07 -0400 (EDT) From: Michael Pohl X-X-Sender: michael@server1.techplant.com To: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-Reply-To: <006901c34430$1da72c80$a322fea9@mattspc> Message-ID: X-Mailkey: j9dfjk23j4dkq MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/120 X-Sequence-Number: 2413 On Sun, 6 Jul 2003, Matthew Nuzum wrote: > At the very least, if there is good documentation for these parameters, > maybe the conf file should provide a link to this info. I believe that is what Josh is proposing: http://archives.postgresql.org/pgsql-performance/2003-07/msg00102.php > [Apache httpd] uses a three phase (if not more) documentation level. > The .conf file contains detailed instructions in an easy to read and > not-to-jargon-ish structure. The docs provide detailed tutorials and > papers that expand on configuration params in an easy to read format. > Both of these refer to the thorough reference manual that breaks each > possible option down into it's nitty gritty details so that a user can > get more information if they so desire. I agree that Apache's approach is primo. Often the .conf comments are enough to jog my memory about a directive I haven't used for a while. Or the comments are enough to let me know I don't need a directive, or that I need to go to the manual and read more. I appreciate that. michael From pgsql-performance-owner@postgresql.org Mon Jul 7 00:55:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0F4ABB42002 for ; Mon, 7 Jul 2003 03:45:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 62352-09 for ; Mon, 7 Jul 2003 00:45:22 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id E526AB42001 for ; Mon, 7 Jul 2003 00:45:21 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h673gnPu024255; Sun, 6 Jul 2003 21:42:49 -0600 (MDT) Message-ID: <3F08EC37.6020303@ethereal-realms.org> Date: Sun, 06 Jul 2003 21:42:47 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Pohl , PostgreSQL Performance Subject: Re: Moving postgresql.conf tunables into 2003... 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-Archive-Number: 200307/121 X-Sequence-Number: 2414 Michael Pohl wrote: > On Sun, 6 Jul 2003, Matthew Nuzum wrote: > > >>At the very least, if there is good documentation for these parameters, >>maybe the conf file should provide a link to this info. > > > I believe that is what Josh is proposing: > > http://archives.postgresql.org/pgsql-performance/2003-07/msg00102.php > > >>[Apache httpd] uses a three phase (if not more) documentation level. >>The .conf file contains detailed instructions in an easy to read and >>not-to-jargon-ish structure. The docs provide detailed tutorials and >>papers that expand on configuration params in an easy to read format. >>Both of these refer to the thorough reference manual that breaks each >>possible option down into it's nitty gritty details so that a user can >>get more information if they so desire. > > > I agree that Apache's approach is primo. Often the .conf comments are > enough to jog my memory about a directive I haven't used for a while. Or > the comments are enough to let me know I don't need a directive, or that I > need to go to the manual and read more. I appreciate that. > > michael > One thing that may also help, is to include more sample .conf files. For example, you could include settings that would be commonly seen for decicated databases with generic specs and another with less resources and not dedicated for use with Postgres. This would allow users to see how certain setting changes will work. The default .conf is great if you want to setup a small test bed, but for a real life example chances are it won't exactly be what your looking for. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-novice-owner@postgresql.org Mon Jul 7 01:24:59 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 55634B42311; Mon, 7 Jul 2003 04:24:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 80110-02; Mon, 7 Jul 2003 01:24:05 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 6413FB42002; Mon, 7 Jul 2003 01:24:04 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h674LVPu015072; Sun, 6 Jul 2003 22:21:32 -0600 (MDT) Message-ID: <3F08F549.3040206@ethereal-realms.org> Date: Sun, 06 Jul 2003 22:21:29 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard Huxton Cc: PostgreSQL Novice , PostgreSQL Performance Subject: Re: [PERFORM] Extreme high load averages References: <3F07ABA1.2070100@ethereal-realms.org> <200307060849.00544.dev@archonet.com> In-Reply-To: <200307060849.00544.dev@archonet.com> Content-Type: multipart/mixed; boundary="------------030901050806080603070002" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/38 X-Sequence-Number: 7573 This is a multi-part message in MIME format. --------------030901050806080603070002 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Richard Huxton wrote: > > I don't know the *BSDs myself, but do you have the equivalent of iostat/vmstat > output you could get for us? Also a snapshot of "top" output? People are > going to want to see: > - overall memory usage (free/buffers/cache/swap) > - memory usage per process > - disk activity (blocks in/out) > I changed a bit of the scripting code to cut down on the weight of a query being run. This is the only thing in the entire system that would cause scripts to run at high processor times for extended lengths. With the corrections, postgres processes average more closely to < 1% then before. This is not stopping the system from getting high load averages. Attached, is an example of the site running at 160 users with very slow response rates (30 seconds for some scripts). According to top, and ps nothing is taking up all that processing time. The processor seems to be purposely sitting there twiddling it's thumbs. Which leads me to believe that perhaps the nice levels have to be changed on the server itself? And perhaps increase the file system buffer to cache files in memory instead of always fetching/writing them? Anyone more ideas? Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org --------------030901050806080603070002 Content-Type: text/plain; name="stats.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="stats.txt" --- top --- load averages: 5.00, 4.72, 3.75 21:45:56 134 processes: 6 running, 128 idle CPU states: 91.7% user, 0.0% nice, 6.6% system, 1.6% interrupt, 0.2% idle Memory: Real: 279M/390M act/tot Free: 617M Swap: 0K/2048M used/tot PID USERNAME PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND 23235 postgres 64 0 12M 95M run - 0:02 9.42% postgres 5299 postgres 64 0 3872K 57M run - 0:01 5.86% postgres 8933 postgres 64 0 3408K 55M run - 0:01 5.47% postgres 16398 postgres 2 0 3776K 17M sleep netio 0:02 0.05% postgres 14007 named 2 0 2528K 2572K sleep select 0:06 0.00% named 3684 postgres 2 0 2120K 4812K sleep select 0:07 0.00% postgres 23518 postgres 2 0 3664K 36M sleep netio 0:03 0.00% postgres 571 postgres 2 0 3776K 51M sleep netio 0:03 0.00% postgres 11159 postgres 2 0 3664K 35M sleep netio 0:03 0.00% postgres 19184 postgres 2 0 3776K 16M sleep netio 0:03 0.00% postgres 28931 postgres 2 0 3712K 16M sleep netio 0:02 0.00% postgres 17523 postgres 2 0 3712K 14M sleep netio 0:02 0.00% postgres 8272 postgres 2 0 3712K 14M sleep netio 0:02 0.00% postgres 12034 postgres 2 0 3712K 14M sleep netio 0:02 0.00% postgres 30825 postgres 2 0 3776K 17M sleep netio 0:02 0.00% postgres 29173 postgres 2 0 3712K 15M sleep netio 0:02 0.00% postgres 9472 postgres 2 0 3664K 34M sleep netio 0:02 0.00% postgres 11542 postgres 2 0 3776K 16M sleep netio 0:02 0.00% postgres --- vmstat --- procs memory page disks faults cpu r b w avm fre flt re pi po fr sr wd0 wd1 in sy cs us sy id 1 0 0 275352 642800 8173 0 0 0 0 0 18 21 534 853 243 50 5 45 --- iostat --- tty wd0 wd1 cpu tin tout KB/t t/s MB/s KB/t t/s MB/s us ni sy in id 0 74 13.00 18 0.23 10.08 21 0.21 50 0 4 1 45 --- pstat -s --- Device 512-blocks Used Avail Capacity Priority swap_device 4194288 0 4194288 0% 0 --- dmesg --- OpenBSD 3.3-stable (compile) #2: Sat Jul 5 15:17:30 MDT 2003 martin@carme:/usr/src/sys/arch/i386/compile cpu0: Intel Pentium III (Coppermine) ("GenuineIntel" 686-class) 1 GHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SYS,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SIMD real mem = 1073250304 (1048096K) avail mem = 992940032 (969668K) using 4278 buffers containing 53764096 bytes (52504K) of memory mainbus0 (root) bios0 at mainbus0: AT/286+(a1) BIOS, date 07/20/01, BIOS32 rev. 0 @ 0xf0b20 apm0 at bios0: Power Management spec V1.2 apm0: AC on, battery charge unknown pcibios0 at bios0: rev. 2.1 @ 0xf0000/0x1382 pcibios0: PCI IRQ Routing Table rev. 1.0 @ 0xf12d0/176 (9 entries) pcibios0: PCI Interrupt Router at 000:04:0 ("VIA VT82C586 PCI-ISA" rev 0x00) pcibios0: PCI bus #1 is the last bus bios0: ROM list: 0xc0000/0x8000 0xc8000/0x1800 pci0 at mainbus0 bus 0: configuration mode 1 (no bios) pchb0 at pci0 dev 0 function 0 "VIA VT82C691 Host-PCI" rev 0xc4 ppb0 at pci0 dev 1 function 0 "VIA VT82C598 PCI-AGP" rev 0x00 pci1 at ppb0 bus 1 vga1 at pci1 dev 0 function 0 "NVidia/SGS-Thomson Velocity128" rev 0x22 wsdisplay0 at vga1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) pcib0 at pci0 dev 4 function 0 "VIA VT82C686 PCI-ISA" rev 0x40 pciide0 at pci0 dev 4 function 1 "VIA VT82C571 IDE" rev 0x06: ATA100, channel 0 configured to compatibility, channel 1 configured to compatibility wd0 at pciide0 channel 0 drive 0: wd0: 16-sector PIO, LBA, 19546MB, 16383 cyl, 16 head, 63 sec, 40031712 sectors wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 5 wd1 at pciide0 channel 1 drive 0: wd1: 16-sector PIO, LBA, 19546MB, 16383 cyl, 16 head, 63 sec, 40031712 sectors atapiscsi0 at pciide0 channel 1 drive 1 scsibus0 at atapiscsi0: 2 targets scsibus0 targ 0 lun 0: SCSI0 5/cdrom removable not configured wd1(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 4 atapiscsi0(pciide0:1:1): using PIO mode 4, DMA mode 2 "VIA VT82C686 SMBus" rev 0x40 at pci0 dev 4 function 4 not configured fxp0 at pci0 dev 10 function 0 "Intel 82557" rev 0x0c: irq 11, address 00:02:b3:8c:4f:db inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 4 isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 pckbd0 at pckbc0 (kbd slot) pckbc0: using irq 1 for kbd slot wskbd0 at pckbd0: console keyboard, using wsdisplay0 pcppi0 at isa0 port 0x61 sysbeep0 at pcppi0 npx0 at isa0 port 0xf0/16: using exception 16 biomask c000 netmask c800 ttymask c802 pctr: 686-class user-level performance counters enabled mtrr: Pentium Pro MTRR support dkcsum: wd0 matched BIOS disk 80 dkcsum: wd1 matched BIOS disk 81 root on wd0a rootdev=0x0 rrootdev=0x300 rawdev=0x302 --------------030901050806080603070002-- From pgsql-patches-owner@postgresql.org Mon Jul 7 03:47:39 2003 X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C8A89B4241A for ; Mon, 7 Jul 2003 06:47:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 18820-08 for ; Mon, 7 Jul 2003 03:47:05 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 1BA22B4276B for ; Mon, 7 Jul 2003 03:47:04 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h676m758002617 for ; Mon, 7 Jul 2003 12:18:07 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h676m78B002579 for ; Mon, 7 Jul 2003 12:18:07 +0530 From: Shridhar Daithankar To: pgsql-patches@postgresql.org Subject: Re: Another POC initdb patch Date: Mon, 7 Jul 2003 12:15:59 +0530 User-Agent: KMail/1.5.2 References: <200307061940.32831.shridhar_daithankar@nospam.persistent.co.in> <9957.1057505128@sss.pgh.pa.us> In-Reply-To: <9957.1057505128@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: <200307071215.59227.shridhar_daithankar@nospam.persistent.co.in> X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/31 X-Sequence-Number: 7618 On Sunday 06 July 2003 20:55, Tom Lane wrote: > Shridhar Daithankar writes: > > In addition to Tom's patch, this patch asks tuning parameters right away, > > while doing initdb. > > Sorry, there is zero chance of putting any interactivity into initdb. > Most RPM installations run it from the RPM install script and would be > unable to cope with this. Hmm.. If distro. vendors can put a wrapper of service script around it on their own, how much difficult it is to modify initdb to revert back to original behaviour? I think it would be fair on linux distro. vendors part if they decide to put a reasonable default for shared_buffers. Unlike postgresql community, they don't haev to worry about OS protability because they know that it is going to run on only linux. I mailed mandrake long time back, requesting a config file for service script where it would allow to specify database location. No reply. > I disagree with the concept of expecting someone to supply useful values > at install time anyway, since a newbie is the *least* likely to have any > idea what to say at that time. Heck, the experts can hardly agree on > what to use ... Whatever user says might not be the best or optimum but will be likely to be much better than 64. I agree that this is not part of rpm philosophy. Install and configure is only followed by debian IIRC. Furthermore this could take care of user complains that postgresql does not have reasonable defaults. Problems with such approach w.r.t. linux distro.s aren't exactly impossible to solve. May be we could add it to release notes, for their convinience. Another proposal is to take out everything interactive I put it in patch, write another shell script, that would tune postgresql.conf, like the configuration wizard you suggested. No matter where it goes, users would be very happy to have a tool which hand holds them to a reasonanly working config file and points to right documentation thereafter. Shridhar From pgsql-performance-owner@postgresql.org Mon Jul 7 04:20:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AC386B427D7 for ; Mon, 7 Jul 2003 07:20:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 36341-05 for ; Mon, 7 Jul 2003 04:19:38 -0300 (ADT) Received: from mail.blarg.net (zoot.blarg.net [206.124.128.9]) by svr1.postgresql.org (Postfix) with ESMTP id 7367EB42168 for ; Mon, 7 Jul 2003 04:19:33 -0300 (ADT) Received: from poindextrose.org (poindextrose.org [206.124.144.246]) by mail.blarg.net (Postfix) with ESMTP id EA2DE33B08 for ; Mon, 7 Jul 2003 00:19:33 -0700 (PDT) Date: Mon, 7 Jul 2003 00:19:33 -0700 Subject: Re: Moving postgresql.conf tunables into 2003... Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) From: Matthew Hixson To: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit In-Reply-To: <20030703232535.GT72567@perrin.int.nxad.com> Message-Id: <5B88D580-B04B-11D7-96EE-000393669C1A@poindextrose.org> X-Mailer: Apple Mail (2.552) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/123 X-Sequence-Number: 2416 Why couldn't Postgres learn for itself what the optimal performance settings would be? The easy one seems to be the effective_cache_size. Top shows us this information. Couldn't Postgres read that value from the same place top reads it instead of relying on a config file value? Seems like it could even adjust to changing conditions as the cache size changes. Wouldn't it be great to set a single parameter in postgresql.conf like: learn = on This would make Postgres run the same queries multiple times with different settings, trying to find the ones that made the query run the fastest. Obviously you wouldn't want this on all the time because Postgres would be doing more work than it needs to satisfy the applications that are asking it for data. You'd leave it running like this for as long as you think it would need to get a sampling of real world use for your specific application. Something like this could automagically adapt to load, hardware, schema, and operating system. If you drop another 1GB of RAM into the machine, just turn the learning option on and let Postgres tune itself again. -M@ On Thursday, July 3, 2003, at 04:25 PM, Sean Chittenden wrote: >> I'm curious how many of the configuration values can be determined >> automatically, or with the help of some script. It seem like there >> could be some perl script in contrib that could help figure this out. >> Possibly you are asked a bunch of questions and then the values are >> computed based on that. Something like: >> >> How many tables will the system have? >> How much memory will be available to the postmaster? >> How many backends will there typically be? >> What is the avg seek time of the drive? >> What's the transfer rate of the drive? >> >> Seems to me that a lot of reasonable default values can be figure out >> from these basic questions. FSM settings, Sort Mem, Random Page Cost, >> Effective Cache Size, Shared Memor, etc, etc. > > Someone was working on a thing called pg_autotune or some such program > that'd do exactly what you're thinking of. > > http://archives.postgresql.org/pgsql-performance/2002-10/msg00101.php > http://gborg.postgresql.org/project/pgautotune/projdisplay.php > > > -- > Sean Chittenden > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend > From pgsql-novice-owner@postgresql.org Thu Jul 10 00:42:46 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 62707B427D7; Mon, 7 Jul 2003 09:09:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 84913-05; Mon, 7 Jul 2003 06:08:50 -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 4BF64B42167; Mon, 7 Jul 2003 06:08:49 -0300 (ADT) Received: from localhost (db@localhost) by zigo.dhs.org (8.11.6/8.11.6) with ESMTP id h6797FG32009; Mon, 7 Jul 2003 11:07:16 +0200 Date: Mon, 7 Jul 2003 11:07:15 +0200 (CEST) From: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= To: Martin Foster Cc: Richard Huxton , PostgreSQL Novice , PostgreSQL Performance Subject: Re: [PERFORM] Extreme high load averages In-Reply-To: <3F08F549.3040206@ethereal-realms.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/77 X-Sequence-Number: 7612 On Sun, 6 Jul 2003, Martin Foster wrote: > The processor seems to be purposely sitting there twiddling it's thumbs. > Which leads me to believe that perhaps the nice levels have to be > changed on the server itself? It could also be all the usual things that affect performance. Are your queries using indexes where it should? Do you vacuum analyze after you have updated/inserted a lot of data? It could be that some of your queries is not as efficient as it should, like doing a sequenctial scan over a table instead of an index scan. That translates into more IO needed and slower response times. Especially when you have more connections figthing for the available IO. -- /Dennis From pgsql-performance-owner@postgresql.org Mon Jul 7 06:23:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 983EAB438B1 for ; Mon, 7 Jul 2003 09:23:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 92222-03 for ; Mon, 7 Jul 2003 06:22:50 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id F2C9AB427D7 for ; Mon, 7 Jul 2003 06:22:39 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19ZSCd-0006JF-00 for ; Mon, 07 Jul 2003 05:22:31 -0400 Received: by dba2 (Postfix, from userid 1019) id AB01AD75A; Mon, 7 Jul 2003 05:22:52 -0400 (EDT) Date: Mon, 7 Jul 2003 05:22:52 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030707092252.GB10293@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030703190502.GR72567@perrin.int.nxad.com> <200307031938.15357.josh@agliodbs.com> <20030705211256.GY72567@perrin.int.nxad.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030705211256.GY72567@perrin.int.nxad.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/125 X-Sequence-Number: 2418 On Sat, Jul 05, 2003 at 02:12:56PM -0700, Sean Chittenden wrote: > The SGML docs aren't in the DBA's face and are way out of the way for > DBAs rolling out a new system or who are tuning the system. SGML == > Developer, conf == DBA. I could not disagree more. I'd say more like, if the dba won't read the manual, get yourself a real dba. Sorry, but so-called professionals who won't learn their tools have no home in my shop. Recently, someone pointed out to me that there _was_ a deficiency in the docs -- one I thought was not there. And in that case, I was more than willing to be chastised. But claiming that inadequate comments in the config file are the only things dbas will lok at, well, frankly, I'm offended. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Jul 7 10:13:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0CF95B43183 for ; Mon, 7 Jul 2003 13:12:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 60069-09 for ; Mon, 7 Jul 2003 10:11:37 -0300 (ADT) Received: from ms-smtp-01.tampabay.rr.com (ms-smtp-01.tampabay.rr.com [65.32.1.43]) by svr1.postgresql.org (Postfix) with ESMTP id B0294B430D3 for ; Mon, 7 Jul 2003 10:11:36 -0300 (ADT) Received: from mattspc (169-52.34-65.tampabay.rr.com [65.34.52.169]) by ms-smtp-01.tampabay.rr.com (8.12.5/8.12.5) with ESMTP id h67DBdqM008395; Mon, 7 Jul 2003 09:11:39 -0400 (EDT) From: "Matthew Nuzum" To: "'Andrew Sullivan'" , Subject: Re: Moving postgresql.conf tunables into 2003... Date: Mon, 7 Jul 2003 09:11:39 -0400 Organization: Bearfruit.org Message-ID: <008301c34489$4dbf0b00$a322fea9@mattspc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-reply-to: <20030707092252.GB10293@libertyrms.info> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/126 X-Sequence-Number: 2419 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- > owner@postgresql.org] On Behalf Of Andrew Sullivan > Sent: Monday, July 07, 2003 5:23 AM > To: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Moving postgresql.conf tunables into 2003... >=20 > On Sat, Jul 05, 2003 at 02:12:56PM -0700, Sean Chittenden wrote: > > The SGML docs aren't in the DBA's face and are way out of the way for > > DBAs rolling out a new system or who are tuning the system. SGML =3D= =3D > > Developer, conf =3D=3D DBA. >=20 > I could not disagree more. I'd say more like, if the dba won't read > the manual, get yourself a real dba. Sorry, but so-called > professionals who won't learn their tools have no home in my shop. >=20 I don' want to come off confrontational, so please don't take this as an attack. Are you willing to say that the PostgreSQL database system should only be used by DBAs? I believe that Postgres is such a good and useful tool that anyone should be able to start using it with little or no barrier to entry. I don't believe I'm alone in this opinion either. As a matter of fact, this philosophy is being adopted by many in the software industry. Note that Linux and many other OSs that act as servers are being made more secure and easier to use __out of the box__ so that a person can simply install from cd and start using the tool with out too much difficulty. Maybe your definition of "dba" is broader than mine and what you mean is, "someone who installs a postgres database". Also, by manual, are you referring to the 213 page Administration guide, or are you talking about the 340 page Reference Manual? Let us rephrase your statement like this: "If the [person who installs a postgres database] won't read the [340 page reference] manual, then that person should go find a different database to use." I think that the postgres installation procedure, .conf files and documentation can be modified in such a way that a newbie (we were all newbies once) can have a good "out of box experience" with little effort. That means they can __quickly__ get a __good performing__ database up and running with __little effort__ and without needing to subscribe to a mailing list or read a book. I have seen software projects that have what I call an "elitist" attitude; meaning they expect you to be an expert or dedicated to their software in order to use it. Invariably this mentality stifles the usefulness of the product. It seems that there is a relative minority of people on this list who feel that you have to be "elite" in order to have a good working postgres installation. I don't feel that should be a requirement or even a consideration. 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 Mon Jul 7 10:23:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 28E14B43848 for ; Mon, 7 Jul 2003 13:23:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 71554-02 for ; Mon, 7 Jul 2003 10:23:39 -0300 (ADT) Received: from mwinf0402.wanadoo.fr (smtp5.wanadoo.fr [193.252.22.27]) by svr1.postgresql.org (Postfix) with ESMTP id C0D38B438AC for ; Mon, 7 Jul 2003 10:23:35 -0300 (ADT) Received: from Paris (ABoulogne-110-1-3-50.w80-15.abo.wanadoo.fr [80.15.41.50]) by mwinf0402.wanadoo.fr (SMTP Server) with ESMTP id 5982B8000B4 for ; Mon, 7 Jul 2003 15:23:38 +0200 (CEST) Reply-To: From: "Michael Mattox" To: Subject: Re: Moving postgresql.conf tunables into 2003... Date: Mon, 7 Jul 2003 15:23:40 +0200 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <008301c34489$4dbf0b00$a322fea9@mattspc> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/127 X-Sequence-Number: 2420 > Are you willing to say that the PostgreSQL database system should only be > used by DBAs? I believe that Postgres is such a good and useful tool that > anyone should be able to start using it with little or no barrier > to entry. This is a good point. After reading previous responses I was starting to feel like the only non-DBA Postgres user on this list. I'm a java architect/developer and until recently I knew very little about databases. I just learned what an index was while trying to tune Postgres. I imagine some of you are even laughing reading this but it's true. In Java land, the O/R mapping tools are getting so good that you don't have to be a database expert to use the database. I'm using JDO which generates my database tables and indexes automatically. But you do need to learn about the database in order to increase performance and optimize the settings. I'm sure I'm not the only developer who is overwhelmed by the Postgres documentation and configuration files. Regards, Michael From pgsql-performance-owner@postgresql.org Mon Jul 7 10:31:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A50AFB43175 for ; Mon, 7 Jul 2003 13:31:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 72205-03 for ; Mon, 7 Jul 2003 10:31:02 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 968F8B435BB for ; Mon, 7 Jul 2003 10:30:51 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h67DUhQ3019042; Mon, 7 Jul 2003 09:30:43 -0400 (EDT) To: "Matthew Nuzum" Cc: "'Andrew Sullivan'" , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... In-reply-to: <008301c34489$4dbf0b00$a322fea9@mattspc> References: <008301c34489$4dbf0b00$a322fea9@mattspc> Comments: In-reply-to "Matthew Nuzum" message dated "Mon, 07 Jul 2003 09:11:39 -0400" Date: Mon, 07 Jul 2003 09:30:43 -0400 Message-ID: <19041.1057584643@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/128 X-Sequence-Number: 2421 "Matthew Nuzum" writes: > Are you willing to say that the PostgreSQL database system should only be > used by DBAs? I believe that Postgres is such a good and useful tool that > anyone should be able to start using it with little or no barrier to entry. I quite agree. But there is a difference between saying "you should get decent performance with no effort" and "you should get optimal performance with no effort". I think we can get to the first with relatively little trouble (like boosting the default shared_buffers to 1000), but the second is an impractical goal. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 7 11:18:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id EE1C8B43175 for ; Mon, 7 Jul 2003 14:17:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 91864-05 for ; Mon, 7 Jul 2003 11:17:35 -0300 (ADT) Received: from yapok.nexcerpt.com (mail.nexcerpt.com [64.147.202.2]) by svr1.postgresql.org (Postfix) with ESMTP id BC86EB43376 for ; Mon, 7 Jul 2003 11:17:33 -0300 (ADT) Received: from takin.private.nexcerpt.com (zorro.nexcerpt.com [64.147.202.1]) by yapok.nexcerpt.com (8.11.6/8.11.6) with ESMTP id h67EHZ725991 for ; Mon, 7 Jul 2003 10:17:35 -0400 Subject: Optimizer differences between 7.2 and 7.3 From: Jeff Boes To: pgsql-performance@postgresql.org Content-Type: text/plain Organization: Nexcerpt, Inc. Message-Id: <1057587455.6466.26.camel@takin.private.nexcerpt.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 07 Jul 2003 10:17:35 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/129 X-Sequence-Number: 2422 Our production database is running under 7.2.4; our test database running almost the same data is at 7.3.3. One table has about 400,000 rows in each schema. A query against an indexed column uses an index scan under 7.2.4, but a sequential scan under 7.3.3. A count of the table in question shows that they have comparable numbers of matching rows. On 7.2.4: select count(*) from articles; count -------- 420213 select count(*) from articles where path_base like 'http://news.findlaw.com/hdocs%'; count ------- 38 (and it returns this nearly instantaneously) explain select count(*) from articles where path_base like 'http://news.findlaw.com/hdocs%' Aggregate (cost=6.02..6.02 rows=1 width=0) -> Index Scan using ix_articles_3 on articles (cost=0.00..6.01 rows=1 width=0) On 7.3.3: select count(*) from articles; count -------- 406319 select count(*) from articles where path_base like 'http://news.findlaw.com/hdocs%' count ------- 23 (and it takes many seconds to return) explain select count(*) from articles where path_base like 'http://news.findlaw.com/hdocs%' Aggregate (cost=205946.65..205946.65 rows=1 width=0) -> Seq Scan on articles (cost=0.00..205946.65 rows=1 width=0) Filter: (path_base ~~ 'http://news.findlaw.com/hdocs%'::text) I can't find any differences between the indexes (ix_articles_3 exists in both schemas); the column statistics are set up the same (the default); and the optimizer settings (costs in postgresql.conf) are the same. -- Jeff Boes vox 269.226.9550 ext 24 Database Engineer fax 269.349.9076 Nexcerpt, Inc. http://www.nexcerpt.com ...Nexcerpt... Extend your Expertise From pgsql-performance-owner@postgresql.org Mon Jul 7 11:40:47 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 484FBB4388E for ; Mon, 7 Jul 2003 14:40:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 00837-09 for ; Mon, 7 Jul 2003 11:40:34 -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 93678B4388B for ; Mon, 7 Jul 2003 11:40:33 -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 19ZXAM-000JPM-0V; Mon, 07 Jul 2003 15:40:31 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 9175D179CD; Mon, 7 Jul 2003 15:40:28 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id EA82F1716D; Mon, 7 Jul 2003 15:40:27 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Jeff Boes , pgsql-performance@postgresql.org Subject: Re: Optimizer differences between 7.2 and 7.3 Date: Mon, 7 Jul 2003 15:40:30 +0100 User-Agent: KMail/1.4.3 References: <1057587455.6466.26.camel@takin.private.nexcerpt.com> In-Reply-To: <1057587455.6466.26.camel@takin.private.nexcerpt.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307071540.30041.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/130 X-Sequence-Number: 2423 On Monday 07 Jul 2003 3:17 pm, Jeff Boes wrote: > Our production database is running under 7.2.4; our test database > running almost the same data is at 7.3.3. One table has about 400,000 > rows in each schema. A query against an indexed column uses an index > scan under 7.2.4, but a sequential scan under 7.3.3. A count of the > table in question shows that they have comparable numbers of matching > rows. [snip[ > select count(*) from articles > where path_base like 'http://news.findlaw.com/hdocs%'; > count > ------- > 38 [snip] > I can't find any differences between the indexes (ix_articles_3 exists > in both schemas); the column statistics are set up the same (the > default); and the optimizer settings (costs in postgresql.conf) are the > same. Check the locale the database was initdb'd to. You'll probably find 7.2.4 i= s=20 in the "C" locale whereas 7.3.3 isn't. The "like" comparison can only use= =20 indexes in the "C" locale. I believe you might need to initdb again to fix= =20 this. --=20 Richard Huxton From pgsql-performance-owner@postgresql.org Mon Jul 7 18:31:21 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 1D4F3B43A4B for ; Mon, 7 Jul 2003 21:31:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27833-05 for ; Mon, 7 Jul 2003 18:31:00 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 2181EB4316B for ; Mon, 7 Jul 2003 18:31:00 -0300 (ADT) Received: from mail.travelamericas.com (dsl231-059-037.sea1.dsl.speakeasy.net [216.231.59.37]) by www.postgresql.com (Postfix) with SMTP id 0473ECF6E47 for ; Mon, 7 Jul 2003 14:09:51 -0300 (ADT) Received: (qmail 25067 invoked from network); 7 Jul 2003 17:08:50 -0000 Received: from unknown (HELO travelamericas.com) (127.0.0.1) by localhost with SMTP; 7 Jul 2003 17:08:50 -0000 Message-ID: <3F09A922.2050409@travelamericas.com> Date: Mon, 07 Jul 2003 10:08:50 -0700 From: Chris Travers User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matthew Nuzum Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... References: <006901c34430$1da72c80$a322fea9@mattspc> In-Reply-To: <006901c34430$1da72c80$a322fea9@mattspc> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/136 X-Sequence-Number: 2429 Matthew Nuzum wrote: >>I'm highly resistant to/disappointed in this attitude and firmly >>believe that there are well understood algorithms that DBAs use to >>diagnose and solve performance problems. It's only a black art >>because it hasn't been documented. Performance tuning isn't voodoo, >>it's adjusting constraints to align with the execution of applications >>and we know what the applications do, therefore the database can mold >>to the applications' needs. >> >> > >I agree. > >We often seem to forget simple lessons in human nature. Expecting someone >to spend 20 extra seconds to do something is often too much. In many cases, >the only "manual" that a person will see is the .conf files. > > > In my opinion, a serious RDBMS system will *always* require the admin to be doing research in order to learn how to use it effectively. We are not talking about a word processor here. That being said, I think that a good part of the problem is that admins don't know where to look for the appropriate documentation and what is needed. Expecting someone to spend 20 seconds looking for a piece of info is not too bad, but expecting them to spend hours trying to figure out what info is relavent is not going to get us anywhere. For those who have been following the discussion relating to MySQL vs PostgreSQL, I think this is relavent here. MySQL does much of its tuning at compile time, and the MySQL team very carefully controls the build process for the various binary distriutions they offer. If you want to see a real mess, try compiling MySQL from source. Talk about having to read documentation on items which *should* be handled by the configure script. OTOH, PostgreSQL is optomized using configuration files and is tunable on the fly. This is, I think, a better approach but it needs to be better documented. Maybe a "Beginner's guide to database server tuning" or something like that. Secondly, documenting the tuning algorythms well my allow PostgreSQL to automatically tune itself to some extent or for the development of performance tuning tools for the server. This would be a big win for the project. Unfortunately I am not knowledgable on this topic to really do this subject justice. Best Wishes, Chris Travers From pgsql-performance-owner@postgresql.org Mon Jul 7 18:20:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 44CAEB438CA for ; Mon, 7 Jul 2003 21:18:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 23094-05 for ; Mon, 7 Jul 2003 18:17:48 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 2983FB43A81 for ; Mon, 7 Jul 2003 18:14:28 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id D96C4CF7566 for ; Mon, 7 Jul 2003 14:50:47 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h67HfpVG010440; Mon, 7 Jul 2003 11:41:52 -0600 (MDT) Date: Mon, 7 Jul 2003 11:35:24 -0600 (MDT) From: "scott.marlowe" To: Brian Tarbox Cc: , Rafal Kedziorski , Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <01b401c34229$dbab6100$01000001@trouble> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/135 X-Sequence-Number: 2428 On Fri, 4 Jul 2003, Brian Tarbox wrote: > I'm actually leaving this list but I can answer this question. Our results > were with a single user and we were running Inodb. We were running on > RedHat 8.0 / 9.0 with vanilla linux settings. Hi Brian, I just wanted to add that if you aren't testing your setup for multiple users, you are doing yourself a disservice. The performance of your app with one user is somewhat interesting, the performance of the system with a dozen or a hundred users is of paramount importance. A server that dies under heavy parallel load is useless, no matter how fast it ran when tested for one user. Conversely, one would prefer a server that was a little slow for single users but can hold up under load. When I first built my test box a few years ago, I tested postgresql / apache / php at 100 or more parallel users. That's where things start getting ugly, and you've got to test for it now, before you commit to a platform. Postgresql is designed to work on anything out of the box, which means it's not optimized for high performance, but for running on old Sparc 2s with 128 meg of ram. If you're going to test it against MySQL, be fair to yourself and performance tune them both before testing, they're performance on vanilla linux with vanilla configuration tuning teachs you little about how they'll behave in production on heavy iron. Good luck on your testing, and please, don't quit testing at the first sign one or the other is faster, be throrough and complete, including heavy parallel load testing with reads AND writes. Know the point at which each system begins to fail / become unresponsive, and how they behave in overload. From pgsql-advocacy-owner@postgresql.org Mon Jul 7 18:31:50 2003 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id BFAD4B43A62; Mon, 7 Jul 2003 21:31:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27843-08; Mon, 7 Jul 2003 18:31:35 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 5A977B439B8; Mon, 7 Jul 2003 18:31:05 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id 7FC90CF768A; Mon, 7 Jul 2003 15:15:23 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h67I6jVG012183; Mon, 7 Jul 2003 12:06:45 -0600 (MDT) Date: Mon, 7 Jul 2003 12:00:17 -0600 (MDT) From: "scott.marlowe" To: Josh Berkus Cc: Kaarel , , Subject: Re: About the default performance In-Reply-To: <200307040956.24420.josh@agliodbs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/42 X-Sequence-Number: 1566 I'm willing to help too. I'm basically a DBA / developer type, with mild C hacking skills (I develop in PHP, so my C coding is quite rusty nowadays.) If nothing else testing on different equipment / OSes. On Fri, 4 Jul 2003, Josh Berkus wrote: > Kaarel: > > (cross-posted back to Performance because I don't want to post twice on the > same topic) > > > The problem is that people often benchmark the so called vanilla > > installation of PostgreSQL. > > > I remember a discussion in the general list about having multiple > > default conf files to choose from. Ala low-end, average and high-end > > installations. A tool to read some system information and dynamically > > generating a proper configuration file was also mentioned. > > Yes. So far, only Justin, Kevin B., Shridhar and I have volunteered to do any > work on that task -- and all of us have been swamped with 7.4-related stuff. > > I would like to see, before the end of the year, some if not all of the stuff > that Kaarel is posting about. Obviously, my first task is to set up a > framework so that everyone can contribute to the project. > > > I'm not an expert of PostgreSQL by any means I have just been reading > > PostgreSQL email lists for only about a month or so. So I believe I have > > read that there is a auto-vacuum being worked on? In my opinion this > > should be included in the main installation by default. This is just the > > kind of job that a machine should do...when a big portion of data has > > changed do VACUUM ANALYCE automagically. > > > > Is these improvements actually being implemented and how far are they? > > The auto-vacuum daemon (pgavd) is finished. However, it will still require > the user to turn it on; we don't want to run potentially RAM-sucking > background processes without user invitiation. So obviously that needs to be > part of a comprehensive "quick start" guide. > > So, Kaarel .... you want to write the "quick start" guide for 7.4? All of > the detail material is available online, you mainly need to provide narrative > and links of the form of ... first, read this: , then do this ... > > > The technical side of these problems is not for this list of course. > > However the "side-effects" (reputation of being slow) of these problems > > direclty relate to advocacy and PostgreSQL popularity. Maybe these > > problems are already worked on or maybe I'm over exaggerating the > > situation but I do believe solving these issues would only benefit > > PostgreSQL. > > You're absolutely correct .... so let's do something about it. From my > perspective, the first step is improved docs, becuase we can have those out > by 7.4 release. > > From pgsql-performance-owner@postgresql.org Mon Jul 7 18:33:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0512DB439E5 for ; Mon, 7 Jul 2003 21:33:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 30988-09 for ; Mon, 7 Jul 2003 18:32:55 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 3ACFAB43A3D for ; Mon, 7 Jul 2003 18:31:10 -0300 (ADT) Received: from TheWorld.com (pcls2.std.com [199.172.62.104]) by www.postgresql.com (Postfix) with ESMTP id 2DAACCF7694 for ; Mon, 7 Jul 2003 15:15:54 -0300 (ADT) Received: from trouble (pool-151-203-213-193.bos.east.verizon.net [151.203.213.193]) by TheWorld.com (8.12.8p1/8.12.8) with SMTP id h67IEkx8028066; Mon, 7 Jul 2003 14:14:50 -0400 From: "Brian Tarbox" To: "scott.marlowe" , "Brian Tarbox" Cc: , "Rafal Kedziorski" , Subject: Re: PostgreSQL vs. MySQL Date: Mon, 7 Jul 2003 14:16:16 -0400 Message-ID: <000d01c344b3$db2add00$01000001@trouble> 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 IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/138 X-Sequence-Number: 2431 Oddly enough, the particular application in question will have an extremely small user base...perhaps a few simultainous users at most. As to the testing, I neglected to say early in this thread that my manager instructed me _not_ to do further performance testing...so as a good consultant I complied. I'm not going to touch if that was a smart instruction to give :-) Brian -----Original Message----- From: scott.marlowe [mailto:scott.marlowe@ihs.com] Sent: Monday, July 07, 2003 1:35 PM To: Brian Tarbox Cc: michael.mattox@verideon.com; Rafal Kedziorski; pgsql-performance@postgresql.org Subject: Re: [PERFORM] PostgreSQL vs. MySQL On Fri, 4 Jul 2003, Brian Tarbox wrote: > I'm actually leaving this list but I can answer this question. Our results > were with a single user and we were running Inodb. We were running on > RedHat 8.0 / 9.0 with vanilla linux settings. Hi Brian, I just wanted to add that if you aren't testing your setup for multiple users, you are doing yourself a disservice. The performance of your app with one user is somewhat interesting, the performance of the system with a dozen or a hundred users is of paramount importance. A server that dies under heavy parallel load is useless, no matter how fast it ran when tested for one user. Conversely, one would prefer a server that was a little slow for single users but can hold up under load. When I first built my test box a few years ago, I tested postgresql / apache / php at 100 or more parallel users. That's where things start getting ugly, and you've got to test for it now, before you commit to a platform. Postgresql is designed to work on anything out of the box, which means it's not optimized for high performance, but for running on old Sparc 2s with 128 meg of ram. If you're going to test it against MySQL, be fair to yourself and performance tune them both before testing, they're performance on vanilla linux with vanilla configuration tuning teachs you little about how they'll behave in production on heavy iron. Good luck on your testing, and please, don't quit testing at the first sign one or the other is faster, be throrough and complete, including heavy parallel load testing with reads AND writes. Know the point at which each system begins to fail / become unresponsive, and how they behave in overload. From pgsql-performance-owner@postgresql.org Mon Jul 7 17:58:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 59D73B439A9 for ; Mon, 7 Jul 2003 20:58:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 05214-05 for ; Mon, 7 Jul 2003 17:58:28 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 5191CB439D3 for ; Mon, 7 Jul 2003 17:57:44 -0300 (ADT) Received: from sabre.velocet.net (sabre.velocet.net [216.138.209.205]) by www.postgresql.com (Postfix) with ESMTP id 3D6E3CF6F5F for ; Mon, 7 Jul 2003 15:23:21 -0300 (ADT) Received: from stark.dyndns.tv (H162.C233.tor.velocet.net [216.138.233.162]) by sabre.velocet.net (Postfix) with ESMTP id F00D6138374; Mon, 7 Jul 2003 14:22:01 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) id 19Zacj-00086X-00; Mon, 07 Jul 2003 14:22:01 -0400 To: pgsql-performance@postgresql.org Subject: optimizer picks smaller table to drive nested loops? From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 07 Jul 2003 14:22:00 -0400 Message-ID: <873chi2o53.fsf@stark.dyndns.tv> Lines: 34 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-Archive-Number: 200307/131 X-Sequence-Number: 2424 Someone asked a hypothetical question about how to retrieve all records of a table twice in SQL. It got me thinking about whether there was a way to do this efficiently. "Obviously" if you do it using the UNION ALL approach postgres isn't going to do two separate scans, doing it otherwise would be quite hard. However using the join approach it seems postgres ought to be able to do a single sequential scan and return every tuple it finds twice. It doesn't do this: slo=> explain analyze select * from region, (select 1 union all select 2) as x; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=0.00..11162.00 rows=5534 width=108) (actual time=0.13..541.19 rows=5534 loops=1) -> Subquery Scan x (cost=0.00..2.00 rows=2 width=0) (actual time=0.03..0.08 rows=2 loops=1) -> Append (cost=0.00..2.00 rows=2 width=0) (actual time=0.02..0.05 rows=2 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=1) -> Result (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.01 rows=1 loops=1) -> Subquery Scan "*SELECT* 2" (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=1) -> Result (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.01 rows=1 loops=1) -> Seq Scan on region (cost=0.00..2813.00 rows=2767 width=104) (actual time=0.03..123.44 rows=2767 loops=2) Total runtime: 566.24 msec (9 rows) Wouldn't it be faster to drive the nested loop the other way around? (I'm also a bit puzzled why the optimizer is calculating that 2,813 * 2 = 5,534) This is tested on 7.3. I haven't tried CVS yet. -- greg From pgsql-performance-owner@postgresql.org Mon Jul 7 18:00:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 0CDC2B43A15 for ; Mon, 7 Jul 2003 21:00:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 07621-03 for ; Mon, 7 Jul 2003 18:00:30 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id B9B20B43A27 for ; Mon, 7 Jul 2003 17:57:57 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id 9B2A6CF6E3F for ; Mon, 7 Jul 2003 16:51:45 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h67Jfjv5019198; Mon, 7 Jul 2003 13:41:45 -0600 (MDT) Date: Mon, 7 Jul 2003 13:35:17 -0600 (MDT) From: "scott.marlowe" To: Martin Foster Cc: Shridhar Daithankar , ostgresql Performance Subject: Re: Extreme high load averages In-Reply-To: <3F0883A5.5020301@ethereal-realms.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/132 X-Sequence-Number: 2425 On Sun, 6 Jul 2003, Martin Foster wrote: > Shridhar Daithankar wrote: > > > > It gives hint to psotgresql how much file system cache is available in the > > system. > > > > You have 1GB memory and your application requirement does not exceed 400MB. So > > OS can use roughly 600MB for file system cache. In that case you can set this > > parameter to 400MB cache to leave room for other application in FS cache. > > > > IIRC, BSD needs sysctl tuning to make more memory available for FS cache other > > wise they max out at 300MB. > > > > Roughly this setting should be (total memory -application > > requirement)*(0.7/0.8) > > > > I guess that high kernel load you are seeing due to increased interaction > > between postgresql and OS when data is swapped to/fro in shared memory. If OS > > cache does well, postgresql should reduce this interaction as well. > > > > > > BTW, since you have IDE disks, heavy disk activity can eat CPU as well. Is > > your disk bandwidth totally maxed out? Check with vmstat or whatever > > equivalent you have on BSD. > > > > Shridhar > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org > > I changed the value of effective_cache_size seems interesting to 512. > The database restarted without any problems and load averages seem to be > a bit lower as a result. I would try a few things. First off, effective_cache_size is the size measured in 8k blocks, so 512 would be a setting of 4 Megs. Probably a little low. If you average 512Meg free, that would be a setting of 65536. Note that the higer the effective_cache_size, the more the planner will favor index scans, and the lower, the more it will favor sequential scans. Generally speaking, index scans cost in CPU terms, while seq scans cost in I/O time. Since you're reporting low CPU usage, I'm guessing you're getting a lot of seq scans. Do you have any type mismatches anywhere that could be the culprit? running vacuum and analyze regurlarly? Any tables that are good candidates for clustering? A common problem is a table like this: create table test (info text, id int8 primary key); insert into test values ('ted',1); .. a few thousand more inserts; vacuum full; analyze; select * from test where id=1; will result in a seq scan, always, because the 1 by itself is autoconverted to int4, which doesn't match int8 automatically. This query: select * from test where id=1::int8 will cast the 1 to an int8 so the index can be used. From pgsql-performance-owner@postgresql.org Mon Jul 7 18:03:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4D411B430D6 for ; Mon, 7 Jul 2003 21:01:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 07389-09 for ; Mon, 7 Jul 2003 18:01:24 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 10E37B43B0D for ; Mon, 7 Jul 2003 17:58:05 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by www.postgresql.com (Postfix) with ESMTP id CD3BFCF7AB9 for ; Mon, 7 Jul 2003 17:13:39 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h67K4qv5020964; Mon, 7 Jul 2003 14:04:52 -0600 (MDT) Date: Mon, 7 Jul 2003 13:58:24 -0600 (MDT) From: "scott.marlowe" To: Brian Tarbox Cc: Brian Tarbox , , Rafal Kedziorski , Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <000d01c344b3$db2add00$01000001@trouble> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/133 X-Sequence-Number: 2426 On Mon, 7 Jul 2003, Brian Tarbox wrote: > Oddly enough, the particular application in question will have an extremely > small user base...perhaps a few simultainous users at most. > > As to the testing, I neglected to say early in this thread that my manager > instructed me _not_ to do further performance testing...so as a good > consultant I complied. I'm not going to touch if that was a smart > instruction to give :-) But remember, you can always rename your performance testing as compliance testing and then it's ok, as long as you don't keep any detailed records about the time it took to run the "compliance testing" queries. Definitely look at the output from explain analyze select ... to see what the planner THINKS the query is gonna cost versus what it really costs. If you see a huge difference between, say estimated rows and actual rows, or some other value, it points to the analyzer not getting the right data for the planner. You can adjust the percentage of a table sampled with alter table to force more data into analyze. From pgsql-performance-owner@postgresql.org Mon Jul 7 18:20:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C6140B43A09 for ; Mon, 7 Jul 2003 21:18:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 24239-04 for ; Mon, 7 Jul 2003 18:18:27 -0300 (ADT) Received: from patriot.simn.com (patriot.simn.com [199.5.214.34]) by svr1.postgresql.org (Postfix) with ESMTP id 7DCD1B439A8 for ; Mon, 7 Jul 2003 18:15:35 -0300 (ADT) Received: from mail.simn.com (mail.simn.com [10.0.0.106]) by patriot.simn.com (8.9.3/8.9.3) with ESMTP id PAA20081; Mon, 7 Jul 2003 15:18:48 -0600 Received: from there (wvmis224randy.simn.com [10.0.101.44]) by mail.simn.com (8.9.3/8.9.3) with SMTP id PAA52502; Mon, 7 Jul 2003 15:15:33 -0600 (MDT) (envelope-from randy@simn.com) Message-Id: <200307072115.PAA52502@mail.simn.com> Content-Type: text/plain; charset="iso-8859-1" From: Randy Neumann To: Greg Stark Subject: Re: optimizer picks smaller table to drive nested loops? Date: Mon, 7 Jul 2003 14:58:54 -0600 X-Mailer: KMail [version 1.3.1] References: <873chi2o53.fsf@stark.dyndns.tv> In-Reply-To: <873chi2o53.fsf@stark.dyndns.tv> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/134 X-Sequence-Number: 2427 On Monday 07 July 2003 12:22 pm, you wrote: > loops=1) -> Seq Scan on region (cost=0.00..2813.00 rows=2767 width=104) > (actual time=0.03..123.44 rows=2767 loops=2) Total runtime: 566.24 msec > (9 rows) > > (I'm also a bit puzzled why the optimizer is calculating that 2,813 * 2 = > 5,534) You should read it 2767 (rows) * 2 = 5534 (rows) 2813.00 is part of the cost. From pgsql-performance-owner@postgresql.org Mon Jul 7 18:41:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B35A7B439B5 for ; Mon, 7 Jul 2003 21:41:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 35013-09 for ; Mon, 7 Jul 2003 18:40:52 -0300 (ADT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with SMTP id 8272CB439AD for ; Mon, 7 Jul 2003 18:40:51 -0300 (ADT) Received: (qmail 84587 invoked by uid 1001); 7 Jul 2003 21:40:48 -0000 Date: Mon, 7 Jul 2003 16:40:48 -0500 From: "Jim C. Nasby" To: Chris Travers Cc: Matthew Nuzum , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030707214048.GC69704@nasby.net> References: <006901c34430$1da72c80$a322fea9@mattspc> <3F09A922.2050409@travelamericas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F09A922.2050409@travelamericas.com> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/139 X-Sequence-Number: 2432 On Mon, Jul 07, 2003 at 10:08:50AM -0700, Chris Travers wrote: > In my opinion, a serious RDBMS system will *always* require the admin to > be doing research in order to learn how to use it effectively. We are > not talking about a word processor here. > > That being said, I think that a good part of the problem is that admins > don't know where to look for the appropriate documentation and what is > needed. Expecting someone to spend 20 seconds looking for a piece of > info is not too bad, but expecting them to spend hours trying to figure > out what info is relavent is not going to get us anywhere. Something else to consider is that this is made worse because tuning for pgsql is quite different than tuning for something like Oracle or DB2, which don't deal as much with metrics such as random access cost v. sequential access. They also take the approach of 'give me as much memory as you can; I'll take it from there, thankyouverymuch', which makes effective_cache_size a bit of a mystery. -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Mon Jul 7 20:30:33 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id BCA2AB430D6 for ; Mon, 7 Jul 2003 23:30:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 63324-08 for ; Mon, 7 Jul 2003 20:30:21 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 9ADA0B43183 for ; Mon, 7 Jul 2003 20:30:20 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h67NTrPu010885; Mon, 7 Jul 2003 17:29:53 -0600 (MDT) Message-ID: <3F0A026E.8090907@ethereal-realms.org> Date: Mon, 07 Jul 2003 17:29:50 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Marlowe Cc: Shridhar Daithankar , Postgresql Performance Subject: Re: Extreme high load averages 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-Archive-Number: 200307/140 X-Sequence-Number: 2433 scott.marlowe wrote: > > > I would try a few things. First off, effective_cache_size is the size > measured in 8k blocks, so 512 would be a setting of 4 Megs. Probably a > little low. If you average 512Meg free, that would be a setting of 65536. > > Note that the higer the effective_cache_size, the more the planner will > favor index scans, and the lower, the more it will favor sequential scans. > > Generally speaking, index scans cost in CPU terms, while seq scans cost in > I/O time. > > Since you're reporting low CPU usage, I'm guessing you're getting a lot of > seq scans. > > Do you have any type mismatches anywhere that could be the culprit? > running vacuum and analyze regurlarly? Any tables that are good > candidates for clustering? > > A common problem is a table like this: > > create table test (info text, id int8 primary key); > insert into test values ('ted',1); > .. a few thousand more inserts; > vacuum full; > analyze; > select * from test where id=1; > > will result in a seq scan, always, because the 1 by itself is > autoconverted to int4, which doesn't match int8 automatically. This > query: > > select * from test where id=1::int8 > > will cast the 1 to an int8 so the index can be used. > That last trick actually listed seemed to have solved on the larger slowdowns I had. It would seem that a view was making use of INTERVAL and CURRENT_TIMESTAMP. However, the datatype did not make use of timezones and that caused significant slowdowns. By using ::TIMESTAMP, it essentially dropped the access time from 4.98+ to 0.98 seconds. This alone makes my day, as it shows that Postgres is performing well, but is just a bit more picky about the queries. I changed the settings as you recommended, locked the memory to 768 megs so that PostgreSQL cannot go beyond that and made the database priority higher. All of those changes seems to have increase overall performance. I do have a site question: ENABLE_HASHJOIN (boolean) ENABLE_INDEXSCAN (boolean) ENABLE_MERGEJOIN (boolean) ENABLE_TIDSCAN (boolean) All of the above, state that they are for debugging the query planner. Does this mean that disabling these reduces debugging overhead and streamlines things? The documentation is rather lacking for information on these. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Mon Jul 7 21:47:21 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 77DE0B43848 for ; Tue, 8 Jul 2003 00:47:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 87933-03 for ; Mon, 7 Jul 2003 21:47:09 -0300 (ADT) Received: from ms-smtp-03.tampabay.rr.com (ms-smtp-03.tampabay.rr.com [65.32.1.41]) by svr1.postgresql.org (Postfix) with ESMTP id 3F9E1B43183 for ; Mon, 7 Jul 2003 21:47:09 -0300 (ADT) Received: from mattspc (169-52.34-65.tampabay.rr.com [65.34.52.169]) by ms-smtp-03.tampabay.rr.com (8.12.5/8.12.5) with ESMTP id h680l04U029519; Mon, 7 Jul 2003 20:47:01 -0400 (EDT) From: "Matthew Nuzum" To: "'scott.marlowe'" , "'ostgresql Performance'" Subject: Re: Extreme high load averages Date: Mon, 7 Jul 2003 20:47:00 -0400 Organization: Bearfruit.org Message-ID: <001901c344ea$71391bf0$a322fea9@mattspc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 In-reply-to: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/141 X-Sequence-Number: 2434 > A common problem is a table like this: >=20 > create table test (info text, id int8 primary key); > insert into test values ('ted',1); > .. a few thousand more inserts; > vacuum full; > analyze; > select * from test where id=3D1; >=20 > will result in a seq scan, always, because the 1 by itself is > autoconverted to int4, which doesn't match int8 automatically. This > query: >=20 > select * from test where id=3D1::int8 >=20 > will cast the 1 to an int8 so the index can be used. >=20 >=20 Hey Scott, this is a little scary because I probably have a lot of this going on... Is there a way to log something so that after a day or so I can go back and look for things like this that would be good candidates for optimization? I've got fast enough servers that currently the impact of this problem might not be too obvious, but I suspect that after the server gets loaded up the impact will become more of a problem. By the way, I must say that this thread has been very useful. 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 Tue Jul 8 12:33:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CD87EB438D7 for ; Tue, 8 Jul 2003 15:33:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 11426-10 for ; Tue, 8 Jul 2003 12:33:32 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id C6DB5B439ED for ; Tue, 8 Jul 2003 12:33:31 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h68FX8v5001446; Tue, 8 Jul 2003 09:33:08 -0600 (MDT) Date: Tue, 8 Jul 2003 09:26:34 -0600 (MDT) From: "scott.marlowe" To: Matthew Nuzum Cc: "'ostgresql Performance'" Subject: Re: Extreme high load averages In-Reply-To: <001901c344ea$71391bf0$a322fea9@mattspc> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/142 X-Sequence-Number: 2435 On Mon, 7 Jul 2003, Matthew Nuzum wrote: > > A common problem is a table like this: > > > > create table test (info text, id int8 primary key); > > insert into test values ('ted',1); > > .. a few thousand more inserts; > > vacuum full; > > analyze; > > select * from test where id=1; > > > > will result in a seq scan, always, because the 1 by itself is > > autoconverted to int4, which doesn't match int8 automatically. This > > query: > > > > select * from test where id=1::int8 > > > > will cast the 1 to an int8 so the index can be used. > > > > > > Hey Scott, this is a little scary because I probably have a lot of this > going on... > > Is there a way to log something so that after a day or so I can go back and > look for things like this that would be good candidates for optimization? > > I've got fast enough servers that currently the impact of this problem might > not be too obvious, but I suspect that after the server gets loaded up the > impact will become more of a problem. > > By the way, I must say that this thread has been very useful. Well, you can turn on some of the newer logging features that tell you how long the query took to run. Look here: http://developer.postgresql.org/docs/postgres/runtime-config.html#RUNTIME-CONFIG-LOGGING and here: http://developer.postgresql.org/docs/postgres/runtime-config.html#RUNTIME-CONFIG-STATISTICS Note that those are the developer docs. I'm pretty sure the first one has a corrolary to the 7.3.x docs, but the second set (log_statement_stats, parser_stats, etc...) looks new for 7.4 From pgsql-performance-owner@postgresql.org Tue Jul 8 16:46:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id EB43DB4315B for ; Tue, 8 Jul 2003 19:46:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 23832-05 for ; Tue, 8 Jul 2003 16:46:10 -0300 (ADT) Received: from lorraine.ipl.co.uk (lorraine.ipl.co.uk [195.112.52.123]) by svr1.postgresql.org (Postfix) with ESMTP id E06BBB4396F for ; Tue, 8 Jul 2003 16:46:09 -0300 (ADT) Received: from HFPORT.dmr.co.uk (pennsoft.gotadsl.co.uk [81.6.232.68]) by lorraine.ipl.co.uk (8.12.9/8.12.9) with ESMTP id h68Jk4RI009190; Tue, 8 Jul 2003 20:46:04 +0100 Message-Id: <5.1.0.14.0.20030708203407.01efc7e0@mailserver.ipl.co.uk> X-Sender: hf1@mailserver.ipl.co.uk X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 08 Jul 2003 20:46:37 +0100 To: pgsql-performance@postgresql.org From: Hilary Forbes Subject: Config file problem Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/143 X-Sequence-Number: 2436 Dear All Please note: I'm using Version 7.1 Following everyone's advice, I increased my max_connections to 64 and shared_buffers to 2000. However, the postmaster then started to issue me error messages saying pg_recvbuf: unexpected EOF on client connection Help! (Needless to say I've restored the default postgresql.conf file and am ok) :-( Obviously I've fouled up somewhere - advice awaited :-) As a point of interest, I searched the documentation fo pg_recvbuf and the search returned no results. Thanks Hilary Hilary Forbes ------------- DMR Computer Limited: http://www.dmr.co.uk/ Direct line: 01689 889950 Switchboard: (44) 1689 860000 Fax: (44) 1689 860330 E-mail: hforbes@dmr.co.uk ********************************************************** From pgsql-performance-owner@postgresql.org Tue Jul 8 17:55:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 40280B430C2 for ; Tue, 8 Jul 2003 20:54:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 50031-03 for ; Tue, 8 Jul 2003 17:54:25 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 7E6A3B430A6 for ; Tue, 8 Jul 2003 17:54:24 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19ZzTm-0003ev-00 for ; Tue, 08 Jul 2003 16:54:26 -0400 Received: by dba2 (Postfix, from userid 1019) id DE55AD75A; Tue, 8 Jul 2003 16:54:48 -0400 (EDT) Date: Tue, 8 Jul 2003 16:54:48 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Strange result: UNIX vs. TCP/IP sockets Message-ID: <20030708205448.GE13501@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030704172205.GH4707@libertyrms.info> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030704172205.GH4707@libertyrms.info> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/144 X-Sequence-Number: 2437 Hi all, You may remember in my last report, I said that it appeared that TCP/IP connections caused EXPLAIN ANALYSE to return (repeatably but not consistently) slower times than when connected over UNIX domain sockets. This turns out to be false. We (well, Chris Browne, actually) ran some tests which demonstrated that the performance problem turned up over the UNIX socket, as well. It was just a statistical fluke that our smaller sample always found the problem on TCP/IP. Of course, now we have some other work to do, but we can rule out the transport at least. Chalk one up for sane results. If we discover any more, I'll post it here. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Jul 8 21:28:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E9EC9B42167 for ; Wed, 9 Jul 2003 00:28:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 17777-03 for ; Tue, 8 Jul 2003 21:27:37 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 84FD1B430A9 for ; Tue, 8 Jul 2003 21:27:36 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h690RdUc002585 for ; Tue, 8 Jul 2003 18:27:39 -0600 (MDT) Message-ID: <3F0B6178.2020805@ethereal-realms.org> Date: Tue, 08 Jul 2003 18:27:36 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance Subject: Efficiency of timestamps Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/145 X-Sequence-Number: 2438 As I keep looking through code to see where I can make things more efficient, I noticed that in some cases timestamps seem horribly inefficient. This leads to very long run times for certain queries. Here is an example: -- USING TIMESTAMPS TO NARROW DOWN -- SELECT Post.PostIDNumber, Post.PuppeteerLogin, Post.PuppetName, Post.PostCmd, Post.PostClass FROM ethereal.Post WHERE Post.PostTimeStamp > (LOCALTIMESTAMP - INTERVAL '10 Minutes') AND Post.RealmName='Amalgam' AND (Post.PostTo='all' OR Post.PostTo='root') AND (NOT EXISTS (SELECT PuppetIgnore.PuppetLogin FROM ethereal.PuppetIgnore WHERE PuppetIgnore.PuppetIgnore='global' AND PuppetIgnore.PuppeteerLogin='root' AND PuppetIgnore.PuppetLogin=Post.PuppeteerLogin) OR Post.PuppeteerLogin IS NULL) AND (NOT EXISTS (SELECT PuppetIgnore.PuppetName FROM ethereal.PuppetIgnore WHERE PuppetIgnore='single' AND PuppetIgnore.PuppeteerLogin='root' AND PuppetIgnore.PuppetName=Post.PuppetName) OR Post.PuppetName IS NULL) ORDER BY Post.PostIDNumber LIMIT 100 -- Explain of Above-- Limit (cost=0.00..260237.32 rows=100 width=48) -> Index Scan using pkpost on post (cost=0.00..3020594.00 rows=1161 width=48) Filter: ((posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) AND (realmname = 'Amalgam'::character varying) AND ((postto = 'all'::character varying) OR (postto = 'root'::character varying)) AND ((NOT (subplan)) OR (puppeteerlogin IS NULL)) AND ((NOT (subplan)) OR (puppetname IS NULL))) SubPlan -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..13.31 rows=1 width=10) Index Cond: (puppeteerlogin = 'root'::character varying) Filter: ((puppetignore = 'global'::character varying) AND (puppetlogin = $0)) -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..5.84 rows=1 width=15) Index Cond: ((puppeteerlogin = 'root'::character varying) AND (puppetname = $1)) Filter: (puppetignore = 'single'::character varying) Result : 22 rows fetched (17.21 sec) -- USING A GENERATED ID NUMBER -- SELECT Post.PostIDNumber, Post.PuppeteerLogin, Post.PuppetName, Post.PostCmd, Post.PostClass FROM ethereal.Post WHERE Post.PostIDNumber > 1 AND Post.RealmName='Amalgam' AND (Post.PostTo='all' OR Post.PostTo='root') AND (NOT EXISTS (SELECT PuppetIgnore.PuppetLogin FROM ethereal.PuppetIgnore WHERE PuppetIgnore.PuppetIgnore='global' AND PuppetIgnore.PuppeteerLogin='root' AND PuppetIgnore.PuppetLogin=Post.PuppeteerLogin) OR Post.PuppeteerLogin IS NULL) AND (NOT EXISTS (SELECT PuppetIgnore.PuppetName FROM ethereal.PuppetIgnore WHERE PuppetIgnore='single' AND PuppetIgnore.PuppeteerLogin='root' AND PuppetIgnore.PuppetName=Post.PuppetName) OR Post.PuppetName IS NULL) ORDER BY Post.PostIDNumber LIMIT 100 -- Explain of Above-- Limit (cost=0.00..86712.10 rows=100 width=48) -> Index Scan using pkpost on post (cost=0.00..3019119.56 rows=3482 width=48) Index Cond: (postidnumber > 1) Filter: ((realmname = 'Amalgam'::character varying) AND ((postto = 'all'::character varying) OR (postto = 'root'::character varying)) AND ((NOT (subplan)) OR (puppeteerlogin IS NULL)) AND ((NOT (subplan)) OR (puppetname IS NULL))) SubPlan -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..13.31 rows=1 width=10) Index Cond: (puppeteerlogin = 'root'::character varying) Filter: ((puppetignore = 'global'::character varying) AND (puppetlogin = $0)) -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..5.84 rows=1 width=15) Index Cond: ((puppeteerlogin = 'root'::character varying) AND (puppetname = $1)) Filter: (puppetignore = 'single'::character varying) Result : 100 rows fetched ( 0.19 sec) -- USING A MIXTURE OF BOTH -- SELECT Post.PostIDNumber, Post.PuppeteerLogin, Post.PuppetName, Post.PostCmd, Post.PostClass FROM ethereal.Post WHERE Post.PostIDNumber > (SELECT MIN(PostIDNumber) FROM ethereal.Post WHERE Post.PostTimeStamp > (LOCALTIMESTAMP - INTERVAL '10 minutes'))::INT AND Post.RealmName='Amalgam' AND (Post.PostTo='all' OR Post.PostTo='root') AND (NOT EXISTS (SELECT PuppetIgnore.PuppetLogin FROM ethereal.PuppetIgnore WHERE PuppetIgnore.PuppetIgnore='global' AND PuppetIgnore.PuppeteerLogin='root' AND PuppetIgnore.PuppetLogin=Post.PuppeteerLogin) OR Post.PuppeteerLogin IS NULL) AND (NOT EXISTS (SELECT PuppetIgnore.PuppetName FROM ethereal.PuppetIgnore WHERE PuppetIgnore='single' AND PuppetIgnore.PuppeteerLogin='root' AND PuppetIgnore.PuppetName=Post.PuppetName) OR Post.PuppetName IS NULL) ORDER BY Post.PostIDNumber LIMIT 100 -- Explain of Above-- Limit (cost=0.00..87101.38 rows=100 width=48) InitPlan -> Aggregate (cost=12412.82..12412.82 rows=1 width=4) -> Index Scan using idxpost_timestamp on post (cost=0.00..12282.42 rows=52160 width=4) Index Cond: (posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) -> Index Scan using pkpost on post (cost=0.00..1010992.25 rows=1161 width=48) Index Cond: (postidnumber > $0) Filter: ((realmname = 'Amalgam'::character varying) AND ((postto = 'all'::character varying) OR (postto = 'root'::character varying)) AND ((NOT (subplan)) OR (puppeteerlogin IS NULL)) AND ((NOT (subplan)) OR (puppetname IS NULL))) SubPlan -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..13.31 rows=1 width=10) Index Cond: (puppeteerlogin = 'root'::character varying) Filter: ((puppetignore = 'global'::character varying) AND (puppetlogin = $1)) -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..5.84 rows=1 width=15) Index Cond: ((puppeteerlogin = 'root'::character varying) AND (puppetname = $2)) Filter: (puppetignore = 'single'::character varying) Result : 18 rows fetched ( 0.04 sec) Both PostIDNumber and PostTimestamp are indexed, so that should not be a bottleneck in itself. However, as you can see in the third example the use of a sub-query actually accelerates the process considerably, meaning that integer based searching is much much faster. Under MySQL timestamps where in Unix time, which is why I may have never noticed such an extreme slowdown when doing similar on that script. Of course to boggle the mind, here is a view that works very well: CREATE VIEW ethereal.Who AS SELECT Po.PuppetName AS PuppetName, Po.PuppeteerLogin AS PuppeteerLogin, Po.RealmName AS RealmName, Re.RealmPublic AS RealmPublic, Re.RealmVerified AS RealmVerified FROM ethereal.Post Po, ethereal.Puppet Ch, ethereal.Realm Re WHERE Po.PuppeteerLogin = Ch.PuppeteerLogin AND Po.RealmName = Re.RealmName AND Po.PostTimestamp > (LOCALTIMESTAMP - INTERVAL '10 minutes') AND Po.PuppetName IS NOT NULL GROUP BY Po.PuppeteerLogin, Po.PuppetName, Po.RealmName, Re.RealmPublic, Re.RealmVerified ORDER BY Po.RealmName, Po.PuppetName; Sort (cost=309259.89..309629.34 rows=147780 width=79) Sort Key: po.realmname, po.puppetname -> Group (cost=270648.27..292815.19 rows=147780 width=79) -> Sort (cost=270648.27..274342.75 rows=1477795 width=79) Sort Key: po.puppeteerlogin, po.puppetname, po.realmname, re.realmpublic, re.realmverified -> Merge Join (cost=22181.60..41087.65 rows=1477795 width=79) Merge Cond: ("outer".puppeteerlogin = "inner".puppeteerlogin) -> Sort (cost=17172.82..17300.26 rows=50978 width=69) Sort Key: po.puppeteerlogin -> Hash Join (cost=12.41..13186.95 rows=50978 width=69) Hash Cond: ("outer".realmname = "inner".realmname) -> Index Scan using idxpost_timestamp on post po (cost=0.00..12282.42 rows=50978 width=42) Index Cond: (posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) Filter: (puppetname IS NOT NULL) -> Hash (cost=11.93..11.93 rows=193 width=27) -> Seq Scan on realm re (cost=0.00..11.93 rows=193 width=27) -> Sort (cost=5008.78..5100.22 rows=36574 width=10) Sort Key: ch.puppeteerlogin -> Seq Scan on puppet ch (cost=0.00..2236.74 rows=36574 width=10) Result : 48 rows fetched ( 0.55 sec) It uses the exact same time restraint as the first three examples, looks through the same table, does a tipple join and still gets off at higher speeds. This seems to indicate that timestamps are actually efficient, which contradicts above examples. Any ideas? Code for the table creation is below signature: Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org -- -- -- NAME : Post -- REFERENCES : Realm* -- Puppet* -- PuppeteerLogin* -- -- DESCRIPTION : Post is the hive of activity for all realms. Associated with all three -- major tables, it is not actually linked because of the nature of storing -- posts for statistics and auditing. CREATE TABLE ethereal.Post ( PostIDNumber INT NOT NULL DEFAULT NEXTVAL('ethereal.seqPost'), RealmName VARCHAR(30) NOT NULL, PuppetName VARCHAR(30), PuppeteerLogin VARCHAR(10), PostTo VARCHAR(30), PostTimestamp TIMESTAMP NOT NULL DEFAULT LOCALTIMESTAMP, PostClass VARCHAR(10) NOT NULL DEFAULT 'general', PostCmd VARCHAR(10) NOT NULL DEFAULT 'none', PostFullFormat TEXT, PostImagelessFormat TEXT, PostPartialFormat TEXT, CONSTRAINT pkPost PRIMARY KEY (PostIDNumber), CONSTRAINT enumPostClass CHECK (PostCLass IN ('banner','dice','duplicate','general','play','private','special','system')), CONSTRAINT enumPostCmd CHECK (PostCmd IN ('general','none','play','stream')) ) WITHOUT OIDS; -- STANDARD INDEX CREATE INDEX idxPost_Class ON ethereal.Post ( PostClass ); CREATE INDEX idxPost_Login ON ethereal.Post ( PuppeteerLogin ); CREATE INDEX idxPost_Puppet ON ethereal.Post ( PuppetName ); CREATE INDEX idxPost_Realm ON ethereal.Post ( RealmName ); CREATE INDEX idxPost_Timestamp ON ethereal.Post ( PostTimestamp ); From pgsql-performance-owner@postgresql.org Tue Jul 8 21:58:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 14A6BB430A9 for ; Wed, 9 Jul 2003 00:56:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27724-03 for ; Tue, 8 Jul 2003 21:55:50 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by svr1.postgresql.org (Postfix) with ESMTP id 016CBB430A8 for ; Tue, 8 Jul 2003 21:55:50 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 18EC1D68B; Tue, 8 Jul 2003 17:55:52 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 0E8D85C0D; Tue, 8 Jul 2003 17:55:52 -0700 (PDT) Date: Tue, 8 Jul 2003 17:55:51 -0700 (PDT) From: Stephan Szabo To: Martin Foster Cc: PostgreSQL Performance Subject: Re: Efficiency of timestamps In-Reply-To: <3F0B6178.2020805@ethereal-realms.org> Message-ID: <20030708174923.X4603-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/146 X-Sequence-Number: 2439 On Tue, 8 Jul 2003, Martin Foster wrote: > As I keep looking through code to see where I can make things more > efficient, I noticed that in some cases timestamps seem horribly > inefficient. This leads to very long run times for certain queries. > > Here is an example: > > -- USING TIMESTAMPS TO NARROW DOWN -- > > SELECT > Post.PostIDNumber, > Post.PuppeteerLogin, > Post.PuppetName, > Post.PostCmd, > Post.PostClass > FROM ethereal.Post > WHERE Post.PostTimeStamp > (LOCALTIMESTAMP - INTERVAL '10 Minutes') > AND Post.RealmName='Amalgam' > AND (Post.PostTo='all' OR Post.PostTo='root') > AND (NOT EXISTS (SELECT PuppetIgnore.PuppetLogin > FROM ethereal.PuppetIgnore > WHERE PuppetIgnore.PuppetIgnore='global' > AND PuppetIgnore.PuppeteerLogin='root' > AND PuppetIgnore.PuppetLogin=Post.PuppeteerLogin) > OR Post.PuppeteerLogin IS NULL) > AND (NOT EXISTS (SELECT PuppetIgnore.PuppetName > FROM ethereal.PuppetIgnore > WHERE PuppetIgnore='single' > AND PuppetIgnore.PuppeteerLogin='root' > AND PuppetIgnore.PuppetName=Post.PuppetName) > OR Post.PuppetName IS NULL) > ORDER BY Post.PostIDNumber LIMIT 100 > > -- Explain of Above-- > Limit (cost=0.00..260237.32 rows=100 width=48) > -> Index Scan using pkpost on post (cost=0.00..3020594.00 rows=1161 > width=48) > Filter: ((posttimestamp > (('now'::text)::timestamp(6) without > time zone - '00:10'::interval)) AND (realmname = 'Amalgam'::character > varying) AND ((postto = 'all'::character varying) OR (postto = > 'root'::character varying)) AND ((NOT (subplan)) OR (puppeteerlogin IS > NULL)) AND ((NOT (subplan)) OR (puppetname IS NULL))) I think you might get better results with some kind of multi-column index. It's using the index to avoid a sort it looks like, but it's not helping to find the conditions. I can't remember the correct ordering, but maybe (posttimestamp, realmname, postidnumber). Having separate indexes on the fields won't help currently since only one index will get chosen for the scan. Also, what does explain analyze show? > -- NAME : Post > -- REFERENCES : Realm* > -- Puppet* > -- PuppeteerLogin* > -- > -- DESCRIPTION : Post is the hive of activity for all realms. > Associated with all three > -- major tables, it is not actually linked because of the > nature of storing > -- posts for statistics and auditing. > > CREATE TABLE ethereal.Post ( > PostIDNumber INT NOT NULL DEFAULT > NEXTVAL('ethereal.seqPost'), > RealmName VARCHAR(30) NOT NULL, > PuppetName VARCHAR(30), > PuppeteerLogin VARCHAR(10), > PostTo VARCHAR(30), > PostTimestamp TIMESTAMP NOT NULL DEFAULT LOCALTIMESTAMP, > PostClass VARCHAR(10) NOT NULL DEFAULT 'general', > PostCmd VARCHAR(10) NOT NULL DEFAULT 'none', > PostFullFormat TEXT, > PostImagelessFormat TEXT, > PostPartialFormat TEXT, > CONSTRAINT pkPost PRIMARY KEY (PostIDNumber), > CONSTRAINT enumPostClass CHECK (PostCLass IN > ('banner','dice','duplicate','general','play','private','special','system')), > CONSTRAINT enumPostCmd CHECK (PostCmd IN > ('general','none','play','stream')) > ) WITHOUT OIDS; > > -- STANDARD INDEX > CREATE INDEX idxPost_Class ON ethereal.Post > ( > PostClass > ); > > CREATE INDEX idxPost_Login ON ethereal.Post > ( > PuppeteerLogin > ); > > CREATE INDEX idxPost_Puppet ON ethereal.Post > ( > PuppetName > ); > > CREATE INDEX idxPost_Realm ON ethereal.Post > ( > RealmName > ); > > CREATE INDEX idxPost_Timestamp ON ethereal.Post > ( > PostTimestamp > ); > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Tue Jul 8 22:12:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E9898B430C2 for ; Wed, 9 Jul 2003 01:12:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 27724-09 for ; Tue, 8 Jul 2003 22:11:49 -0300 (ADT) Received: from houston.familyhealth.com.au (unknown [203.59.48.253]) by svr1.postgresql.org (Postfix) with ESMTP id 2FEEBB430C9 for ; Tue, 8 Jul 2003 22:11:48 -0300 (ADT) Received: from mars (work-40.internal [192.168.0.40]) by houston.familyhealth.com.au (8.12.9/8.12.9) with SMTP id h691Bdm3042268; Wed, 9 Jul 2003 09:11:40 +0800 (WST) (envelope-from chriskl@familyhealth.com.au) Message-ID: <08e601c345b7$4c1b11c0$2800a8c0@mars> From: "Christopher Kings-Lynne" To: , "Hilary Forbes" References: <5.1.0.14.0.20030708203407.01efc7e0@mailserver.ipl.co.uk> Subject: Re: Config file problem Date: Wed, 9 Jul 2003 09:13:23 +0800 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/147 X-Sequence-Number: 2440 > Please note: I'm using Version 7.1 Upgrade to 7.3 :) > Following everyone's advice, I increased my max_connections to 64 and shared_buffers to 2000. However, the postmaster then started to issue me error messages saying > > pg_recvbuf: unexpected EOF on client connection That's odd. I have no idea how your changes and that error can possibly be related. I get those all the time in my logs, but that seems to be something to do with how clients disconnect in Apache sometimes or something. Chris From pgsql-performance-owner@postgresql.org Tue Jul 8 22:37:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 909D5B430CD for ; Wed, 9 Jul 2003 01:37:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 34618-04 for ; Tue, 8 Jul 2003 22:37:19 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 6014DB430C2 for ; Tue, 8 Jul 2003 22:37:18 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h691bJUc000685; Tue, 8 Jul 2003 19:37:20 -0600 (MDT) Message-ID: <3F0B71CC.1030106@ethereal-realms.org> Date: Tue, 08 Jul 2003 19:37:16 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephan Szabo Cc: PostgreSQL Performance Subject: Re: Efficiency of timestamps References: <20030708174923.X4603-100000@megazone23.bigpanda.com> In-Reply-To: <20030708174923.X4603-100000@megazone23.bigpanda.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/148 X-Sequence-Number: 2441 Stephan Szabo wrote: > > > I think you might get better results with some kind of multi-column index. > It's using the index to avoid a sort it looks like, but it's not helping > to find the conditions. I can't remember the correct ordering, but maybe > (posttimestamp, realmname, postidnumber). Having separate indexes on the > fields won't help currently since only one index will get chosen for the > scan. Also, what does explain analyze show? > Hope that shed's light on the matter. Limit (cost=0.00..260237.32 rows=100 width=48) (actual time=68810.26..68820.83 rows=55 loops=1) -> Index Scan using pkpost on post (cost=0.00..3020594.00 rows=1161 width=48) (actual time=68810.25..68820.72 rows=55 loops=1) Filter: ((posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) AND (realmname = 'Amalgam'::character varying) AND ((postto = 'all'::character varying) OR (postto = 'root'::character varying)) AND ((NOT (subplan)) OR (puppeteerlogin IS NULL)) AND ((NOT (subplan)) OR (puppetname IS NULL))) SubPlan -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..13.31 rows=1 width=10) (actual time=0.02..0.02 rows=0 loops=55) Index Cond: (puppeteerlogin = 'root'::character varying) Filter: ((puppetignore = 'global'::character varying) AND (puppetlogin = $0)) -> Index Scan using pkpuppetignore on puppetignore (cost=0.00..5.84 rows=1 width=15) (actual time=0.01..0.01 rows=0 loops=55) Index Cond: ((puppeteerlogin = 'root'::character varying) AND (puppetname = $1)) Filter: (puppetignore = 'single'::character varying) Total runtime: 68821.11 msec -- Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Tue Jul 8 23:49:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AC13FB4315E for ; Wed, 9 Jul 2003 02:49:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 55871-01 for ; Tue, 8 Jul 2003 23:49:02 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by svr1.postgresql.org (Postfix) with ESMTP id 2F077B430DB for ; Tue, 8 Jul 2003 23:49:01 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1C5D8D614; Tue, 8 Jul 2003 19:49:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1218C5C0C; Tue, 8 Jul 2003 19:49:05 -0700 (PDT) Date: Tue, 8 Jul 2003 19:49:04 -0700 (PDT) From: Stephan Szabo To: Martin Foster Cc: PostgreSQL Performance Subject: Re: Efficiency of timestamps In-Reply-To: <3F0B71CC.1030106@ethereal-realms.org> Message-ID: <20030708192541.D5781-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/149 X-Sequence-Number: 2442 On Tue, 8 Jul 2003, Martin Foster wrote: > Stephan Szabo wrote: > > > > > > I think you might get better results with some kind of multi-column index. > > It's using the index to avoid a sort it looks like, but it's not helping > > to find the conditions. I can't remember the correct ordering, but maybe > > (posttimestamp, realmname, postidnumber). Having separate indexes on the > > fields won't help currently since only one index will get chosen for the > > scan. Also, what does explain analyze show? > > > > Hope that shed's light on the matter. > > Limit (cost=0.00..260237.32 rows=100 width=48) (actual > time=68810.26..68820.83 rows=55 loops=1) > -> Index Scan using pkpost on post (cost=0.00..3020594.00 > rows=1161 width=48) (actual time=68810.25..68820.72 rows=55 loops=1) > Filter: ((posttimestamp > (('now'::text)::timestamp(6) without > time zone - '00:10'::interval)) AND (realmname = 'Amalgam'::character > varying) AND ((postto = 'all'::character varying) OR (postto = > 'root'::character varying)) AND ((NOT (subplan)) OR (puppeteerlogin IS > NULL)) AND ((NOT (subplan)) OR (puppetname IS NULL))) > SubPlan > -> Index Scan using pkpuppetignore on puppetignore > (cost=0.00..13.31 rows=1 width=10) (actual time=0.02..0.02 rows=0 loops=55) > Index Cond: (puppeteerlogin = 'root'::character varying) > Filter: ((puppetignore = 'global'::character varying) > AND (puppetlogin = $0)) > -> Index Scan using pkpuppetignore on puppetignore > (cost=0.00..5.84 rows=1 width=15) (actual time=0.01..0.01 rows=0 loops=55) > Index Cond: ((puppeteerlogin = 'root'::character > varying) AND (puppetname = $1)) > Filter: (puppetignore = 'single'::character varying) > Total runtime: 68821.11 msec The row estimate is high. How many rows meet the various conditions and some of the combinations? And how many rows does it estimate if you do a simpler query on those with explain? I still think some variety of multi-column index to make the above index conditions would help, but you'd probably need to play with which ones help, and with the cost cut for the limit, I don't know if it'd actually get a better plan, but it may be worth trying a bunch and seeing which ones are useful and then dropping the rest. From pgsql-performance-owner@postgresql.org Wed Jul 9 01:23:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9F772B430D1 for ; Wed, 9 Jul 2003 04:23:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 93913-03 for ; Wed, 9 Jul 2003 01:23:43 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id AC8D5B43924 for ; Wed, 9 Jul 2003 01:23:42 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h694NeUc024080; Tue, 8 Jul 2003 22:23:40 -0600 (MDT) Message-ID: <3F0B98CA.90800@ethereal-realms.org> Date: Tue, 08 Jul 2003 22:23:38 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephan Szabo , PostgreSQL Performance Subject: Re: Efficiency of timestamps References: <20030708192541.D5781-100000@megazone23.bigpanda.com> In-Reply-To: <20030708192541.D5781-100000@megazone23.bigpanda.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/150 X-Sequence-Number: 2443 Stephan Szabo wrote: > > > The row estimate is high. How many rows meet the various conditions and > some of the combinations? And how many rows does it estimate if you do a > simpler query on those with explain? > > I still think some variety of multi-column index to make the above index > conditions would help, but you'd probably need to play with which ones > help, and with the cost cut for the limit, I don't know if it'd actually > get a better plan, but it may be worth trying a bunch and seeing which > ones are useful and then dropping the rest. > > At any given point in time you would not expect to see much more then 30 posts applying for a time based search. That is primarily a result of having more then one room for which posts are attached to, and then some posts exist just to show people are there et cetera. Simpler queries seem to do quiet well. That view makes use of the same table and seems to have no performance impact from doing as such, and the position based search is considerably faster. I can show EXPLAIN ANALYSE for all of those if you wish. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Wed Jul 9 02:01:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 63E18B43961 for ; Wed, 9 Jul 2003 05:01:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 12879-01 for ; Wed, 9 Jul 2003 02:01:35 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by svr1.postgresql.org (Postfix) with ESMTP id 64652B438D9 for ; Wed, 9 Jul 2003 02:01:35 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 63685D61B; Tue, 8 Jul 2003 22:01:33 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 591C45C0C; Tue, 8 Jul 2003 22:01:33 -0700 (PDT) Date: Tue, 8 Jul 2003 22:01:33 -0700 (PDT) From: Stephan Szabo To: Martin Foster Cc: PostgreSQL Performance Subject: Re: Efficiency of timestamps In-Reply-To: <3F0B98CA.90800@ethereal-realms.org> Message-ID: <20030708215908.U8273-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/151 X-Sequence-Number: 2444 On Tue, 8 Jul 2003, Martin Foster wrote: > Stephan Szabo wrote: > > > The row estimate is high. How many rows meet the various conditions and > > some of the combinations? And how many rows does it estimate if you do a > > simpler query on those with explain? > > > > I still think some variety of multi-column index to make the above index > > conditions would help, but you'd probably need to play with which ones > > help, and with the cost cut for the limit, I don't know if it'd actually > > get a better plan, but it may be worth trying a bunch and seeing which > > ones are useful and then dropping the rest. > > > At any given point in time you would not expect to see much more then 30 > posts applying for a time based search. That is primarily a result of > having more then one room for which posts are attached to, and then some > posts exist just to show people are there et cetera. > > Simpler queries seem to do quiet well. That view makes use of the same > table and seems to have no performance impact from doing as such, and > the position based search is considerably faster. Well, the reason I asked is to see both whether the estimates for the various columns were somewhere near reality (if not, then you may need to raise the statistics target for the column) which might affect whether it'd consider using a multi-column index for the conditions and sort rather than the index scan it was using. From pgsql-performance-owner@postgresql.org Wed Jul 9 03:51:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 99F4FB42166 for ; Wed, 9 Jul 2003 06:51:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47243-07 for ; Wed, 9 Jul 2003 03:51:45 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id BCBBAB430A9 for ; Wed, 9 Jul 2003 03:51:44 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h696pjUc026528 for ; Wed, 9 Jul 2003 00:51:45 -0600 (MDT) Message-ID: <3F0BBB7E.6080008@ethereal-realms.org> Date: Wed, 09 Jul 2003 00:51:42 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance Subject: Re: Efficiency of timestamps References: <20030708215908.U8273-100000@megazone23.bigpanda.com> In-Reply-To: <20030708215908.U8273-100000@megazone23.bigpanda.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/152 X-Sequence-Number: 2445 Stephan Szabo wrote: > > Well, the reason I asked is to see both whether the estimates for the > various columns were somewhere near reality (if not, then you may need to > raise the statistics target for the column) which might affect whether > it'd consider using a multi-column index for the conditions and sort > rather than the index scan it was using. > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster I'm going to have to pull out the 'Practical PostgreSQL' book and brush up on optimizing. This level of optimization is not something I have had to deal with in the past. Also to make this interesting. The sub-query method is faster at times and slower in others. But doing two separate queries and working on the PostIDNumber field exclusively is always blazingly fast... Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Wed Jul 9 14:30:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 459C7B4315E for ; Wed, 9 Jul 2003 17:30:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 98964-07 for ; Wed, 9 Jul 2003 14:29:39 -0300 (ADT) Received: from freebsd47.hub.org (u134n133.eastlink.ca [24.224.134.133]) by svr1.postgresql.org (Postfix) with ESMTP id 79DD5B430D8 for ; Wed, 9 Jul 2003 14:29:39 -0300 (ADT) Received: from [192.168.0.5] (freebsd47 [192.168.0.5]) by freebsd47.hub.org (Postfix) with ESMTP id 113DCA955; Wed, 9 Jul 2003 14:29:38 -0300 (ADT) Subject: Some very weird behaviour.... From: Chris Bowlby Reply-To: excalibur@hub.org To: pgsql-performance@postgresql.org Content-Type: text/plain Organization: Hub.Org Networking Services Message-Id: <1057771777.33712.98.camel@freebsd47> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 09 Jul 2003 14:29:38 -0300 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/153 X-Sequence-Number: 2446 Hi All, I'm sure some of you know me from previous questions on other lists, but this one has myself and Marc completely stumped. We've got a database that has about 89 Million rows, under PostgreSQL 7.3.3 on a dual PIII 1.2 with 4 GBytes of RAM on a 5 disk RAID 5 array. The dataset itself is about 26+ GBYtes in size, all of it in the one table. To give you some perspective on the size of the dataset and the performance level we are hitting, here are some "good" results based on some explains: jnlstats=# explain analyze select count(*) from some_table where some_time::date='2003-05-21'; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1794562.35..1794562.35 rows=1 width=0) (actual time=3013.55..3013.55 rows=1 loops=1) -> Index Scan using some_table_ix_0 on some_table (cost=0.00..1793446.02 rows=446531 width=0) (actual time=48.40..2721.26 rows=249837 loops=1) Index Cond: ((some_time)::date = '2003-05-21'::date) Total runtime: 3015.02 msec (4 rows) jnlstats=# explain analyze select count(*) from stats_raw where some_time::date='2003-05-21'; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1794562.35..1794562.35 rows=1 width=0) (actual time=1401.23..1401.23 rows=1 loops=1) -> Index Scan using some_table_ix_0 on some_table (cost=0.00..1793446.02 rows=446531 width=0) (actual time=0.50..1118.92 rows=249837 loops=1) Index Cond: ((some_time)::date = '2003-05-21'::date) Total runtime: 1401.42 msec There are about 249837 items that the query is identifying as valid results and the results range between 1-1.4 seconds over ten runs with the initial query taking 3 seconds, this average is how 90% of the queries resopond, but we've got several peaks that we can not explain in any way. For instance: jnlstats=# explain analyze select count(*) from some_table where some_time::date='2003-05-26'; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1794562.35..1794562.35 rows=1 width=0) (actual time=307025.65..307025.65 rows=1 loops=1) -> Index Scan using some_table_ix_0 on some_table (cost=0.00..1793446.02 rows=446531 width=0) (actual time=51.05..306256.93 rows=374540 loops=1) Index Cond: ((some_time)::date = '2003-05-26'::date) Total runtime: 307025.81 msec (4 rows) jnlstats=# explain analyze select count(*) from some_table where some_time::date='2003-05-26'; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1794562.35..1794562.35 rows=1 width=0) (actual time=10837.86..10837.86 rows=1 loops=1) -> Index Scan using some_table_ix_0 on some_table (cost=0.00..1793446.02 rows=446531 width=0) (actual time=1.01..10304.78 rows=374540 loops=1) Index Cond: ((some_time)::date = '2003-05-26'::date) Total runtime: 10838.04 msec The total number of items counted is 374540 items, so not too much more then the previous query, but the 300 second runtime was unexpected (we were expecting ~4-5 seconds and then ~1-2 seconds for the caches results. I have 5 other dates that all exhibit this information,but it's ONLY those dates that run that slow and the one I presented above here is the largest of them all. The database server is configured with a 5 MByte shared mamory buffer, but even a larger shared memory buffer does not help (we have had it set to 800 MBytes before). The disk is getting hit the heviest durring that last query, with iostat results being: tty da0 da1 da2 cpu tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id 0 25 12.22 1 0.02 7.68 0 0.00 7.68 0 0.00 0 0 0 0 99 4 3758 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 6 0 38 0 56 0 151 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 9 0 43 0 48 0 148 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 10 0 40 0 49 0 153 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 10 0 40 0 49 0 152 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 10 0 40 1 49 0 150 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 9 0 42 0 49 0 153 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 9 0 41 1 49 0 149 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 8 0 45 0 48 0 148 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 11 0 41 0 48 0 152 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 12 0 38 0 50 0 152 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 14 0 37 0 49 0 152 16.00 20 0.31 8.00 9 0.07 8.00 16 0.12 0 0 1 0 98 0 152 2.00 1 0.00 0.00 0 0.00 1.00 2 0.00 0 0 0 0 100 0 152 11.33 6 0.07 0.00 0 0.00 1.00 2 0.00 0 0 0 0 99 0 152 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 1 0 0 0 99 0 152 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 1 0 0 0 99 0 152 0.00 0 0.00 0.00 0 0.00 0.00 0 0.00 0 0 0 0 100 0 154 0.00 0 0.00 5.89 18 0.10 0.00 0 0.00 0 0 1 0 98 The database is vacuumed about once every hour, the pg_stats table shows: jnlstats=# select tablename, attname, n_distinct from pg_stats where tablename = 'some_table'; tablename | attname | n_distinct -----------+------------------+------------ some_table | some_time | -0.24305 So the column is very distinct (assuming that's what a negative number means). What I'm looking for is any form of explaination that might be casusing those spikes, but at the same time a possible solution that might help me bring it down some... -- Chris Bowlby Hub.Org Networking Services From pgsql-performance-owner@postgresql.org Wed Jul 9 14:43:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E3413B439E1 for ; Wed, 9 Jul 2003 17:43:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 05878-08 for ; Wed, 9 Jul 2003 14:42:40 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 6F76BB439FF for ; Wed, 9 Jul 2003 14:42:06 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id CA22D1025A; Wed, 9 Jul 2003 13:35:23 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id B7DA510248; Wed, 9 Jul 2003 13:35:21 -0400 (EDT) Subject: Re: Some very weird behaviour.... From: Rod Taylor To: excalibur@hub.org Cc: Postgresql Performance In-Reply-To: <1057771777.33712.98.camel@freebsd47> References: <1057771777.33712.98.camel@freebsd47> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-2WPcwRj2P0eDr0K6ZKFz" Message-Id: <1057772554.46100.103.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 09 Jul 2003 17:42:35 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/154 X-Sequence-Number: 2447 --=-2WPcwRj2P0eDr0K6ZKFz Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > To give you some perspective on the size of the dataset and the > performance level we are hitting, here are some "good" results based on > some explains: Before Tom jumps in taking all the fun out of trying to solve it... The estimates in the slow queries seem perfectly reasonable. In fact, the cost estimates of both the slow and fast queries are the same which is what would be expected if all of the data was distributed evenly amongst the table. Given it's a date, I would guess that the data is generally inserted into the table in an order following the date but for some reason those 'high' dates have their data distributed more evenly amongst the table.=20 Clustered data will have fewer disk seeks and deal with fewer pages of information in general which makes for a much faster query. Distributed data will have to pull out significantly more information from the disk, throwing most of it away. I would guess that sometime on 2002-05-25 someone did a bit of data cleaning (deleting records). Next day the free space map had entries available in various locations within the table, and used them rather than appending to the end. With 89 Million records with date being significant, I'm guessing there aren't very many modifications or deletes on it. So.. How to solve the problem? If this is the type of query that occurs most often, you do primarily inserts, and the inserts are generally created following date, cluster the table by index "some_table_ix_0".=20 The clustering won't degrade very much since that is how you naturally insert the data. --=-2WPcwRj2P0eDr0K6ZKFz Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/DFQK6DETLow6vwwRAgZKAJ9HI3RaznYivCB+4IXKnXa5SbzqLwCfRZ4V hz7nN0f7Ps1DRNwWtZ0XR9I= =XEZh -----END PGP SIGNATURE----- --=-2WPcwRj2P0eDr0K6ZKFz-- From pgsql-performance-owner@postgresql.org Wed Jul 9 15:29:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9357BB4388D for ; Wed, 9 Jul 2003 18:29:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 18693-07 for ; Wed, 9 Jul 2003 15:29:10 -0300 (ADT) Received: from hot.ee (mail.hot.ee [194.126.101.94]) by svr1.postgresql.org (Postfix) with ESMTP id 30673B430B3 for ; Wed, 9 Jul 2003 15:29:06 -0300 (ADT) Received: from localhost (relay3 [127.0.0.1]) by hot.ee (Postfix) with ESMTP id 82FD0C1110; Wed, 9 Jul 2003 21:29:02 +0300 (EEST) Received: from hot.ee ([127.0.0.1]) by localhost (relay3 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24055-18; Wed, 9 Jul 2003 21:29:02 +0300 (EEST) Received: from future.ee (80-235-33-206-dsl.mus.estpak.ee [80.235.33.206]) by hot.ee (Postfix) with ESMTP id 2C9EFC1127; Wed, 9 Jul 2003 21:29:00 +0300 (EEST) Message-ID: <3F0C5FFF.30406@future.ee> Date: Wed, 09 Jul 2003 21:33:35 +0300 From: Kaarel User-Agent: Mozilla/5.0 (X11; U; Linux i686; et-EE; rv:1.3) Gecko/20030313 X-Accept-Language: et, en-gb MIME-Version: 1.0 To: Tom Lane Cc: Matthew Nuzum , 'Andrew Sullivan' , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... References: <008301c34489$4dbf0b00$a322fea9@mattspc> <19041.1057584643@sss.pgh.pa.us> In-Reply-To: <19041.1057584643@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by mail.hot.ee X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/155 X-Sequence-Number: 2448 >>Are you willing to say that the PostgreSQL database system should only be >>used by DBAs? I believe that Postgres is such a good and useful tool that >>anyone should be able to start using it with little or no barrier to entry. > > > I quite agree. But there is a difference between saying "you should get > decent performance with no effort" and "you should get optimal > performance with no effort". I think we can get to the first with > relatively little trouble (like boosting the default shared_buffers to > 1000), but the second is an impractical goal. Just wanted to repeat some of the thoughts already been expressed. There are no reasons why shouldn't PostgreSQL be reasonably well configured for a particular platform out of the box. Not for maximum performance but for good enough performance. The many complaints by new users about PostgreSQL being suprisingly slow and the all the so standard answers (vacuum, pump up memory settings) imho prove that the default installatio can be improved. Already mentioned in the mail lists: using multiple standard conf files, quering system info and dynamically generating all or some parts of the conf file, automating the vacuum process... Kaarel From pgsql-performance-owner@postgresql.org Wed Jul 9 16:49:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 79B9EB438D9 for ; Wed, 9 Jul 2003 19:49:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 50700-10 for ; Wed, 9 Jul 2003 16:48:36 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 16718B439D5 for ; Wed, 9 Jul 2003 16:48:29 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h69JlSWk009941; Wed, 9 Jul 2003 13:47:28 -0600 (MDT) Date: Wed, 9 Jul 2003 13:40:45 -0600 (MDT) From: "scott.marlowe" To: Kaarel Cc: Tom Lane , Matthew Nuzum , "'Andrew Sullivan'" , Subject: Re: Moving postgresql.conf tunables into 2003... In-Reply-To: <3F0C5FFF.30406@future.ee> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/156 X-Sequence-Number: 2449 On Wed, 9 Jul 2003, Kaarel wrote: > >>Are you willing to say that the PostgreSQL database system should only be > >>used by DBAs? I believe that Postgres is such a good and useful tool that > >>anyone should be able to start using it with little or no barrier to entry. > > > > > > I quite agree. But there is a difference between saying "you should get > > decent performance with no effort" and "you should get optimal > > performance with no effort". I think we can get to the first with > > relatively little trouble (like boosting the default shared_buffers to > > 1000), but the second is an impractical goal. > > > Just wanted to repeat some of the thoughts already been expressed. > > There are no reasons why shouldn't PostgreSQL be reasonably well > configured for a particular platform out of the box. Not for maximum > performance but for good enough performance. The many complaints by new > users about PostgreSQL being suprisingly slow and the all the so > standard answers (vacuum, pump up memory settings) imho prove that the > default installatio can be improved. Already mentioned in the mail > lists: using multiple standard conf files, quering system info and > dynamically generating all or some parts of the conf file, automating > the vacuum process... It would be nice to have a program that could run on any OS postgresql runs on and could report on the current limits of the kernel, and make recommendations for changes the admin might want to make. One could probably make a good stab at effective cache size during install. Anything reasonably close would probably help. Report what % of said resources could be consumed by postgresql under various circumstances... From pgsql-performance-owner@postgresql.org Wed Jul 9 18:46:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CC3E0B430CB for ; Wed, 9 Jul 2003 21:45:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 79242-10 for ; Wed, 9 Jul 2003 18:45:26 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id D03B3B439ED for ; Wed, 9 Jul 2003 18:45:25 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h69Lj8Uc012190; Wed, 9 Jul 2003 15:45:10 -0600 (MDT) Message-ID: <3F0C8CE1.3080308@ethereal-realms.org> Date: Wed, 09 Jul 2003 15:45:05 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Marlowe , PostgreSQL Performance Subject: Re: Moving postgresql.conf tunables into 2003... 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-Archive-Number: 200307/157 X-Sequence-Number: 2450 Scott Marlowe wrote: > > It would be nice to have a program that could run on any OS postgresql > runs on and could report on the current limits of the kernel, and make > recommendations for changes the admin might want to make. > > One could probably make a good stab at effective cache size during > install. Anything reasonably close would probably help. > > Report what % of said resources could be consumed by postgresql under > various circumstances... > One of the issues that automating the process would encounter are limits in the kernel that are too low for PostgreSQL to handle. The BSD's come to mind where they need values manually increased in the kernel before you can reach a reasonable maximum connection count. Another example is how OpenBSD will outright crash when trying to test the database during install time. It seems that most of the tests fail because the maximum amount of processes allowed is too low for the test to succeed. While FreeBSD will work just fine on those same tests. If PostgreSQL automates the configuration, that would be a plus. But also detect the platform and inform the person that these changes should be done to the kernel, sysctl or whatever in order to have that configuration run. Perl may be useful in this for a few reasons. It's portable enough to run on multiple Unix variants and the tools would be fairly standard, so the code would require less considerations for more exotic implementations. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Wed Jul 9 20:31:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 7B1CFB43162 for ; Wed, 9 Jul 2003 23:31:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 22776-08 for ; Wed, 9 Jul 2003 20:30:29 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 81309B430AF for ; Wed, 9 Jul 2003 20:30:29 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 9C3622105A; Wed, 9 Jul 2003 16:30:31 -0700 (PDT) Date: Wed, 9 Jul 2003 16:30:31 -0700 From: Sean Chittenden To: Michael Mattox Cc: pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Message-ID: <20030709233031.GF72567@perrin.int.nxad.com> References: <20030703190502.GR72567@perrin.int.nxad.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/158 X-Sequence-Number: 2451 > I don't have much to add because I'm pretty new to Postgres and have > been soliciting advice here recently, but I totally agree with > everything you said. I don't mind if it's in the postgres.conf file > or in a faq that is easy to find, I just would like it to be in one > place. A good example of the need for this is when I was tuning > "effective_cache" I thought that was creating a cache for Postgres > when in fact as it was pointed out to me, it's just hinting to > postgres the size of the OS cache. Lots of ways for people to get > really confused here. I looked through the src/doc/runtime.sgml for a good place to stick this and couldn't find a place that this seemed appropriate, but on FreeBSD, this can be determined with a great deal of precision in a programmatic manner: echo "effective_cache_size = $((`sysctl -n vfs.hibufspace` / 8192))" The same OID is available via C too. It'd be slick if PostgreSQL could tune itself (on FreeBSD) at initdb time with the above code. If Linux exports this info via /proc and can whip out the appropriate magic, even better. An uncommented out good guess that shows up in postgresql.conf would be stellar and quite possible with the use of sed. Maybe an initdb switch could be added to have initdb tune the config it generates? If a -n is added, have it generate a config and toss it to stdout? case `uname` in "FreeBSD") echo "effective_cache_size = $((`sysctl -n vfs.hibufspace` / 8192))" ;; *) echo "Unable to automatically determine the effective cache size" >> /dev/stderr ;; esac -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Wed Jul 9 21:25:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id A9F65B439C9 for ; Thu, 10 Jul 2003 00:25:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 31130-09 for ; Wed, 9 Jul 2003 21:25:06 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 3F503B430C3 for ; Wed, 9 Jul 2003 21:25:06 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6A0NlUc025125; Wed, 9 Jul 2003 18:23:48 -0600 (MDT) Message-ID: <3F0CB210.60309@ethereal-realms.org> Date: Wed, 09 Jul 2003 18:23:44 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Sean Chittenden , PostgreSQL Performance Subject: Re: Moving postgresql.conf tunables into 2003... References: <20030703190502.GR72567@perrin.int.nxad.com> <20030709233031.GF72567@perrin.int.nxad.com> In-Reply-To: <20030709233031.GF72567@perrin.int.nxad.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/159 X-Sequence-Number: 2452 Sean Chittenden wrote: > > I looked through the src/doc/runtime.sgml for a good place to stick > this and couldn't find a place that this seemed appropriate, but on > FreeBSD, this can be determined with a great deal of precision in a > programmatic manner: > > echo "effective_cache_size = $((`sysctl -n vfs.hibufspace` / 8192))" > > The same OID is available via C too. It'd be slick if PostgreSQL > could tune itself (on FreeBSD) at initdb time with the above code. If > Linux exports this info via /proc and can whip out the appropriate > magic, even better. An uncommented out good guess that shows up in > postgresql.conf would be stellar and quite possible with the use of > sed. > > Maybe an initdb switch could be added to have initdb tune the config > it generates? If a -n is added, have it generate a config and toss it > to stdout? > > > case `uname` in > "FreeBSD") > echo "effective_cache_size = $((`sysctl -n vfs.hibufspace` / 8192))" > ;; > *) > echo "Unable to automatically determine the effective cache size" >> /dev/stderr > ;; > esac > > > -sc > Simplest way may be to create a 'auto-tune' directory with scripts for configured platforms. When postgres installs the databases, it checks for 'tune.xxx' and if found uses that to generate the script itself? This would allow for defaults on platforms that do not have them and optimization for those that do. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Wed Jul 9 22:47:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 567A7B439CF for ; Thu, 10 Jul 2003 01:47:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 59000-01 for ; Wed, 9 Jul 2003 22:46:46 -0300 (ADT) Received: from server1.techplant.com (unknown [209.61.173.33]) by svr1.postgresql.org (Postfix) with ESMTP id B0641B43A01 for ; Wed, 9 Jul 2003 22:46:44 -0300 (ADT) Received: from localhost (michael@localhost) by server1.techplant.com (8.11.6/8.11.6) with ESMTP id h6A1maV09949 for ; Wed, 9 Jul 2003 21:48:36 -0400 Date: Wed, 9 Jul 2003 21:48:36 -0400 (EDT) From: Michael Pohl X-X-Sender: michael@server1.techplant.com To: pgsql-performance@postgresql.org Subject: plpgsql vs. SQL performance (again) Message-ID: X-Mailkey: j9dfjk23j4dkq MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/161 X-Sequence-Number: 2454 About a month ago I asked the general list about plpgsql functions that occasionally significantly underperform their straight SQL equivalents. Tom noted that a different query plan was almost certainly being chosen by the plpgsql function: http://archives.postgresql.org/pgsql-general/2003-05/msg00966.php http://archives.postgresql.org/pgsql-general/2003-05/msg00998.php Tom suggested checking for sloppy datatype declarations in the plpgsql functions. Double-checked, a-ok. Tom also suggested that indexscans might not get picked by the plpgsql function if I have some very skewed statistics. Is there a way to verify the plpgsql function's planner choices? My casual observations are that this problem occurs with aggregates, and that the big performance hit is not consistent. I'd like advice on more formal troubleshooting. I can provide examples (my latest problem function is currently taking over 4 seconds vs. .04 seconds for its straight SQL equivalent), table schema, explain output for the straight SQL, etc., if anyone cares to work through this with me. thanks, michael From pgsql-performance-owner@postgresql.org Wed Jul 9 22:46:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C142DB439D3 for ; Thu, 10 Jul 2003 01:46:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 54368-09 for ; Wed, 9 Jul 2003 22:45:43 -0300 (ADT) Received: from camellia.sanmina.com.hk (unknown [211.96.107.86]) by svr1.postgresql.org (Postfix) with ESMTP id 0EBD2B439BF for ; Wed, 9 Jul 2003 22:45:41 -0300 (ADT) Received: from ChrisWu ([172.25.15.102]) by camellia.sanmina.com.hk (8.11.0/8.11.2) with SMTP id h6A1k0j05222 for ; Thu, 10 Jul 2003 09:46:01 +0800 Reply-To: From: "Chris_Wu" To: Subject: Can you help me? Date: Thu, 10 Jul 2003 09:51:53 +0800 Message-ID: <000201c34685$d7242210$660f19ac@ChrisWu> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) Importance: Normal 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.2 tagged_above=0.0 required=5.0 tests=BAYES_30, RCVD_IN_RFCI X-Spam-Level: X-Archive-Number: 200307/160 X-Sequence-Number: 2453 Hello all! I'm a new to Postgresql , I have never used it before. I am having an issue with configure the postgresql.conf file. The machine itself is a 2.66GHz P4 w/ 2G memory. Would you mind to send me a copy of examples .(postgresql.conf) Maybe you can tell me how to configure these parameters. Thanks Sincerely, Chris.Wu From pgsql-novice-owner@postgresql.org Thu Jul 10 02:38:18 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 4DED3CBF91; Thu, 10 Jul 2003 05:38:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 46984-10; Thu, 10 Jul 2003 02:37:40 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id D5562CBF69; Thu, 10 Jul 2003 02:37:39 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6A5bqUc006234; Wed, 9 Jul 2003 23:37:52 -0600 (MDT) Message-ID: <3F0CFBAE.6080002@ethereal-realms.org> Date: Wed, 09 Jul 2003 23:37:50 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= , PostgreSQL Performance , PostgreSQL Novice Subject: Re: [PERFORM] Extreme high load averages 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-Archive-Number: 200307/82 X-Sequence-Number: 7617 Dennis Bj�rklund wrote: > On Sun, 6 Jul 2003, Martin Foster wrote: > > >>The processor seems to be purposely sitting there twiddling it's thumbs. >> Which leads me to believe that perhaps the nice levels have to be >>changed on the server itself? > > > It could also be all the usual things that affect performance. Are your > queries using indexes where it should? Do you vacuum analyze after you > have updated/inserted a lot of data? > > It could be that some of your queries is not as efficient as it should, > like doing a sequenctial scan over a table instead of an index scan. That > translates into more IO needed and slower response times. Especially when > you have more connections figthing for the available IO. > I actually got a bit more respect for PostgreSQL tonight. It seems that one of my scripts was not committing changes after maintenance was conducted. Meaning that rows that would normally be removed after offline archiving was completed were in fact still around. Normally at any given point in time this table would grow 50K rows during a day, be archived that night and then loose rows that were no longer needed. This process, is what allowed MySQL to maintain any stability as the size of this table can balloon significantly. PostgreSQL with tweaking was handling a table with nearly 300K rows. That size alone would of dragged the MySQL system down to a near grind, and since most of those rows are not needed. One can imagine that queries are needlessly processing rows that should be outright ignored. This probably explains why row numbering based searches greatly accelerated the overall process. By fixing the script and doing the appropriate full vacuum and re-index, the system is behaving much more like it should. Even if the process may seem a bit odd to some. The reason for removing rows on a daily basis is due to the perishable nature of the information. Since this is a chat site, posts over a day old are rarely needed for any reason. Which is why they are archived into dumps in case we really need to retrieve the information itself and this gives us the added bonus of smaller backup sizes and smaller database sizes. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Thu Jul 10 03:29:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CA092CB557 for ; Thu, 10 Jul 2003 06:29:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 49947-03 for ; Thu, 10 Jul 2003 03:29:09 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id DDF0ACB405 for ; Thu, 10 Jul 2003 03:29:07 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6A6VEdI003579 for ; Thu, 10 Jul 2003 12:01:14 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6A6VCKr003533 for ; Thu, 10 Jul 2003 12:01:13 +0530 From: "Shridhar Daithankar" To: Postgresql Performance Date: Thu, 10 Jul 2003 12:00:16 +0530 MIME-Version: 1.0 Subject: Re: [NOVICE] Extreme high load averages Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F0D5550.21678.4E122CF@localhost> In-reply-to: <3F0CFBAE.6080002@ethereal-realms.org> References: 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-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/163 X-Sequence-Number: 2456 On 9 Jul 2003 at 23:37, Martin Foster wrote: > By fixing the script and doing the appropriate full vacuum and re-index, > the system is behaving much more like it should. Even if the process > may seem a bit odd to some. > > The reason for removing rows on a daily basis is due to the perishable > nature of the information. Since this is a chat site, posts over a day > old are rarely needed for any reason. Which is why they are archived > into dumps in case we really need to retrieve the information itself and > this gives us the added bonus of smaller backup sizes and smaller > database sizes. I have an idea. How about creating a table for each day. Use it for a while and rename it. Since you can rename a table in transaction, it should not be a problem. You can use inheritance if you want to query all of them. Using indexes and foregin keys on inherited tables is a problem though. That way deletion would be avoided and so would vacuum. It should be mich lighter on the system overall as well. Tell us if it works. Bye Shridhar -- Kaufman's Law: A policy is a restrictive document to prevent a recurrence of a single incident, in which that incident is never mentioned. From pgsql-performance-owner@postgresql.org Thu Jul 10 03:55:40 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id CC34CCBF43 for ; Thu, 10 Jul 2003 06:55:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 52449-07 for ; Thu, 10 Jul 2003 03:54:52 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 509DDCC020 for ; Thu, 10 Jul 2003 03:43:47 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6A6hOUc022678; Thu, 10 Jul 2003 00:43:24 -0600 (MDT) Message-ID: <3F0D0B0A.70506@ethereal-realms.org> Date: Thu, 10 Jul 2003 00:43:22 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Shridhar Daithankar , PostgreSQL Performance Subject: Re: [NOVICE] Extreme high load averages References: <3F0D5550.21678.4E122CF@localhost> In-Reply-To: <3F0D5550.21678.4E122CF@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/164 X-Sequence-Number: 2457 Shridhar Daithankar wrote: > > > I have an idea. > > How about creating a table for each day. Use it for a while and rename it. > Since you can rename a table in transaction, it should not be a problem. > > You can use inheritance if you want to query all of them. Using indexes and > foregin keys on inherited tables is a problem though. > > That way deletion would be avoided and so would vacuum. It should be mich > lighter on the system overall as well. > > Tell us if it works. > > Bye > Shridhar > Generally I won't be pulling 250K rows from that table. It's maintained nightly during the general cleanup process where stale users, rooms and posts are removed from the system. Then the system runs a normal VACUUM ANALYSE to get things going again smoothly. Once a week a more detailed archiving takes place which runs an all out vaccume and re-index. That's the so called plan at least. As for creating a new table, that in itself is a nice idea. But it would cause issues for people currently in the realm. Their posts would essentially dissapear from site and cause more confusion then its worth. Inheritance would work, but the database would essentially just grow and grow and grow right? BTW, I can't thank you all enough for this general advice. It's helping me get this thing running very smoothly. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Thu Jul 10 04:10:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 8FD1FCBED8 for ; Thu, 10 Jul 2003 07:10:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 53814-09 for ; Thu, 10 Jul 2003 04:10:06 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 3FB70CB566 for ; Thu, 10 Jul 2003 04:10:04 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6A7CD6B019658 for ; Thu, 10 Jul 2003 12:42:13 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6A7CCKr019645; Thu, 10 Jul 2003 12:42:12 +0530 From: "Shridhar Daithankar" To: PostgreSQL Performance , Martin Foster Date: Thu, 10 Jul 2003 12:41:16 +0530 MIME-Version: 1.0 Subject: Re: [NOVICE] Extreme high load averages Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F0D5EEC.29862.506A9AE@localhost> In-reply-to: <3F0D0B0A.70506@ethereal-realms.org> References: <3F0D5550.21678.4E122CF@localhost> 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-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/165 X-Sequence-Number: 2458 On 10 Jul 2003 at 0:43, Martin Foster wrote: > As for creating a new table, that in itself is a nice idea. But it > would cause issues for people currently in the realm. Their posts > would essentially dissapear from site and cause more confusion then its > worth. No they won't. Say you have a base table and your current post table is child of that. You can query on base table and get rows from child table. That way all the data would always be there. While inserting posts, you would insert in child table. While qeurying you would query on base table. That way things will be optimal. > Inheritance would work, but the database would essentially just grow and > grow and grow right? Right. But there are two advantages. 1. It will always contain valid posts. No dead tuples. 2. You can work in chuncks of data. Each child table can be dealt with separately without affecting other child tables, whereas in case of a single large table, entire site is affected.. Deleting 100K posts from 101K rows table is vastly different than deleting 10K posts from 2M rows table. Later one would unnecessary starve the table with dead tuples and IO whereas in former case you can do create table as select from and drop the original.. HTH Bye Shridhar -- "[In 'Doctor' mode], I spent a good ten minutes telling Emacs what Ithought of it. (The response was, 'Perhaps you could try to be lessabusive.')"(By Matt Welsh) From pgsql-performance-owner@postgresql.org Thu Jul 10 07:10:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AEE80CC556 for ; Thu, 10 Jul 2003 09:41:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 86768-10 for ; Thu, 10 Jul 2003 06:41:25 -0300 (ADT) Received: from deun2kex01.REALGARANT.DE (mail.realgarant.de [195.143.134.176]) by svr1.postgresql.org (Postfix) with ESMTP id 1E53CCC20F for ; Thu, 10 Jul 2003 05:27:48 -0300 (ADT) content-class: urn:content-classes:message Subject: Re: Can you help me? MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Jul 2003 10:29:46 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Can you help me? Thread-Index: AcNGhVHowkiBB+a0SaOI/n4Tc7QatgANuPXA From: "Oliver Scheit" To: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/166 X-Sequence-Number: 2459 With 2 GB RAM I'd go for about this: (assuming you're using Linux) shared_buffers =3D 32768 sort_mem =3D 61440 vacuum_mem =3D 32768 effective_cache_size =3D 64000 that should give you a start. You might have to adjust your shmall and shmmax parameters, again assuming you're using linux. (you have to edit the /etc/sysctl.conf file) There's good stuff on the web, try google and feed it with "postgres shared_buffers effective_cache_size" or "linux shmall shmmax" regards, Oli -----Urspr=A8=B9ngliche Nachricht----- Von: Chris_Wu [mailto:Chris.Wu@Sanmina-SCI.Com] Gesendet: Donnerstag, 10. Juli 2003 03:52 An: pgsql-performance@postgresql.org Betreff: [PERFORM] Can you help me? Hello all! I'm a new to Postgresql , I have never used it before. I am having an issue with configure the postgresql.conf file. The machine itself is a 2.66GHz P4 w/ 2G memory. Would you mind to send me a copy of examples .(postgresql.conf) Maybe you can tell me how to configure these parameters. Thanks Sincerely, Chris.Wu ---------------------------(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-sql-owner@postgresql.org Fri Jul 11 05:32:36 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 8DE31CC3C0 for ; Fri, 11 Jul 2003 08:32:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 73019-05 for ; Fri, 11 Jul 2003 05:32:22 -0300 (ADT) Received: from server1.techplant.com (unknown [209.61.173.33]) by svr1.postgresql.org (Postfix) with ESMTP id D927ECD0CD for ; Thu, 10 Jul 2003 09:54:09 -0300 (ADT) Received: from localhost (michael@localhost) by server1.techplant.com (8.11.6/8.11.6) with ESMTP id h6ACtxB13911; Thu, 10 Jul 2003 08:56:04 -0400 Date: Thu, 10 Jul 2003 08:55:59 -0400 (EDT) From: Michael Pohl X-X-Sender: michael@server1.techplant.com To: pgsql-sql@postgresql.org Cc: Tom Rochester Subject: Re: substr_count In-Reply-To: Message-ID: X-Mailkey: j9dfjk23j4dkq MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/139 X-Sequence-Number: 14253 On Thu, 10 Jul 2003, Tom Rochester wrote: > I would like to achive something along the lines of: > > SELECT field FROM table WHERE field ILIKE '$searchterm' ORDER BY > substr_count(field, '$searchterm'); If you have plperl installed: create or replace function substr_count( varchar(255), varchar(255) ) returns int as ' my ($field, $searchterm) = @_; my $count = $field =~ s/$searchterm//g; return $count; ' language 'plperl'; michael From pgsql-performance-owner@postgresql.org Fri Jul 11 02:56:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 30561D22B8 for ; Fri, 11 Jul 2003 05:54:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 15789-01 for ; Fri, 11 Jul 2003 02:54:28 -0300 (ADT) Received: from freebsd47.hub.org (u134n133.eastlink.ca [24.224.134.133]) by svr1.postgresql.org (Postfix) with ESMTP id 9669CCD797 for ; Thu, 10 Jul 2003 12:08:56 -0300 (ADT) Received: from [192.168.0.5] (freebsd47 [192.168.0.5]) by freebsd47.hub.org (Postfix) with ESMTP id 48959A955; Thu, 10 Jul 2003 12:09:10 -0300 (ADT) Subject: Re: Some very weird behaviour.... From: Chris Bowlby Reply-To: excalibur@hub.org To: Rod Taylor Cc: Postgresql Performance In-Reply-To: <1057772554.46100.103.camel@jester> References: <1057771777.33712.98.camel@freebsd47> <1057772554.46100.103.camel@jester> Content-Type: text/plain Organization: Hub.Org Networking Services Message-Id: <1057849750.38433.12.camel@freebsd47> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 10 Jul 2003 12:09:10 -0300 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/170 X-Sequence-Number: 2463 On Wed, 2003-07-09 at 14:42, Rod Taylor wrote: Clustering definatly helped with that case, and appears to have helped with all of the dates I have had high execution times for... thanks for the tip.. > > To give you some perspective on the size of the dataset and the > > performance level we are hitting, here are some "good" results based on > > some explains: > > Before Tom jumps in taking all the fun out of trying to solve it... > > > The estimates in the slow queries seem perfectly reasonable. In fact, > the cost estimates of both the slow and fast queries are the same which > is what would be expected if all of the data was distributed evenly > amongst the table. > > Given it's a date, I would guess that the data is generally inserted > into the table in an order following the date but for some reason those > 'high' dates have their data distributed more evenly amongst the table. > Clustered data will have fewer disk seeks and deal with fewer pages of > information in general which makes for a much faster query. Distributed > data will have to pull out significantly more information from the disk, > throwing most of it away. > > I would guess that sometime on 2002-05-25 someone did a bit of data > cleaning (deleting records). Next day the free space map had entries > available in various locations within the table, and used them rather > than appending to the end. With 89 Million records with date being > significant, I'm guessing there aren't very many modifications or > deletes on it. > > So.. How to solve the problem? If this is the type of query that occurs > most often, you do primarily inserts, and the inserts are generally > created following date, cluster the table by index "some_table_ix_0". > The clustering won't degrade very much since that is how you naturally > insert the data. -- Chris Bowlby Hub.Org Networking Services From pgsql-performance-owner@postgresql.org Fri Jul 11 04:10:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3EBB9CD5C7 for ; Fri, 11 Jul 2003 07:10:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 41620-03 for ; Fri, 11 Jul 2003 04:10:11 -0300 (ADT) Received: from mail-2.zoominternet.net (unknown [63.67.120.12]) by svr1.postgresql.org (Postfix) with SMTP id BA070CD7E7 for ; Thu, 10 Jul 2003 12:17:46 -0300 (ADT) Received: (qmail 5616 invoked from network); 10 Jul 2003 15:17:58 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-2.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 10 Jul 2003 15:17:58 -0000 Subject: force the use of a particular index From: Scott Cain To: pgsql-performance@postgresql.org Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1057850280.1451.22.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 10 Jul 2003 11:18:01 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/172 X-Sequence-Number: 2465 Hello, I am wondering if there is a way to force the use of a particular index when doing a query. I have two tables that are pretty big (each >3 million rows), and when I do a join between them the performance is generally quite poor as it does not use the indexes that I think it should use. Here is an example query: SELECT DISTINCT f.name,fl.fmin,fl.fmax,fl.strand,f.type_id,f.feature_id FROM feature f, featureloc fl WHERE f.feature_id = fl.feature_id and fl.srcfeature_id = 6 and fl.fmin <= 2585581 and fl.fmax >= 2565581 and f.type_id = 219 Now, I know that if the query planner will use an index on featureloc on (srcfeature_id, fmin, fmax) that will reduce the amount of data from the featureloc table from over 3 million to at most a few thousand, and it will go quite quickly (if I drop other indexes on this table, it does use that index and completes in about 1/1000th of the time). After that, the join with the feature table should go quite quickly as well using the primary key on feature. So, the question is, is there a way I can force the query planner to use the index I want it to use? I have experimented with using INNER JOIN and changing the order of the tables in the join clause, but nothing seems to work. Any suggestions? Thanks much, Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Thu Jul 10 21:44:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 70B2DCB77B for ; Fri, 11 Jul 2003 00:41:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 16103-07 for ; Thu, 10 Jul 2003 21:41:28 -0300 (ADT) Received: from spirit.aldeiadigital.com.br (iplus-fac-225-213-137.xdsl-fixo.ctbcnetsuper.com.br [200.225.213.137]) by svr1.postgresql.org (Postfix) with ESMTP id 3330ACC570 for ; Thu, 10 Jul 2003 14:41:53 -0300 (ADT) Received: from webmail.ad2.com.br (localhost.localdomain [127.0.0.1]) by spirit.aldeiadigital.com.br (8.11.6/8.11.6) with SMTP id h6AHhMY25122 for ; Thu, 10 Jul 2003 14:43:25 -0300 Received: from 192.168.1.100 (SquirrelMail authenticated user alepaes) by webmail.ad2.com.br with HTTP; Thu, 10 Jul 2003 14:43:25 -0300 (BRT) Message-ID: <1192.192.168.1.100.1057859005.squirrel@webmail.ad2.com.br> Date: Thu, 10 Jul 2003 14:43:25 -0300 (BRT) Subject: Dual Xeon + HW RAID question From: "alexandre arruda paes :: aldeia digital" To: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.0 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME, USER_AGENT X-Spam-Level: * X-Archive-Number: 200307/168 X-Sequence-Number: 2461 Hi, I have this machine with a 10 million records: * Dual Xeon 2.0 (HyperThreading enabled), 3 7200 SCSI , Adaptec 2110S, RAID 5 - 32k chunk size, 1 GB Ram DDR 266 ECC, RH 8.0 - 2.4.18 The database is mirrored with contrib/dbmirror in a P4 1 Gb Ram + IDE If a disk failure occurs, I can use the server in the mirror. I will format the main server in this weekend and I have seen in the list some people that recomends a Software RAID instead HW. I think too remove the RAID 5 and turn a RAID 1 for data in 2 HDs. SO, WAL and swap in the thrid HD. My questions: 1) I will see best disk performance changing the disk layout like above 2) HyperThreading really improve a procces basead program, like postgres Thank�s for all Alexandre From pgsql-performance-owner@postgresql.org Fri Jul 11 03:28:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id C896BDCA91 for ; Fri, 11 Jul 2003 06:28:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 28518-06 for ; Fri, 11 Jul 2003 03:28:09 -0300 (ADT) Received: from martin.sysdetect.com (martin.sysdetect.com [65.209.102.1]) by svr1.postgresql.org (Postfix) with ESMTP id AB1F2CC753 for ; Thu, 10 Jul 2003 15:19:19 -0300 (ADT) Received: (from mail@localhost) by martin.sysdetect.com (8.11.4/8.11.3) id h6AIJY600701 for ; Thu, 10 Jul 2003 18:19:34 GMT Received: from winwood.sysdetect.com(172.16.1.1) via SMTP by mail.sysdetect.com, id smtpdtJ2556; Thu Jul 10 18:19:26 2003 Received: from sysd.com (thriller.sysdetect.com [172.16.1.33]) by winwood.sysdetect.com (8.11.6/8.11.6) with ESMTP id h6AIJQ913911 for ; Thu, 10 Jul 2003 14:19:26 -0400 Message-ID: <3F0DAE2E.3020102@sysd.com> Date: Thu, 10 Jul 2003 14:19:26 -0400 From: Rich Cullingford User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: pre-Vacuum statistics Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/171 X-Sequence-Number: 2464 Greetings, All the recommendations I can locate concerning the use of (the various flavors of) VACUUM suggest running it at regular intervals. Is there any way, for a given table, to discover how many/what percentage of rows are likely to be VACUUMable at a given point, so that some kind of threshold-based VACUUM could be done by an application? We have several tables that undergo bursty UPDATEs, where large numbers of transactions occur "relatively" infrequently; and others where the UPDATEs occur at regular intervals (a few seconds or so). Thanks for any advice! Regards, Rich Cullingford rculling@sysd.com From pgsql-novice-owner@postgresql.org Fri Jul 11 19:29:20 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id D2C79CF0D3; Thu, 10 Jul 2003 23:53:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 07493-06; Thu, 10 Jul 2003 20:53:10 -0300 (ADT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by svr1.postgresql.org (Postfix) with ESMTP id 1B546CB993; Thu, 10 Jul 2003 17:21:53 -0300 (ADT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id D6B2F20F00; Thu, 10 Jul 2003 13:22:07 -0700 (PDT) Date: Thu, 10 Jul 2003 13:22:07 -0700 From: Sean Chittenden To: Martin Foster Cc: PostgreSQL Performance , PostgreSQL Novice Subject: Re: [PERFORM] Extreme high load averages Message-ID: <20030710202207.GA10120@perrin.int.nxad.com> References: <3F0CFBAE.6080002@ethereal-realms.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F0CFBAE.6080002@ethereal-realms.org> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/91 X-Sequence-Number: 7626 > I actually got a bit more respect for PostgreSQL tonight. It seems > that one of my scripts was not committing changes after maintenance > was conducted. Meaning that rows that would normally be removed > after offline archiving was completed were in fact still around. > > Normally at any given point in time this table would grow 50K rows > during a day, be archived that night and then loose rows that were > no longer needed. This process, is what allowed MySQL to maintain > any stability as the size of this table can balloon significantly. > > PostgreSQL with tweaking was handling a table with nearly 300K rows. > That size alone would of dragged the MySQL system down to a near > grind, and since most of those rows are not needed. One can imagine > that queries are needlessly processing rows that should be outright > ignored. Having used MySQL once upon a time and run into it's problems when you have more than 1M rows in a table, it took me a while when 1st using PostgreSQL to trust that PostgreSQL can reliably handle millions or billions of rows without crapping out randomly and corrupting itself. If you would have let this grow, you'd run out of disk space long before you hit anything close to a stability, reliability, or performance problem with PostgreSQL. I have one table in particular that has about 1.9B rows in it right now and it conservatively takes about 0.04ms for non-complex queries to run against the table. In MySQL land, I wouldn't dare let something grow that big... which would've been a huge problem because the table mentioned above isn't logging data or something I can routinely purge. It's a strange feeling at first to not have to design your application around size or tuple limitations of the database any more. :) I'm glad you're enjoying PostgreSQL. -sc -- Sean Chittenden From pgsql-performance-owner@postgresql.org Fri Jul 11 00:14:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id AB297CB4E7 for ; Fri, 11 Jul 2003 03:14:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 64616-01 for ; Fri, 11 Jul 2003 00:14:01 -0300 (ADT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 3BD45CF408 for ; Thu, 10 Jul 2003 21:23:07 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6B0NBUc010670; Thu, 10 Jul 2003 18:23:13 -0600 (MDT) Message-ID: <3F0E036F.7080108@ethereal-realms.org> Date: Thu, 10 Jul 2003 18:23:11 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Shridhar Daithankar" , PostgreSQL Performance Subject: Re: [NOVICE] Extreme high load averages References: <3F0D5550.21678.4E122CF@localhost> <3F0D5EEC.29862.506A9AE@localhost> In-Reply-To: <3F0D5EEC.29862.506A9AE@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/169 X-Sequence-Number: 2462 Shridhar Daithankar wrote: > On 10 Jul 2003 at 0:43, Martin Foster wrote: > >>As for creating a new table, that in itself is a nice idea. But it >>would cause issues for people currently in the realm. Their posts >>would essentially dissapear from site and cause more confusion then its >>worth. > > > No they won't. Say you have a base table and your current post table is child > of that. You can query on base table and get rows from child table. That way > all the data would always be there. > > While inserting posts, you would insert in child table. While qeurying you > would query on base table. That way things will be optimal. > > >>Inheritance would work, but the database would essentially just grow and >>grow and grow right? > > > Right. But there are two advantages. > > 1. It will always contain valid posts. No dead tuples. > 2. You can work in chuncks of data. Each child table can be dealt with > separately without affecting other child tables, whereas in case of a single > large table, entire site is affected.. > > Deleting 100K posts from 101K rows table is vastly different than deleting 10K > posts from 2M rows table. Later one would unnecessary starve the table with > dead tuples and IO whereas in former case you can do create table as select > from and drop the original.. > > HTH > > Bye > Shridhar While your idea is sound, I can easily report that this is as bad or even worse then removing thousands of rows at any given point in time. Trying to remove a child table, will pretty much guarantee a complete and total deadlock in the database. While it's waiting for a lock, it's locking out authenticating users but allows existing connections to go through. And considering this goes on for tens of minutes and people keep piling on requests to the server, this quickly disintegrates into one hell of a mess. I.E. requires a cold boot to get this thing up again. Perhaps it is more efficient, but until I can remove archived tables entirely, I do not exactly see a compelling reason to use inheritance. Also, some questions are not answered from documentation. Such as are indexes carried forth, if you call the parent table, or do you have to re-create them all manually. And what happens to the primary key constraints that no longer show up. Thanks for the tip though. Just wish it worked better then it does. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Fri Jul 11 16:44:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 81650CC23E for ; Fri, 11 Jul 2003 19:44:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 18636-09 for ; Fri, 11 Jul 2003 19:43:47 +0000 (GMT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 6A0EFDC7A4 for ; Fri, 11 Jul 2003 03:09:31 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6B69cUc029383; Fri, 11 Jul 2003 00:09:39 -0600 (MDT) Message-ID: <3F0E54A2.4040604@ethereal-realms.org> Date: Fri, 11 Jul 2003 00:09:38 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Shridhar Daithankar" , PostgreSQL Performance Subject: Re: [NOVICE] Extreme high load averages References: <3F0D5550.21678.4E122CF@localhost> <3F0D5EEC.29862.506A9AE@localhost> In-Reply-To: <3F0D5EEC.29862.506A9AE@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/180 X-Sequence-Number: 2473 Shridhar Daithankar wrote: > On 10 Jul 2003 at 0:43, Martin Foster wrote: > >>As for creating a new table, that in itself is a nice idea. But it >>would cause issues for people currently in the realm. Their posts >>would essentially dissapear from site and cause more confusion then its >>worth. > > > No they won't. Say you have a base table and your current post table is child > of that. You can query on base table and get rows from child table. That way > all the data would always be there. > > While inserting posts, you would insert in child table. While qeurying you > would query on base table. That way things will be optimal. > > >>Inheritance would work, but the database would essentially just grow and >>grow and grow right? > > > Right. But there are two advantages. > > 1. It will always contain valid posts. No dead tuples. > 2. You can work in chuncks of data. Each child table can be dealt with > separately without affecting other child tables, whereas in case of a single > large table, entire site is affected.. > > Deleting 100K posts from 101K rows table is vastly different than deleting 10K > posts from 2M rows table. Later one would unnecessary starve the table with > dead tuples and IO whereas in former case you can do create table as select > from and drop the original.. > > HTH > > Bye > Shridhar > > -- > "[In 'Doctor' mode], I spent a good ten minutes telling Emacs what Ithought of > it. (The response was, 'Perhaps you could try to be lessabusive.')"(By Matt > Welsh) > When I ran EXPLAIN on the views and queries making use of the inherited tables, I noticed that everything worked based on sequence scans and it avoided all indexes. While making use of ONLY kicked in full indexes. This is even after having created a child table with the same indexes as the parent. Is this a known issue, or just some sort of oddity on my setup? Tables still cannot be removed easily, but I found a way to work around it for a day-to-day basis. Essentailly I just clean out the tables containing old rows and delete them later. However based on the above, I doubt performance would get any better. Thanks for the advice however! Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Fri Jul 11 13:57:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 45637CDED1 for ; Fri, 11 Jul 2003 16:57:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 20611-02 for ; Fri, 11 Jul 2003 16:57:44 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 7625FCBAF3 for ; Fri, 11 Jul 2003 07:31:28 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6BAXxsq018873 for ; Fri, 11 Jul 2003 16:03:59 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6BAXwKr018860 for ; Fri, 11 Jul 2003 16:03:58 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Fri, 11 Jul 2003 16:02:43 +0530 MIME-Version: 1.0 Subject: Postgresql General Bits issue Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F0EDFA3.17295.589F4A4@localhost> 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-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: 200307/173 X-Sequence-Number: 2466 Hi all, Few days back, I promised an article of postgresql tuning. It is already published and I had the notification in my inbox but somwhow missed that. The articles are available at http://www.varlena.com/GeneralBits/. I would be looking forward to the feedback. And BTW, what's up with the lists? Not a single message on general and hackers? Kind of strange, I would say.. Bye Shridhar -- Arnold's Addendum: Anything not fitting into these categories causes cancer in rats. From pgsql-performance-owner@postgresql.org Fri Jul 11 14:14:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E42FDCF238 for ; Fri, 11 Jul 2003 17:14:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 44560-04 for ; Fri, 11 Jul 2003 14:14:40 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 35E29CB4CD for ; Fri, 11 Jul 2003 07:50:23 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 2D60E10258; Fri, 11 Jul 2003 06:43:54 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 2B18D10257; Fri, 11 Jul 2003 06:43:52 -0400 (EDT) Subject: Re: force the use of a particular index From: Rod Taylor To: Scott Cain Cc: Postgresql Performance In-Reply-To: <1057850280.1451.22.camel@localhost.localdomain> References: <1057850280.1451.22.camel@localhost.localdomain> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-aIjvwgwPPR9tkPp6L8lX" Message-Id: <1057920672.46100.149.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 10:51:13 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/175 X-Sequence-Number: 2468 --=-aIjvwgwPPR9tkPp6L8lX Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2003-07-10 at 15:18, Scott Cain wrote: > Hello, >=20 > I am wondering if there is a way to force the use of a particular index > when doing a query. I have two tables that are pretty big (each >3 > million rows), and when I do a join between them the performance is > generally quite poor as it does not use the indexes that I think it > should use. Here is an example query: Please send the EXPLAIN ANALYZE results for that query with and without sequential scans enabled. set enable_seqscan =3D true; EXPLAIN ANALYZE ; set enable_seqscan =3D false; EXPLAIN ANALYZE ; --=-aIjvwgwPPR9tkPp6L8lX Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Dpag6DETLow6vwwRAvM9AJ9Az1pie2jtgOkmjDiE9ppLtdkMYwCffzTi CLMhs6t3xg/ukmKWspVgY/I= =CfIy -----END PGP SIGNATURE----- --=-aIjvwgwPPR9tkPp6L8lX-- From pgsql-performance-owner@postgresql.org Fri Jul 11 14:57:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id CBF37CD93B for ; Fri, 11 Jul 2003 17:56:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 43466-02 for ; Fri, 11 Jul 2003 17:56:29 +0000 (GMT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 117EECB668 for ; Fri, 11 Jul 2003 07:55:09 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id C4D1510258; Fri, 11 Jul 2003 06:48:40 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id A6E0A10248; Fri, 11 Jul 2003 06:48:38 -0400 (EDT) Subject: Re: Dual Xeon + HW RAID question From: Rod Taylor To: "alexandre arruda paes :: aldeia digital" Cc: Postgresql Performance In-Reply-To: <1192.192.168.1.100.1057859005.squirrel@webmail.ad2.com.br> References: <1192.192.168.1.100.1057859005.squirrel@webmail.ad2.com.br> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-fQh+MgZ7ooui4ax3LzGS" Message-Id: <1057920958.46100.154.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 10:55:59 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/177 X-Sequence-Number: 2470 --=-fQh+MgZ7ooui4ax3LzGS Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > 2) HyperThreading really improve a procces basead program, like postgres I've not seen the results of this type of measurement posted, so really couldn't say. --=-fQh+MgZ7ooui4ax3LzGS Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Dpe+6DETLow6vwwRAqqHAJ46YgYC5AlnBFjJJ0LPkxEvlsLO/gCeLVzh j3ZQimdxgMuC66shKSa7+bQ= =wpIp -----END PGP SIGNATURE----- --=-fQh+MgZ7ooui4ax3LzGS-- From pgsql-performance-owner@postgresql.org Fri Jul 11 15:05:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 03072CD987 for ; Fri, 11 Jul 2003 17:28:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 32745-05 for ; Fri, 11 Jul 2003 17:29:04 +0000 (GMT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 57662CB834 for ; Fri, 11 Jul 2003 07:56:56 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 0CD7D1024D; Fri, 11 Jul 2003 06:50:28 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 363AB10248; Fri, 11 Jul 2003 06:50:26 -0400 (EDT) Subject: Re: pre-Vacuum statistics From: Rod Taylor To: Rich Cullingford Cc: Postgresql Performance In-Reply-To: <3F0DAE2E.3020102@sysd.com> References: <3F0DAE2E.3020102@sysd.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-rn2Ra4SNDxOlVZr5kKBX" Message-Id: <1057921066.46100.157.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 10:57:47 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/178 X-Sequence-Number: 2471 --=-rn2Ra4SNDxOlVZr5kKBX Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Thu, 2003-07-10 at 18:19, Rich Cullingford wrote: > Greetings, > All the recommendations I can locate concerning the use of (the various= =20 > flavors of) VACUUM suggest running it at regular intervals. Is there any= =20 > way, for a given table, to discover how many/what percentage of rows are= =20 Not nicely, but you may want to look at pg_autovacuum either off gborg or in the 7.4 /contrib/pg_autovacuum directory. It will fire off a periodic vacuum based on table activity from the statistics system. --=-rn2Ra4SNDxOlVZr5kKBX Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Dpgq6DETLow6vwwRAkXdAJ9CyjuRC/tQ87vinLLhqVcLfuqutACghMH2 bvq5mAl/pZCHJWRixsjJv6Q= =+3jT -----END PGP SIGNATURE----- --=-rn2Ra4SNDxOlVZr5kKBX-- From pgsql-performance-owner@postgresql.org Fri Jul 11 18:39:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 31AEACDB52 for ; Fri, 11 Jul 2003 21:10:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 17249-07 for ; Fri, 11 Jul 2003 21:11:05 +0000 (GMT) Received: from mail-2.zoominternet.net (unknown [63.67.120.12]) by svr1.postgresql.org (Postfix) with SMTP id 28F62CC63D for ; Fri, 11 Jul 2003 10:17:23 -0300 (ADT) Received: (qmail 6943 invoked from network); 11 Jul 2003 13:17:37 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-2.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 11 Jul 2003 13:17:37 -0000 Subject: Re: force the use of a particular index From: Scott Cain To: Rod Taylor Cc: Postgresql Performance In-Reply-To: <1057920672.46100.149.camel@jester> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1057929459.5766.7.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 09:17:40 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/183 X-Sequence-Number: 2476 The problem (at least as it appears to me) is not that it is performing a table scan instead of an index scan, it is that it is using the wrong index. Here is the output from EXPLAIN ANALYZE: QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------ Unique (cost=494008.47..494037.59 rows=166 width=54) (actual time=114660.37..114660.38 rows=1 loops=1) -> Sort (cost=494008.47..494012.63 rows=1664 width=54) (actual time=114660.37..114660.37 rows=1 loops=1) Sort Key: f.name, fl.fmin, fl.fmax, fl.strand, f.type_id, f.feature_id -> Nested Loop (cost=0.00..493919.44 rows=1664 width=54) (actual time=2596.13..114632.90 rows=1 loops=1) -> Index Scan using feature_pkey on feature f (cost=0.00..134601.43 rows=52231 width=40) (actual time=105.74..56048.87 rows=13825 loops=1) Filter: (type_id = 219) -> Index Scan using featureloc_idx1 on featureloc fl (cost=0.00..6.87 rows=1 width=14) (actual time=4.23..4.23 rows=0 loops=13825) Index Cond: ("outer".feature_id = fl.feature_id) Filter: ((srcfeature_id = 6) AND (fmin <= 2585581) AND (fmax >= 2565581)) Total runtime: 114660.91 msec This is the same regardless of enable_seqscan's setting. The index that it is using on featureloc (featureloc_idx1) is on the foreign key feature_id. It should instead be using another index, featureloc_idx3, which is built on (srcfeature_id, fmin, fmax). I should also mention that I've done a VACUUM FULL ANALYZE on this database, and I've been using it for a while, and this is the primary type of query I perform on the database. Thanks, Scott On Fri, 2003-07-11 at 06:51, Rod Taylor wrote: > On Thu, 2003-07-10 at 15:18, Scott Cain wrote: > > Hello, > > > > I am wondering if there is a way to force the use of a particular index > > when doing a query. I have two tables that are pretty big (each >3 > > million rows), and when I do a join between them the performance is > > generally quite poor as it does not use the indexes that I think it > > should use. Here is an example query: > > Please send the EXPLAIN ANALYZE results for that query with and without > sequential scans enabled. > > set enable_seqscan = true; > EXPLAIN ANALYZE ; > > set enable_seqscan = false; > EXPLAIN ANALYZE ; -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Fri Jul 11 13:58:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 74196D227D for ; Fri, 11 Jul 2003 16:58:15 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 20822-02 for ; Fri, 11 Jul 2003 16:58:28 +0000 (GMT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id AAD84D3FAE for ; Fri, 11 Jul 2003 10:37:26 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 0895A10258; Fri, 11 Jul 2003 09:30:58 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 0366510248; Fri, 11 Jul 2003 09:30:55 -0400 (EDT) Subject: Re: force the use of a particular index From: Rod Taylor To: Scott Cain Cc: Postgresql Performance In-Reply-To: <1057929459.5766.7.camel@localhost.localdomain> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> <1057929459.5766.7.camel@localhost.localdomain> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-u5Sm2bo4G7N40JScR94f" Message-Id: <1057930695.46100.172.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 13:38:16 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/174 X-Sequence-Number: 2467 --=-u5Sm2bo4G7N40JScR94f Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2003-07-11 at 13:17, Scott Cain wrote: > The problem (at least as it appears to me) is not that it is performing > a table scan instead of an index scan, it is that it is using the wrong > index. Here is the output from EXPLAIN ANALYZE: >=20 > = QUERY PLAN > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= -------- > Unique (cost=3D494008.47..494037.59 rows=3D166 width=3D54) (actual time= =3D114660.37..114660.38 rows=3D1 loops=3D1) > -> Sort (cost=3D494008.47..494012.63 rows=3D1664 width=3D54) (actual= time=3D114660.37..114660.37 rows=3D1 loops=3D1) > Sort Key: f.name, fl.fmin, fl.fmax, fl.strand, f.type_id, f.feat= ure_id > -> Nested Loop (cost=3D0.00..493919.44 rows=3D1664 width=3D54)= (actual time=3D2596.13..114632.90 rows=3D1 loops=3D1) > -> Index Scan using feature_pkey on feature f (cost=3D0.= 00..134601.43 rows=3D52231 width=3D40) (actual time=3D105.74..56048.87 rows= =3D13825 loops=3D1) > Filter: (type_id =3D 219) > -> Index Scan using featureloc_idx1 on featureloc fl (co= st=3D0.00..6.87 rows=3D1 width=3D14) (actual time=3D4.23..4.23 rows=3D0 loo= ps=3D13825) > Index Cond: ("outer".feature_id =3D fl.feature_id) > Filter: ((srcfeature_id =3D 6) AND (fmin <=3D 258558= 1) AND (fmax >=3D 2565581)) > Total runtime: 114660.91 msec > it is using on featureloc (featureloc_idx1) is on the foreign key > feature_id. It should instead be using another index, featureloc_idx3, > which is built on (srcfeature_id, fmin, fmax). Nope.. The optimizer is right in the decision to use featureloc_idx1.=20 You will notice it is expecting to retrieve a single row from this index, but the featureloc_idx3 is bound to be larger (due to indexing more data), thus take more disk reads for the exact same information (or in this case, lack thereof). What is taking a long time is the scan on feature_pkey. It looks like it is throwing away a ton of rows that are not type_id =3D 219. Either that, or you do a pile of deletes and haven't run REINDEX recently. Create an index consisting of (feature_id, type_id). This will probably make a significant different in execution time. --=-u5Sm2bo4G7N40JScR94f Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Dr3G6DETLow6vwwRAhQxAJ9FFy+CGHh99UjCETJeDiSDFtMGSgCcCjQ3 7S5fDFJ5d8n1Jamw0jhCfXk= =Tu/i -----END PGP SIGNATURE----- --=-u5Sm2bo4G7N40JScR94f-- From pgsql-performance-owner@postgresql.org Fri Jul 11 16:45:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 36CB1CD6CB for ; Fri, 11 Jul 2003 19:43:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 82886-04 for ; Fri, 11 Jul 2003 19:44:04 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 646D6CBAB8 for ; Fri, 11 Jul 2003 12:23:56 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6BFO1Q3011920; Fri, 11 Jul 2003 11:24:01 -0400 (EDT) To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: force the use of a particular index In-reply-to: <1057850280.1451.22.camel@localhost.localdomain> References: <1057850280.1451.22.camel@localhost.localdomain> Comments: In-reply-to Scott Cain message dated "10 Jul 2003 11:18:01 -0400" Date: Fri, 11 Jul 2003 11:24:01 -0400 Message-ID: <11919.1057937041@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/181 X-Sequence-Number: 2474 Scott Cain writes: > So, the question is, is there a way I can force the query planner to use > the index I want it to use? No (and I don't think there should be). Given that it *can* generate the plan you want, this is clearly an estimation failure. What is the index it does use? Would you show us EXPLAIN ANALYZE results when using each index? regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jul 12 00:07:33 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id DF991CB5DA for ; Sat, 12 Jul 2003 03:07:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 04284-02 for ; Sat, 12 Jul 2003 03:07:19 +0000 (GMT) Received: from mail-1.zoominternet.net (unknown [63.67.120.8]) by svr1.postgresql.org (Postfix) with SMTP id BD3ECCD12B for ; Fri, 11 Jul 2003 12:36:02 -0300 (ADT) Received: (qmail 17107 invoked from network); 11 Jul 2003 15:36:18 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-1.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 11 Jul 2003 15:36:18 -0000 Subject: Re: force the use of a particular index From: Scott Cain To: Rod Taylor Cc: Postgresql Performance In-Reply-To: <1057930695.46100.172.camel@jester> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> <1057929459.5766.7.camel@localhost.localdomain> <1057930695.46100.172.camel@jester> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1057937779.5767.17.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 11:36:19 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/184 X-Sequence-Number: 2477 Rod, I see what you mean about the scan on the feature_pkey taking a long time. I tried several things to remedy that. I created an index on feature (feature_id,type_id) (which I don't think makes sense since feature_id is the primary key, so add another column really doesn't help). I also created a index on feature (type_id, feature_id), but the planner doesn't use it. Also, there was an already existing index on feature (type_id) that the planner never used. One thing I tried that changed the query plan and improved performance slightly (but still nowhere near what I need) was to add a partial index on featureloc on (fmin,fmax) where scrfeature_id=6. This is something I could realistically do since there are relatively few (>30) srcfeature_ids that I am interested in, so putting in place a partial index for each of them would not be a big deal. Nevertheless, the performance is still not there. Here is the EXPLAIN ANALYZE for this situation: QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (cost=156172.23..156200.11 rows=159 width=54) (actual time=63631.93..63631.93 rows=1 loops=1) -> Sort (cost=156172.23..156176.21 rows=1594 width=54) (actual time=63631.93..63631.93 rows=1 loops=1) Sort Key: f.name, fl.fmin, fl.fmax, fl.strand, f.type_id, f.feature_id -> Hash Join (cost=135100.30..156087.46 rows=1594 width=54) (actual time=63631.29..63631.79 rows=1 loops=1) Hash Cond: ("outer".feature_id = "inner".feature_id) -> Index Scan using featureloc_src_6 on featureloc fl (cost=0.00..18064.99 rows=101883 width=14) (actual time=26.11..430.00 rows=570 loops=1) Index Cond: ((fmin <= 2585581) AND (fmax >= 2565581)) Filter: (srcfeature_id = 6) -> Hash (cost=134601.43..134601.43 rows=48347 width=40) (actual time=63182.86..63182.86 rows=0 loops=1) -> Index Scan using feature_pkey on feature f (cost=0.00..134601.43 rows=48347 width=40) (actual time=69.98..62978.27 rows=13825 loops=1) Filter: (type_id = 219) Total runtime: 63632.28 msec (12 rows) Any other ideas? Thanks, Scott On Fri, 2003-07-11 at 09:38, Rod Taylor wrote: > On Fri, 2003-07-11 at 13:17, Scott Cain wrote: > > The problem (at least as it appears to me) is not that it is performing > > a table scan instead of an index scan, it is that it is using the wrong > > index. Here is the output from EXPLAIN ANALYZE: > > > > QUERY PLAN > > ------------------------------------------------------------------------------------------------------------------------------------------------------------ > > Unique (cost=494008.47..494037.59 rows=166 width=54) (actual time=114660.37..114660.38 rows=1 loops=1) > > -> Sort (cost=494008.47..494012.63 rows=1664 width=54) (actual time=114660.37..114660.37 rows=1 loops=1) > > Sort Key: f.name, fl.fmin, fl.fmax, fl.strand, f.type_id, f.feature_id > > -> Nested Loop (cost=0.00..493919.44 rows=1664 width=54) (actual time=2596.13..114632.90 rows=1 loops=1) > > -> Index Scan using feature_pkey on feature f (cost=0.00..134601.43 rows=52231 width=40) (actual time=105.74..56048.87 rows=13825 loops=1) > > Filter: (type_id = 219) > > -> Index Scan using featureloc_idx1 on featureloc fl (cost=0.00..6.87 rows=1 width=14) (actual time=4.23..4.23 rows=0 loops=13825) > > Index Cond: ("outer".feature_id = fl.feature_id) > > Filter: ((srcfeature_id = 6) AND (fmin <= 2585581) AND (fmax >= 2565581)) > > Total runtime: 114660.91 msec > > > it is using on featureloc (featureloc_idx1) is on the foreign key > > feature_id. It should instead be using another index, featureloc_idx3, > > which is built on (srcfeature_id, fmin, fmax). > > Nope.. The optimizer is right in the decision to use featureloc_idx1. > You will notice it is expecting to retrieve a single row from this > index, but the featureloc_idx3 is bound to be larger (due to indexing > more data), thus take more disk reads for the exact same information (or > in this case, lack thereof). > > What is taking a long time is the scan on feature_pkey. It looks like it > is throwing away a ton of rows that are not type_id = 219. Either that, > or you do a pile of deletes and haven't run REINDEX recently. > > Create an index consisting of (feature_id, type_id). This will probably > make a significant different in execution time. -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Fri Jul 11 16:48:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E6427CDC3E for ; Fri, 11 Jul 2003 19:46:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 22412-02 for ; Fri, 11 Jul 2003 19:46:22 +0000 (GMT) Received: from mail-3.zoominternet.net (unknown [63.67.120.25]) by svr1.postgresql.org (Postfix) with SMTP id 6167FCD7D1 for ; Fri, 11 Jul 2003 12:38:30 -0300 (ADT) Received: (qmail 25559 invoked from network); 11 Jul 2003 15:38:44 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-3.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 11 Jul 2003 15:38:44 -0000 Subject: Re: force the use of a particular index From: Scott Cain To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <11919.1057937041@sss.pgh.pa.us> References: <1057850280.1451.22.camel@localhost.localdomain> <11919.1057937041@sss.pgh.pa.us> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1057937927.5766.21.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 11:38:47 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/182 X-Sequence-Number: 2475 Hi Tom, Embarrassingly, I can't. I've been monkeying with the database so much that I can't seem to get it back to the state where I reproduce the behavior I want. A database drop and reload may be the only way, but since that is a time consuming thing to do, I won't be able to do it until this evening. Thanks, Scott On Fri, 2003-07-11 at 11:24, Tom Lane wrote: > Scott Cain writes: > > So, the question is, is there a way I can force the query planner to use > > the index I want it to use? > > No (and I don't think there should be). Given that it *can* generate > the plan you want, this is clearly an estimation failure. What is the > index it does use? Would you show us EXPLAIN ANALYZE results when > using each index? > > regards, tom lane -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Sat Jul 12 02:30:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 8BA52CADE4 for ; Sat, 12 Jul 2003 05:30:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 88894-10 for ; Sat, 12 Jul 2003 05:30:14 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id DA91ACEA23 for ; Fri, 11 Jul 2003 12:44:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6BFiSQ3012044; Fri, 11 Jul 2003 11:44:28 -0400 (EDT) To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: force the use of a particular index In-reply-to: <1057937927.5766.21.camel@localhost.localdomain> References: <1057850280.1451.22.camel@localhost.localdomain> <11919.1057937041@sss.pgh.pa.us> <1057937927.5766.21.camel@localhost.localdomain> Comments: In-reply-to Scott Cain message dated "11 Jul 2003 11:38:47 -0400" Date: Fri, 11 Jul 2003 11:44:27 -0400 Message-ID: <12043.1057938267@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/187 X-Sequence-Number: 2480 Scott Cain writes: > Embarrassingly, I can't. I've been monkeying with the database so much > that I can't seem to get it back to the state where I reproduce the > behavior I want. If the thing works as desired after a VACUUM ANALYZE, then I suggest the estimation failure was just due to out-of-date statistics ... regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jul 12 00:28:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 3C355CB4E8 for ; Sat, 12 Jul 2003 03:28:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 43861-09 for ; Sat, 12 Jul 2003 03:29:12 +0000 (GMT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id B79C9CCA32 for ; Fri, 11 Jul 2003 13:20:03 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 3786C10257; Fri, 11 Jul 2003 12:13:35 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 5365010248; Fri, 11 Jul 2003 12:13:32 -0400 (EDT) Subject: Re: force the use of a particular index From: Rod Taylor To: Scott Cain Cc: Postgresql Performance In-Reply-To: <1057937779.5767.17.camel@localhost.localdomain> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> <1057929459.5766.7.camel@localhost.localdomain> <1057930695.46100.172.camel@jester> <1057937779.5767.17.camel@localhost.localdomain> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-J+ySi224Ty4kTbhgY9Wh" Message-Id: <1057940450.65544.14.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 12:20:51 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/185 X-Sequence-Number: 2478 --=-J+ySi224Ty4kTbhgY9Wh Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2003-07-11 at 11:36, Scott Cain wrote: > Rod, >=20 > I see what you mean about the scan on the feature_pkey taking a long > time. I tried several things to remedy that. I created an index on > feature (feature_id,type_id) (which I don't think makes sense since > feature_id is the primary key, so add another column really doesn't It may be the primary key, but the system looked like it was throwing away many rows based on type_id. If it was throwing away many more rows than found, the index with type_id may have been cheaper. It is difficult to tell from an EXPLAIN ANALYZE as it doesn't tell you exactly how many rows were filtered, just the cost to read them and how many were used after the filter. > help). I also created a index on feature (type_id, feature_id), but the > planner doesn't use it. Also, there was an already existing index on > feature (type_id) that the planner never used. It cannot use more than one index for a given table scan at the moment.=20 There are proposals on how to 'fix' that, but those require significant=20 overhauls of various systems. > Any other ideas? Out of curiosity, what do you get if you disable hash joins? set enable_hashjoin =3D false; How about a partial index on (feature_id) where type_id =3D 219? --=-J+ySi224Ty4kTbhgY9Wh Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/DuPi6DETLow6vwwRAuOwAJ0bdMZTtdts3vQRFRhAzBkNj+AaWgCdE6Bp wQqVL8GRRtWEYOdRbeDfdfI= =l6S/ -----END PGP SIGNATURE----- --=-J+ySi224Ty4kTbhgY9Wh-- From pgsql-performance-owner@postgresql.org Fri Jul 11 14:27:06 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id B747FCC544 for ; Fri, 11 Jul 2003 17:23:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 47366-02 for ; Fri, 11 Jul 2003 14:23:36 -0300 (ADT) Received: from mail-2.zoominternet.net (unknown [63.67.120.12]) by svr1.postgresql.org (Postfix) with SMTP id 0B941CCA1B for ; Fri, 11 Jul 2003 14:20:41 -0300 (ADT) Received: (qmail 4776 invoked from network); 11 Jul 2003 17:20:59 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-2.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 11 Jul 2003 17:20:59 -0000 Subject: Re: force the use of a particular index From: Scott Cain To: Rod Taylor Cc: Postgresql Performance In-Reply-To: <1057940450.65544.14.camel@jester> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> <1057929459.5766.7.camel@localhost.localdomain> <1057930695.46100.172.camel@jester> <1057937779.5767.17.camel@localhost.localdomain> <1057940450.65544.14.camel@jester> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1057944059.5766.34.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 13:20:59 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/176 X-Sequence-Number: 2469 On Fri, 2003-07-11 at 12:20, Rod Taylor wrote: > On Fri, 2003-07-11 at 11:36, Scott Cain wrote: > > Any other ideas? > > Out of curiosity, what do you get if you disable hash joins? > > set enable_hashjoin = false; BINGO! QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (cost=161718.69..161738.38 rows=113 width=53) (actual time=529.03..529.03 rows=1 loops=1) -> Sort (cost=161718.69..161721.50 rows=1125 width=53) (actual time=529.02..529.02 rows=1 loops=1) Sort Key: f.name, fl.fmin, fl.fmax, fl.strand, f.type_id, f.feature_id -> Merge Join (cost=26493.64..161661.65 rows=1125 width=53) (actual time=416.46..528.77 rows=1 loops=1) Merge Cond: ("outer".feature_id = "inner".feature_id) -> Index Scan using feature_pkey on feature f (cost=0.00..134592.43 rows=47912 width=39) (actual time=0.46..502.50 rows=431 loops=1) Filter: (type_id = 219) -> Sort (cost=26493.64..26722.33 rows=91476 width=14) (actual time=23.98..24.38 rows=570 loops=1) Sort Key: fl.feature_id -> Index Scan using featureloc_src_6 on featureloc fl (cost=0.00..18039.22 rows=91476 width=14) (actual time=15.16..21.85 rows=570 loops=1) Index Cond: ((fmin <= 2585581) AND (fmax >= 2565581)) Filter: (srcfeature_id = 6) Total runtime: 529.52 msec (13 rows) > > How about a partial index on (feature_id) where type_id = 219? That is a possiblity. type_id is a foreign key on another table that has several thousand rows, but in practice, there will be only a subset of those that we are interested in using with this query, so it may not be too unwieldy to do for each interesting type_id in practice. However, for testing I just created the partial index on type_id=219 and it was not used, so it may not make a difference anyway. Thanks much, Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Fri Jul 11 15:35:14 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id E2B88D4D2F for ; Fri, 11 Jul 2003 18:35:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 67656-06 for ; Fri, 11 Jul 2003 15:35:01 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 3D804D16C6 for ; Fri, 11 Jul 2003 15:13:59 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id B07BC1024D; Fri, 11 Jul 2003 14:07:30 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 4CAD810248; Fri, 11 Jul 2003 14:07:28 -0400 (EDT) Subject: Re: force the use of a particular index From: Rod Taylor To: Scott Cain Cc: Postgresql Performance In-Reply-To: <1057944059.5766.34.camel@localhost.localdomain> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> <1057929459.5766.7.camel@localhost.localdomain> <1057930695.46100.172.camel@jester> <1057937779.5767.17.camel@localhost.localdomain> <1057940450.65544.14.camel@jester> <1057944059.5766.34.camel@localhost.localdomain> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-MgIJz9eNr28YhK4WMPO7" Message-Id: <1057947284.65544.129.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 14:14:45 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/179 X-Sequence-Number: 2472 --=-MgIJz9eNr28YhK4WMPO7 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > > set enable_hashjoin =3D false; >=20 > BINGO! I'm not so sure about that. Your dataset seems to have changed fairly significantly since the last test. > -> Index Scan using feature_pkey on feature f (cost=3D0.00..134592.43 r= ows=3D47912 width=3D39) (actual time=3D0.46..502.50 rows=3D431 loops=3D1) Notice it only pulled out 431 rows where prior runs pulled out several thousand (~13000). I think what really happened was something came along and deleted a bunch of stuff, then vacuum ran. --=-MgIJz9eNr28YhK4WMPO7 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Dv6U6DETLow6vwwRAtvLAJ97871/AsF/HJHde8OkVt/M/eaxngCfcyGf HfR5rF9jKGm9vnv5b1ndlV0= =7hTh -----END PGP SIGNATURE----- --=-MgIJz9eNr28YhK4WMPO7-- From pgsql-performance-owner@postgresql.org Sat Jul 12 00:53:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id ACF4FCB6EF for ; Sat, 12 Jul 2003 03:53:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 19059-08 for ; Sat, 12 Jul 2003 03:53:28 +0000 (GMT) Received: from mail-3.zoominternet.net (unknown [63.67.120.25]) by svr1.postgresql.org (Postfix) with SMTP id CD5F5D5331 for ; Fri, 11 Jul 2003 15:22:46 -0300 (ADT) Received: (qmail 6679 invoked from network); 11 Jul 2003 18:23:04 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-3.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 11 Jul 2003 18:23:04 -0000 Subject: Re: force the use of a particular index From: Scott Cain To: Rod Taylor Cc: Postgresql Performance In-Reply-To: <1057947284.65544.129.camel@jester> References: <1057850280.1451.22.camel@localhost.localdomain> <1057920672.46100.149.camel@jester> <1057929459.5766.7.camel@localhost.localdomain> <1057930695.46100.172.camel@jester> <1057937779.5767.17.camel@localhost.localdomain> <1057940450.65544.14.camel@jester> <1057944059.5766.34.camel@localhost.localdomain> <1057947284.65544.129.camel@jester> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1057947784.5767.39.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 11 Jul 2003 14:23:04 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/186 X-Sequence-Number: 2479 On Fri, 2003-07-11 at 14:14, Rod Taylor wrote: > > > set enable_hashjoin = false; > > > > BINGO! > > I'm not so sure about that. Your dataset seems to have changed fairly > significantly since the last test. > > > -> Index Scan using feature_pkey on feature f (cost=0.00..134592.43 rows=47912 width=39) (actual time=0.46..502.50 rows=431 loops=1) > > Notice it only pulled out 431 rows where prior runs pulled out several > thousand (~13000). I think what really happened was something came > along and deleted a bunch of stuff, then vacuum ran. There is nearly a zero chance that happened. This database is accessible only by me, I haven't deleted anything. The only things I have done is to create and drop various indexes and run vacuum. Is there anything else that could explain the difference? Is the index scan on feature_pkey using information from the index scan on featureloc_src_6 to limit the number of rows to get from feature? Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-novice-owner@postgresql.org Fri Jul 11 23:17:22 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 90836CB586 for ; Sat, 12 Jul 2003 02:17:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 18464-06 for ; Sat, 12 Jul 2003 02:17:34 +0000 (GMT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 99E50CB57A for ; Fri, 11 Jul 2003 23:17:19 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6C2HZUc004871 for ; Fri, 11 Jul 2003 20:17:36 -0600 (MDT) Message-ID: <3F0F6FBE.1090300@ethereal-realms.org> Date: Fri, 11 Jul 2003 20:17:34 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Novice Subject: Optimizer Parameters Content-Type: multipart/mixed; boundary="------------070703010902070702070901" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/95 X-Sequence-Number: 7630 This is a multi-part message in MIME format. --------------070703010902070702070901 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Upon testing queries with EXPLAIN ANALYSE, I started to notice that the planner would avoid using indexes when available. Instead it would jump to sequence scans, ignoring the index and increasing overall time it took to get results. I have been looking up documentation and noticed that you can somewhat force Postgres into using Indexes when available. So I changed the following two lines in the .conf file: enable_seqscan = false enable_nestloop = false This was recommended in the documentation, and to say the least things have really changed in performance. Queries have halved the time needed to execute even if the estimates are insanely high compared. I also increased this value, which apparently helps when running ANALYSE on tables: default_statistics_target = 1000 Now how sane is it to keep those options turned off? And what side effects can I expect from changing default_statistics_target? And any way to have the planner quiet guessing tens of thousands of rows will be return when there are at most hundred? I included the EXPLAIN ALALYSE results in an attachment to maintain formatting of the output. Thanks in advance! Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org --------------070703010902070702070901 Content-Type: text/plain; name="planner.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="planner.txt" EXPLAIN ANALYSE SELECT Po.PuppetName AS PuppetName, Po.PuppeteerLogin AS PuppeteerLogin, Po.RealmName AS RealmName, Re.RealmPublic AS RealmPublic, Re.RealmVerified AS RealmVerified FROM ethereal.Post Po, ethereal.Puppet Ch, ethereal.Realm Re WHERE Po.PuppeteerLogin = Ch.PuppeteerLogin AND Po.RealmName = Re.RealmName AND Po.PostTimestamp > (LOCALTIMESTAMP - INTERVAL '10 minutes') AND Po.PuppetName IS NOT NULL GROUP BY Po.PuppeteerLogin, Po.PuppetName, Po.RealmName, Re.RealmPublic, Re.RealmVerified; -- Pre changes Group (cost=298025.66..322310.42 rows=161898 width=77) (actual time=4241.28..4329.68 rows=74 loops=1) -> Sort (cost=298025.66..302073.12 rows=1618985 width=77) (actual time=4241.23..4253.68 rows=14420 loops=1) Sort Key: po.puppeteerlogin, po.puppetname, po.realmname, re.realmpublic, re.realmverified -> Merge Join (cost=24174.23..44794.94 rows=1618985 width=77) (actual time=3199.66..3891.09 rows=14420 loops=1) Merge Cond: ("outer".puppeteerlogin = "inner".puppeteerlogin) -> Sort (cost=5964.67..6056.93 rows=36906 width=10) (actual time=366.18..427.94 rows=36318 loops=1) Sort Key: ch.puppeteerlogin -> Seq Scan on puppet ch (cost=0.00..3165.06 rows=36906 width=10) (actual time=0.02..133.52 rows=36456 loops=1) -> Sort (cost=18209.57..18310.85 rows=40513 width=67) (actual time=2832.70..2945.77 rows=14411 loops=1) Sort Key: po.puppeteerlogin -> Hash Join (cost=30.30..15109.11 rows=40513 width=67) (actual time=2822.23..2830.93 rows=392 loops=1) Hash Cond: ("outer".realmname = "inner".realmname) -> Seq Scan on post po (cost=0.00..14369.84 rows=40513 width=41) (actual time=2820.88..2826.30 rows=392 loops=1) Filter: ((posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) AND (puppetname IS NOT NULL)) -> Hash (cost=29.84..29.84 rows=184 width=26) (actual time=1.25..1.25 rows=0 loops=1) -> Seq Scan on realm re (cost=0.00..29.84 rows=184 width=26) (actual time=0.02..0.90 rows=179 loops=1) Total runtime: 4419.10 msec (17 rows) -- Post changes Group (cost=100293106.79..100316406.96 rows=155334 width=77) (actual time=1029.10..1159.25 rows=99 loops=1) -> Sort (cost=100293106.79..100296990.15 rows=1553344 width=77) (actual time=1025.98..1047.32 rows=24730 loops=1) Sort Key: po.puppeteerlogin, po.puppetname, po.realmname, re.realmpublic, re.realmverified -> Merge Join (cost=100031106.45..100050913.48 rows=1553344 width=77) (actual time=453.60..839.30 rows=24730 loops=1) Merge Cond: ("outer".puppeteerlogin = "inner".puppeteerlogin) -> Sort (cost=25124.25..25229.58 rows=42133 width=67) (actual time=17.07..17.67 rows=631 loops=1) Sort Key: po.puppeteerlogin -> Hash Join (cost=120.06..21887.85 rows=42133 width=67) (actual time=2.32..14.25 rows=631 loops=1) Hash Cond: ("outer".realmname = "inner".realmname) -> Index Scan using idxpost_timestamp on post po (cost=0.00..21030.46 rows=42133 width=41) (actual time=0.15..7.05 rows=631 loops=1) Index Cond: (posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) Filter: (puppetname IS NOT NULL) -> Hash (cost=119.61..119.61 rows=181 width=26) (actual time=2.01..2.01 rows=0 loops=1) -> Index Scan using pkrealm on realm re (cost=0.00..119.61 rows=181 width=26) (actual time=0.05..1.55 rows=181 loops=1) -> Sort (cost=100005982.20..100006073.27 rows=36428 width=10) (actual time=435.39..506.81 rows=58859 loops=1) Sort Key: ch.puppeteerlogin -> Seq Scan on puppet ch (cost=100000000.00..100003222.28 rows=36428 width=10) (actual time=0.03..184.55 rows=36428 loops=1) Total runtime: 1175.33 msec (21 rows) EXPLAIN ANALYSE SELECT Po.PuppetName AS PuppetName, Po.PuppeteerLogin AS PuppeteerLogin, Po.RealmName AS RealmName, Re.RealmPublic AS RealmPublic, Re.RealmVerified AS RealmVerified FROM ethereal.Post Po, ethereal.Puppet Ch, ethereal.Realm Re WHERE Po.PostIDNumber > (SELECT MIN(PostIDNumber) FROM ethereal.Post WHERE PostTimeStamp > (LOCALTIMESTAMP - INTERVAL '10 minutes')) AND Po.PuppeteerLogin = Ch.PuppeteerLogin AND Po.RealmName = Re.RealmName AND Po.PuppetName IS NOT NULL GROUP BY Po.PuppeteerLogin, Po.PuppetName, Po.RealmName, Re.RealmPublic, Re.RealmVerified; -- Pre changes Group (cost=297096.47..321381.23 rows=161898 width=77) (actual time=2108.70..2179.12 rows=76 loops=1) InitPlan -> Aggregate (cost=14473.08..14473.08 rows=1 width=4) (actual time=1141.58..1141.58 rows=1 loops=1) -> Seq Scan on post (cost=0.00..14369.84 rows=41297 width=4) (actual time=1136.50..1140.95 rows=413 loops=1) Filter: (posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) -> Sort (cost=297096.47..301143.93 rows=1618985 width=77) (actual time=2108.55..2121.85 rows=15302 loops=1) Sort Key: po.puppeteerlogin, po.puppetname, po.realmname, re.realmpublic, re.realmverified -> Merge Join (cost=23245.04..43865.75 rows=1618985 width=77) (actual time=1782.43..2003.58 rows=15302 loops=1) Merge Cond: ("outer".puppeteerlogin = "inner".puppeteerlogin) -> Sort (cost=5964.67..6056.93 rows=36906 width=10) (actual time=415.56..449.62 rows=36318 loops=1) Sort Key: ch.puppeteerlogin -> Seq Scan on puppet ch (cost=0.00..3165.06 rows=36906 width=10) (actual time=0.02..135.58 rows=36456 loops=1) -> Sort (cost=17280.38..17381.66 rows=40513 width=67) (actual time=1362.15..1376.53 rows=15293 loops=1) Sort Key: po.puppeteerlogin -> Hash Join (cost=30.30..14179.92 rows=40513 width=67) (actual time=1354.41..1360.42 rows=411 loops=1) Hash Cond: ("outer".realmname = "inner".realmname) -> Seq Scan on post po (cost=0.00..13440.65 rows=40513 width=41) (actual time=1353.11..1355.96 rows=411 loops=1) Filter: ((postidnumber > $0) AND (puppetname IS NOT NULL)) -> Hash (cost=29.84..29.84 rows=184 width=26) (actual time=1.20..1.20 rows=0 loops=1) -> Seq Scan on realm re (cost=0.00..29.84 rows=184 width=26) (actual time=0.02..0.88 rows=179 loops=1) Total runtime: 2192.72 msec (21 rows) -- Post changes Group (cost=100292759.45..100316059.61 rows=155334 width=77) (actual time=876.30..969.77 rows=84 loops=1) InitPlan -> Aggregate (cost=21137.57..21137.57 rows=1 width=4) (actual time=3.98..3.98 rows=1 loops=1) -> Index Scan using idxpost_timestamp on post (cost=0.00..21030.46 rows=42846 width=4) (actual time=0.14..3.26 rows=538 loops=1) Index Cond: (posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) -> Sort (cost=100292759.45..100296642.81 rows=1553344 width=77) (actual time=875.32..893.11 rows=20378 loops=1) Sort Key: po.puppeteerlogin, po.puppetname, po.realmname, re.realmpublic, re.realmverified -> Merge Join (cost=100030759.11..100050566.13 rows=1553344 width=77) (actual time=436.22..708.88 rows=20378 loops=1) Merge Cond: ("outer".puppeteerlogin = "inner".puppeteerlogin) -> Sort (cost=24776.90..24882.24 rows=42133 width=67) (actual time=26.54..27.01 rows=524 loops=1) Sort Key: po.puppeteerlogin -> Hash Join (cost=120.06..21540.50 rows=42133 width=67) (actual time=5.93..24.30 rows=524 loops=1) Hash Cond: ("outer".realmname = "inner".realmname) -> Index Scan using pkpost on post po (cost=0.00..20683.11 rows=42133 width=41) (actual time=4.08..17.10 rows=524 loops=1) Index Cond: (postidnumber > $0) Filter: (puppetname IS NOT NULL) -> Hash (cost=119.61..119.61 rows=181 width=26) (actual time=1.68..1.68 rows=0 loops=1) -> Index Scan using pkrealm on realm re (cost=0.00..119.61 rows=181 width=26) (actual time=0.04..1.28 rows=181 loops=1) -> Sort (cost=100005982.20..100006073.27 rows=36428 width=10) (actual time=408.56..456.91 rows=54202 loops=1) Sort Key: ch.puppeteerlogin -> Seq Scan on puppet ch (cost=100000000.00..100003222.28 rows=36428 width=10) (actual time=0.01..162.22 rows=36428 loops=1) Total runtime: 984.75 msec (22 rows) --------------070703010902070702070901-- From pgsql-performance-owner@postgresql.org Sat Jul 12 15:25:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 1DA42CB70D for ; Sat, 12 Jul 2003 18:25:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 29163-04 for ; Sat, 12 Jul 2003 18:25:16 +0000 (GMT) Received: from c001.snv.cp.net (h021.c001.snv.cp.net [209.228.32.135]) by svr1.postgresql.org (Postfix) with SMTP id BAEBECB5B7 for ; Sat, 12 Jul 2003 15:24:55 -0300 (ADT) Received: (cpmta 15517 invoked from network); 12 Jul 2003 11:25:15 -0700 Received: from 209.228.32.137 (HELO mail.dilger.cc.criticalpath.net) by smtp.register-admin.com (209.228.32.135) with SMTP; 12 Jul 2003 11:25:15 -0700 X-Sent: 12 Jul 2003 18:25:15 GMT Received: from [216.68.146.219] by mail.dilger.cc with HTTP; Sat, 12 Jul 2003 11:25:14 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 To: alexandre@aldeiadigital.com.br Cc: pgsql-performance@postgresql.org From: "Nikolaus Dilger" Subject: Re: Dual Xeon + HW RAID question X-Sent-From: nikolaus@dilger.cc Date: Sat, 12 Jul 2003 11:25:14 -0700 (PDT) X-Mailer: Web Mail 5.4.0-4_sol28 Message-Id: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=RCVD_IN_UNCONFIRMED_DSBL X-Spam-Level: X-Archive-Number: 200307/188 X-Sequence-Number: 2481 Alexandre, Since you want the fastest speed I would do the 2 data disks in RAID 0 (striping) not RAID 1 (mirroring). If you would care about not loosing any transactions you would keep all 3 disks in RAID 5. Don't know the answer to the Hyperthreading question.=20 Why don't you run a test to find out? Regards, Nikolaus On Thu, 10 Jul 2003 14:43:25 -0300 (BRT), "alexandre arruda paes :: aldeia digital" wrote: >=20 > Hi, >=20 > I have this machine with a 10 million records: > * Dual Xeon 2.0 (HyperThreading enabled), 3 7200 SCSI , > Adaptec 2110S, > RAID 5 - 32k chunk size, 1 GB Ram DDR 266 ECC, RH 8.0 - > 2.4.18 >=20 > The database is mirrored with contrib/dbmirror in a P4 > 1 Gb Ram + IDE >=20 > If a disk failure occurs, I can use the server in the > mirror. >=20 > I will format the main server in this weekend and I > have seen in the list > some people that recomends a Software RAID instead HW. >=20 > I think too remove the RAID 5 and turn a RAID 1 for > data in 2 HDs. > SO, WAL and swap in the thrid HD. >=20 > My questions: >=20 > 1) I will see best disk performance changing the disk > layout like above > 2) HyperThreading really improve a procces basead > program, like postgres >=20 > Thank=B4s for all >=20 > Alexandre >=20 >=20 >=20 > ---------------------------(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-novice-owner@postgresql.org Sat Jul 12 17:46:33 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 236E4CB4CC for ; Sat, 12 Jul 2003 20:46:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 26970-09 for ; Sat, 12 Jul 2003 20:46:13 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 5D223CB436 for ; Sat, 12 Jul 2003 17:45:53 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6CKkBQ3018389; Sat, 12 Jul 2003 16:46:11 -0400 (EDT) To: Martin Foster Cc: PostgreSQL Novice Subject: Re: Optimizer Parameters In-reply-to: <3F0F6FBE.1090300@ethereal-realms.org> References: <3F0F6FBE.1090300@ethereal-realms.org> Comments: In-reply-to Martin Foster message dated "Fri, 11 Jul 2003 20:17:34 -0600" Date: Sat, 12 Jul 2003 16:46:10 -0400 Message-ID: <18388.1058042770@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/101 X-Sequence-Number: 7636 Martin Foster writes: > force Postgres into using Indexes when available. So I changed the > following two lines in the .conf file: > enable_seqscan = false > enable_nestloop = false > This was recommended in the documentation, Where would you say that setting those off in the config file is "recommended"? > Now how sane is it to keep those options turned off? It isn't. If you have to force them off for a particular query, do so right before you issue that query, and turn them on again after. Turning them off globally is sure to cause you pain later. > And any > way to have the planner quiet guessing tens of thousands of rows will be > return when there are at most hundred? > AND Po.PostTimestamp > (LOCALTIMESTAMP - INTERVAL '10 minutes') > AND Po.PuppetName IS NOT NULL > -> Seq Scan on post po (cost=0.00..14369.84 rows=40513 width=41) (actual time=2820.88..2826.30 rows=392 loops=1) > Filter: ((posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) AND (puppetname IS NOT NULL)) Not with that coding technique; "LOCALTIMESTAMP - INTERVAL '10 minutes'" isn't a constant and so the planner can't look at its statistics to see that only a small part of the table will be selected. There are two standard workarounds for this: 1. Do the timestamp arithmetic on the client side, so that the query you send the backend has a simple constant: ... AND Po.PostTimestamp > '2003-07-12 16:27' 2. Create a function that is falsely marked immutable, viz: create function ago(interval) returns timestamp without time zone as 'select localtimestamp - $1' language sql immutable strict; ... AND Po.PostTimestamp > ago('10 minutes') Because the function is marked immutable, the planner will reduce "ago('10 minutes')" to a constant on sight, and then use that value for planning purposes. This technique can cause problems, since in some contexts the reduction will occur prematurely, but as long as you only use ago() in interactively-issued queries it works okay. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jul 12 18:09:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7C0D9CB88F for ; Sat, 12 Jul 2003 21:09:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 39530-06 for ; Sat, 12 Jul 2003 21:09:02 +0000 (GMT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by svr1.postgresql.org (Postfix) with ESMTP id AB242CB87B for ; Sat, 12 Jul 2003 18:08:42 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030712210904.PAPT24359.lakemtao02.cox.net@[192.168.1.1]> for ; Sat, 12 Jul 2003 17:09:04 -0400 Subject: [OT] Such incredible h/w (was Re: Dual Xeon + HW RAID question) From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> References: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> Content-Type: text/plain Message-Id: <1058044143.18887.17.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 12 Jul 2003 16:09:03 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/189 X-Sequence-Number: 2482 Back in the day, we got good performance from similar sized tables using VMS, a small VAX with only 256MB RAM and narrow SCSI 1GB disks. The RDBMS was DEC's own Rdb/VMS. A "small" mainframe (6 MIPS, 8MB RAM) also gave good performance. So, this old curmudgeon asks, why such beefy h/w for such small databases. On Sat, 2003-07-12 at 13:25, Nikolaus Dilger wrote: > Alexandre, > > Since you want the fastest speed I would do the 2 data > disks in RAID 0 (striping) not RAID 1 (mirroring). > > If you would care about not loosing any transactions > you would keep all 3 disks in RAID 5. > > Don't know the answer to the Hyperthreading question. > Why don't you run a test to find out? > > Regards, > Nikolaus > > On Thu, 10 Jul 2003 14:43:25 -0300 (BRT), "alexandre > arruda paes :: aldeia digital" wrote: > > > > > Hi, > > > > I have this machine with a 10 million records: > > * Dual Xeon 2.0 (HyperThreading enabled), 3 7200 SCSI > , > > Adaptec 2110S, > > RAID 5 - 32k chunk size, 1 GB Ram DDR 266 ECC, RH 8.0 > - > > 2.4.18 > > > > The database is mirrored with contrib/dbmirror in a P4 > > 1 Gb Ram + IDE > > > > If a disk failure occurs, I can use the server in the > > mirror. > > > > I will format the main server in this weekend and I > > have seen in the list > > some people that recomends a Software RAID instead HW. > > > > I think too remove the RAID 5 and turn a RAID 1 for > > data in 2 HDs. > > SO, WAL and swap in the thrid HD. > > > > My questions: > > > > 1) I will see best disk performance changing the disk > > layout like above > > 2) HyperThreading really improve a procces basead > > program, like postgres -- +-----------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA http://members.cox.net/ron.l.johnson | | | | 4 degrees from Vladimir Putin +-----------------------------------------------------------+ From pgsql-novice-owner@postgresql.org Sat Jul 12 21:34:50 2003 X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B6A3CCB688 for ; Sun, 13 Jul 2003 00:34:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 86869-01 for ; Sun, 13 Jul 2003 00:34:33 +0000 (GMT) Received: from ethereal-realms.org (thebe.ethereal-realms.org [142.179.222.205]) by svr1.postgresql.org (Postfix) with ESMTP id 2F4F4CB68B for ; Sat, 12 Jul 2003 21:34:15 -0300 (ADT) Received: from thebe (martin@thebe [192.168.1.1]) by ethereal-realms.org (8.12.6/8.12.6) with ESMTP id h6D0YaUd013928 for ; Sat, 12 Jul 2003 18:34:36 -0600 (MDT) Message-ID: <3F10A4DD.4050405@ethereal-realms.org> Date: Sat, 12 Jul 2003 18:16:29 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane , PostgreSQL Performance Subject: Re: Optimizer Parameters References: <3F0F6FBE.1090300@ethereal-realms.org> <18388.1058042770@sss.pgh.pa.us> In-Reply-To: <18388.1058042770@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit ReSent-Date: Sat, 12 Jul 2003 18:34:31 -0600 (MDT) Resent-From: Martin Foster Resent-To: PostgreSQL Novice ReSent-Subject: Re: [NOVICE] Optimizer Parameters ReSent-Message-ID: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/103 X-Sequence-Number: 7638 Tom Lane wrote: > >>force Postgres into using Indexes when available. So I changed the >>following two lines in the .conf file: > > >> enable_seqscan = false >> enable_nestloop = false > >This was recommended in the documentation, > > > Where would you say that setting those off in the config file is > "recommended"? > > >>Now how sane is it to keep those options turned off? > > > It isn't. If you have to force them off for a particular query, do > so right before you issue that query, and turn them on again after. > Turning them off globally is sure to cause you pain later. > > >>And any >>way to have the planner quiet guessing tens of thousands of rows will be >>return when there are at most hundred? > > >> AND Po.PostTimestamp > (LOCALTIMESTAMP - INTERVAL '10 minutes') >> AND Po.PuppetName IS NOT NULL > > >> -> Seq Scan on post po (cost=0.00..14369.84 rows=40513 width=41) (actual time=2820.88..2826.30 rows=392 loops=1) >> Filter: ((posttimestamp > (('now'::text)::timestamp(6) without time zone - '00:10'::interval)) AND (puppetname IS NOT NULL)) > > > Not with that coding technique; "LOCALTIMESTAMP - INTERVAL '10 minutes'" > isn't a constant and so the planner can't look at its statistics to > see that only a small part of the table will be selected. > > There are two standard workarounds for this: > > 1. Do the timestamp arithmetic on the client side, so that the query > you send the backend has a simple constant: > > ... AND Po.PostTimestamp > '2003-07-12 16:27' > > 2. Create a function that is falsely marked immutable, viz: > > create function ago(interval) returns timestamp without time zone as > 'select localtimestamp - $1' language sql immutable strict; > > ... AND Po.PostTimestamp > ago('10 minutes') > > Because the function is marked immutable, the planner will reduce > "ago('10 minutes')" to a constant on sight, and then use that value > for planning purposes. This technique can cause problems, since > in some contexts the reduction will occur prematurely, but as long > as you only use ago() in interactively-issued queries it works okay. > > regards, tom lane http://www.postgresql.org/docs/7.3/static/indexes-examine.html The conf file does not make a mention of it, other then perhaps being used to debug. The above link points to disabling it, but tells you nothing about potential consequences and what to do if it works better then it did before. However, when I tried out your functions things started to work much better then previously. This to say the least is a great sign as it will increase overall performance. So thanks for that! As a side note, would you recommend disabling fsync for added performance? This would be joined with a healthy dose of a kernel file system buffer. Simply curious, as I have been increasing certain options for the WAL to mean it writes less often (transactions are numerous so that's not an issue) to the hard drives. Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Sat Jul 12 23:14:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 43D26CB584 for ; Sun, 13 Jul 2003 02:14:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 51864-06 for ; Sun, 13 Jul 2003 02:14:35 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id B575DCADB9 for ; Sat, 12 Jul 2003 23:14:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6D2EbQ3019621; Sat, 12 Jul 2003 22:14:37 -0400 (EDT) To: Martin Foster Cc: PostgreSQL Performance Subject: Re: [NOVICE] Optimizer Parameters In-reply-to: <3F10A4DD.4050405@ethereal-realms.org> References: <3F0F6FBE.1090300@ethereal-realms.org> <18388.1058042770@sss.pgh.pa.us> <3F10A4DD.4050405@ethereal-realms.org> Comments: In-reply-to Martin Foster message dated "Sat, 12 Jul 2003 18:16:29 -0600" Date: Sat, 12 Jul 2003 22:14:37 -0400 Message-ID: <19620.1058062477@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/191 X-Sequence-Number: 2484 Martin Foster writes: > As a side note, would you recommend disabling > fsync for added performance? Only if you are willing to sacrifice crash-safety in the name of speed. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jul 13 03:36:14 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id C4971CB56E for ; Sun, 13 Jul 2003 06:36:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 37973-03 for ; Sun, 13 Jul 2003 06:36:03 +0000 (GMT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id 4336ACB56A for ; Sun, 13 Jul 2003 03:35:41 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6D6wXi29850 for ; Sat, 12 Jul 2003 23:58:33 -0700 From: "Balazs Wellisch" To: Subject: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Sat, 12 Jul 2003 23:35:38 -0700 Message-ID: <001001c34908$fc98bc60$0600a8c0@home01> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0011_01C348CE.5039E460" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 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.2 tagged_above=0.0 required=5.0 tests=HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200307/192 X-Sequence-Number: 2485 This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C348CE.5039E460 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi all, I'm in the process of initiating a movement in our company to move towards open source software use. As part of this movement I will be recommending PostgreSQL as an alternative to the currently used MSSQL. I'm going with PostgreSQL over MySQL because of the much more complete feature set it provides. (After having used MSSQL for quite some time not having triggers, foreign keys, sub selects, etc. is not an option.) However, to be able to justify the move I will have to demonstrate that PostgreSQL is up to par with MSSQL and MySQL when it comes to performance. After having read through the docs and the lists it seems obvious that PostgreSQL is not configured for high performance out of the box. I don't have months to learn the ins and outs of PostgreSQL performance tuning so I looked around to see if there are any preconfigured solutions out there. I found that Red Hat Database 2.1 comes with PostgreSQL installed. However, as far as I can tell it comes with postgreSQL 7.2 and it requires Red Hat 8.0 or Red Hat Advanced Server which is based on Red Hat 7.2. Would I be better off installing Red Hat 9.0 and PostgreSQL 7.3 and try to performance tune the installation myself, or should I buy Red Hat Advanced Server and install Red Hat Database 2.1? (Let's say money is no object) So, does anyone here have any experience using RH AS and DB 2.1? Any advice would be much appreciated. TIA Balazs ------=_NextPart_000_0011_01C348CE.5039E460 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi all,

 

I’m in the process of initiating a movement in our company to move towards open source software use. As part of this movement I will be recommending PostgreSQL as an alternati= ve to the currently used MSSQL. I’m going with Postgre= SQL over MySQL because of the much more complete fe= ature set it provides. (After having used MSSQL for quite some time not having triggers, foreign keys, sub selects, etc. is not an option.)

 

However, to be able to justify the move I will have to demonstrate that PostgreSQL is up to par with M= SSQL and MySQL when it comes to performance. After h= aving read through the docs and the lists it seems obvious that PostgreSQL is not configured for high performance out of the box. I don’t have months to learn the ins and outs of PostgreSQL performance tuning so I looked around to see if there are any preconfigured solutions out there.

 

I found that Red Hat Database 2.1 comes with PostgreSQL installed. However, as far as I can tell it comes with postgreSQL 7.2 and it requires Red H= at 8.0 or Red Hat Advanced Server which is based on Red Hat 7.2. Would I be better= off installing Red Hat 9.0 and PostgreSQL 7.3 and t= ry to performance tune the installation myself, or sho= uld I buy Red Hat Advanced Server and install Red Hat Database 2.1? (Let’s = say money is no object)

 

So, does anyone here have any experience using = RH = = AS a= nd DB 2.1?

 

Any advice would be much appreciated.<= /font>

 

TIA

 

Balazs

 

------=_NextPart_000_0011_01C348CE.5039E460-- From pgsql-general-owner@postgresql.org Sun Jul 13 07:10:32 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id DD092CB9B0 for ; Sun, 13 Jul 2003 10:10:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 42870-02 for ; Sun, 13 Jul 2003 10:10:15 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 77937CB9BC for ; Sun, 13 Jul 2003 07:09:51 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6DAD2Ki010900 for ; Sun, 13 Jul 2003 15:43:02 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6DAD0Kr010861; Sun, 13 Jul 2003 15:43:00 +0530 From: Shridhar Daithankar To: Ron Johnson Subject: Re: Tuning PostgreSQL Date: Sun, 13 Jul 2003 15:41:08 +0530 User-Agent: KMail/1.5.2 References: <20030704142800.GC4592@libertyrms.info> <3F05E144.10448.6784AB@localhost> <1058072009.18890.121.camel@haggis> In-Reply-To: <1058072009.18890.121.camel@haggis> Cc: pgsql-performance@postgresql.org, pgsql-general@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307131541.08155.shridhar_daithankar@nospam.persistent.co.in> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/436 X-Sequence-Number: 45289 On Sunday 13 July 2003 10:23, Ron Johnson wrote: > On Fri, 2003-07-04 at 09:49, Shridhar Daithankar wrote: > > On 4 Jul 2003 at 16:35, Michael Mattox wrote: > > [snip] > > > On a positive note, me and Josh are finishing a bare bone performance > > article that would answer lot of your questions. I am counting on you to > > provide valuable feedback. I expect it out tomorrow or on sunday..Josh > > will confirm that.. > > Hello, > > Is this doc publicly available yet? Yes. See http://www.varlena.com/GeneralBits/ I thought I announved it on performance.. anyways.. Shridhar From pgsql-performance-owner@postgresql.org Sun Jul 13 07:20:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2EF28CB9B0 for ; Sun, 13 Jul 2003 10:20:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 04747-09 for ; Sun, 13 Jul 2003 10:21:00 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 57C55CB95C for ; Sun, 13 Jul 2003 07:20:39 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6DANoVG011387 for ; Sun, 13 Jul 2003 15:53:50 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6DANoKr011374 for ; Sun, 13 Jul 2003 15:53:50 +0530 From: Shridhar Daithankar To: Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Sun, 13 Jul 2003 15:51:57 +0530 User-Agent: KMail/1.5.2 References: <001001c34908$fc98bc60$0600a8c0@home01> In-Reply-To: <001001c34908$fc98bc60$0600a8c0@home01> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307131551.57688.shridhar_daithankar@nospam.persistent.co.in> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/194 X-Sequence-Number: 2487 On Sunday 13 July 2003 12:05, Balazs Wellisch wrote: > Hi all, > However, to be able to justify the move I will have to demonstrate that > PostgreSQL is up to par with MSSQL and MySQL when it comes to > performance. After having read through the docs and the lists it seems > obvious that PostgreSQL is not configured for high performance out of > the box. I don't have months to learn the ins and outs of PostgreSQL > performance tuning so I looked around to see if there are any > preconfigured solutions out there. If postgresql performance is going to be a concern, concurrency considerations with mysql will be even bigger concern. Postgresql can be tuned. For achieving good concurrency with mysql, you might have to redesign your app. In general, this list can help you to tune the things. Shouldn't be that big concern. > > I found that Red Hat Database 2.1 comes with PostgreSQL installed. > However, as far as I can tell it comes with postgreSQL 7.2 and it > requires Red Hat 8.0 or Red Hat Advanced Server which is based on Red > Hat 7.2. Would I be better off installing Red Hat 9.0 and PostgreSQL 7.3 > and try to performance tune the installation myself, or should I buy Red > Hat Advanced Server and install Red Hat Database 2.1? (Let's say money > is no object) I would rather vote for RH-AS with postgresql 7.4 devel. Former for it's big-app tunings out of the box and later for it's performance. Of course best way is to try it out yourself. Even vanilaa distro. on good hardware should be plenty good.. Shridhar From pgsql-performance-owner@postgresql.org Sun Jul 13 09:18:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 42986CB5AC for ; Sun, 13 Jul 2003 12:18:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 05542-02 for ; Sun, 13 Jul 2003 12:18:57 +0000 (GMT) Received: from community9.interfree.it (community9.interfree.it [213.158.72.64]) by svr1.postgresql.org (Postfix) with SMTP id CB42FCB5A9 for ; Sun, 13 Jul 2003 09:18:37 -0300 (ADT) Received: (qmail 14445 invoked by uid 320); 13 Jul 2003 12:18:59 -0000 Date: 13 Jul 2003 12:18:59 -0000 Message-ID: <20030713121859.14444.qmail@community9.interfree.it> From: lax@interfree.it () Reply-To: lax@interfree.it To: pgsql-performance@postgresql.org Subject: Help disk-pages 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: 200307/195 X-Sequence-Number: 2488 Hi all! I'm new to Postgresql and I'm trying solve a problem: is there a way to know how many disk-pages are read during a query? Because I found out only how many disk-pages a relation has and I'd like to know if there is a system catalog or something else that stores this information thanks, Andrea Lazzarotto ----------------------------------------------------- Salve, il messaggio che hai ricevuto � stato inviato per mezzo del sistema di web mail interfree. Se anche tu vuoi una casella di posta free visita il sito http://club.interfree.it Ti aspettiamo! ----------------------------------------------------- From pgsql-performance-owner@postgresql.org Sun Jul 13 14:37:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 8FB0CCBA74 for ; Sun, 13 Jul 2003 17:36:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 33360-10 for ; Sun, 13 Jul 2003 17:36:32 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 3394CCBA70 for ; Sun, 13 Jul 2003 14:36:09 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1823507; Sun, 13 Jul 2003 10:03:34 -0700 Message-ID: <3F119743.2050803@joeconway.com> Date: Sun, 13 Jul 2003 10:30:43 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Balazs Wellisch Cc: pgsql-performance@postgresql.org Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL References: <001001c34908$fc98bc60$0600a8c0@home01> In-Reply-To: <001001c34908$fc98bc60$0600a8c0@home01> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/196 X-Sequence-Number: 2489 Balazs Wellisch wrote: > I don't have months to learn the ins and outs of PostgreSQL > performance tuning so I looked around to see if there are any > preconfigured solutions out there. I don't know of a preconfigured solution. Generally speaking, the best configuration will be highly dependent on your hardware, data, and application. > Hat Advanced Server and install Red Hat Database 2.1? (Let's say money > is no object) There are many Linux and other OS distributions that will work just fine. You may need to tweak a few kernel configuration parameters, but that's not too difficult; see: http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=kernel-resources.html I would *not* use the default version of Postgres shipped with any particular distribution. Use 7.3.3 because that is the latest released version. Or, as Shridhar mentioned in his post, the are a number of pretty significant performance improvements in 7.4 (which is in feature freeze and scheduled to go into beta on 21 July). If you are in an exploratory/test phase rather than production right now, I'd say use the 7.4 beta for your comparisons. If money is truly not a problem, but time is, my advice is to hire a consultant. There are probably several people on this list that can fill that role for you. Otherwise read the archives and ask lots of specific questions. Joe From pgsql-performance-owner@postgresql.org Sun Jul 13 15:04:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 5820BCBA94 for ; Sun, 13 Jul 2003 18:04:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 46137-04 for ; Sun, 13 Jul 2003 18:05:16 +0000 (GMT) Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 6B6BCCBA85 for ; Sun, 13 Jul 2003 15:04:52 -0300 (ADT) Received: from weaver.tuc.noao.edu ([140.252.38.8] verified) by noao.edu (CommuniGate Pro SMTP 4.1b9) with ESMTP-TLS id 8066675; Sun, 13 Jul 2003 11:05:15 -0700 Received: from weaver.tuc.noao.edu (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.5) with ESMTP id h6DI5FIY017117; Sun, 13 Jul 2003 11:05:15 -0700 Received: (from swampler@localhost) by weaver.tuc.noao.edu (8.12.8/8.12.8/Submit) id h6DI5FTx017115; Sun, 13 Jul 2003 11:05:15 -0700 X-Authentication-Warning: weaver.tuc.noao.edu: swampler set sender to swampler@noao.edu using -f Subject: Improving a simple query? From: Steve Wampler Reply-To: swampler@noao.edu To: Postgres-performance Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: National Solar Observatory Message-Id: <1058119515.23012.114.camel@weaver.tuc.noao.edu> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 13 Jul 2003 11:05:15 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/197 X-Sequence-Number: 2490 I'm not an SQL or PostgreSQL expert. I'm getting abysmal performance on a nested query and need some help on finding ways to improve the performance: Background: RH 8.0 dual-CPU machine (1.2GHz athlon) Postgresql 7.2 1GB ram (Machine is dedicated to postgres, so there's not much else running.) The table has ~500K rows. Table definition: lab.devel.configdb=# \d attributes_table Table "attributes_table" Column | Type | Modifiers --------+--------------------------+--------------- id | character varying(64) | not null name | character varying(64) | not null units | character varying(32) | value | text | time | timestamp with time zone | default now() Indexes: id_index, name_index Primary key: attributes_table_pkey Triggers: trigger_insert View definition: lab.devel.configdb=# \d attributes; View "attributes" Column | Type | Modifiers --------+-----------------------+----------- id | character varying(64) | name | character varying(64) | units | character varying(32) | value | text | View definition: SELECT attributes_table.id, attributes_table.name, attributes_table.units, attributes_table.value FROM attributes_table; Query: select * from attributes_table where id in (select id from attributes where (name='obsid') and (value='oid00066')); Now, the inner SELECT is fast: lab.devel.configdb=# explain analyze select id from attributes where (name='obsid') and (value='oid00066'); NOTICE: QUERY PLAN: Index Scan using name_index on attributes_table (cost=0.00..18187.48 rows=15 width=25) (actual time=0.33..238.06 rows=2049 loops=1) Total runtime: 239.28 msec EXPLAIN But the outer SELECT insists on using a sequential scan [it should pick up about 20K-40K rows (normally, access is through a script]. How slow? Slow enough that: explain analyze select * from attributes_table where id in (select id from attributes where (name='obsid') and (value='oid00066')); hasn't completed in the last 15 minutes. Removing the analyze gives: lab.devel.configdb=# explain select * from attributes_table where id in (select id from attributes where (name='obsid') and (value='oid00066')); NOTICE: QUERY PLAN: Seq Scan on attributes_table (cost=100000000.00..8873688920.07 rows=241201 width=59) SubPlan -> Materialize (cost=18187.48..18187.48 rows=15 width=25) -> Index Scan using name_index on attributes_table (cost=0.00..18187.48 rows=15 width=25) EXPLAIN Obviously, something is forcing the outer select into a sequential scan, which is what I assume is the bottleneck (see above about lack of expert-ness...). I've played with the settings in postgresql.conf, using the on-line performance tuning guide: shared_buffers = 8192 # 2*max_connections, min 16 max_fsm_relations = 1000 # min 10, fsm is free space map max_fsm_pages = 10000 # min 1000, fsm is free space map max_locks_per_transaction = 128 # min 10 wal_buffers = 64 # min 4 sort_mem = 128 # min 32 vacuum_mem = 4096 # min 1024 wal_files = 32 # range 0-64 (default was 0) effective_cache_size = 96000 # default in 8k pages random_page_cost = 3 but haven't noticed an significant change with these settings over more conservative settings. Any suggestions? Is there a better way to phrase the query that would provide order-of-magnitude improvement? Thanks! Steve -- Steve Wampler -- swampler@noao.edu Quantum materiae materietur marmota monax si marmota monax materiam possit materiari? From pgsql-performance-owner@postgresql.org Sun Jul 13 16:09:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 81671CB5E7 for ; Sun, 13 Jul 2003 19:08:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 56523-06 for ; Sun, 13 Jul 2003 19:09:18 +0000 (GMT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by svr1.postgresql.org (Postfix) with ESMTP id 9319DCB539 for ; Sun, 13 Jul 2003 16:08:55 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19bmDm-0001GJ-0U; Sun, 13 Jul 2003 20:09:19 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id CD32017A24; Sun, 13 Jul 2003 20:09:17 +0100 (BST) Received: from mainbox.archonet.com (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with SMTP id 283621757D; Sun, 13 Jul 2003 20:09:17 +0100 (BST) Received: from 192.168.1.32 (SquirrelMail authenticated user dev) by mainbox.archonet.com with HTTP; Sun, 13 Jul 2003 20:09:17 +0100 (BST) Message-ID: <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> In-Reply-To: <1058119515.23012.114.camel@weaver.tuc.noao.edu> References: <1058119515.23012.114.camel@weaver.tuc.noao.edu> Date: Sun, 13 Jul 2003 20:09:17 +0100 (BST) Subject: Re: Improving a simple query? From: "Richard Huxton" To: swampler@noao.edu Cc: "Postgres-performance" User-Agent: SquirrelMail/1.4.0 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/198 X-Sequence-Number: 2491 > I'm not an SQL or PostgreSQL expert. > > I'm getting abysmal performance on a nested query and > need some help on finding ways to improve the performance: [snip] > select * from attributes_table where id in (select id from > attributes where (name='obsid') and (value='oid00066')); This is the classic IN problem (much improved in 7.4 dev I believe). The recommended approach is to rewrite the query as an EXISTS form if possible. See the mailing list archives for plenty of examples. Could you not rewrite this as a simple join though? - Richard From pgsql-performance-owner@postgresql.org Sun Jul 13 16:39:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 5C31DCBAA8 for ; Sun, 13 Jul 2003 19:30:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 39863-07 for ; Sun, 13 Jul 2003 19:30:47 +0000 (GMT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id 9C7CECB539 for ; Sun, 13 Jul 2003 16:30:24 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6DJrVi04001 for ; Sun, 13 Jul 2003 12:53:31 -0700 Message-ID: <007301c34975$41874050$0600a8c0@home01> From: "Balazs Wellisch" To: References: <001001c34908$fc98bc60$0600a8c0@home01> <200307131551.57688.shridhar_daithankar@nospam.persistent.co.in> Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Sun, 13 Jul 2003 12:30:44 -0700 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/199 X-Sequence-Number: 2492 > On Sunday 13 July 2003 12:05, Balazs Wellisch wrote: > > Hi all, > > However, to be able to justify the move I will have to demonstrate that > > PostgreSQL is up to par with MSSQL and MySQL when it comes to > > performance. After having read through the docs and the lists it seems > > obvious that PostgreSQL is not configured for high performance out of > > the box. I don't have months to learn the ins and outs of PostgreSQL > > performance tuning so I looked around to see if there are any > > preconfigured solutions out there. > > If postgresql performance is going to be a concern, concurrency > considerations with mysql will be even bigger concern. Postgresql can be > tuned. For achieving good concurrency with mysql, you might have to redesign > your app. > Yes, we still may use MySQL in certain situations, but we are looking at PostgreSQL for concurrency and other reasons such as the much more complete set of features it provides. And now that we found PostgreSQL Manager (http://www.ems-hitech.com/pgmanager) it's even up to par with MSSQL in ease of use! > In general, this list can help you to tune the things. Shouldn't be that big > concern. > That's good to hear! > > > > I found that Red Hat Database 2.1 comes with PostgreSQL installed. > > However, as far as I can tell it comes with postgreSQL 7.2 and it > > requires Red Hat 8.0 or Red Hat Advanced Server which is based on Red > > Hat 7.2. Would I be better off installing Red Hat 9.0 and PostgreSQL 7.3 > > and try to performance tune the installation myself, or should I buy Red > > Hat Advanced Server and install Red Hat Database 2.1? (Let's say money > > is no object) > > I would rather vote for RH-AS with postgresql 7.4 devel. Former for it's > big-app tunings out of the box and later for it's performance. > Could you enumerate what those settings are? What should I be looking at as far as kernel, file system, etc. goes? > Of course best way is to try it out yourself. Even vanilaa distro. on good > hardware should be plenty good.. > > Shridhar > Thank you for your advice. It's much appriciated. Balazs From pgsql-performance-owner@postgresql.org Sun Jul 13 16:42:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 75D3ACBAAF for ; Sun, 13 Jul 2003 19:42:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 80384-02 for ; Sun, 13 Jul 2003 19:42:32 +0000 (GMT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id 2C012CBAAE for ; Sun, 13 Jul 2003 16:42:09 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6DK5Gi04031 for ; Sun, 13 Jul 2003 13:05:16 -0700 Message-ID: <008801c34976$e58a4ac0$0600a8c0@home01> From: "Balazs Wellisch" To: References: <001001c34908$fc98bc60$0600a8c0@home01> <1058100557.19798.20.camel@haggis> Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Sun, 13 Jul 2003 12:42:29 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-13" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/200 X-Sequence-Number: 2493 > On Sun, 2003-07-13 at 01:35, Balazs Wellisch wrote: > > Hi all, > > > > > > > > I�m in the process of initiating a movement in our company to move > > towards open source software use. As part of this movement I will be > > recommending PostgreSQL as an alternative to the currently used MSSQL. > > I�m going with PostgreSQL over MySQL because of the much more complete > > feature set it provides. (After having used MSSQL for quite some time > > not having triggers, foreign keys, sub selects, etc. is not an > > option.) > > Note that I've read a couple of times from Tom Lane (one of the > core team) that FKs are a serous performance drag, so I'd drop > them after the s/w has been in production long enough to work > out the kinks. > That's interesting, I didn't know that. Any idea how much of a performance drag we're talking about? > > However, to be able to justify the move I will have to demonstrate > > that PostgreSQL is up to par with MSSQL and MySQL when it comes to > > performance. After having read through the docs and the lists it seems > > obvious that PostgreSQL is not configured for high performance out of > > the box. I don�t have months to learn the ins and outs of PostgreSQL > > performance tuning so I looked around to see if there are any > > preconfigured solutions out there. > > http://www.varlena.com/GeneralBits/ > http://www.varlena.com/GeneralBits/Tidbits/perf.html > http://www.varlena.com/GeneralBits/Tidbits/annotated_conf_e.html > Those links are great!!! Thank you for bringing them to my attantion. And a BIG thank you to the authors (Josh Berkus & Shridhar Daithankar) for making this available. I've been looking for an authoritative and comprehensive source for performance tuning tips but haven't found much except for little tidbits here and there. This is very nice. > Me, I'd install Debian, but I understand the comfort level created > by RH. > Don't know much about Debian, but we've been working with RH for years. I've had nothing but good experiences with them. (Except maybe for RH8) The new Enterprise direction they're going in is exectly what we need. Longer testing cycles and better tuned distributions are good for businesses like us. We don't necessarily need the latest and greates we need the latest and most stable to guarantee the highest return on our investment. But, this discussion is for another list... :) Thanks for your advice. This list has proved to be a great asset so far. Balazs From pgsql-performance-owner@postgresql.org Sun Jul 13 16:53:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 330B6CBAA8 for ; Sun, 13 Jul 2003 19:50:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 94227-09 for ; Sun, 13 Jul 2003 19:51:08 +0000 (GMT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id C08CFCB539 for ; Sun, 13 Jul 2003 16:50:45 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6DKDri04055 for ; Sun, 13 Jul 2003 13:13:53 -0700 Message-ID: <009901c34978$19697270$0600a8c0@home01> From: "Balazs Wellisch" To: References: <20030713110341.A16172@bacon> <20030713143721.A18011@bacon> Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Sun, 13 Jul 2003 12:51:02 -0700 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/201 X-Sequence-Number: 2494 > The most important thing seems to be to increase shared_buffers. On my > RH7.3 machine here, Linux is configured with shmmax = 32MB which allows me > a value of just under 4000 for shared_buffers (3900 works, 3950 doesn't). > If your selects return large amounts of data, you'll probably also need to > increase sort_mem (I use a value of 1024 so a query would have to return > more that 1MB of data before the sort (assuming there is a order by clause > to cause a sort) starts paging stuff out disk. > > > > I found that Red Hat Database 2.1 comes with PostgreSQL installed. > > However, as far as I can tell it comes with postgreSQL 7.2 and it > > requires Red Hat 8.0 or Red Hat Advanced Server which is based on Red > > Hat 7.2. Would I be better off installing Red Hat 9.0 and PostgreSQL 7.3 > > and try to performance tune the installation myself, or should I buy Red > > Hat Advanced Server and install Red Hat Database 2.1? (Let's say money > > is no object) > > > Alternatively, you simply compile 7.3.3 from source. I've upgraded most my > machines that way. > Unfortunatelly, compiling from source is not really an option for us. We use RPMs only to ease the installation and upgrade process. We have over a hundred servers to maintaine and having to compile and recompile software everytime a new release comes out would be waaaaay too much work. > > > > So, does anyone here have any experience using RH AS and DB 2.1? > > Are RH still selling DB 2.1? I can't find it listed on their web site. > -- Yes, it's available for free download. The documentation is here: http://www.redhat.com/docs/manuals/database/. I'd welcome your oppinions on this product. Thank you for your comments. Balazs From pgsql-performance-owner@postgresql.org Sun Jul 13 16:54:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E43D0CBAB1 for ; Sun, 13 Jul 2003 19:54:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 30041-02 for ; Sun, 13 Jul 2003 19:54:41 +0000 (GMT) Received: from celery.tssi.com (celery.tssi.com [198.147.197.6]) by svr1.postgresql.org (Postfix) with SMTP id B0006CB539 for ; Sun, 13 Jul 2003 16:54:18 -0300 (ADT) Received: (qmail 15747 invoked by uid 1000); 13 Jul 2003 19:54:40 -0000 Message-ID: <20030713195440.15746.qmail@celery.tssi.com> From: nolan@celery.tssi.com Subject: Re: Improving a simple query? To: swampler@noao.edu Date: Sun, 13 Jul 2003 14:54:40 -0500 (CDT) Cc: pgsql-performance@postgresql.org (Postgres-performance) In-Reply-To: <1058119515.23012.114.camel@weaver.tuc.noao.edu> from "Steve Wampler" at Jul 13, 2003 11:05:15 AM X-Mailer: ELM [version 2.5 PL3] 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-Archive-Number: 200307/202 X-Sequence-Number: 2495 > select * from attributes_table where id in (select id from > attributes where (name='obsid') and (value='oid00066')); Can you convert it into a join? 'where in' clauses tend to slow pgsql down. -- Mike Nolan From pgsql-performance-owner@postgresql.org Sun Jul 13 17:04:30 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4207DCBABC for ; Sun, 13 Jul 2003 20:04:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 39361-01 for ; Sun, 13 Jul 2003 20:04:50 +0000 (GMT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id DB24BCB539 for ; Sun, 13 Jul 2003 17:04:27 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6DKRZi04079 for ; Sun, 13 Jul 2003 13:27:35 -0700 Message-ID: <009d01c3497a$039b8f30$0600a8c0@home01> From: "Balazs Wellisch" To: References: <001001c34908$fc98bc60$0600a8c0@home01> <3F119743.2050803@joeconway.com> Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Sun, 13 Jul 2003 13:04:48 -0700 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/203 X-Sequence-Number: 2496 > There are many Linux and other OS distributions that will work just > fine. You may need to tweak a few kernel configuration parameters, but > that's not too difficult; see: > http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=kernel-resources.html > Yes, I looked at the online documentation but found it a little too generic. Although it gives me good idea of where to look to adjust performance related parameters I need a little more specific advise. I just don't have the time to tweak and test different configurations for months to see what works and what doesn't. Ideally, I'd love to run my own benchmarks and become an expert at postgresql, but unfortunately in the real world I have deadlines to meet and clients to appease. So, I was hoping someone would have some real world experiences to share running postgresql on RH in an enterprise environment. > I would *not* use the default version of Postgres shipped with any > particular distribution. Use 7.3.3 because that is the latest released > version. Or, as Shridhar mentioned in his post, the are a number of > pretty significant performance improvements in 7.4 (which is in feature > freeze and scheduled to go into beta on 21 July). If you are in an > exploratory/test phase rather than production right now, I'd say use the > 7.4 beta for your comparisons. > Well, I could start by testing 7.4, however I'd have to go back to the stable version once we're ready to use it a production environment. So, I might as well stick with eveluating the production version. > If money is truly not a problem, but time is, my advice is to hire a > consultant. There are probably several people on this list that can fill > that role for you. Otherwise read the archives and ask lots of specific > questions. > Once we're ready to go with postgresql in a production environment we may indeed need to hire a consultant. Any suggestions whom I should contact? (We're in the San Diego area) Thank you for your advice. Balazs From pgsql-performance-owner@postgresql.org Sun Jul 13 17:31:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 6B5D1CBACB for ; Sun, 13 Jul 2003 20:30:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 85324-05 for ; Sun, 13 Jul 2003 20:31:15 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id CB733CBAC4 for ; Sun, 13 Jul 2003 17:30:52 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1823566; Sun, 13 Jul 2003 12:58:15 -0700 Message-ID: <3F11C037.3070008@joeconway.com> Date: Sun, 13 Jul 2003 13:25:27 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Balazs Wellisch Cc: pgsql-performance@postgresql.org Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL References: <001001c34908$fc98bc60$0600a8c0@home01> <3F119743.2050803@joeconway.com> <009d01c3497a$039b8f30$0600a8c0@home01> In-Reply-To: <009d01c3497a$039b8f30$0600a8c0@home01> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/204 X-Sequence-Number: 2497 Balazs Wellisch wrote: >>I would *not* use the default version of Postgres shipped with any >>particular distribution. Use 7.3.3 because that is the latest released >>version. Or, as Shridhar mentioned in his post, the are a number of >>pretty significant performance improvements in 7.4 (which is in feature >>freeze and scheduled to go into beta on 21 July). If you are in an >>exploratory/test phase rather than production right now, I'd say use the >>7.4 beta for your comparisons. > > Well, I could start by testing 7.4, however I'd have to go back to the > stable version once we're ready to use it a production environment. So, I > might as well stick with eveluating the production version. How soon do you think you'll be in production? PostgreSQL beta testing usually seems to run about 2 months or so -- if you won't be in production before October, it is a good bet that Postgres 7.4 will be out or at least in release candidate by then. But it really depends on your specific application. If you use lots of "WHERE foo IN (SELECT ...)" type queries, you'll need to rewrite them in 7.3.3 or earlier, but in 7.4 they will probably work fine. Also, if you do much in the way of aggregate queries for reporting, 7.4 will likely give you a significant performance boost. >>If money is truly not a problem, but time is, my advice is to hire a >>consultant. There are probably several people on this list that can fill >>that role for you. Otherwise read the archives and ask lots of specific >>questions. > > Once we're ready to go with postgresql in a production environment we may > indeed need to hire a consultant. Any suggestions whom I should contact? > (We're in the San Diego area) > Um, actually, I live in the San Diego area ;-) Joe From pgsql-performance-owner@postgresql.org Sun Jul 13 17:45:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 35AE6CBADE for ; Sun, 13 Jul 2003 20:45:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 80384-05 for ; Sun, 13 Jul 2003 20:46:09 +0000 (GMT) Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id E1805CBAD4 for ; Sun, 13 Jul 2003 17:45:46 -0300 (ADT) Received: from weaver.tuc.noao.edu ([140.252.38.8] verified) by noao.edu (CommuniGate Pro SMTP 4.1b9) with ESMTP-TLS id 8067177 for pgsql-performance@postgresql.org; Sun, 13 Jul 2003 13:46:10 -0700 Received: from weaver.tuc.noao.edu (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.5) with ESMTP id h6DKkAIY018150; Sun, 13 Jul 2003 13:46:10 -0700 Received: (from swampler@localhost) by weaver.tuc.noao.edu (8.12.8/8.12.8/Submit) id h6DKkA9g018148; Sun, 13 Jul 2003 13:46:10 -0700 Date: Sun, 13 Jul 2003 13:46:10 -0700 From: Steve Wampler To: pgsql-performance@postgresql.org Subject: Re: Improving a simple query? Message-ID: <20030713204610.GA18123@weaver.tuc.noao.edu> References: <1058119515.23012.114.camel@weaver.tuc.noao.edu> <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/205 X-Sequence-Number: 2498 On Sun, Jul 13, 2003 at 08:09:17PM +0100, Richard Huxton wrote: > > I'm not an SQL or PostgreSQL expert. > > > > I'm getting abysmal performance on a nested query and > > need some help on finding ways to improve the performance: > [snip] > > select * from attributes_table where id in (select id from > > attributes where (name='obsid') and (value='oid00066')); > > This is the classic IN problem (much improved in 7.4 dev I believe). The > recommended approach is to rewrite the query as an EXISTS form if > possible. See the mailing list archives for plenty of examples. > > Could you not rewrite this as a simple join though? Hmmm, I don't see how. Then again, I'm pretty much the village idiot w.r.t. SQL... The inner select is locating a set of (2049) ids (actually from the same table, since 'attributes' is just a view into 'attributes_table'). The outer select is then locating all records (~30-40K) that have any of those ids. Is that really something a JOIN could be used for? -Steve -- Steve Wampler -- swampler@noao.edu Quantum materiae materietur marmota monax si marmota monax materiam possit materiari? From pgsql-sql-owner@postgresql.org Sun Jul 13 18:50:31 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id D4C2ECBAE8 for ; Sun, 13 Jul 2003 21:50:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 37706-05 for ; Sun, 13 Jul 2003 21:50:40 +0000 (GMT) Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 64AE1CBAA8 for ; Sun, 13 Jul 2003 18:50:18 -0300 (ADT) Received: from weaver.tuc.noao.edu ([140.252.38.8] verified) by noao.edu (CommuniGate Pro SMTP 4.1b9) with ESMTP-TLS id 8067408 for pgsql-sql@postgresql.org; Sun, 13 Jul 2003 14:50:42 -0700 Received: from weaver.tuc.noao.edu (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.5) with ESMTP id h6DLogIY018660; Sun, 13 Jul 2003 14:50:42 -0700 Received: (from swampler@localhost) by weaver.tuc.noao.edu (8.12.8/8.12.8/Submit) id h6DLogBC018658; Sun, 13 Jul 2003 14:50:42 -0700 Date: Sun, 13 Jul 2003 14:50:42 -0700 From: Steve Wampler To: pgsql-sql@postgresql.org Subject: Replacing a simple nested query? Message-ID: <20030713215042.GA18643@weaver.tuc.noao.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/155 X-Sequence-Number: 14269 I've got a simple nested query: select * from attributes where id in (select id from attributes where (name='obsid') and (value='oid00066')); that performs abysmally. I've heard this described as the 'classic WHERE IN' problem. Is there a better way to obtain the same results? The inner select identifies a set of ids (2049 of them, to be exact) that are then used to locate records that have the same id (about 30-40K of those, including the aforementioned 2049). Thanks! -Steve -- Steve Wampler -- swampler@noao.edu Quantum materiae materietur marmota monax si marmota monax materiam possit materiari? From pgsql-sql-owner@postgresql.org Sun Jul 13 19:06:56 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B0383CBB05 for ; Sun, 13 Jul 2003 22:06:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 87782-06 for ; Sun, 13 Jul 2003 22:07:01 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id B1F3CCBB03 for ; Sun, 13 Jul 2003 19:06:38 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1823616; Sun, 13 Jul 2003 14:34:01 -0700 Message-ID: <3F11D6A9.4040905@joeconway.com> Date: Sun, 13 Jul 2003 15:01:13 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Wampler Cc: pgsql-sql@postgresql.org Subject: Re: Replacing a simple nested query? References: <20030713215042.GA18643@weaver.tuc.noao.edu> In-Reply-To: <20030713215042.GA18643@weaver.tuc.noao.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/156 X-Sequence-Number: 14270 Steve Wampler wrote: > I've got a simple nested query: > > select * from attributes where id in (select id from > attributes where (name='obsid') and (value='oid00066')); > > that performs abysmally. I've heard this described as the > 'classic WHERE IN' problem. I may be missing something, but why can't you just do: select * from attributes where name='obsid' and value='oid00066'; ? Joe From pgsql-performance-owner@postgresql.org Sun Jul 13 19:31:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 724C3CB56A for ; Sun, 13 Jul 2003 22:31:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 14912-01 for ; Sun, 13 Jul 2003 22:32:12 +0000 (GMT) Received: from flake.decibel.org (unknown [66.143.173.58]) by svr1.postgresql.org (Postfix) with SMTP id A03A7CBB14 for ; Sun, 13 Jul 2003 19:31:50 -0300 (ADT) Received: (qmail 75849 invoked by uid 1001); 13 Jul 2003 22:32:14 -0000 Date: Sun, 13 Jul 2003 17:32:14 -0500 From: "Jim C. Nasby" To: Balazs Wellisch Cc: pgsql-performance@postgresql.org Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Message-ID: <20030713223214.GJ5877@nasby.net> References: <20030713110341.A16172@bacon> <20030713143721.A18011@bacon> <009901c34978$19697270$0600a8c0@home01> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <009901c34978$19697270$0600a8c0@home01> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/206 X-Sequence-Number: 2499 On Sun, Jul 13, 2003 at 12:51:02PM -0700, Balazs Wellisch wrote: > > Alternatively, you simply compile 7.3.3 from source. I've upgraded most my > > machines that way. > > > > Unfortunatelly, compiling from source is not really an option for us. We use > RPMs only to ease the installation and upgrade process. We have over a > hundred servers to maintaine and having to compile and recompile software > everytime a new release comes out would be waaaaay too much work. If you aren't settled on OS yet, take a look at FreeBSD, or one of the linuxes that have better app management. Keeping pgsql up-to-date using ports on FreeBSD is pretty painless (for that matter, so is keeping the OS itself up-to-date). -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Sun Jul 13 21:02:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 0F997CADC5 for ; Mon, 14 Jul 2003 00:01:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 29086-02 for ; Mon, 14 Jul 2003 00:01:41 +0000 (GMT) Received: from fuji.krosing.net (unknown [194.204.44.118]) by svr1.postgresql.org (Postfix) with ESMTP id 3AE34CADB8 for ; Sun, 13 Jul 2003 21:01:19 -0300 (ADT) Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h6DNwUXi019163; Mon, 14 Jul 2003 02:58:30 +0300 Received: (from hannu@localhost) by fuji.krosing.net (8.12.8/8.12.8/Submit) id h6DNwS2l019161; Mon, 14 Jul 2003 02:58:28 +0300 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: Improving a simple query? From: Hannu Krosing To: Steve Wampler Cc: pgsql-performance@postgresql.org In-Reply-To: <20030713204610.GA18123@weaver.tuc.noao.edu> References: <1058119515.23012.114.camel@weaver.tuc.noao.edu> <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> <20030713204610.GA18123@weaver.tuc.noao.edu> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1058140707.19113.0.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 14 Jul 2003 02:58:28 +0300 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/207 X-Sequence-Number: 2500 Steve Wampler kirjutas P, 13.07.2003 kell 23:46: > On Sun, Jul 13, 2003 at 08:09:17PM +0100, Richard Huxton wrote: > > > I'm not an SQL or PostgreSQL expert. > > > > > > I'm getting abysmal performance on a nested query and > > > need some help on finding ways to improve the performance: > > [snip] > > > select * from attributes_table where id in (select id from > > > attributes where (name='obsid') and (value='oid00066')); > > > > This is the classic IN problem (much improved in 7.4 dev I believe). The > > recommended approach is to rewrite the query as an EXISTS form if > > possible. See the mailing list archives for plenty of examples. > > > > Could you not rewrite this as a simple join though? > > Hmmm, I don't see how. Then again, I'm pretty much the village > idiot w.r.t. SQL... > > The inner select is locating a set of (2049) ids (actually from > the same table, since 'attributes' is just a view into > 'attributes_table'). The outer select is then locating all > records (~30-40K) that have any of those ids. Is that really > something a JOIN could be used for? There may be some subtle differences, but most likely the 'join' form wis like this: select at.* from attributes_table at, attributes a where at.id = a.id and a.name='obsid' and a.value='oid00066' -------------- Hannu From pgsql-performance-owner@postgresql.org Sun Jul 13 22:23:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4296ECB5B7 for ; Mon, 14 Jul 2003 01:23:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 75989-04 for ; Mon, 14 Jul 2003 01:23:49 +0000 (GMT) Received: from celery.tssi.com (celery.tssi.com [198.147.197.6]) by svr1.postgresql.org (Postfix) with SMTP id 5ACD2CB597 for ; Sun, 13 Jul 2003 22:23:28 -0300 (ADT) Received: (qmail 18921 invoked by uid 1000); 14 Jul 2003 01:23:47 -0000 Message-ID: <20030714012347.18920.qmail@celery.tssi.com> From: nolan@celery.tssi.com Subject: Re: Improving a simple query? To: swampler@noao.edu (Steve Wampler) Date: Sun, 13 Jul 2003 20:23:47 -0500 (CDT) Cc: pgsql-performance@postgresql.org In-Reply-To: <20030713204610.GA18123@weaver.tuc.noao.edu> from "Steve Wampler" at Jul 13, 2003 01:46:10 PM X-Mailer: ELM [version 2.5 PL3] 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-Archive-Number: 200307/208 X-Sequence-Number: 2501 > > Could you not rewrite this as a simple join though? > > Hmmm, I don't see how. Then again, I'm pretty much the village > idiot w.r.t. SQL... > > The inner select is locating a set of (2049) ids (actually from > the same table, since 'attributes' is just a view into > 'attributes_table'). The outer select is then locating all > records (~30-40K) that have any of those ids. Is that really > something a JOIN could be used for? This may be a question for SQL theoretists, but I don't think I've ever run across a query with a 'where in' clause that couldn't be written as a join. I think linguistically 'where in' may even be a special case of 'join'. Yet another question for the theoretists: Would it be possible to optimize a 'where in' query by rewriting it as a join? -- Mike Nolan From pgsql-performance-owner@postgresql.org Sun Jul 13 23:31:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 4A5FDCB625 for ; Mon, 14 Jul 2003 02:30:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 36965-02 for ; Mon, 14 Jul 2003 02:31:09 +0000 (GMT) Received: from hub.org (hub.org [64.117.225.220]) by svr1.postgresql.org (Postfix) with ESMTP id 7F3E6CBA91 for ; Sun, 13 Jul 2003 23:30:49 -0300 (ADT) Received: from morpheus.pgsql.com (u231n71.eastlink.ca [24.222.231.71]) by hub.org (Postfix) with ESMTP id B9EFE5B97BB; Sun, 13 Jul 2003 23:31:08 -0300 (ADT) Message-Id: <5.2.1.1.0.20030713232822.00a076c0@mail.hub.org> X-Sender: chris@pgsql.com@mail.pgsql.com X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Sun, 13 Jul 2003 23:31:01 -0300 To: Steve Wampler , pgsql-performance@postgresql.org From: Chris Bowlby Subject: Re: Improving a simple query? In-Reply-To: <20030713204610.GA18123@weaver.tuc.noao.edu> References: <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> <1058119515.23012.114.camel@weaver.tuc.noao.edu> <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/209 X-Sequence-Number: 2502 At 01:46 PM 7/13/03 -0700, Steve Wampler wrote: The following left join should work if I've done my select right, you might want to play with a left versus right to see which will give you a better result, but this query should help: SELECT * FROM attributes_table att LEFT JOIN attributes at ON (at.name = 'obsid' AND at.value = 'oid00066') WHERE att.id = at.id; >On Sun, Jul 13, 2003 at 08:09:17PM +0100, Richard Huxton wrote: > > > I'm not an SQL or PostgreSQL expert. > > > > > > I'm getting abysmal performance on a nested query and > > > need some help on finding ways to improve the performance: > > [snip] > > > select * from attributes_table where id in (select id from > > > attributes where (name='obsid') and (value='oid00066')); > > > > This is the classic IN problem (much improved in 7.4 dev I believe). The > > recommended approach is to rewrite the query as an EXISTS form if > > possible. See the mailing list archives for plenty of examples. > > > > Could you not rewrite this as a simple join though? > >Hmmm, I don't see how. Then again, I'm pretty much the village >idiot w.r.t. SQL... > >The inner select is locating a set of (2049) ids (actually from >the same table, since 'attributes' is just a view into >'attributes_table'). The outer select is then locating all >records (~30-40K) that have any of those ids. Is that really >something a JOIN could be used for? > >-Steve >-- >Steve Wampler -- swampler@noao.edu >Quantum materiae materietur marmota monax si marmota > monax materiam possit materiari? > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Sun Jul 13 23:33:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 8A8E5CBB6D for ; Mon, 14 Jul 2003 02:33:15 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 47295-01 for ; Mon, 14 Jul 2003 02:33:34 +0000 (GMT) Received: from hub.org (hub.org [64.117.225.220]) by svr1.postgresql.org (Postfix) with ESMTP id 3B809CBB69 for ; Sun, 13 Jul 2003 23:33:14 -0300 (ADT) Received: from morpheus.hub.org (u231n71.eastlink.ca [24.222.231.71]) by hub.org (Postfix) with ESMTP id 7372D5B99FE; Sun, 13 Jul 2003 23:33:33 -0300 (ADT) Message-Id: <5.2.1.1.0.20030713233301.009fd160@mail.hub.org> X-Sender: excalibur@hub.org@mail.hub.org X-Mailer: QUALCOMM Windows Eudora Version 5.2.1 Date: Sun, 13 Jul 2003 23:33:26 -0300 To: Chris Bowlby , Steve Wampler , pgsql-performance@postgresql.org From: Chris Bowlby Subject: Re: Improving a simple query? In-Reply-To: <5.2.1.1.0.20030713232822.00a076c0@mail.hub.org> References: <20030713204610.GA18123@weaver.tuc.noao.edu> <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> <1058119515.23012.114.camel@weaver.tuc.noao.edu> <49293.192.168.1.32.1058123357.squirrel@mainbox.archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/210 X-Sequence-Number: 2503 At 11:31 PM 7/13/03 -0300, Chris Bowlby wrote: Woops, this might not go through via the address I used :> (not subscribed with that address).. >At 01:46 PM 7/13/03 -0700, Steve Wampler wrote: > > The following left join should work if I've done my select right, you > might want to play with a left versus right to see which will give you a > better result, but this query should help: > > SELECT * FROM attributes_table att LEFT JOIN attributes at ON (at.name = > 'obsid' AND at.value = 'oid00066') WHERE att.id = at.id; > >>On Sun, Jul 13, 2003 at 08:09:17PM +0100, Richard Huxton wrote: >> > > I'm not an SQL or PostgreSQL expert. >> > > >> > > I'm getting abysmal performance on a nested query and >> > > need some help on finding ways to improve the performance: >> > [snip] >> > > select * from attributes_table where id in (select id from >> > > attributes where (name='obsid') and (value='oid00066')); >> > >> > This is the classic IN problem (much improved in 7.4 dev I believe). The >> > recommended approach is to rewrite the query as an EXISTS form if >> > possible. See the mailing list archives for plenty of examples. >> > >> > Could you not rewrite this as a simple join though? >> >>Hmmm, I don't see how. Then again, I'm pretty much the village >>idiot w.r.t. SQL... >> >>The inner select is locating a set of (2049) ids (actually from >>the same table, since 'attributes' is just a view into >>'attributes_table'). The outer select is then locating all >>records (~30-40K) that have any of those ids. Is that really >>something a JOIN could be used for? >> >>-Steve >>-- >>Steve Wampler -- swampler@noao.edu >>Quantum materiae materietur marmota monax si marmota >> monax materiam possit materiari? >> >>---------------------------(end of broadcast)--------------------------- >>TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Mon Jul 14 00:19:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 96609CBB81 for ; Mon, 14 Jul 2003 03:19:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 35228-07 for ; Mon, 14 Jul 2003 03:20:19 +0000 (GMT) Received: from camellia.sanmina.com.hk (unknown [211.96.107.86]) by svr1.postgresql.org (Postfix) with ESMTP id 5B6E5CBB80 for ; Mon, 14 Jul 2003 00:19:52 -0300 (ADT) Received: from ChrisWu ([172.25.15.102]) by camellia.sanmina.com.hk (8.11.0/8.11.2) with SMTP id h6E3KMj19289 for ; Mon, 14 Jul 2003 11:20:26 +0800 Reply-To: From: "Chris_Wu" To: Subject: How to configure the postgresql.conf files Date: Mon, 14 Jul 2003 11:26:37 +0800 Message-ID: <000001c349b7$bc8b6280$660f19ac@ChrisWu> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.4 tagged_above=0.0 required=5.0 tests=RCVD_IN_RFCI X-Spam-Level: * X-Archive-Number: 200307/211 X-Sequence-Number: 2504 Hello all! I'm a new to Postgresql , I have never used it before. I am having an issue with configure the postgresql.conf file. The machine itself is a CPU= 2.66GHz P4 w/ Memory= 2G Maybe you can tell me how to configure these parameters. shared_buffers= max_fsm_relations= max_fsm_pages= max_locks_per_transaction= wal_buffers= sort_mem= vacuum_mem= wal_files= wal_sync_method= wal_debug = commit_delay = commit_siblings = checkpoint_segments = checkpoint_timeout = fsync = true enable_seqscan = enable_indexscan = enable_tidscan = enable_sort = enable_nestloop = enable_mergejoin = enable_hashjoin = ksqo = effective_cache_size = random_page_cost = cpu_tuple_cost = cpu_index_tuple_cost = cpu_operator_cost = Would you mind to send me a copy of examples .(postgresql.conf) Thanks Sincerely, Chris.Wu From pgsql-performance-owner@postgresql.org Mon Jul 14 00:34:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id DE3C2CBB8B for ; Mon, 14 Jul 2003 03:34:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 63933-08 for ; Mon, 14 Jul 2003 03:34:50 +0000 (GMT) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by svr1.postgresql.org (Postfix) with ESMTP id 24955CBB87 for ; Mon, 14 Jul 2003 00:34:23 -0300 (ADT) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id NAA22638; Mon, 14 Jul 2003 13:53:16 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3F1224E5.4040802@oasis.net.au> Date: Mon, 14 Jul 2003 13:35:01 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris.Wu@Sanmina-SCI.Com Cc: pgsql-performance@postgresql.org Subject: Re: How to configure the postgresql.conf files References: <000001c349b7$bc8b6280$660f19ac@ChrisWu> In-Reply-To: <000001c349b7$bc8b6280$660f19ac@ChrisWu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/212 X-Sequence-Number: 2505 Hi Chris, I suggest you read this tech. document: http://www.varlena.com/GeneralBits/ I think you'll it's the best place to start. Cheers Rudi. Chris_Wu wrote: >Hello all! > I'm a new to Postgresql , I have never used it before. > I am having an issue with configure the postgresql.conf file. > The machine itself is a > CPU= 2.66GHz P4 w/ > Memory= 2G > Maybe you can tell me how to configure these parameters. > shared_buffers= > max_fsm_relations= > max_fsm_pages= > max_locks_per_transaction= > wal_buffers= > sort_mem= > vacuum_mem= > wal_files= > wal_sync_method= > wal_debug = > commit_delay = > commit_siblings = > checkpoint_segments = > checkpoint_timeout = > fsync = true > enable_seqscan = > enable_indexscan = > enable_tidscan = > enable_sort = > enable_nestloop = > enable_mergejoin = > enable_hashjoin = > ksqo = > effective_cache_size = > random_page_cost = > cpu_tuple_cost = > cpu_index_tuple_cost = > cpu_operator_cost = > > Would you mind to send me a copy of examples .(postgresql.conf) > Thanks > Sincerely, > >Chris.Wu > > > >---------------------------(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 Mon Jul 14 00:45:36 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 674DACBB87 for ; Mon, 14 Jul 2003 03:45:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 16205-06 for ; Mon, 14 Jul 2003 03:45:57 +0000 (GMT) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0B678CBB88 for ; Mon, 14 Jul 2003 00:45:31 -0300 (ADT) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id OAA23456; Mon, 14 Jul 2003 14:05:31 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3F1227AB.2060400@oasis.net.au> Date: Mon, 14 Jul 2003 13:46:51 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris.Wu@Sanmina-SCI.Com Cc: pgsql-performance@postgresql.org Subject: Re: How to configure the postgresql.conf files References: <000001c349b7$bc8b6280$660f19ac@ChrisWu> In-Reply-To: <000001c349b7$bc8b6280$660f19ac@ChrisWu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/213 X-Sequence-Number: 2506 Chris, Oops - it's changed ! Here's the link's you need: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html Cheers Rudi. Chris_Wu wrote: >Hello all! > I'm a new to Postgresql , I have never used it before. > I am having an issue with configure the postgresql.conf file. > The machine itself is a > CPU= 2.66GHz P4 w/ > Memory= 2G > Maybe you can tell me how to configure these parameters. > shared_buffers= > max_fsm_relations= > max_fsm_pages= > max_locks_per_transaction= > wal_buffers= > sort_mem= > vacuum_mem= > wal_files= > wal_sync_method= > wal_debug = > commit_delay = > commit_siblings = > checkpoint_segments = > checkpoint_timeout = > fsync = true > enable_seqscan = > enable_indexscan = > enable_tidscan = > enable_sort = > enable_nestloop = > enable_mergejoin = > enable_hashjoin = > ksqo = > effective_cache_size = > random_page_cost = > cpu_tuple_cost = > cpu_index_tuple_cost = > cpu_operator_cost = > > Would you mind to send me a copy of examples .(postgresql.conf) > Thanks > Sincerely, > >Chris.Wu > > > >---------------------------(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 Mon Jul 14 03:36:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 9F2CECBB45 for ; Mon, 14 Jul 2003 06:36:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 55299-04 for ; Mon, 14 Jul 2003 06:36:40 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 922A9CBB38 for ; Mon, 14 Jul 2003 03:36:14 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6E6dhNV013042 for ; Mon, 14 Jul 2003 12:09:43 +0530 Received: from daithan.intranet.pspl.co.in (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6E6dgKr013029 for ; Mon, 14 Jul 2003 12:09:42 +0530 From: Shridhar Daithankar To: Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Date: Mon, 14 Jul 2003 12:07:32 +0530 User-Agent: KMail/1.5.2 References: <20030713110341.A16172@bacon> <20030713143721.A18011@bacon> <009901c34978$19697270$0600a8c0@home01> In-Reply-To: <009901c34978$19697270$0600a8c0@home01> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307141207.32187.shridhar_daithankar@nospam.persistent.co.in> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/214 X-Sequence-Number: 2507 On Monday 14 July 2003 01:21, Balazs Wellisch wrote: > Unfortunatelly, compiling from source is not really an option for us. We > use RPMs only to ease the installation and upgrade process. We have over a > hundred servers to maintaine and having to compile and recompile software > everytime a new release comes out would be waaaaay too much work. Use checkinstall. Simple. Google for more information. Making your own rpms isn't that big deal..:-) From pgsql-performance-owner@postgresql.org Mon Jul 14 08:18:40 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 055A0CBBDF for ; Mon, 14 Jul 2003 11:18:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 68159-04 for ; Mon, 14 Jul 2003 11:19:00 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 9EDA1CB592 for ; Mon, 14 Jul 2003 08:18:37 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19c1ME-0004KF-00 for ; Mon, 14 Jul 2003 07:19:02 -0400 Received: by dba2 (Postfix, from userid 1019) id 06821CEC9; Mon, 14 Jul 2003 07:19:25 -0400 (EDT) Date: Mon, 14 Jul 2003 07:19:25 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Dual Xeon + HW RAID question Message-ID: <20030714111925.GD24166@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/215 X-Sequence-Number: 2508 On Sat, Jul 12, 2003 at 11:25:14AM -0700, Nikolaus Dilger wrote: > Alexandre, > > Since you want the fastest speed I would do the 2 data > disks in RAID 0 (striping) not RAID 1 (mirroring). Note that RAID 0 buys you nothing at all in redundancy. So if the point is to be able to recover from a disk failure, you need 1 (or some combination of 0 and 1, or 5). A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Jul 14 08:43:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id DF78CCBC91 for ; Mon, 14 Jul 2003 11:43:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 74266-05 for ; Mon, 14 Jul 2003 11:43:59 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 8123ECBC7B for ; Mon, 14 Jul 2003 08:43:36 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19c1kP-0004cm-00 for ; Mon, 14 Jul 2003 07:44:01 -0400 Received: by dba2 (Postfix, from userid 1019) id E22FBCEC9; Mon, 14 Jul 2003 07:44:24 -0400 (EDT) Date: Mon, 14 Jul 2003 07:44:24 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Message-ID: <20030714114424.GH24166@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <001001c34908$fc98bc60$0600a8c0@home01> <1058100557.19798.20.camel@haggis> <008801c34976$e58a4ac0$0600a8c0@home01> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <008801c34976$e58a4ac0$0600a8c0@home01> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/216 X-Sequence-Number: 2509 On Sun, Jul 13, 2003 at 12:42:29PM -0700, Balazs Wellisch wrote: > > On Sun, 2003-07-13 at 01:35, Balazs Wellisch wrote: > > Note that I've read a couple of times from Tom Lane (one of the > > core team) that FKs are a serous performance drag, so I'd drop > > them after the s/w has been in production long enough to work > > out the kinks. > > > > That's interesting, I didn't know that. Any idea how much of a performance > drag we're talking about? Foreign keys in any database are going to cost you something, because they require a lookup in other tables. The big hit from FKs in PostgreSQL used to be that they caused deadlocks in older versions. I _think_ this is fixed by default in 7.3.3; if not, there's a patch floating around for the problem. The repair is definitely in 7.4. That said, if speed is your goal, FKs are always going to be a cost for you. OTOH, people who try to handle this sort of thing in the application come to regret it. You probably want to look somewhere else to solve your performance difficulties from FKs. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Jul 14 08:44:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 28039CBF0B for ; Mon, 14 Jul 2003 11:44:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 87586-01 for ; Mon, 14 Jul 2003 11:45:05 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id E78B7CBF7C for ; Mon, 14 Jul 2003 08:44:42 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19c1lU-0004d2-00 for ; Mon, 14 Jul 2003 07:45:08 -0400 Received: by dba2 (Postfix, from userid 1019) id 8901ACEC9; Mon, 14 Jul 2003 07:45:31 -0400 (EDT) Date: Mon, 14 Jul 2003 07:45:31 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Message-ID: <20030714114531.GI24166@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030713110341.A16172@bacon> <20030713143721.A18011@bacon> <009901c34978$19697270$0600a8c0@home01> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <009901c34978$19697270$0600a8c0@home01> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/217 X-Sequence-Number: 2510 On Sun, Jul 13, 2003 at 12:51:02PM -0700, Balazs Wellisch wrote: > > Unfortunatelly, compiling from source is not really an option for us. We use > RPMs only to ease the installation and upgrade process. We have over a > hundred servers to maintaine and having to compile and recompile software > everytime a new release comes out would be waaaaay too much work. It's not clear that the RPMs will help you in ease of upgrade. More precisely, be real sure you dump your database before upgrading major versions (e.g. 7.3.x to 7.4.x). A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Jul 14 10:38:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id D9DAFCBFBA; Mon, 14 Jul 2003 13:37:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 00191-04; Mon, 14 Jul 2003 13:38:15 +0000 (GMT) Received: from noao.edu (noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 34128CBF6B; Mon, 14 Jul 2003 10:37:53 -0300 (ADT) Received: from weaver.tuc.noao.edu ([140.252.38.8] verified) by noao.edu (CommuniGate Pro SMTP 4.1b9) with ESMTP-TLS id 8070998; Mon, 14 Jul 2003 06:38:19 -0700 Received: from weaver.tuc.noao.edu (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.5) with ESMTP id h6EDcIIY024693; Mon, 14 Jul 2003 06:38:18 -0700 Received: (from swampler@localhost) by weaver.tuc.noao.edu (8.12.8/8.12.8/Submit) id h6EDcIb3024691; Mon, 14 Jul 2003 06:38:18 -0700 X-Authentication-Warning: weaver.tuc.noao.edu: swampler set sender to swampler@noao.edu using -f Subject: Re: [SQL] Replacing a simple nested query? From: Steve Wampler Reply-To: swampler@noao.edu To: pgsql-sql@postgresql.org, Postgres-performance In-Reply-To: <20030713215042.GA18643@weaver.tuc.noao.edu> References: <20030713215042.GA18643@weaver.tuc.noao.edu> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: National Solar Observatory Message-Id: <1058189898.23013.135.camel@weaver.tuc.noao.edu> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 14 Jul 2003 06:38:18 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/218 X-Sequence-Number: 2511 On Sun, 2003-07-13 at 14:50, Steve Wampler wrote: > I've got a simple nested query: > > select * from attributes where id in (select id from > attributes where (name='obsid') and (value='oid00066')); > > that performs abysmally. I've heard this described as the > 'classic WHERE IN' problem. > > Is there a better way to obtain the same results? The inner > select identifies a set of ids (2049 of them, to be exact) > that are then used to locate records that have the same id > (about 30-40K of those, including the aforementioned 2049). For the record, Joe Conway and Hannu Krosing both provided the same solution: select at.* from attributes_table at, attributes a where at.id = a.id and a.name='obsid' and a.value='oid00066'; which is several orders of infinity faster than than my naive approach above: ------------------------------------------------------------- lab.devel.configdb=# explain analyze select * from attributes_table where id in (select id from attributes where (name='obsid') and (value='oid00066')) order by id; NOTICE: QUERY PLAN: Index Scan using id_index on attributes_table (cost=0.00..8773703316.10 rows=241201 width=59) (actual time=136297.91..3418016.04 rows=32799 loops=1) SubPlan -> Materialize (cost=18187.48..18187.48 rows=15 width=25) (actual time=0.01..1.68 rows=1979 loops=482402) -> Index Scan using name_index on attributes_table (cost=0.00..18187.48 rows=15 width=25) (actual time=0.27..251.95 rows=2049 loops=1) Total runtime: 3418035.38 msec -------------------------------------------------------------- lab.devel.configdb=# explain analyze select at.* from attributes_table at, attributes a where at.id = a.id and a.name='obsid' and a.value='oid00066'; NOTICE: QUERY PLAN: Nested Loop (cost=0.00..18739.44 rows=217 width=84) (actual time=0.76..1220.65 rows=32799 loops=1) -> Index Scan using name_index on attributes_table (cost=0.00..18187.48 rows=15 width=25) (actual time=0.47..507.31 rows=2049 loops=1) -> Index Scan using id_index on attributes_table at (cost=0.00..35.80 rows=12 width=59) (actual time=0.11..0.31 rows=16 loops=2049) Total runtime: 1235.42 msec ------------------------------------------------------------------- My thanks to both Joe and Hannu! Steve -- Steve Wampler -- swampler@noao.edu Quantum materiae materietur marmota monax si marmota monax materiam possit materiari? From pgsql-performance-owner@postgresql.org Mon Jul 14 11:07:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id A6E1DCBFF7 for ; Mon, 14 Jul 2003 14:07:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 80422-10 for ; Mon, 14 Jul 2003 14:08:10 +0000 (GMT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by svr1.postgresql.org (Postfix) with ESMTP id 598C4CBFF6 for ; Mon, 14 Jul 2003 11:07:48 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19c3yT-00018C-0U; Mon, 14 Jul 2003 15:06:41 +0100 Date: Mon, 14 Jul 2003 15:06:39 +0100 From: Paul Thomas To: Balazs Wellisch Cc: "pgsql-performance @ postgresql . org" Subject: Re: Pgsql - Red Hat Linux - VS MySQL VS MSSQL Message-ID: <20030714150639.A20427@bacon> References: <20030714122050.C19680@bacon> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <20030714122050.C19680@bacon>; from paul@tmsl.demon.co.uk on Mon, Jul 14, 2003 at 12:20:50 +0100 X-Mailer: Balsa 1.2.3 Lines: 30 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/219 X-Sequence-Number: 2512 On 13/07/2003 20:51 Balazs Wellisch wrote: > [snip] > > > So, does anyone here have any experience using RH AS and DB 2.1? > > > > Are RH still selling DB 2.1? I can't find it listed on their web site. > > -- > > Yes, it's available for free download. The documentation is here: > http://www.redhat.com/docs/manuals/database/. I'd welcome your oppinions > on > this product. > > Thank you for your comments. It looks like they just wrote a number of GUI versions of the command line utilities. From what I can tell, its still a standard postgresql database behind the scenes. -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+ From pgsql-performance-owner@postgresql.org Mon Jul 14 11:27:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 992EECC003 for ; Mon, 14 Jul 2003 14:27:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 17452-08 for ; Mon, 14 Jul 2003 14:27:22 +0000 (GMT) Received: from domain.com (unknown [208.254.142.2]) by svr1.postgresql.org (Postfix) with SMTP id 400B9CBC33 for ; Mon, 14 Jul 2003 11:27:00 -0300 (ADT) Received: (qmail 80882 invoked from network); 14 Jul 2003 14:27:24 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost.uu.net with SMTP; 14 Jul 2003 14:27:24 -0000 Received: from showie ([172.18.7.196] [172.18.7.196]) by mail1.centwire.com (VaMailArmor-2.0.1.7) id 80820-07545FFD; Mon, 14 Jul 2003 09:27:21 -0500 Message-ID: <012701c34a14$9b60ce80$c40712ac@showie> From: "Stephen Howie" To: Subject: Tunning FreeeBSD and PostgreSQL Date: Mon, 14 Jul 2003 09:31:26 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0124_01C349EA.B2860B90" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-AntiVirus: checked by Vexira MailArmor (version: 2.0.1.7; VAE: 6.20.0.1; VDF: 6.20.0.37; host: mail2.centwire.com) X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.2 tagged_above=0.0 required=5.0 tests=HTML_40_50, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200307/220 X-Sequence-Number: 2513 This is a multi-part message in MIME format. ------=_NextPart_000_0124_01C349EA.B2860B90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Tried to search the list but the search wasn't working. I have a server running strictly PostgreSQL that I'm trying to tune for per= formance. The specs are 2 X 2.4 Athlon MP processors 2G Reg DDR FreeBSD 4.8 SMP kernel complied PostgreSQL 7.3.3 4 X 80G IDE Raid 5 My problem is that I have not totally put my head around the concepts of th= e shmmax, shmmaxpgs, etc.... As it pertains to my current setup and the sh= ared mem values in postgresql.conf. I'm looking for a good rule of thumb w= hen approaching this. Any help or direction would be greatly appreciated. Thanks Stephen Howie ------=_NextPart_000_0124_01C349EA.B2860B90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Tried to search the list but the search wa= sn't=20 working.
 
I have a server running strictly PostgreSQ= L that=20 I'm trying to tune for performance. The specs are
 
2 X 2.4 Athlon MP processors
2G Reg DDR
FreeBSD 4.8 SMP kernel complied
PostgreSQL 7.3.3
4 X 80G IDE Raid 5
 
My problem is that I have not totally put = my head=20 around the concepts of the shmmax, shmmaxpgs, etc....  As it pertains = to my=20 current setup and the shared mem values in postgresql.conf.  I'm looki= ng=20 for a good rule of thumb when approaching this.  Any help or direction= =20 would be greatly appreciated.
 
Thanks
Stephen Howie
------=_NextPart_000_0124_01C349EA.B2860B90-- From pgsql-performance-owner@postgresql.org Mon Jul 14 13:02:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 3913CCC086 for ; Mon, 14 Jul 2003 16:02:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 41417-03 for ; Mon, 14 Jul 2003 16:02:24 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 4B765CC00B for ; Mon, 14 Jul 2003 13:01:57 -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.36 #2) id 19c5mL-0005Ax-0Z; Mon, 14 Jul 2003 17:02:17 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id B043A17D4C; Mon, 14 Jul 2003 17:02:15 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 1841116BFB; Mon, 14 Jul 2003 17:02:15 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: "Stephen Howie" , Subject: Re: Tunning FreeeBSD and PostgreSQL Date: Mon, 14 Jul 2003 17:02:25 +0100 User-Agent: KMail/1.4.3 References: <012701c34a14$9b60ce80$c40712ac@showie> In-Reply-To: <012701c34a14$9b60ce80$c40712ac@showie> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307141702.25620.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/221 X-Sequence-Number: 2514 On Monday 14 Jul 2003 3:31 pm, Stephen Howie wrote: [snip] > My problem is that I have not totally put my head around the concepts of > the shmmax, shmmaxpgs, etc.... As it pertains to my current setup and the > shared mem values in postgresql.conf. I'm looking for a good rule of thu= mb > when approaching this. Any help or direction would be greatly appreciate= d. There are two articles recently posted here: http://www.varlena.com/GeneralBits/ They should provide a good start. --=20 Richard Huxton From pgsql-performance-owner@postgresql.org Mon Jul 14 13:52:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 21A61CC084 for ; Mon, 14 Jul 2003 16:52:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 36254-01 for ; Mon, 14 Jul 2003 16:53:21 +0000 (GMT) Received: from martin.sysdetect.com (martin.sysdetect.com [65.209.102.1]) by svr1.postgresql.org (Postfix) with ESMTP id 90497CC0C1 for ; Mon, 14 Jul 2003 13:52:54 -0300 (ADT) Received: (from mail@localhost) by martin.sysdetect.com (8.11.4/8.11.3) id h6EGrLx12268 for ; Mon, 14 Jul 2003 16:53:21 GMT Received: from winwood.sysdetect.com(172.16.1.1) via SMTP by mail.sysdetect.com, id smtpds14224; Mon Jul 14 16:53:19 2003 Received: from sysd.com (thriller.sysdetect.com [172.16.1.33]) by winwood.sysdetect.com (8.11.6/8.11.6) with ESMTP id h6EGrI921571 for ; Mon, 14 Jul 2003 12:53:19 -0400 Message-ID: <3F12DFFE.3090207@sysd.com> Date: Mon, 14 Jul 2003 12:53:18 -0400 From: Rich Cullingford User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Java Out-of-memory errors on attempts to read tables with millions of rows Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/222 X-Sequence-Number: 2515 Greetings, We have several tables (in a PG 7.3.3 database on RH Linux 7.3) with 2M+ rows (each row 300-400 bytes in length) that we SELECT into a JDBC ResultSet for display to the user. We expected that the driver would not actually transmit data from the database until the application began issuing getXXX() calls. (IIRC, this is the way the Oracle driver works, and we had created a buffering mechanism to use it.) Instead, the driver appears to be attempting to create the whole rowset in Java memory before returning, and the application runs out of memory. (Java has been configured to use up to 1.5G on the machine this occurs on.) Now the SELECT is preceded by a COUNT of the rows that the same query would return, so perhaps that's what's causing the problem. But the question is, is this the way a ResultSet is supposed to work? Are there any configuration options available that modify this behavior? Are there commercial implementations of PG JDBC that don't have this problem? (Shame on me, but I have to ask. :) Any help will be greatly appreciated! Rich Cullingford rculling@sysd.com From pgsql-performance-owner@postgresql.org Mon Jul 14 14:07:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E5090CC0E3 for ; Mon, 14 Jul 2003 17:07:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 36254-02 for ; Mon, 14 Jul 2003 17:08:10 +0000 (GMT) Received: from mailout02.sul.t-online.com (mailout02.sul.t-online.com [194.25.134.17]) by svr1.postgresql.org (Postfix) with ESMTP id CCEF3CC084 for ; Mon, 14 Jul 2003 14:07:43 -0300 (ADT) Received: from fwd07.aul.t-online.de by mailout02.sul.t-online.com with smtp id 19c6nz-0004ND-02; Mon, 14 Jul 2003 19:08:03 +0200 Received: from router.azrael.de (GQbfJaZvZeXPwbvwcE0n1uDOYAa86QpAF2xohICbE2QaGI4o9eFVUn@[80.141.249.129]) by fmrl07.sul.t-online.com with esmtp id 19c6nr-0g0MCW0; Mon, 14 Jul 2003 19:07:55 +0200 Received: from azrael.azrael.de (azrael.azrael.de [192.168.202.18]) by router.azrael.de (8.11.4/8.11.4) with ESMTP id h6EH7Qt20710; Mon, 14 Jul 2003 19:07:42 +0200 Date: Mon, 14 Jul 2003 19:07:44 +0200 From: Evil Azrael X-Mailer: The Bat! (v1.62r) Personal X-Priority: 3 (Normal) Message-ID: <71226588.20030714190744@evilazrael.de> To: Rich Cullingford Cc: pgsql-performance@postgresql.org Subject: Re: Java Out-of-memory errors on attempts to read tables with millions of rows In-Reply-To: <3F12DFFE.3090207@sysd.com> References: <3F12DFFE.3090207@sysd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Seen: false X-ID: GQbfJaZvZeXPwbvwcE0n1uDOYAa86QpAF2xohICbE2QaGI4o9eFVUn@t-dialin.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=IN_REP_TO, RCVD_IN_NJABL, REFERENCES, X_NJABL_DIALUP X-Spam-Level: X-Archive-Number: 200307/223 X-Sequence-Number: 2516 I think you want to use a Cursor for browsing the data. Christoph Nelles Am Montag, 14. Juli 2003 um 18:53 schrieben Sie: RC> Greetings, RC> We have several tables (in a PG 7.3.3 database on RH Linux 7.3) with 2M+ RC> rows (each row 300-400 bytes in length) that we SELECT into a JDBC RC> ResultSet for display to the user. We expected that the driver would not RC> actually transmit data from the database until the application began RC> issuing getXXX() calls. (IIRC, this is the way the Oracle driver works, RC> and we had created a buffering mechanism to use it.) Instead, the driver RC> appears to be attempting to create the whole rowset in Java memory RC> before returning, and the application runs out of memory. (Java has been RC> configured to use up to 1.5G on the machine this occurs on.) RC> Now the SELECT is preceded by a COUNT of the rows that the same query RC> would return, so perhaps that's what's causing the problem. But the RC> question is, is this the way a ResultSet is supposed to work? Are there RC> any configuration options available that modify this behavior? Are there RC> commercial implementations of PG JDBC that don't have this problem? RC> (Shame on me, but I have to ask. :) RC> Any help will be greatly appreciated! RC> Rich Cullingford RC> rculling@sysd.com RC> ---------------------------(end of broadcast)--------------------------- RC> TIP 9: the planner will ignore your desire to choose an index scan if your RC> joining column's datatypes do not match -- Mit freundlichen Gr�ssen Evil Azrael mailto:evilazrael@evilazrael.de From pgsql-performance-owner@postgresql.org Mon Jul 14 14:19:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A13D6CC0C5 for ; Mon, 14 Jul 2003 17:19:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 21663-09 for ; Mon, 14 Jul 2003 17:19:28 +0000 (GMT) Received: from domain.com (unknown [208.254.142.2]) by svr1.postgresql.org (Postfix) with SMTP id 5C3E9CC0AB for ; Mon, 14 Jul 2003 14:19:02 -0300 (ADT) Received: (qmail 50430 invoked from network); 14 Jul 2003 17:19:27 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost.uu.net with SMTP; 14 Jul 2003 17:19:27 -0000 Received: from showie ([172.18.7.196] [172.18.7.196]) by mail1.centwire.com (VaMailArmor-2.0.1.7) id 50396-291F60B5; Mon, 14 Jul 2003 12:19:25 -0500 Message-ID: <017201c34a2c$a4fd5c70$c40712ac@showie> From: "Stephen Howie" To: "Richard Huxton" , References: <012701c34a14$9b60ce80$c40712ac@showie> <200307141702.25620.dev@archonet.com> Subject: Re: Tunning FreeeBSD and PostgreSQL Date: Mon, 14 Jul 2003 12:23:30 -0500 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-AntiVirus: checked by Vexira MailArmor (version: 2.0.1.7; VAE: 6.20.0.1; VDF: 6.20.0.37; host: mail2.centwire.com) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/224 X-Sequence-Number: 2517 Richard- That was very helpfull Thanks! I still would like some guidance on tunning FreeBSD (shmmax and shmmaxpgs). Do I need to even touch these settings? Stephen Howie >There are two articles recently posted here: > >http://www.varlena.com/GeneralBits/ > >They should provide a good start. >-- > Richard Huxton > >---------------------------(end of broadcast)--------------------------- >TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Mon Jul 14 14:52:49 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B18F8CC0AB for ; Mon, 14 Jul 2003 17:52:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 84687-10 for ; Mon, 14 Jul 2003 17:53:12 +0000 (GMT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id A192FCC0FA for ; Mon, 14 Jul 2003 14:52:46 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6EHrC0P012779 for ; Mon, 14 Jul 2003 12:53:13 -0500 Reply-To: From: "Nick Fankhauser" To: "Pgsql-Performance@Postgresql. Org" Subject: Sanity check requested Date: Mon, 14 Jul 2003 12:51:44 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/225 X-Sequence-Number: 2518 Hi folks- For some time, we've been running Postgres with the default configuration & getting adequate performance, but the time has come to tune a bit, so I've been lurking on this list & gathering notes. Now I'm about ready to make a change & would appreciate it if a few more experienced folks could comment on whether I appear to be heading in the right direction- Here's what I'm planning: Increase SHMMAX and SHMALL in my kernel to 134217728 (128MB) Increase shared_buffers to 8192 (64MB) Increase sort_mem to 16384 (16MB) Increase effective_cache_size to 65536 (1/2 GB) Here's the environment: The Hardware is a dual-processor Athlon 1.2 Ghz box with 1 GB of RAM and the DB on SCSI RAID drives. The server runs only PostgreSQL The database size is about 8GB, with the largest table 2.5 GB, and the two most commonly queried tables at 1 GB each. The two most commonly queried tables are usually queried based on a non-unique indexed varchar field typically 20 chars long. The query is a "like" on people's names with trailing %, so this often gets pushed to seq scan or returns several thousand records. (As when someone searches on 'Jones%'. Records from the largest table are always accessed via unique index in groups of 20 or less. The OS is Debian Linux kernel 2.4.x (recompiled custom kernel for dual processor support) The PostgreSQL version is 7.3.2 We typically have about 30 interactive users on the DB, but they're using a shared connection pool of 16. Our main problem appears to be when one of the users fires up a large query and creates a log-jam with resources. My reasoning is that I'll increase shared_buffers based on anecdotal recommendations I've seen on this list to 64MB. I'll boost the OS SHMMAX to twice that value to allow adequate room for other shared memory needs, thus reserving 128MB. Of the remaining memory, 256MB goes to 16 connections * 16MB sort space, if I leave about 128 MB for headroom, then 1/2 GB should be left available for the effective cache size. Any thoughts? Is this a sane plan? Are there other parameters I should consider changing first? Thanks! -Nick --------------------------------------------------------------------- Nick Fankhauser nickf@doxpop.com Phone 1.765.965.7363 Fax 1.765.962.9788 doxpop - Court records at your fingertips - http://www.doxpop.com/ --------------------------------------------------------------------- Nick Fankhauser nickf@doxpop.com Phone 1.765.965.7363 Fax 1.765.962.9788 doxpop - Court records at your fingertips - http://www.doxpop.com/ From pgsql-performance-owner@postgresql.org Mon Jul 14 15:00:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id A2AE8CC0ED for ; Mon, 14 Jul 2003 17:59:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 95218-01 for ; Mon, 14 Jul 2003 17:59:25 +0000 (GMT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id 5FF6DCC0AB for ; Mon, 14 Jul 2003 14:58:59 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6EHxN0P012822; Mon, 14 Jul 2003 12:59:23 -0500 Reply-To: From: "Nick Fankhauser" To: "Stephen Howie" , Subject: Re: Tunning FreeeBSD and PostgreSQL Date: Mon, 14 Jul 2003 12:57:55 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <017201c34a2c$a4fd5c70$c40712ac@showie> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/226 X-Sequence-Number: 2519 > I still would like some guidance on tunning FreeBSD (shmmax and > shmmaxpgs). > Do I need to even touch these settings? Stephen- I have no idea what these are set to by default in FreeBSD, but here's the page that covers changing it in the postgresql docs: http://www.postgresql.org/docs/7.3/static/kernel-resources.html -Nick From pgsql-performance-owner@postgresql.org Mon Jul 14 15:04:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 207EBCC10D for ; Mon, 14 Jul 2003 18:04:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 39006-03 for ; Mon, 14 Jul 2003 18:04:36 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 00F9ECC10C for ; Mon, 14 Jul 2003 15:04:10 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6EI4ZQ3010252; Mon, 14 Jul 2003 14:04:35 -0400 (EDT) To: Greg Stark Cc: pgsql-performance@postgresql.org Subject: Re: optimizer picks smaller table to drive nested loops? In-reply-to: <873chi2o53.fsf@stark.dyndns.tv> References: <873chi2o53.fsf@stark.dyndns.tv> Comments: In-reply-to Greg Stark message dated "07 Jul 2003 14:22:00 -0400" Date: Mon, 14 Jul 2003 14:04:35 -0400 Message-ID: <10251.1058205875@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/227 X-Sequence-Number: 2520 Greg Stark writes: > slo=> explain analyze select * from region, (select 1 union all select 2) as x; > QUERY PLAN > ------------------------------------------------------------------------------------------------------------------------ > Nested Loop (cost=0.00..11162.00 rows=5534 width=108) (actual time=0.13..541.19 rows=5534 loops=1) > -> Subquery Scan x (cost=0.00..2.00 rows=2 width=0) (actual time=0.03..0.08 rows=2 loops=1) > -> Append (cost=0.00..2.00 rows=2 width=0) (actual time=0.02..0.05 rows=2 loops=1) > -> Subquery Scan "*SELECT* 1" (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=1) > -> Result (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.01 rows=1 loops=1) > -> Subquery Scan "*SELECT* 2" (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=1) > -> Result (cost=0.00..1.00 rows=1 width=0) (actual time=0.01..0.01 rows=1 loops=1) > -> Seq Scan on region (cost=0.00..2813.00 rows=2767 width=104) (actual time=0.03..123.44 rows=2767 loops=2) > Total runtime: 566.24 msec > (9 rows) > Wouldn't it be faster to drive the nested loop the other way around? You seem to be using a rather wacko value of cpu_tuple_cost; those Result nodes ought to be costed at 0.01 not 1.00. With the default cost settings I get an other-way-around plan for a similar test. (I used tenk1 from the regression database as the outer table.) However, it looks to me like the subquery-scan-outside plan probably is the faster one, on both my machine and yours. I get regression=# explain analyze select * from tenk1, (select 1 union all select 2) as x; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..858.00 rows=20000 width=248) (actual time=0.42..3648.61 rows=20000 loops=1) -> Seq Scan on tenk1 (cost=0.00..458.00 rows=10000 width=244) (actual time=0.23..199.97 rows=10000 loops=1) -> Subquery Scan x (cost=0.00..0.02 rows=2 width=0) (actual time=0.07..0.24 rows=2 loops=10000) -> Append (cost=0.00..0.02 rows=2 width=0) (actual time=0.05..0.17 rows=2 loops=10000) -> Subquery Scan "*SELECT* 1" (cost=0.00..0.01 rows=1 width=0) (actual time=0.03..0.06 rows=1 loops=10000) -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=10000) -> Subquery Scan "*SELECT* 2" (cost=0.00..0.01 rows=1 width=0) (actual time=0.03..0.06 rows=1 loops=10000) -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=10000) Total runtime: 3807.39 msec (9 rows) regression=# set cpu_tuple_cost = 1; SET regression=# explain analyze select * from tenk1, (select 1 union all select 2) as x; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=0.00..40718.00 rows=20000 width=248) (actual time=0.39..1214.42 rows=20000 loops=1) -> Subquery Scan x (cost=0.00..2.00 rows=2 width=0) (actual time=0.10..0.31 rows=2 loops=1) -> Append (cost=0.00..2.00 rows=2 width=0) (actual time=0.06..0.22 rows=2 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..1.00 rows=1 width=0) (actual time=0.05..0.08 rows=1 loops=1) -> Result (cost=0.00..1.00 rows=1 width=0) (actual time=0.03..0.04 rows=1 loops=1) -> Subquery Scan "*SELECT* 2" (cost=0.00..1.00 rows=1 width=0) (actual time=0.05..0.08 rows=1 loops=1) -> Result (cost=0.00..1.00 rows=1 width=0) (actual time=0.02..0.03 rows=1 loops=1) -> Seq Scan on tenk1 (cost=0.00..10358.00 rows=10000 width=244) (actual time=0.17..188.37 rows=10000 loops=2) Total runtime: 1371.17 msec (9 rows) The flipover point between the two plans is cpu_tuple_cost = 0.04 in my tests. It looks to me like we've neglected to charge any cost associated with Subquery Scan or Append nodes. Certainly Subquery Scan ought to charge at least a cpu_tuple_cost per row. Perhaps Append ought to as well --- although since it doesn't do selection or projection, I'm not quite sure where the time is going in that case. (Hmmm... time to get out the profiler...) regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 14 15:40:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id D1748CBFB2 for ; Mon, 14 Jul 2003 18:40:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 36719-09 for ; Mon, 14 Jul 2003 18:41:12 +0000 (GMT) Received: from sabre.velocet.net (sabre.velocet.net [216.138.209.205]) by svr1.postgresql.org (Postfix) with ESMTP id 43CBECBFB0 for ; Mon, 14 Jul 2003 15:40:46 -0300 (ADT) Received: from stark.dyndns.tv (H162.C233.tor.velocet.net [216.138.233.162]) by sabre.velocet.net (Postfix) with ESMTP id 29D16139067; Mon, 14 Jul 2003 14:40:39 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) id 19c8FZ-00085s-00; Mon, 14 Jul 2003 14:40:37 -0400 To: Tom Lane Cc: Greg Stark , pgsql-performance@postgresql.org Subject: Re: optimizer picks smaller table to drive nested loops? References: <873chi2o53.fsf@stark.dyndns.tv> <10251.1058205875@sss.pgh.pa.us> In-Reply-To: <10251.1058205875@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 14 Jul 2003 14:40:37 -0400 Message-ID: <87znjhkl3u.fsf@stark.dyndns.tv> Lines: 32 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-Archive-Number: 200307/228 X-Sequence-Number: 2521 Tom Lane writes: > You seem to be using a rather wacko value of cpu_tuple_cost; those > Result nodes ought to be costed at 0.01 not 1.00. With the default oops yes, thanks. that was left over from other experimentation. > However, it looks to me like the subquery-scan-outside plan probably > is the faster one, on both my machine and yours. I get > > regression=# explain analyze select * from tenk1, (select 1 union all select 2) as x; > QUERY PLAN > ---------------------------------------------------------------------------------------------------------------------------- > Nested Loop (cost=0.00..858.00 rows=20000 width=248) (actual time=0.42..3648.61 rows=20000 loops=1) > -> Seq Scan on tenk1 (cost=0.00..458.00 rows=10000 width=244) (actual time=0.23..199.97 rows=10000 loops=1) > -> Subquery Scan x (cost=0.00..0.02 rows=2 width=0) (actual time=0.07..0.24 rows=2 loops=10000) ... > Total runtime: 3807.39 msec > Nested Loop (cost=0.00..40718.00 rows=20000 width=248) (actual time=0.39..1214.42 rows=20000 loops=1) > -> Subquery Scan x (cost=0.00..2.00 rows=2 width=0) (actual time=0.10..0.31 rows=2 loops=1) > -> Seq Scan on tenk1 (cost=0.00..10358.00 rows=10000 width=244) (actual time=0.17..188.37 rows=10000 loops=2) > Total runtime: 1371.17 msec Woah, that's pretty whacky. It seems like it ought to be way faster to do a single sequential scan and return two records for each tuple read rather than do an entire unnecessary sequential scan, even if most or even all of the second one is cached. -- greg From pgsql-performance-owner@postgresql.org Mon Jul 14 17:58:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id B5B16CC161 for ; Mon, 14 Jul 2003 20:58:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 90476-02 for ; Mon, 14 Jul 2003 20:58:25 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id BFA89CC050 for ; Mon, 14 Jul 2003 17:57:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6EKwPQ3014111; Mon, 14 Jul 2003 16:58:25 -0400 (EDT) To: Greg Stark Cc: pgsql-performance@postgresql.org Subject: Re: optimizer picks smaller table to drive nested loops? In-reply-to: <87znjhkl3u.fsf@stark.dyndns.tv> References: <873chi2o53.fsf@stark.dyndns.tv> <10251.1058205875@sss.pgh.pa.us> <87znjhkl3u.fsf@stark.dyndns.tv> Comments: In-reply-to Greg Stark message dated "14 Jul 2003 14:40:37 -0400" Date: Mon, 14 Jul 2003 16:58:25 -0400 Message-ID: <14110.1058216305@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/229 X-Sequence-Number: 2522 Greg Stark writes: > Tom Lane writes: >> However, it looks to me like the subquery-scan-outside plan probably >> is the faster one, on both my machine and yours. I get > Woah, that's pretty whacky. It seems like it ought to be way faster to do a > single sequential scan and return two records for each tuple read rather than > do an entire unnecessary sequential scan, even if most or even all of the > second one is cached. The problem is the CPU expense of executing "SELECT 1 UNION SELECT 2" over and over. Doing that for every row of the outer table adds up. We were both testing on relatively small tables --- I suspect the results would be different if the outer table were too large to fit in disk cache. I am not sure why the planner did not choose to stick a Materialize node atop the Subquery Scan, though. It looks to me like it should have considered that option --- possibly the undercharging for Subquery Scan is the reason it wasn't chosen. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 14 19:44:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B36BACC1B9 for ; Mon, 14 Jul 2003 22:41:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 78857-01 for ; Mon, 14 Jul 2003 22:41:24 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 77F1ACC1CD for ; Mon, 14 Jul 2003 19:40:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6EMfPQ3016145; Mon, 14 Jul 2003 18:41:25 -0400 (EDT) To: Greg Stark Cc: pgsql-performance@postgresql.org Subject: Re: optimizer picks smaller table to drive nested loops? In-reply-to: <14110.1058216305@sss.pgh.pa.us> References: <873chi2o53.fsf@stark.dyndns.tv> <10251.1058205875@sss.pgh.pa.us> <87znjhkl3u.fsf@stark.dyndns.tv> <14110.1058216305@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 14 Jul 2003 16:58:25 -0400" Date: Mon, 14 Jul 2003 18:41:25 -0400 Message-ID: <16143.1058222485@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/230 X-Sequence-Number: 2523 I said: > I am not sure why the planner did not choose to stick a Materialize > node atop the Subquery Scan, though. It looks to me like it should > have considered that option --- possibly the undercharging for Subquery > Scan is the reason it wasn't chosen. Indeed, after fixing the unrealistic estimate for SubqueryScan, I get this: regression=# explain analyze select * from tenk1, (select 1 union all select 2) as x; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------ Nested Loop (cost=0.06..858.06 rows=20000 width=248) (actual time=0.25..1448.19 rows=20000 loops=1) -> Seq Scan on tenk1 (cost=0.00..458.00 rows=10000 width=244) (actual time=0.06..162.48 rows=10000 loops=1) -> Materialize (cost=0.06..0.08 rows=2 width=4) (actual time=0.01..0.03 rows=2 loops=10000) -> Subquery Scan x (cost=0.00..0.06 rows=2 width=4) (actual time=0.10..0.27 rows=2 loops=1) -> Append (cost=0.00..0.04 rows=2 width=0) (actual time=0.07..0.20 rows=2 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..0.02 rows=1 width=0) (actual time=0.05..0.08 rows=1 loops=1) -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.03..0.03 rows=1 loops=1) -> Subquery Scan "*SELECT* 2" (cost=0.00..0.02 rows=1 width=0) (actual time=0.03..0.06 rows=1 loops=1) -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.01..0.02 rows=1 loops=1) Total runtime: 1627.26 msec (10 rows) which is probably the best way to do it, all things considered. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jul 15 02:41:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 14A09CBB3A for ; Tue, 15 Jul 2003 05:41:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 54277-03 for ; Tue, 15 Jul 2003 05:41:20 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 9BD32CB56E for ; Tue, 15 Jul 2003 02:40:51 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6F5iblG032743 for ; Tue, 15 Jul 2003 11:14:37 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6F5iaKr032697 for ; Tue, 15 Jul 2003 11:14:36 +0530 From: "Shridhar Daithankar" To: "Pgsql-Performance@Postgresql. Org" Date: Tue, 15 Jul 2003 11:12:10 +0530 MIME-Version: 1.0 Subject: Re: Sanity check requested Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F13E18A.21241.4B86CB0@localhost> In-reply-to: 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/231 X-Sequence-Number: 2524 On 14 Jul 2003 at 12:51, Nick Fankhauser wrote: > Any thoughts? Is this a sane plan? Are there other parameters I should > consider changing first? Well, everything seems to be in order and nothing much to suggest I guess. But still.. 1. 30 users does not seem to be much of a oevrhead. If possible try doing away with connection pooling. Buta test benchmark run is highly recommended. 2. While increasing sort memory, try 4/8/16 in that order. That way you will get a better picture of load behaviour. Though whatever you put appears reasonable, having more data always help. 3. I don't know how this affects on SCSI drives, but what file system you are using? Can you try diferent ones? Like reiserfs/ext3 and XFS? See what fits your bill. 4. OK, this is too much but linux kernel 2.6 is in test and has vastly improved IO scheduler. May be you should look at it if you are up to experimentation. HTH Bye Shridhar -- You're dead, Jim. -- McCoy, "The Tholian Web", stardate unknown From pgsql-general-owner@postgresql.org Tue Jul 15 12:59:08 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id DC620CC3CB for ; Tue, 15 Jul 2003 15:59:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 38969-01 for ; Tue, 15 Jul 2003 15:59:32 +0000 (GMT) Received: from buckaroo.freeuk.net (buckaroo.freeuk.net [212.126.144.5]) by svr1.postgresql.org (Postfix) with ESMTP id A9DD6CC3C7 for ; Tue, 15 Jul 2003 12:59:02 -0300 (ADT) Received: from claranet by buckaroo.freeuk.net with local (Exim 4.12) id 19cSDD-000Euo-00 for pgsql-general@postgresql.org; Tue, 15 Jul 2003 16:59:31 +0100 To: pgsql-general@postgresql.org Reply-To: psql-mail@freeuk.com Subject: Query Optimisation Cc: X-Remote_Addr: 212.126.153.41 Precedence: normal Message-Id: From: psql-mail@freeuk.com Date: Tue, 15 Jul 2003 16:59:31 +0100 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/560 X-Sequence-Number: 45413 Hi, I have the following query - is there anything i've missed or is it just slow?! I have an index on meta.date that i thought might have been used but isn't (I know it would only be a small performance increase in the current plan). meta.date is between 1999 and 2003. I think generally the most efficient order to do things would be to extract all the messages within the date range and then search over just them. I am currently in the process of setting up full text indexing as described in the techdocs.postgresql.org i guess this is the main way of speeding up searches through ~40GB of bulk text? Thanks!... m EXPLAIN ANALYZE SELECT meta.msg_id, date, from_line, subject FROM message ,meta WHERE meta.date >= '15-06-2003 00:00:00' AND meta.date <= '26-06-2003 00:00:00' AND message.header||message.body ILIKE '%chicken%' AND meta.sys_id = message.sys_id ORDER BY meta.date DESC; QUERY PLAN ------------------------------------------------------------------------ ------------------------------------------------------------------------ ------ Sort (cost=50.16..50.17 rows=1 width=120) (actual time=412333.65.. 412333.76 rows=166 loops=1) Sort Key: meta.date -> Nested Loop (cost=0.00..50.15 rows=1 width=120) (actual time= 400713.41..412332.53 rows=166 loops=1) -> Seq Scan on message (cost=0.00..25.00 rows=5 width=8) (actual time= 58.18..410588.49 rows=20839 loops=1) Filter: ((header || body) ~~* '%chicken%'::text) -> Index Scan using meta_pkey on meta (cost=0.00..5.02 rows=1 width= 112) (actual time=0.07..0.07 rows=0 loops=20839) Index Cond: (meta.sys_id = "outer".sys_id) Filter: ((date >= '2003-06-15 00:00:00'::timestamp without time zone) AND (date <= '2003-06-26 00:00:00'::timestamp without time zone)) Total runtime: 412334.08 msec (9 rows) From pgsql-performance-owner@postgresql.org Tue Jul 15 13:09:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id C4514CC3F8 for ; Tue, 15 Jul 2003 16:09:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 36737-09 for ; Tue, 15 Jul 2003 16:09:20 +0000 (GMT) Received: from megazone.bigpanda.com (unknown [66.180.233.26]) by svr1.postgresql.org (Postfix) with ESMTP id 496BFCC3C6 for ; Tue, 15 Jul 2003 13:08:50 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 463E6D628; Tue, 15 Jul 2003 09:09:19 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 3BE725C0C; Tue, 15 Jul 2003 09:09:19 -0700 (PDT) Date: Tue, 15 Jul 2003 09:09:19 -0700 (PDT) From: Stephan Szabo To: Cc: Subject: Re: [GENERAL] Query Optimisation In-Reply-To: Message-ID: <20030715090339.K95323-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/232 X-Sequence-Number: 2525 [replying to -performance] On Tue, 15 Jul 2003 psql-mail@freeuk.com wrote: > Hi, I have the following query - is there anything i've missed or is it > just slow?! The fact that it underestimates the number of matching message rows by a factor of about 4000 doesn't help. I'm not sure you're going to be able to get a better estimate using message.header||message.body ILIKE '%chicken%' (possibly using two ilikes with or might help but probably not enough). Have you vacuum analyzed the two tables recently? The seq scan cost on message seems fairly low given what I would expect to be the size of that table. > I am currently in the process of setting up full text indexing as > described in the techdocs.postgresql.org i guess this is the main way > of speeding up searches through ~40GB of bulk text? That's still probably the best way. > EXPLAIN ANALYZE SELECT meta.msg_id, date, from_line, subject FROM > message ,meta WHERE meta.date >= '15-06-2003 00:00:00' AND meta.date <= > '26-06-2003 00:00:00' AND message.header||message.body ILIKE '%chicken%' > AND meta.sys_id = message.sys_id ORDER BY meta.date DESC; > QUERY PLAN > > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > ------ > Sort (cost=50.16..50.17 rows=1 width=120) (actual time=412333.65.. > 412333.76 rows=166 loops=1) > Sort Key: meta.date > -> Nested Loop (cost=0.00..50.15 rows=1 width=120) (actual time= > 400713.41..412332.53 rows=166 loops=1) > -> Seq Scan on message (cost=0.00..25.00 rows=5 width=8) (actual time= > 58.18..410588.49 rows=20839 loops=1) > Filter: ((header || body) ~~* '%chicken%'::text) > -> Index Scan using meta_pkey on meta (cost=0.00..5.02 rows=1 width= > 112) (actual time=0.07..0.07 rows=0 loops=20839) > Index Cond: (meta.sys_id = "outer".sys_id) > Filter: ((date >= '2003-06-15 00:00:00'::timestamp without time zone) > AND (date <= '2003-06-26 00:00:00'::timestamp without time zone)) > Total runtime: 412334.08 msec > (9 rows) > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-general-owner@postgresql.org Tue Jul 15 13:21:05 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 989ABCC423 for ; Tue, 15 Jul 2003 16:21:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 98466-10 for ; Tue, 15 Jul 2003 16:21:27 +0000 (GMT) Received: from mx1.eskimo.com (mx1.eskimo.com [204.122.16.48]) by svr1.postgresql.org (Postfix) with ESMTP id D777DCC41E for ; Tue, 15 Jul 2003 13:20:57 -0300 (ADT) Received: from eskimo.com (johnnyb@eskimo.com [204.122.16.13]) by mx1.eskimo.com (8.9.3/8.8.8) with ESMTP id JAA02833; Tue, 15 Jul 2003 09:21:26 -0700 Received: from localhost (johnnyb@localhost) by eskimo.com (8.9.1a/8.9.1) with ESMTP id JAA19082; Tue, 15 Jul 2003 09:21:26 -0700 (PDT) X-Authentication-Warning: eskimo.com: johnnyb owned process doing -bs Date: Tue, 15 Jul 2003 09:21:26 -0700 (PDT) From: Jonathan Bartlett To: psql-mail@freeuk.com Cc: pgsql-general@postgresql.org Subject: Re: Query Optimisation In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/563 X-Sequence-Number: 45416 Try explicitly casting the values into the appropriate date type. Jon On Tue, 15 Jul 2003 psql-mail@freeuk.com wrote: > Hi, I have the following query - is there anything i've missed or is it > just slow?! > > I have an index on meta.date that i thought might have been used but > isn't (I know it would only be a small performance increase in the > current plan). > > meta.date is between 1999 and 2003. I think generally the most > efficient order to do things would be to extract all the messages > within the date range and then search over just them. > > I am currently in the process of setting up full text indexing as > described in the techdocs.postgresql.org i guess this is the main way > of speeding up searches through ~40GB of bulk text? > > Thanks!... > m > > EXPLAIN ANALYZE SELECT meta.msg_id, date, from_line, subject FROM > message ,meta WHERE meta.date >= '15-06-2003 00:00:00' AND meta.date <= > '26-06-2003 00:00:00' AND message.header||message.body ILIKE '%chicken%' > AND meta.sys_id = message.sys_id ORDER BY meta.date DESC; > QUERY PLAN > > ------------------------------------------------------------------------ > ------------------------------------------------------------------------ > ------ > Sort (cost=50.16..50.17 rows=1 width=120) (actual time=412333.65.. > 412333.76 rows=166 loops=1) > Sort Key: meta.date > -> Nested Loop (cost=0.00..50.15 rows=1 width=120) (actual time= > 400713.41..412332.53 rows=166 loops=1) > -> Seq Scan on message (cost=0.00..25.00 rows=5 width=8) (actual time= > 58.18..410588.49 rows=20839 loops=1) > Filter: ((header || body) ~~* '%chicken%'::text) > -> Index Scan using meta_pkey on meta (cost=0.00..5.02 rows=1 width= > 112) (actual time=0.07..0.07 rows=0 loops=20839) > Index Cond: (meta.sys_id = "outer".sys_id) > Filter: ((date >= '2003-06-15 00:00:00'::timestamp without time zone) > AND (date <= '2003-06-26 00:00:00'::timestamp without time zone)) > Total runtime: 412334.08 msec > (9 rows) > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-general-owner@postgresql.org Tue Jul 15 13:36:00 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 10DD8CC412 for ; Tue, 15 Jul 2003 16:36:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 56196-02 for ; Tue, 15 Jul 2003 16:36:17 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 020ECCC40C for ; Tue, 15 Jul 2003 13:35:47 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6FGZuQ3023273; Tue, 15 Jul 2003 12:35:56 -0400 (EDT) To: psql-mail@freeuk.com Cc: pgsql-general@postgresql.org Subject: Re: Query Optimisation In-reply-to: References: Comments: In-reply-to psql-mail@freeuk.com message dated "Tue, 15 Jul 2003 16:59:31 +0100" Date: Tue, 15 Jul 2003 12:35:56 -0400 Message-ID: <23272.1058286956@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/566 X-Sequence-Number: 45419 psql-mail@freeuk.com writes: > -> Seq Scan on message (cost=0.00..25.00 rows=5 width=8) (actual time= > 58.18..410588.49 rows=20839 loops=1) > Filter: ((header || body) ~~* '%chicken%'::text) Estimated cost of a seqscan only 25? Have you ever vacuumed or analyzed that table? The planner evidently thinks it is tiny ... regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jul 15 13:44:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2EA5ECC42E for ; Tue, 15 Jul 2003 16:44:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 58140-04 for ; Tue, 15 Jul 2003 16:44:48 +0000 (GMT) Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id 099A6CC427 for ; Tue, 15 Jul 2003 13:44:19 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kciLink.com (Postfix) with ESMTP id 625503E81 for ; Tue, 15 Jul 2003 12:44:48 -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 SMTP id 67661-09 for ; Tue, 15 Jul 2003 12:44:38 -0400 (EDT) Received: by lorax.kciLink.com (Postfix, from userid 8) id 08F843E5A; Tue, 15 Jul 2003 12:44:38 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Tunning FreeeBSD and PostgreSQL Date: Tue, 15 Jul 2003 12:44:37 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 52 Message-ID: References: <012701c34a14$9b60ce80$c40712ac@showie> <200307141702.25620.dev@archonet.com> <017201c34a2c$a4fd5c70$c40712ac@showie> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kciLink.com 1058287478 41564 216.194.193.105 (15 Jul 2003 16:44:38 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Tue, 15 Jul 2003 16:44:38 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, berkeley-unix) Cancel-Lock: sha1:dX6CBbs9tUMIV931MgOXMfyQLZM= X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/233 X-Sequence-Number: 2526 >>>>> "SH" == Stephen Howie writes: SH> Richard- SH> That was very helpfull Thanks! SH> I still would like some guidance on tunning FreeBSD (shmmax and shmmaxpgs). SH> Do I need to even touch these settings? Here's what I use on FreeBSD 4.7/4.8. The kernel settings don't hurt anything being too large for the SHM values, since they are limits, not anything pre-allocated (from my understanding). These settings allow for up to 100,000 shared buffers (I currently only use 30,000 buffers) options SYSVMSG #SYSV-style message queues # only purpose of this box is to run PostgreSQL, which needs tons of shared # memory, and some semaphores. # Postgres allocates buffers in 8k chunks, so tell Postgres to use about # 150 fewer than SHMMAXPGS/2 buffers to leave some room for other Postgres # shared memory needs. options SYSVSHM #SYSV-style shared memory # Maximum number of shared memory pages system wide. options SHMALL=262144 # Maximum size, in pages (4k), of a single System V shared memory region. options SHMMAXPGS=262144 # only need semaphores for PostgreSQL options SYSVSEM #SYSV-style semaphores # Maximum number of System V semaphores that can be used on the system at # one time. options SEMMNI=32 # Total number of semaphores system wide options SEMMNS=512 # Maximum number of entries in a semaphore map. options SEMMAP=256 Also, in /etc/sysctl.conf I put # need lots of files for database kern.maxfiles=8000 # tuning for PostgreSQL kern.ipc.shm_use_phys=1 -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Tue Jul 15 14:10:14 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 63B24CC40B for ; Tue, 15 Jul 2003 17:10:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 39051-09 for ; Tue, 15 Jul 2003 17:10:38 +0000 (GMT) Received: from domain.com (unknown [208.254.142.2]) by svr1.postgresql.org (Postfix) with SMTP id 72FA4CB571 for ; Tue, 15 Jul 2003 14:10:08 -0300 (ADT) Received: (qmail 72648 invoked from network); 15 Jul 2003 17:10:36 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost.uu.net with SMTP; 15 Jul 2003 17:10:36 -0000 Received: from showie ([172.18.7.196] [172.18.7.196]) by mail1.centwire.com (VaMailArmor-2.0.1.7) id 72609-790785AE; Tue, 15 Jul 2003 12:10:33 -0500 Message-ID: <005e01c34af4$9578e670$c40712ac@showie> From: "Stephen Howie" To: "Vivek Khera" , References: <012701c34a14$9b60ce80$c40712ac@showie> <200307141702.25620.dev@archonet.com> <017201c34a2c$a4fd5c70$c40712ac@showie> Subject: Re: Tunning FreeeBSD and PostgreSQL Date: Tue, 15 Jul 2003 12:14:43 -0500 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-AntiVirus: checked by Vexira MailArmor (version: 2.0.1.7; VAE: 6.20.0.1; VDF: 6.20.0.38; host: mail2.centwire.com) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/234 X-Sequence-Number: 2527 Vivek, Thanks, for your reply. May I ask what you system setup is like (i.e. memory and such)? ----- Original Message ----- From: "Vivek Khera" Newsgroups: ml.postgres.performance To: Sent: Tuesday, July 15, 2003 11:44 AM Subject: Re: [PERFORM] Tunning FreeeBSD and PostgreSQL > >>>>> "SH" == Stephen Howie writes: > > SH> Richard- > SH> That was very helpfull Thanks! > SH> I still would like some guidance on tunning FreeBSD (shmmax and shmmaxpgs). > SH> Do I need to even touch these settings? > > Here's what I use on FreeBSD 4.7/4.8. The kernel settings don't hurt > anything being too large for the SHM values, since they are limits, > not anything pre-allocated (from my understanding). These settings > allow for up to 100,000 shared buffers (I currently only use 30,000 > buffers) > > > options SYSVMSG #SYSV-style message queues > > # only purpose of this box is to run PostgreSQL, which needs tons of shared > # memory, and some semaphores. > # Postgres allocates buffers in 8k chunks, so tell Postgres to use about > # 150 fewer than SHMMAXPGS/2 buffers to leave some room for other Postgres > # shared memory needs. > options SYSVSHM #SYSV-style shared memory > # Maximum number of shared memory pages system wide. > options SHMALL=262144 > # Maximum size, in pages (4k), of a single System V shared memory region. > options SHMMAXPGS=262144 > > # only need semaphores for PostgreSQL > options SYSVSEM #SYSV-style semaphores > # Maximum number of System V semaphores that can be used on the system at > # one time. > options SEMMNI=32 > # Total number of semaphores system wide > options SEMMNS=512 > # Maximum number of entries in a semaphore map. > options SEMMAP=256 > > > Also, in /etc/sysctl.conf I put > > # need lots of files for database > kern.maxfiles=8000 > # tuning for PostgreSQL > kern.ipc.shm_use_phys=1 > > > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Vivek Khera, Ph.D. Khera Communications, Inc. > Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 > AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > From pgsql-performance-owner@postgresql.org Tue Jul 15 15:04:37 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id B69B6CC44F for ; Tue, 15 Jul 2003 18:04:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 60196-06 for ; Tue, 15 Jul 2003 18:04:54 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) by svr1.postgresql.org (Postfix) with ESMTP id 5ECBDCB571 for ; Tue, 15 Jul 2003 15:04:25 -0300 (ADT) Received: by yertle.kcilink.com (Postfix, from userid 100) id D36C62178A; Tue, 15 Jul 2003 14:04:54 -0400 (EDT) From: Vivek Khera MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16148.16966.755692.737018@yertle.int.kciLink.com> Date: Tue, 15 Jul 2003 14:04:54 -0400 To: "Stephen Howie" Cc: Subject: Re: Tunning FreeeBSD and PostgreSQL In-Reply-To: <005e01c34af4$9578e670$c40712ac@showie> References: <012701c34a14$9b60ce80$c40712ac@showie> <200307141702.25620.dev@archonet.com> <017201c34a2c$a4fd5c70$c40712ac@showie> <005e01c34af4$9578e670$c40712ac@showie> X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/235 X-Sequence-Number: 2528 >>>>> "SH" == Stephen Howie writes: SH> Vivek, SH> Thanks, for your reply. May I ask what you system setup is like (i.e. SH> memory and such)? Current box is dual P3 1GHz and 2GB RAM. RAID0+1 on 4 disks. I'm about to order a bigger box, since I'm saturating the disk bandwidth as far as I can measure it. I'm thinking along the lines of 8 disks on RAID0+1 and 4GB RAM. The CPUs twiddle their thumbs a lot, so no point in really beefing that up. From pgsql-performance-owner@postgresql.org Tue Jul 15 19:10:21 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 811DBCC493 for ; Tue, 15 Jul 2003 22:10:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 97950-10 for ; Tue, 15 Jul 2003 22:10:44 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 4B555CC4F7 for ; Tue, 15 Jul 2003 19:10:16 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3219065; Tue, 15 Jul 2003 15:11:00 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Joseph Shraibman Subject: Re: max_fsm_pages question Date: Tue, 15 Jul 2003 15:09:54 -0700 User-Agent: KMail/1.4.3 References: <3F0B8459.80409@xtenit.com> In-Reply-To: <3F0B8459.80409@xtenit.com> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307151509.54994.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/236 X-Sequence-Number: 2529 Joe, > Regarding the document at > http://www.varlena.com/GeneralBits/Tidbits/perf.html#maxfsmp > > In section 3.3 you say max_fsm_pages should be set to the number of pages > that vacuum reports. Does that apply to table pages only or both table and > index pages? Because I'm finding my index pages are a lot more than the > table pages. Depends on which version you're using. As of 7.4 (now in beta), both ... this is a major feature for 7.4, which should reduce the need to REINDEX significantly. For 7.3.3 and earlier, table pages only. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-odbc-owner@postgresql.org Wed Jul 16 11:21:47 2003 X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 87787CC625 for ; Wed, 16 Jul 2003 14:17:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 86100-04 for ; Wed, 16 Jul 2003 14:18:06 +0000 (GMT) Received: from albert.auore.net (197.Red-80-24-20.pooles.rima-tde.net [80.24.20.197]) by svr1.postgresql.org (Postfix) with SMTP id 4B11CCC64D for ; Wed, 16 Jul 2003 11:14:49 -0300 (ADT) Received: (qmail 2880 invoked by uid 1000); 16 Jul 2003 14:15:14 -0000 From: Albert Cervera Areny Reply-To: albertca@jazzfree.com To: pgsql-odbc@postgresql.org, pgsql-performance@postgresql.org Subject: Bad performance using ODBC Date: Wed, 16 Jul 2003 16:15:01 +0200 User-Agent: KMail/1.5.9 MIME-Version: 1.0 Content-Disposition: inline Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Message-Id: <200307161615.13989.albertca@jazzfree.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/36 X-Sequence-Number: 3097 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I have a performance problem using postgresql when the connection is made= =20 via ODBC with a windows machine using the latests ODBC drivers (Windows) an= d=20 PostgreSQL 7.3.3 (Linux). The queries made by my Visual Basic program are very very simple. It quer= ies=20 with as Select if a record exists and if so, it reduces stock with an Updat= e.=20 For the benchmarks I do it 200 times. If I test it against an Access database (located in a SMB server) it spen= ds=20 3 seconds but against PostgreSQL 17 !! Exactly the same test programmed in = C=20 (with pgsql libraries) and run within the same machine or another Linux=20 spends less than a second!! So the problem seems to be whether with the ODBC drivers or with Windows= =20 ODBC itself. Are there any parameters in the ODBC drivers that might help= =20 reducing that big overhead added or do you have any suggestions to speed it= =20 up? Thanks in advance! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/FV3pTK7ZP4pDOHcRAmVWAJ9KF/YyKmuBZcidV3FK2gESaX25NwCgjABx 6WhA0HgC7oxF7VFJeczIrgE=3D =3D3H+u -----END PGP SIGNATURE----- From pgsql-odbc-owner@postgresql.org Wed Jul 16 11:38:47 2003 X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 67289CC589; Wed, 16 Jul 2003 14:38:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 39968-02; Wed, 16 Jul 2003 14:38:14 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 28D4ECBAEF; Wed, 16 Jul 2003 11:37:51 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6GEcGQ3018119; Wed, 16 Jul 2003 10:38:17 -0400 (EDT) To: albertca@jazzfree.com Cc: pgsql-odbc@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [PERFORM] Bad performance using ODBC In-reply-to: <200307161615.13989.albertca@jazzfree.com> References: <200307161615.13989.albertca@jazzfree.com> Comments: In-reply-to Albert Cervera Areny message dated "Wed, 16 Jul 2003 16:15:01 +0200" Date: Wed, 16 Jul 2003 10:38:16 -0400 Message-ID: <18118.1058366296@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/37 X-Sequence-Number: 3098 Albert Cervera Areny writes: > I have a performance problem using postgresql when the connection is made > via ODBC with a windows machine using the latests ODBC drivers (Windows) and > PostgreSQL 7.3.3 (Linux). Do you have logging turned on in the ODBC driver? I recall hearing that that adds a heck of a lot of overhead... regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jul 16 23:57:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 0D138CC415 for ; Thu, 17 Jul 2003 02:57:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 60016-07 for ; Thu, 17 Jul 2003 02:57:35 +0000 (GMT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id EBC5CCADB5 for ; Wed, 16 Jul 2003 23:57:10 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6H3K3i17635 for ; Wed, 16 Jul 2003 20:20:03 -0700 Message-ID: <004b01c34c0f$256bfb80$0600a8c0@home01> From: "Balazs Wellisch" To: Subject: Hardware performance Date: Wed, 16 Jul 2003 19:57:22 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0048_01C34BD4.789C1230" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 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.6 tagged_above=0.0 required=5.0 tests=BAYES_30, HTML_20_30 X-Spam-Level: X-Archive-Number: 200307/239 X-Sequence-Number: 2532 This is a multi-part message in MIME format. ------=_NextPart_000_0048_01C34BD4.789C1230 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all, first of all I'd like to thank everyone who responded to my earlier post. I= have a much better understanding of postgres performance tuning now. In ca= se anyone's interested we've decided to go with RH9 and PostgreSQL 7.3 and = we'll do the OS and DB tuning ourselves. (should be a good learning experie= nce) We are now getting ready to purchase the hardware that will be used to run = the database server. We're spending quite a bit of money on it because this= will eventually, if things go well within two months, become a production = server. We're getting all RH certified hardware from Dell. (Dell 2650) We're now stuck on the question of what type of RAID configuration to use f= or this server. RAID 5 offers the best fault tolerance but doesn't perform = all that well. RAID 10 offers much better performance, but no hot swap. Or = should we not use RAID at all. I know that ideally the log (WAL) files shou= ld reside on a separate disk from the rest of the DB. Should we use 4 separ= ate drives instead? One for the OS, one for data, one for WAL, one for swap= ? Or RAID 10 for everything plus 1 drive for WAL? Or RAID 5 for everything? We have the budget for 5 drives. Does anyone have any real world experience= with what hard drive configuration works best for postgres? This is going = to be a dedicated DB server. There are going to be a large number of transa= ctions being written to the database. (Information is logged from a separat= e app through ODBC to postgres) And there will be some moderately complex q= ueries run concurrently to present this information in the form of various = reports on the web. (The app server is a separate machine and will connect = to the DB through JDBC to create the HTML reports) Any thoughts, ideas, comments would be appreciated. Thank you, Balazs Wellisch Neu Solutions balazs@neusolutions.com ------=_NextPart_000_0048_01C34BD4.789C1230 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi all,
 
first of all I'd like to thank everyone wh= o=20 responded to my earlier post. I have a much better understanding of postgre= s=20 performance tuning now. In case anyone's interested we've decided to go wit= h RH9=20 and PostgreSQL 7.3 and we'll do the OS and DB tuning ourselves. (should be = a=20 good learning experience)
 
We are now getting ready to purchase the h= ardware=20 that will be used to run the database server. We're spending quite a bit of= =20 money on it because this will eventually, if things go well within two= =20 months, become a production server. We're getting all RH certified hardware= from=20 Dell. (Dell 2650)
 
We're now stuck on the question of what ty= pe of=20 RAID configuration to use for this server. RAID 5 offers the best fault=20 tolerance but doesn't perform all that well. RAID 10 offers much better=20 performance, but no hot swap. Or should we not use RAID at all. I know that= =20 ideally the log (WAL) files should reside on a separate disk from the rest = of=20 the DB. Should we use 4 separate drives instead? One for the OS, one for da= ta,=20 one for WAL, one for swap? Or RAID 10 for everything plus 1 drive for WAL? = Or=20 RAID 5 for everything?
 
We have the budget for 5 drives. Does anyo= ne have=20 any real world experience with what hard drive configuration works best for= =20 postgres? This is going to be a dedicated DB server. There are going to be = a=20 large number of transactions being written to the database. (Information is= =20 logged from a separate app through ODBC to postgres) And there will be some= =20 moderately complex queries run concurrently to present this information&nbs= p;in=20 the form of various reports on the web. (The app server is a separate machi= ne=20 and will connect to the DB through JDBC to create the HTML reports)<= /DIV>
 
Any thoughts, ideas, comments would be=20 appreciated.
 
Thank you,
 
Balazs Wellisch
Neu Solutions
balazs@neusolutions.com<= /DIV>
 
------=_NextPart_000_0048_01C34BD4.789C1230-- From pgsql-performance-owner@postgresql.org Thu Jul 17 01:25:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 21BCBCC88F for ; Thu, 17 Jul 2003 04:25:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 35392-10 for ; Thu, 17 Jul 2003 04:25:59 +0000 (GMT) Received: from pos_pdc.posportal.com (unknown [12.158.169.100]) by svr1.postgresql.org (Postfix) with ESMTP id 7A0ADCC886 for ; Thu, 17 Jul 2003 01:25:30 -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: Hardware performance Date: Wed, 16 Jul 2003 21:25:43 -0700 Message-ID: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCA3@pos_pdc.posportal.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware performance Thread-Index: AcNMDzqIhh5+uYI3QA6yk4RNVGBPvgACDyAP From: "Roman Fail" To: "Balazs Wellisch" , X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/240 X-Sequence-Number: 2533 SSd2ZSBnb3QgYSBEZWxsIDI2NTAgc2V0IHVwIHdpdGggNSBkcml2ZXMgYW5k IGEgc2VwYXJhdGUgYXBwIHNlcnZlciBjb25uZWN0aW5nIHdpdGggSkRCQy4g IFNpbmNlIHlvdSd2ZSBvbmx5IGdvdCA1IGRyaXZlcywgbXkgY29uY2x1c2lv biByZWdhcmRpbmcgdGhlIGJlc3QgYmFsYW5jZSBvZiBwZXJmb3JtYW5jZSBh bmQgcmVkdW5kYW5jeSB3YXM6DQogDQoyIGRyaXZlcyBoYXZlIHRoZSBPUywg c3dhcCwgYW5kIFdBTCBpbiBSQUlELTENCjMgZHJpdmVzIGhhdmUgdGhlIGRh dGEgaW4gUkFJRC01DQogDQpJZiB5b3UgY2FuIGFmZm9yZCBpdCwgZ2V0IHRo ZSAyKzMgc3BsaXQgYmFja3BsYW5lIGFuZCBtYWtlIHRoZSAzIGRhdGEgZHJp dmVzIHRoZSBiaWdnZXN0LCBmYXN0ZXN0IHlvdSBjYW4gYWZmb3JkLiAgQ3Vy cmVudGx5IHRoYXQgbWVhbnMgdGhlIDE1ayA3M0dCIGRyaXZlcywgd2hpY2gg d291bGQgZ2l2ZSB5b3UgMTQ2R0IgZm9yIGRhdGEuICBNYWtlIHRoZSBPUyBk cml2ZXMgc21hbGxlciBhbmQgc2xvd2VyIGlmIHlvdSBuZWVkIHRvIHNhdmUg Y2FzaC4gIA0KIA0KSWYgb25seSBpdCBoYWQgc2l4IGRyaXZlIGJheXMuLi4u eW91IGNvdWxkIHVzZSA0IGRyaXZlcyBmb3IgdGhlIGRhdGEgYW5kIGRvIFJB SUQtMTAuICBJZiB5b3UndmUgZ290IHRoZSBhZGRpdGlvbmFsIHJhY2tzcGFj ZSBhdmFpbGFibGUsIHlvdSBjb3VsZCBnZXQgdGhlIDVVIERlbGwgMjYwMCBp bnN0ZWFkIGZvciB0aGUgc2FtZSBiYWxscGFyayBjb3N0LiAgSWYgeW91IG9y ZGVyIGl0IHdpdGggcmFjayByYWlscywgaXQgY29tZXMgYWxsIHNldCB1cCBm b3IgcmFjayBpbnN0YWxsYXRpb24uLi5hIHNwZWNpYWwgc2lkZXdheXMgZmFj ZXBsYXRlIGFuZCBldmVyeXRoaW5nLg0KIA0KQnkgdGhlIHdheSwgUkFJRC01 IGlzIG5vdCB0aGUgYmVzdCBmYXVsdCB0b2xlcmFuY2UsIFJBSUQtMSBvciBS QUlELTEwIGlzLiAgQW5kIHlvdSBjYW4gY2VydGFpbmx5IGhvdC1zd2FwIFJB SUQtMTAgYXJyYXlzLiAgSSd2ZSBhY3R1YWxseSBkb25lIGl0Li4uLnJlY2Vu dGx5ISAgSSBhbSBvZiB0aGUgbWluZCB0aGF0IHNpbmdsZSBkcml2ZXMgYXJl IG5vdCBhbiBvcHRpb24gZm9yIHByb2R1Y3Rpb24gc2VydmVycyAtIEkganVz dCBkb24ndCBuZWVkIHRoZSBwYWluIG9mIHRoZSBzZXJ2ZXIgZ29pbmcgZG93 biBhdCBhbGwuICBBbHRob3VnaCB0aGV5IERPIGdvIGRvd24gZGVzcGl0ZSBy ZWR1bmRhbmN5Li4uSSBqdXN0IGhhZCBhIFNDU0kgYmFja3BsYW5lIGdvIG91 dCBpbiBhIERlbGwgNjYwMCB0aGF0IGhhcyBldmVyeSBiaXQgb2YgcmVkdW5k YW5jeSB5b3UgY2FuIG9yZGVyLiAgV2hpbGUgdW5jb21tb24sIHRoZSBiYWNr cGxhbmUgaXMgb25lIG9uZSBvZiB0aGUgbWFueSBzaW5nbGUgcG9pbnRzIG9m IGZhaWx1cmUhICANCiANClJvbWFuIEZhaWwNClBPUyBQb3J0YWwsIEluYy4N CiANCiANCg0KCS0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tIA0KCUZyb206 IEJhbGF6cyBXZWxsaXNjaCBbbWFpbHRvOmJhbGF6c0BuZXVzb2x1dGlvbnMu Y29tXSANCglTZW50OiBXZWQgNy8xNi8yMDAzIDc6NTcgUE0gDQoJVG86IHBn c3FsLXBlcmZvcm1hbmNlQHBvc3RncmVzcWwub3JnIA0KCUNjOiANCglTdWJq ZWN0OiBbUEVSRk9STV0gSGFyZHdhcmUgcGVyZm9ybWFuY2UNCgkNCgkNCglI aSBhbGwsDQoJIA0KCWZpcnN0IG9mIGFsbCBJJ2QgbGlrZSB0byB0aGFuayBl dmVyeW9uZSB3aG8gcmVzcG9uZGVkIHRvIG15IGVhcmxpZXIgcG9zdC4gSSBo YXZlIGEgbXVjaCBiZXR0ZXIgdW5kZXJzdGFuZGluZyBvZiBwb3N0Z3JlcyBw ZXJmb3JtYW5jZSB0dW5pbmcgbm93LiBJbiBjYXNlIGFueW9uZSdzIGludGVy ZXN0ZWQgd2UndmUgZGVjaWRlZCB0byBnbyB3aXRoIFJIOSBhbmQgUG9zdGdy ZVNRTCA3LjMgYW5kIHdlJ2xsIGRvIHRoZSBPUyBhbmQgREIgdHVuaW5nIG91 cnNlbHZlcy4gKHNob3VsZCBiZSBhIGdvb2QgbGVhcm5pbmcgZXhwZXJpZW5j ZSkNCgkgDQoJV2UgYXJlIG5vdyBnZXR0aW5nIHJlYWR5IHRvIHB1cmNoYXNl IHRoZSBoYXJkd2FyZSB0aGF0IHdpbGwgYmUgdXNlZCB0byBydW4gdGhlIGRh dGFiYXNlIHNlcnZlci4gV2UncmUgc3BlbmRpbmcgcXVpdGUgYSBiaXQgb2Yg bW9uZXkgb24gaXQgYmVjYXVzZSB0aGlzIHdpbGwgZXZlbnR1YWxseSwgaWYg dGhpbmdzIGdvIHdlbGwgd2l0aGluIHR3byBtb250aHMsIGJlY29tZSBhIHBy b2R1Y3Rpb24gc2VydmVyLiBXZSdyZSBnZXR0aW5nIGFsbCBSSCBjZXJ0aWZp ZWQgaGFyZHdhcmUgZnJvbSBEZWxsLiAoRGVsbCAyNjUwKQ0KCSANCglXZSdy ZSBub3cgc3R1Y2sgb24gdGhlIHF1ZXN0aW9uIG9mIHdoYXQgdHlwZSBvZiBS QUlEIGNvbmZpZ3VyYXRpb24gdG8gdXNlIGZvciB0aGlzIHNlcnZlci4gUkFJ RCA1IG9mZmVycyB0aGUgYmVzdCBmYXVsdCB0b2xlcmFuY2UgYnV0IGRvZXNu J3QgcGVyZm9ybSBhbGwgdGhhdCB3ZWxsLiBSQUlEIDEwIG9mZmVycyBtdWNo IGJldHRlciBwZXJmb3JtYW5jZSwgYnV0IG5vIGhvdCBzd2FwLiBPciBzaG91 bGQgd2Ugbm90IHVzZSBSQUlEIGF0IGFsbC4gSSBrbm93IHRoYXQgaWRlYWxs eSB0aGUgbG9nIChXQUwpIGZpbGVzIHNob3VsZCByZXNpZGUgb24gYSBzZXBh cmF0ZSBkaXNrIGZyb20gdGhlIHJlc3Qgb2YgdGhlIERCLiBTaG91bGQgd2Ug dXNlIDQgc2VwYXJhdGUgZHJpdmVzIGluc3RlYWQ/IE9uZSBmb3IgdGhlIE9T LCBvbmUgZm9yIGRhdGEsIG9uZSBmb3IgV0FMLCBvbmUgZm9yIHN3YXA/IE9y IFJBSUQgMTAgZm9yIGV2ZXJ5dGhpbmcgcGx1cyAxIGRyaXZlIGZvciBXQUw/ IE9yIFJBSUQgNSBmb3IgZXZlcnl0aGluZz8NCgkgDQoJV2UgaGF2ZSB0aGUg YnVkZ2V0IGZvciA1IGRyaXZlcy4gRG9lcyBhbnlvbmUgaGF2ZSBhbnkgcmVh bCB3b3JsZCBleHBlcmllbmNlIHdpdGggd2hhdCBoYXJkIGRyaXZlIGNvbmZp Z3VyYXRpb24gd29ya3MgYmVzdCBmb3IgcG9zdGdyZXM/IFRoaXMgaXMgZ29p bmcgdG8gYmUgYSBkZWRpY2F0ZWQgREIgc2VydmVyLiBUaGVyZSBhcmUgZ29p bmcgdG8gYmUgYSBsYXJnZSBudW1iZXIgb2YgdHJhbnNhY3Rpb25zIGJlaW5n IHdyaXR0ZW4gdG8gdGhlIGRhdGFiYXNlLiAoSW5mb3JtYXRpb24gaXMgbG9n Z2VkIGZyb20gYSBzZXBhcmF0ZSBhcHAgdGhyb3VnaCBPREJDIHRvIHBvc3Rn cmVzKSBBbmQgdGhlcmUgd2lsbCBiZSBzb21lIG1vZGVyYXRlbHkgY29tcGxl eCBxdWVyaWVzIHJ1biBjb25jdXJyZW50bHkgdG8gcHJlc2VudCB0aGlzIGlu Zm9ybWF0aW9uIGluIHRoZSBmb3JtIG9mIHZhcmlvdXMgcmVwb3J0cyBvbiB0 aGUgd2ViLiAoVGhlIGFwcCBzZXJ2ZXIgaXMgYSBzZXBhcmF0ZSBtYWNoaW5l IGFuZCB3aWxsIGNvbm5lY3QgdG8gdGhlIERCIHRocm91Z2ggSkRCQyB0byBj cmVhdGUgdGhlIEhUTUwgcmVwb3J0cykNCgkgDQoJQW55IHRob3VnaHRzLCBp ZGVhcywgY29tbWVudHMgd291bGQgYmUgYXBwcmVjaWF0ZWQuDQoJIA0KCVRo YW5rIHlvdSwNCgkgDQoJQmFsYXpzIFdlbGxpc2NoDQoJTmV1IFNvbHV0aW9u cw0KCWJhbGF6c0BuZXVzb2x1dGlvbnMuY29tDQoJIA0KDQo= From pgsql-performance-owner@postgresql.org Thu Jul 17 01:53:38 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id B6388CC86C for ; Thu, 17 Jul 2003 04:53:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 66337-06 for ; Thu, 17 Jul 2003 04:53:54 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 682E4CADC4 for ; Thu, 17 Jul 2003 01:53:25 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1825975; Wed, 16 Jul 2003 21:20:02 -0700 Message-ID: <3F162B7D.1020106@joeconway.com> Date: Wed, 16 Jul 2003 21:52:13 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Balazs Wellisch Cc: pgsql-performance@postgresql.org Subject: Re: Hardware performance References: <004b01c34c0f$256bfb80$0600a8c0@home01> In-Reply-To: <004b01c34c0f$256bfb80$0600a8c0@home01> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/241 X-Sequence-Number: 2534 Balazs Wellisch wrote: > first of all I'd like to thank everyone who responded to my earlier > post. I have a much better understanding of postgres performance > tuning now. In case anyone's interested we've decided to go with RH9 > and PostgreSQL 7.3 and we'll do the OS and DB tuning ourselves. > (should be a good learning experience) Good choice! I think you'll find that this list will be a great resource as you learn. One point here is that you should use 7.3.3 (latest release version) instead of the version of Postgres in the distribution. Also, you might want to rebuild the RPMs from source using "--target i686". > We have the budget for 5 drives. Does anyone have any real world > experience with what hard drive configuration works best for > postgres? This is going to be a dedicated DB server. There are going > to be a large number of transactions being written to the database. To an extent it depends on how big the drives are and how large you expect the database to get. For maximal performance you want RAID 1+0 for data and WAL; and you want OS, data, and WAL each on their own drives. So with 5 drives one possible configuration is: 1 drive OS: OS on it's own drive makes it easy to upgrade, or restore the OS from CD if needed 2 drives, RAID 1+0: WAL 2 drives, RAID 1+0: data But I've seem reports that with fast I/O subsystems, there was no measurable difference with WAL separated from data. And to be honest, I've never personally found it necessary to separate WAL from data. You may want to test with WAL on the same volume as the data to see if there is enough difference to warrant separating it or not given your load and your actual hardware. If not, use 1 OS drive and 4 RAID 1+0 drives as one volume. You never want find any significant use of hard disk based swap space -- if you see that, you are probably misconfigured, and performance will be poor no matter how you've set up the drives. > And there will be some moderately complex queries run concurrently to > present this information in the form of various reports on the web. Once you have some data on your test server, and you have complex queries to tune, there will be a few details you'll get asked every time if you don't provide them when posting a question to the list: 1) Have you been running VACUUM and ANALYZE (or VACUUM ANALYZE) at appropriate intervals? 2) What are the table definitions and indexes for all tables involved? 3) What is the output of EXPLAIN ANALYZE? HTH, Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 04:58:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id D13B4CC863 for ; Thu, 17 Jul 2003 07:58:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 07927-08 for ; Thu, 17 Jul 2003 07:59:11 +0000 (GMT) Received: from fuji.krosing.net (unknown [194.204.44.118]) by svr1.postgresql.org (Postfix) with ESMTP id 92222CC8F3 for ; Thu, 17 Jul 2003 04:58:42 -0300 (ADT) Received: from fuji.krosing.net (localhost.localdomain [127.0.0.1]) by fuji.krosing.net (8.12.8/8.12.8) with ESMTP id h6H7uphY004623; Thu, 17 Jul 2003 10:56:51 +0300 Received: (from hannu@localhost) by fuji.krosing.net (8.12.8/8.12.8/Submit) id h6H7unD7004621; Thu, 17 Jul 2003 10:56:49 +0300 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: Hardware performance From: Hannu Krosing To: Joe Conway Cc: pgsql-performance@postgresql.org In-Reply-To: <3F162B7D.1020106@joeconway.com> References: <004b01c34c0f$256bfb80$0600a8c0@home01> <3F162B7D.1020106@joeconway.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1058428609.4289.5.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 17 Jul 2003 10:56:49 +0300 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/242 X-Sequence-Number: 2535 Joe Conway kirjutas N, 17.07.2003 kell 07:52: > To an extent it depends on how big the drives are and how large you > expect the database to get. For maximal performance you want RAID 1+0 > for data and WAL; and you want OS, data, and WAL each on their own > drives. So with 5 drives one possible configuration is: > > 1 drive OS: OS on it's own drive makes it easy to upgrade, or restore > the OS from CD if needed > 2 drives, RAID 1+0: WAL > 2 drives, RAID 1+0: data How do you do RAID 1+0 with just two drives ? -------------- Hannu From pgsql-performance-owner@postgresql.org Thu Jul 17 05:58:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 6F694CC917 for ; Thu, 17 Jul 2003 08:58:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 59832-05 for ; Thu, 17 Jul 2003 08:59:17 +0000 (GMT) Received: from ainea-ag.de (unknown [195.145.148.245]) by svr1.postgresql.org (Postfix) with SMTP id 6B298CC863 for ; Thu, 17 Jul 2003 05:58:48 -0300 (ADT) Received: (qmail 18947 invoked from network); 17 Jul 2003 08:59:42 -0000 Received: from kanzler.ainea-ag.de (HELO allanon.ainea-ag.de) (@195.145.148.242) by grinch.ainea-ag.de with SMTP; 17 Jul 2003 08:59:42 -0000 Message-Id: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> X-Sender: fkreitner@195.145.148.245 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 17 Jul 2003 11:01:18 +0200 To: pgsql-performance@postgresql.org From: Fabian Kreitner Subject: index / sequential scan problem Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/243 X-Sequence-Number: 2536 Hi all, Im currently taking my first steps with db optimizations and am wondering whats happening here and if/how i can help pg choose the better plan. Thanks, Fabian >>> psql (PostgreSQL) 7.2.2 perg_1097=# VACUUM ANALYZE ; VACUUM perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) (actual time=0.28..2305.52 rows=31122 loops=1) SubPlan -> Seq Scan on notiz_gelesen b (cost=0.00..1.79 rows=1 width=0) (actual time=0.07..0.07 rows=0 loops=31122) Total runtime: 2334.42 msec EXPLAIN perg_1097=# SET enable_seqscan to false; SET VARIABLE perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=100000000.00..100111719.36 rows=15561 width=12) (actual time=0.24..538.86 rows=31122 loops=1) SubPlan -> Index Scan using idx_notiz_gelesen_2 on notiz_gelesen b (cost=0.00..3.57 rows=1 width=0) (actual time=0.01..0.01 rows=0 loops=31122) Total runtime: 570.75 msec EXPLAIN perg_1097=# perg_1097=# \d notiz_objekt; Table "notiz_objekt" Column | Type | Modifiers ----------+---------+----------- notiz_id | integer | obj_id | integer | obj_typ | integer | Indexes: idx_notiz_objekt_1, idx_notiz_objekt_2 perg_1097=# \d notiz_gelesen; Table "notiz_gelesen" Column | Type | Modifiers ----------+--------------------------+---------------------------------------------------- notiz_id | integer | ma_id | integer | ma_pid | integer | stamp | timestamp with time zone | default ('now'::text)::timestamp(6) with time zone anzeigen | character varying | Indexes: idx_notiz_gelesen_1, idx_notiz_gelesen_2 perg_1097=# perg_1097=# select count(*) from notiz_objekt; count ------- 31122 (1 row) perg_1097=# select count(*) from notiz_gelesen; count ------- 45 (1 row) perg_1097=# idx_notiz_gelesen_1 (ma_id,ma_pid) idx_notiz_gelesen_2 (notiz_id) From pgsql-performance-owner@postgresql.org Thu Jul 17 06:15:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 09341CC866 for ; Thu, 17 Jul 2003 09:15:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 66026-04 for ; Thu, 17 Jul 2003 09:16:05 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id ACC44CAE14 for ; Thu, 17 Jul 2003 06:15:36 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6H9K29i009393 for ; Thu, 17 Jul 2003 14:50:02 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6H9K1uf009380 for ; Thu, 17 Jul 2003 14:50:02 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Thu, 17 Jul 2003 14:47:46 +0530 MIME-Version: 1.0 Subject: Re: index / sequential scan problem Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F16B712.19311.58D7530@localhost> In-reply-to: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/244 X-Sequence-Number: 2537 On 17 Jul 2003 at 11:01, Fabian Kreitner wrote: > psql (PostgreSQL) 7.2.2 > > perg_1097=# VACUUM ANALYZE ; > VACUUM > perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ > perg_1097-# from notiz_objekt a > perg_1097-# where not exists > perg_1097-# ( > perg_1097(# select 1 > perg_1097(# from notiz_gelesen b > perg_1097(# where ma_id = 2001 > perg_1097(# and ma_pid = 1097 > perg_1097(# and a.notiz_id = b.notiz_id > perg_1097(# ) > perg_1097-# ; For 31K records, seq. scan does not sound like a bad plan to me but anyway.. How about where ma_id = 2001::integer and ma_pid = 1097::integer in above query? Bye Shridhar -- No one can guarantee the actions of another. -- Spock, "Day of the Dove", stardate unknown From pgsql-performance-owner@postgresql.org Thu Jul 17 07:12:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 93838CC918 for ; Thu, 17 Jul 2003 10:12:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 68589-06 for ; Thu, 17 Jul 2003 10:12:49 +0000 (GMT) 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 682FBCAE14 for ; Thu, 17 Jul 2003 07:12:22 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 19d5ko-000OCK-0V; Thu, 17 Jul 2003 11:12:50 +0100 Date: Thu, 17 Jul 2003 11:12:48 +0100 From: Paul Thomas To: Fabian Kreitner Cc: "pgsql-performance @ postgresql . org" Subject: Re: index / sequential scan problem Message-ID: <20030717111248.C27264@bacon> References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245>; from fabian.kreitner@ainea-ag.de on Thu, Jul 17, 2003 at 10:01:18 +0100 X-Mailer: Balsa 1.2.3 Lines: 22 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/245 X-Sequence-Number: 2538 On 17/07/2003 10:01 Fabian Kreitner wrote: Hi Fabian, When you are doing these kinds of tests, you need to be aware that the kernel may have most of your data cached after the first query and this may be why the second query appears to run faster. Also don't be worried if the planner chooses a seq scan for small tables as the whole table can often be bought into memory with one IO whereas reading the index then the table would be 2 IOs. HTH -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 17 07:14:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 8B0A4CC918 for ; Thu, 17 Jul 2003 10:14:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 81081-08 for ; Thu, 17 Jul 2003 10:14:17 +0000 (GMT) Received: from mail2.mediadesign.nl (md2.mediadesign.nl [212.19.205.67]) by svr1.postgresql.org (Postfix) with SMTP id A089ECAE14 for ; Thu, 17 Jul 2003 07:13:49 -0300 (ADT) Received: (qmail 8997 invoked by uid 666); 17 Jul 2003 10:14:16 -0000 Date: Thu, 17 Jul 2003 12:14:16 +0200 From: Vincent van Leeuwen To: pgsql-performance@postgresql.org Subject: Re: Hardware performance Message-ID: <20030717101415.GR21071@md2.mediadesign.nl> Mail-Followup-To: pgsql-performance@postgresql.org References: <004b01c34c0f$256bfb80$0600a8c0@home01> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <004b01c34c0f$256bfb80$0600a8c0@home01> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/246 X-Sequence-Number: 2539 On 2003-07-16 19:57:22 -0700, Balazs Wellisch wrote: > We're now stuck on the question of what type of RAID configuration to use > for this server. RAID 5 offers the best fault tolerance but doesn't perform > all that well. RAID 10 offers much better performance, but no hot swap. Or > should we not use RAID at all. I know that ideally the log (WAL) files > should reside on a separate disk from the rest of the DB. Should we use 4 > separate drives instead? One for the OS, one for data, one for WAL, one for > swap? Or RAID 10 for everything plus 1 drive for WAL? Or RAID 5 for > everything? > We have recently run our own test (simulating our own database load) on a new server which contained 7 15K rpm disks. Since we always want to have a hot-spare drive (servers are located in a hard-to-reach datacenter) and we always want redundancy, we tested two different configurations: - 6 disk RAID 10 array, holding everything - 4 disk RAID 5 array holding postgresql data and 2 disk RAID 1 array holding OS, swap and WAL logs Our database is used for a very busy community website, so our load contains a lot of inserts/updates for a website, but much more selects than there are updates. Our findings were that the 6 disk RAID 10 set was significantly faster than the other setup. So I'd recommend a 4-disk RAID 10 array. I'd use the 5th drive for a hot-spare drive, but that's your own call. However, it would be best if you tested some different setups under your own database load to see what works best for you. Vincent van Leeuwen Media Design - http://www.mediadesign.nl/ From pgsql-performance-owner@postgresql.org Thu Jul 17 08:11:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 44AB8CC943 for ; Thu, 17 Jul 2003 11:11:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 40452-08 for ; Thu, 17 Jul 2003 11:11:41 +0000 (GMT) Received: from ainea-ag.de (unknown [195.145.148.245]) by svr1.postgresql.org (Postfix) with SMTP id 507D0CC97B for ; Thu, 17 Jul 2003 08:11:14 -0300 (ADT) Received: (qmail 20458 invoked from network); 17 Jul 2003 11:12:10 -0000 Received: from kanzler.ainea-ag.de (HELO allanon.ainea-ag.de) (@195.145.148.242) by grinch.ainea-ag.de with SMTP; 17 Jul 2003 11:12:10 -0000 Message-Id: <5.1.0.14.0.20030717130132.0397b6b0@195.145.148.245> X-Sender: fkreitner@195.145.148.245 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 17 Jul 2003 13:12:10 +0200 To: pgsql-performance@postgresql.org From: Fabian Kreitner Subject: Re: index / sequential scan problem In-Reply-To: <3F16B712.19311.58D7530@localhost> References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/248 X-Sequence-Number: 2541 At 11:17 17.07.2003, Shridhar Daithankar wrote: >On 17 Jul 2003 at 11:01, Fabian Kreitner wrote: > > psql (PostgreSQL) 7.2.2 > > > > perg_1097=# VACUUM ANALYZE ; > > VACUUM > > perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ > > perg_1097-# from notiz_objekt a > > perg_1097-# where not exists > > perg_1097-# ( > > perg_1097(# select 1 > > perg_1097(# from notiz_gelesen b > > perg_1097(# where ma_id = 2001 > > perg_1097(# and ma_pid = 1097 > > perg_1097(# and a.notiz_id = b.notiz_id > > perg_1097(# ) > > perg_1097-# ; > >For 31K records, seq. scan does not sound like a bad plan to me but anyway.. Im not generally worried that it uses a seq scan but that the second example (where an index on the sub select is used on a table with only 45 entries) executes more than 4 times faster. Its not a cache thing either, since i can enable seqscan again and it will run with 2300ms again. >How about > > where ma_id = 2001::integer >and ma_pid = 1097::integer > >in above query? I dont really understand in what way this will help the planner but ill try. Thanks, Fabian From pgsql-performance-owner@postgresql.org Thu Jul 17 08:10:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 79B2CCC943 for ; Thu, 17 Jul 2003 11:10:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 62187-03 for ; Thu, 17 Jul 2003 11:11:02 +0000 (GMT) Received: from ainea-ag.de (unknown [195.145.148.245]) by svr1.postgresql.org (Postfix) with SMTP id 63185CC8FB for ; Thu, 17 Jul 2003 08:10:35 -0300 (ADT) Received: (qmail 20436 invoked from network); 17 Jul 2003 11:11:31 -0000 Received: from kanzler.ainea-ag.de (HELO allanon.ainea-ag.de) (@195.145.148.242) by grinch.ainea-ag.de with SMTP; 17 Jul 2003 11:11:31 -0000 Message-Id: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> X-Sender: fkreitner@195.145.148.245 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 17 Jul 2003 13:13:06 +0200 To: pgsql-performance@postgresql.org From: Fabian Kreitner Subject: Re: index / sequential scan problem In-Reply-To: <20030717111248.C27264@bacon> References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/247 X-Sequence-Number: 2540 At 12:12 17.07.2003, you wrote: >On 17/07/2003 10:01 Fabian Kreitner wrote: > >Hi Fabian, > >When you are doing these kinds of tests, you need to be aware that the >kernel may have most of your data cached after the first query and this >may be why the second query appears to run faster. I thought of this too, but executions times wont change with repeating / alternating these two tests. >Also don't be worried if the planner chooses a seq scan for small tables >as the whole table can often be bought into memory with one IO whereas >reading the index then the table would be 2 IOs. HTH That is what I read too and is why Im confused that the index is indeed executing faster. Can this be a problem with the hardware and/or postgress installation? Thanks, Fabian From pgsql-performance-owner@postgresql.org Thu Jul 17 08:16:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 31DFFCC943 for ; Thu, 17 Jul 2003 11:16:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 71530-05 for ; Thu, 17 Jul 2003 11:16:58 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 36F19CC8FB for ; Thu, 17 Jul 2003 08:16:31 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6HBKwtR019868 for ; Thu, 17 Jul 2003 16:50:58 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6HBKwuf019854 for ; Thu, 17 Jul 2003 16:50:58 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Thu, 17 Jul 2003 16:48:42 +0530 MIME-Version: 1.0 Subject: Re: index / sequential scan problem Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F16D36A.20463.3954D1@localhost> In-reply-to: <5.1.0.14.0.20030717130132.0397b6b0@195.145.148.245> References: <3F16B712.19311.58D7530@localhost> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/249 X-Sequence-Number: 2542 On 17 Jul 2003 at 13:12, Fabian Kreitner wrote: > At 11:17 17.07.2003, Shridhar Daithankar wrote: > >How about > > > > where ma_id = 2001::integer > >and ma_pid = 1097::integer > > > >in above query? > > I dont really understand in what way this will help the planner but ill try. That is typecasting. It helps planner understand query in more correct fashion. Bye Shridhar -- QOTD: "I may not be able to walk, but I drive from the sitting posistion." From pgsql-performance-owner@postgresql.org Thu Jul 17 09:34:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 2DCC9CC764 for ; Thu, 17 Jul 2003 12:34:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 20881-02 for ; Thu, 17 Jul 2003 12:34:45 +0000 (GMT) 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 F0911CADB5 for ; Thu, 17 Jul 2003 09:34:18 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 19d7yB-00050B-0V; Thu, 17 Jul 2003 13:34:48 +0100 Date: Thu, 17 Jul 2003 13:34:45 +0100 From: Paul Thomas To: Fabian Kreitner Cc: "pgsql-performance @ postgresql . org" Subject: Re: index / sequential scan problem Message-ID: <20030717133445.A27991@bacon> References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <20030717111248.C27264@bacon> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245>; from fabian.kreitner@ainea-ag.de on Thu, Jul 17, 2003 at 12:13:06 +0100 X-Mailer: Balsa 1.2.3 Lines: 31 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/250 X-Sequence-Number: 2543 On 17/07/2003 12:13 Fabian Kreitner wrote: > That is what I read too and is why Im confused that the index is indeed > executing faster. Can this be a problem with the hardware and/or > postgress installation? It's more likely that the OS has most of the data cached after the first query and so doesn't need to re-read that data from disk when you retry the query with seq scan disabled. Try something like this: set enable_seqscan to true; explain analyze ...... set enable_seqscan to false; explain analyze ...... set enable_seqscan to true; explain analyze ...... I expect you will find that the third query is also a lot faster that the first query. HTH -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 17 09:48:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A8EEACADB5 for ; Thu, 17 Jul 2003 12:48:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 04626-06 for ; Thu, 17 Jul 2003 12:48:26 +0000 (GMT) Received: from ainea-ag.de (unknown [195.145.148.245]) by svr1.postgresql.org (Postfix) with SMTP id 8536DCC8D6 for ; Thu, 17 Jul 2003 09:47:59 -0300 (ADT) Received: (qmail 21488 invoked from network); 17 Jul 2003 12:48:56 -0000 Received: from kanzler.ainea-ag.de (HELO allanon.ainea-ag.de) (@195.145.148.242) by grinch.ainea-ag.de with SMTP; 17 Jul 2003 12:48:56 -0000 Message-Id: <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245> X-Sender: fkreitner@195.145.148.245 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 17 Jul 2003 14:50:30 +0200 To: pgsql-performance@postgresql.org From: Fabian Kreitner Subject: Re: index / sequential scan problem In-Reply-To: <20030717133445.A27991@bacon> References: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <20030717111248.C27264@bacon> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/251 X-Sequence-Number: 2544 At 14:34 17.07.2003, you wrote: >On 17/07/2003 12:13 Fabian Kreitner wrote: >>That is what I read too and is why Im confused that the index is indeed >>executing faster. Can this be a problem with the hardware and/or >>postgress installation? > > >It's more likely that the OS has most of the data cached after the first >query and so doesn't need to re-read that data from disk when you retry >the query with seq scan disabled. Try something like this: > >set enable_seqscan to true; >explain analyze ...... >set enable_seqscan to false; >explain analyze ...... >set enable_seqscan to true; >explain analyze ...... > >I expect you will find that the third query is also a lot faster that the >first query. Im afraid, no. Database has been stopped / started right before this. perg_1097=# set enable_seqscan to true; SET VARIABLE perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) (actual time=0.28..2298.71 rows=31122 loops=1) SubPlan -> Seq Scan on notiz_gelesen b (cost=0.00..1.79 rows=1 width=0) (actual time=0.07..0.07 rows=0 loops=31122) Total runtime: 2327.37 msec EXPLAIN perg_1097=# set enable_seqscan to false; SET VARIABLE perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=100000000.00..100111719.36 rows=15561 width=12) (actual time=0.25..535.75 rows=31122 loops=1) SubPlan -> Index Scan using idx_notiz_gelesen_2 on notiz_gelesen b (cost=0.00..3.57 rows=1 width=0) (actual time=0.01..0.01 rows=0 loops=31122) Total runtime: 567.94 msec EXPLAIN perg_1097=# set enable_seqscan to true; SET VARIABLE perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) (actual time=0.13..2300.74 rows=31122 loops=1) SubPlan -> Seq Scan on notiz_gelesen b (cost=0.00..1.79 rows=1 width=0) (actual time=0.07..0.07 rows=0 loops=31122) Total runtime: 2330.25 msec EXPLAIN perg_1097=# From pgsql-performance-owner@postgresql.org Thu Jul 17 09:52:28 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 21B17CC9A6 for ; Thu, 17 Jul 2003 12:52:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 19277-01 for ; Thu, 17 Jul 2003 12:52:42 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id B1A7ACC8CD for ; Thu, 17 Jul 2003 09:52:15 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6HCuiD1016780 for ; Thu, 17 Jul 2003 18:26:44 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6HCuiuf016767 for ; Thu, 17 Jul 2003 18:26:44 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Thu, 17 Jul 2003 18:24:27 +0530 MIME-Version: 1.0 Subject: Re: index / sequential scan problem Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F16E9DB.15319.90FDAD@localhost> In-reply-to: <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245> References: <20030717133445.A27991@bacon> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/252 X-Sequence-Number: 2545 On 17 Jul 2003 at 14:50, Fabian Kreitner wrote: > At 14:34 17.07.2003, you wrote: > >I expect you will find that the third query is also a lot faster that the > >first query. > > Im afraid, no. > Database has been stopped / started right before this. > > perg_1097=# set enable_seqscan to true; > SET VARIABLE > perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ > perg_1097-# from notiz_objekt a > perg_1097-# where not exists Well, he said query and not the query plan...:-) While explain analyze is great for judging what is happening, it's not always a good idea to trust the numbers produced by it. It will probably produce same number for a SCSI disk machine and for a IDE disk machine, everything else being equal. Obviously that is not correct. Only thing you can trust in explain analyze is it's plan. Numbers are based on heuristic and should be taken as hint only. Bye Shridhar -- Harrisberger's Fourth Law of the Lab: Experience is directly proportional to the amount of equipment ruined. From pgsql-performance-owner@postgresql.org Thu Jul 17 11:10:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E3488CC9E3 for ; Thu, 17 Jul 2003 14:10:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 38345-01 for ; Thu, 17 Jul 2003 14:10:48 +0000 (GMT) Received: from indygecko.com (h24-77-222-182.ok.shawcable.net [24.77.222.182]) by svr1.postgresql.org (Postfix) with ESMTP id 3823CCC9FA for ; Thu, 17 Jul 2003 11:10:22 -0300 (ADT) Received: from [192.168.10.10] ([::ffff:192.168.10.10]) by indygecko.com with esmtp; Thu, 17 Jul 2003 07:10:39 -0700 Subject: Re: index / sequential scan problem From: Jord Tanner To: Fabian Kreitner Cc: pgsql-performance@postgresql.org In-Reply-To: <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245> References: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <20030717111248.C27264@bacon> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245> Organization: Message-Id: <1058451034.2010.4.camel@gecko> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 17 Jul 2003 07:10:35 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/253 X-Sequence-Number: 2546 I've seen similar behavior in my own queries. I found that reducing random_page_cost from the default of 4 down to 2 caused the query to choose the index, and resulted in an order of magnitude improvement on some queries. On Thu, 2003-07-17 at 05:50, Fabian Kreitner wrote: > At 14:34 17.07.2003, you wrote: > > >On 17/07/2003 12:13 Fabian Kreitner wrote: > >>That is what I read too and is why Im confused that the index is indeed > >>executing faster. Can this be a problem with the hardware and/or > >>postgress installation? > > > > > >It's more likely that the OS has most of the data cached after the first > >query and so doesn't need to re-read that data from disk when you retry > >the query with seq scan disabled. Try something like this: > > > >set enable_seqscan to true; > >explain analyze ...... > >set enable_seqscan to false; > >explain analyze ...... > >set enable_seqscan to true; > >explain analyze ...... > > > >I expect you will find that the third query is also a lot faster that the > >first query. > > Im afraid, no. > Database has been stopped / started right before this. > > perg_1097=# set enable_seqscan to true; > SET VARIABLE > perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ > perg_1097-# from notiz_objekt a > perg_1097-# where not exists > perg_1097-# ( > perg_1097(# select 1 > perg_1097(# from notiz_gelesen b > perg_1097(# where ma_id = 2001 > perg_1097(# and ma_pid = 1097 > perg_1097(# and a.notiz_id = b.notiz_id > perg_1097(# ) > perg_1097-# ; > NOTICE: QUERY PLAN: > > Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) > (actual time=0.28..2298.71 rows=31122 loops=1) > SubPlan > -> Seq Scan on notiz_gelesen b (cost=0.00..1.79 rows=1 width=0) > (actual time=0.07..0.07 rows=0 loops=31122) > Total runtime: 2327.37 msec > > EXPLAIN > perg_1097=# set enable_seqscan to false; > SET VARIABLE > perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ > perg_1097-# from notiz_objekt a > perg_1097-# where not exists > perg_1097-# ( > perg_1097(# select 1 > perg_1097(# from notiz_gelesen b > perg_1097(# where ma_id = 2001 > perg_1097(# and ma_pid = 1097 > perg_1097(# and a.notiz_id = b.notiz_id > perg_1097(# ) > perg_1097-# ; > NOTICE: QUERY PLAN: > > Seq Scan on notiz_objekt a (cost=100000000.00..100111719.36 rows=15561 > width=12) (actual time=0.25..535.75 rows=31122 loops=1) > SubPlan > -> Index Scan using idx_notiz_gelesen_2 on notiz_gelesen > b (cost=0.00..3.57 rows=1 width=0) (actual time=0.01..0.01 rows=0 loops=31122) > Total runtime: 567.94 msec > > EXPLAIN > perg_1097=# set enable_seqscan to true; > SET VARIABLE > perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ > perg_1097-# from notiz_objekt a > perg_1097-# where not exists > perg_1097-# ( > perg_1097(# select 1 > perg_1097(# from notiz_gelesen b > perg_1097(# where ma_id = 2001 > perg_1097(# and ma_pid = 1097 > perg_1097(# and a.notiz_id = b.notiz_id > perg_1097(# ) > perg_1097-# ; > NOTICE: QUERY PLAN: > > Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) > (actual time=0.13..2300.74 rows=31122 loops=1) > SubPlan > -> Seq Scan on notiz_gelesen b (cost=0.00..1.79 rows=1 width=0) > (actual time=0.07..0.07 rows=0 loops=31122) > Total runtime: 2330.25 msec > > EXPLAIN > perg_1097=# > > > ---------------------------(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 -- Jord Tanner From pgsql-performance-owner@postgresql.org Thu Jul 17 11:38:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id EB708CC8D7 for ; Thu, 17 Jul 2003 14:38:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 19588-08 for ; Thu, 17 Jul 2003 14:38:24 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 43651CCA32 for ; Thu, 17 Jul 2003 11:37:59 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 19d9ts-0005rq-0Z; Thu, 17 Jul 2003 15:38:28 +0100 Date: Thu, 17 Jul 2003 15:38:25 +0100 From: Paul Thomas To: Fabian Kreitner Cc: "pgsql-performance @ postgresql . org" Subject: Re: index / sequential scan problem Message-ID: <20030717153825.C27991@bacon> References: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <20030717111248.C27264@bacon> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <20030717133445.A27991@bacon> <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245>; from fabian.kreitner@ainea-ag.de on Thu, Jul 17, 2003 at 13:50:30 +0100 X-Mailer: Balsa 1.2.3 Lines: 33 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/254 X-Sequence-Number: 2547 On 17/07/2003 13:50 Fabian Kreitner wrote: > [snip] > Im afraid, no. > Database has been stopped / started right before this. > [snip] 1) enable_seqscan = true > Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) > (actual time=0.28..2298.71 rows=31122 loops=1) > [snip] 2) enable_seqscan = false > Seq Scan on notiz_objekt a (cost=100000000.00..100111719.36 rows=15561 > width=12) (actual time=0.25..535.75 rows=31122 loops=1) I've just noticed this. Something is not right here. Look at the crazy cost estimation for the second query. It looks to me like enable_indexscan, enable_tidscan, enable_sort, enable_nestloop, enable_mergejoin or enable_hashjoin have been set to false. Looking at the source, thats the only way I can see that such large numbers can be produced. HTH -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 17 11:45:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id C1AD3CCA38 for ; Thu, 17 Jul 2003 14:45:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 55134-05 for ; Thu, 17 Jul 2003 14:45:34 +0000 (GMT) Received: from mta4.adelphia.net (mta4.adelphia.net [64.8.50.184]) by svr1.postgresql.org (Postfix) with ESMTP id 1D36CCCA36 for ; Thu, 17 Jul 2003 11:45:09 -0300 (ADT) Received: from potentialtech.com ([24.53.179.151]) by mta4.adelphia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030717144535.DZEQ28181.mta4.adelphia.net@potentialtech.com> for ; Thu, 17 Jul 2003 10:45:35 -0400 Message-ID: <3F16B68F.7060207@potentialtech.com> Date: Thu, 17 Jul 2003 10:45:35 -0400 From: Bill Moran User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3) Gecko/20030429 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Relation of indices to ANALYZE Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/255 X-Sequence-Number: 2548 Hello all, I'm putting together a database that has me wondering about the interaction of ANALYZE with indices. I guess the basic question is: are indices affected by the results of ANALYZE. The particular application I've got is doing a batch insert of lots of records. For performance, I'm dropping the indexes on the table, doing the inserts, then recreating the indexes a then doing a VACUUM ANALYZE. Specifically, I'm wondering if I should do the ANALYZE before or after I recreate the indexes, or whether it matters. Any feedbackis welcome. -- Bill Moran Potential Technologies http://www.potentialtech.com From pgsql-performance-owner@postgresql.org Thu Jul 17 11:59:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id DA879CCA2C for ; Thu, 17 Jul 2003 14:59:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 24586-08 for ; Thu, 17 Jul 2003 14:59:37 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id CEE1BCAE14 for ; Thu, 17 Jul 2003 11:59:05 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1826298; Thu, 17 Jul 2003 07:25:37 -0700 Message-ID: <3F16B971.7050104@joeconway.com> Date: Thu, 17 Jul 2003 07:57:53 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hannu Krosing Cc: pgsql-performance@postgresql.org Subject: Re: Hardware performance References: <004b01c34c0f$256bfb80$0600a8c0@home01> <3F162B7D.1020106@joeconway.com> <1058428609.4289.5.camel@fuji.krosing.net> In-Reply-To: <1058428609.4289.5.camel@fuji.krosing.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/256 X-Sequence-Number: 2549 Hannu Krosing wrote: > How do you do RAID 1+0 with just two drives ? > Hmm, good point -- I must have been tired last night ;-). With two drives you can do mirroring or striping, but not both. Usually I've seen a pair of mirrored drives for the OS, and a RAID 1+0 array for data. But that requires 6 drives, not 5. On non-database servers usually the data array is RAID 5, and you could get away with 5 drives (as someone else pointed out). As I said, I've never personally found it necessary to move WAL off to a different physical drive. What do you think is the best configuration given the constraint of 5 drives? 1 drive for OS, and 4 for RAID 1+0 for data-plus-WAL? I guess the ideal would be to find enough money for that 6th drive, use the mirrored pair for both OS and WAL. Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 12:05:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 0742BCCA08 for ; Thu, 17 Jul 2003 15:05:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 52629-08 for ; Thu, 17 Jul 2003 15:06:23 +0000 (GMT) Received: from mailhub1.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by svr1.postgresql.org (Postfix) with ESMTP id F1087CCA3D for ; Thu, 17 Jul 2003 12:05:52 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.12) id 19dAKy-0005Bv-00; Thu, 17 Jul 2003 16:06:28 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.1 HotFix 0.7 (built May 7 2002)) with ESMTPA id <0HI600BJCCM9G6@imail.sghms.ac.uk>; Thu, 17 Jul 2003 16:06:09 +0100 (BST) Date: Thu, 17 Jul 2003 16:04:38 +0100 From: Adam Witney Subject: Re: Hardware performance In-reply-to: <3F16B971.7050104@joeconway.com> To: Joe Conway Cc: pgsql-performance Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH1: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-100.8, required 5, IN_REP_TO, QUOTED_EMAIL_TEXT, USER_AGENT_ENTOURAGE, USER_IN_WHITELIST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/257 X-Sequence-Number: 2550 > As I said, I've never personally found it necessary to move WAL off to a > different physical drive. What do you think is the best configuration > given the constraint of 5 drives? 1 drive for OS, and 4 for RAID 1+0 for > data-plus-WAL? I guess the ideal would be to find enough money for that > 6th drive, use the mirrored pair for both OS and WAL. I think the issue from the original posters point of view is that the Dell PE2650 can only hold a maximum of 5 internal drives -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Thu Jul 17 12:10:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id DA615CCA33 for ; Thu, 17 Jul 2003 15:10:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 55824-10 for ; Thu, 17 Jul 2003 15:11:26 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 5E293CAE14 for ; Thu, 17 Jul 2003 12:10:55 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1826308; Thu, 17 Jul 2003 07:37:27 -0700 Message-ID: <3F16BC38.6070504@joeconway.com> Date: Thu, 17 Jul 2003 08:09:44 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Adam Witney Cc: pgsql-performance Subject: Re: Hardware performance 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-Archive-Number: 200307/258 X-Sequence-Number: 2551 Adam Witney wrote: > I think the issue from the original posters point of view is that the Dell > PE2650 can only hold a maximum of 5 internal drives > True enough, but maybe that's a reason to be looking at other alternatives. I think he said the hardware hasn't been bought yet. Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 12:22:21 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4A4EECCA48 for ; Thu, 17 Jul 2003 15:22:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 49762-03 for ; Thu, 17 Jul 2003 15:22:39 +0000 (GMT) Received: from mailhub1.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0ECF5CCA43 for ; Thu, 17 Jul 2003 12:22:09 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub1.sghms.ac.uk with esmtp (Exim 4.12) id 19dAaW-00060T-00; Thu, 17 Jul 2003 16:22:32 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.1 HotFix 0.7 (built May 7 2002)) with ESMTPA id <0HI600B7WDD1HM@imail.sghms.ac.uk>; Thu, 17 Jul 2003 16:22:13 +0100 (BST) Date: Thu, 17 Jul 2003 16:20:42 +0100 From: Adam Witney Subject: Re: Hardware performance In-reply-to: <3F16BC38.6070504@joeconway.com> To: Joe Conway Cc: pgsql-performance Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH1: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-101.3, required 5, EMAIL_ATTRIBUTION, IN_REP_TO, QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES, USER_AGENT_ENTOURAGE, USER_IN_WHITELIST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/259 X-Sequence-Number: 2552 On 17/7/03 4:09 pm, "Joe Conway" wrote: > Adam Witney wrote: >> I think the issue from the original posters point of view is that the Dell >> PE2650 can only hold a maximum of 5 internal drives >> > > True enough, but maybe that's a reason to be looking at other > alternatives. I think he said the hardware hasn't been bought yet. Actually I am going through the same questions myself at the moment.... I would like to have a 2 disk RAID1 and a 4 disk RAID5, so need at least 6 disks.... Anybody have any suggestions or experience with other hardware manufacturers for this size of setup? (2U rack, up to 6 disks, 2 processors, ~2GB RAM, if possible) Thanks adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. From pgsql-performance-owner@postgresql.org Thu Jul 17 12:42:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id E8006CCA08 for ; Thu, 17 Jul 2003 15:42:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 93076-01 for ; Thu, 17 Jul 2003 15:43:12 +0000 (GMT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id 7C26CCCA4B for ; Thu, 17 Jul 2003 12:42:41 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6HFh00P030832; Thu, 17 Jul 2003 10:43:04 -0500 Reply-To: From: "Nick Fankhauser" To: , "Pgsql-Performance@Postgresql. Org" Subject: Re: Sanity check requested Date: Thu, 17 Jul 2003 10:41:35 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <3F13E18A.21241.4B86CB0@localhost> Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/260 X-Sequence-Number: 2553 Shridhar- I appreciate your thoughts- I'll be running some before & after tests on this using one of our development/hot-swap boxes, so I'll report the results back to the list. A few more thoughts/questions: > 1. 30 users does not seem to be much of a oevrhead. If possible > try doing away with connection pooling. The application needs to scale up gracefully. We actually have about 200 users that could decide to log on at the same time- 30 is just a typical load. We'd also prefer to have 20,000 subscribers so we can start making a living with this business . > 2. While increasing sort memory, try 4/8/16 in that order. That > way you will get a better picture of load behaviour. Though whatever you put appears > reasonable, having more data always help. I'll try that approach while testing. Is it the case that the sort memory is allocated for each connection and becomes unavailable to other processes while the connection exists? If so, since I'm using a connection pool, I should be able to control total usage precisely. Without a connection pool, I could start starving the rest of the system for resources if the number of users spiked unexpectedly. Correct? > 3. I don't know how this affects on SCSI drives, but what file > system you are using? Can you try diferent ones? > 4. OK, this is too much but linux kernel 2.6 is in test and has > vastly improved IO... I'm using ext2. For now, I'll leave this and the OS version alone. If I change too many variables, I won't be able to discern which one is causing a change. Although I understand that there's an element of art to tuning, I'm enough of a neophyte that I don't have a "feeling" for the tuning parameters yet and hence I have to take a scientific approach of just tweaking a few variables in an otherwise controlled and unchanged environment. If I can't reach my goals with the simple approach, I'll consider some of the more radical ideas. Again, thanks for the ideas- I'll feed the results back after I've done some tests -Nick From pgsql-performance-owner@postgresql.org Thu Jul 17 12:57:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 2AD68CCA51 for ; Thu, 17 Jul 2003 15:57:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 93842-05 for ; Thu, 17 Jul 2003 15:58:19 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id D5EA4CCA5C for ; Thu, 17 Jul 2003 12:57:48 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3225145; Thu, 17 Jul 2003 08:58:28 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: , , "Pgsql-Performance@Postgresql. Org" Subject: Re: Sanity check requested Date: Thu, 17 Jul 2003 08:57:08 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307170857.08837.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/261 X-Sequence-Number: 2554 Nick, > I'll try that approach while testing. Is it the case that the sort memory > is allocated for each connection and becomes unavailable to other processes > while the connection exists? If so, since I'm using a connection pool, I > should be able to control total usage precisely. Without a connection pool, > I could start starving the rest of the system for resources if the number > of users spiked unexpectedly. Correct? Wrong, actually. Sort memory is allocated *per sort*, not per connnection or per query. So a single complex query could easily use 4xsort_mem if it has several merge joins ... and a pooled connection could use many times sort_mem depending on activity. Thus connection pooling does not help you with sort_mem usage at all, unless your pooling mechanism can control the rate at which queries are fed to the planner. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jul 17 13:12:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 657A0CCA76 for ; Thu, 17 Jul 2003 16:12:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 54847-05 for ; Thu, 17 Jul 2003 16:13:12 +0000 (GMT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id CC3C9CCA63 for ; Thu, 17 Jul 2003 13:12:41 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6HGD60P031453; Thu, 17 Jul 2003 11:13:10 -0500 Reply-To: From: "Nick Fankhauser" To: "Josh Berkus" , "Pgsql-Performance@Postgresql. Org" Subject: Re: Sanity check requested Date: Thu, 17 Jul 2003 11:11:41 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <200307170857.08837.josh@agliodbs.com> Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/263 X-Sequence-Number: 2556 > Wrong, actually. Sort memory is allocated *per sort*, not per connnection or > per query. So a single complex query could easily use 4xsort_mem if it has > several merge joins ... Thanks for the correction- it sounds like this is one where usage can't be precisely controlled in a dynamic user environment & I just need to get a feel for what works under a load that approximates my production system. -Nick From pgsql-performance-owner@postgresql.org Thu Jul 17 13:11:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 0DBD1CADD0 for ; Thu, 17 Jul 2003 16:11:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 38345-09 for ; Thu, 17 Jul 2003 16:12:18 +0000 (GMT) Received: from beamish.nsd.ca (beamish.nsd.ca [205.150.156.194]) by svr1.postgresql.org (Postfix) with ESMTP id AE4E9CCA46 for ; Thu, 17 Jul 2003 13:11:47 -0300 (ADT) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id MAA08475; Thu, 17 Jul 2003 12:12:12 -0400 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma008471; Thu, 17 Jul 03 12:12:03 -0400 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id MAA31821; Thu, 17 Jul 2003 12:02:20 -0400 Message-ID: <3F16CB27.23A29390@nsd.ca> Date: Thu, 17 Jul 2003 12:13:27 -0400 From: Jean-Luc Lachance X-Mailer: Mozilla 4.8 [en] (X11; U; Linux 2.4.18-24.7.x i686) X-Accept-Language: en MIME-Version: 1.0 To: Joe Conway Cc: Balazs Wellisch , pgsql-performance@postgresql.org Subject: Re: Hardware performance References: <004b01c34c0f$256bfb80$0600a8c0@home01> <3F162B7D.1020106@joeconway.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/262 X-Sequence-Number: 2555 I am currious. How can you have RAID 1+0 with only 2 drives? If you are thinking about partitioning the drives, wont this defeate the purpose? JLL Joe Conway wrote: > > [...] > 2 drives, RAID 1+0: WAL > 2 drives, RAID 1+0: data > [...] From pgsql-performance-owner@postgresql.org Thu Jul 17 13:13:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2C96ECCA74 for ; Thu, 17 Jul 2003 16:13:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 42496-07 for ; Thu, 17 Jul 2003 16:14:14 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id E19C1CCA6A for ; Thu, 17 Jul 2003 13:13:43 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 3.35 #1) id 19dBOV-000Cud-0W; Thu, 17 Jul 2003 17:14:11 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id A553616982; Thu, 17 Jul 2003 17:14:10 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 021401697C; Thu, 17 Jul 2003 17:14:09 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Bill Moran , pgsql-performance@postgresql.org Subject: Re: Relation of indices to ANALYZE Date: Thu, 17 Jul 2003 17:14:06 +0100 User-Agent: KMail/1.4.3 References: <3F16B68F.7060207@potentialtech.com> In-Reply-To: <3F16B68F.7060207@potentialtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307171714.06993.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/264 X-Sequence-Number: 2557 On Thursday 17 Jul 2003 3:45 pm, Bill Moran wrote: > Hello all, > > I'm putting together a database that has me wondering about the interacti= on > of ANALYZE with indices. I guess the basic question is: are indices > affected by the results of ANALYZE. > > The particular application I've got is doing a batch insert of lots of > records. For performance, I'm dropping the indexes on the table, doing t= he > inserts, then recreating the indexes a then doing a VACUUM ANALYZE.=20 > Specifically, I'm wondering if I should do the ANALYZE before or after I > recreate the indexes, or whether it matters. I don't think it matters - the analyse looks at the data, and then when you= =20 run a query the planner estimates how many rows each clause will require an= d=20 checks if there is an index that will help. --=20 Richard Huxton From pgsql-odbc-owner@postgresql.org Thu Jul 17 13:14:57 2003 X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 8E1ACCCA80 for ; Thu, 17 Jul 2003 16:14:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 44262-09 for ; Thu, 17 Jul 2003 16:14:40 +0000 (GMT) Received: from albert.auore.net (197.Red-80-24-20.pooles.rima-tde.net [80.24.20.197]) by svr1.postgresql.org (Postfix) with SMTP id 9B6E4CCA6A for ; Thu, 17 Jul 2003 13:14:08 -0300 (ADT) Received: (qmail 3427 invoked by uid 1000); 17 Jul 2003 16:14:35 -0000 From: Albert Cervera Areny Reply-To: albertca@jazzfree.com To: Tom Lane Subject: Re: [PERFORM] Bad performance using ODBC Date: Thu, 17 Jul 2003 18:14:16 +0200 User-Agent: KMail/1.5.9 Cc: pgsql-odbc@postgresql.org, pgsql-performance@postgresql.org References: <200307161615.13989.albertca@jazzfree.com> <18118.1058366296@sss.pgh.pa.us> In-Reply-To: <18118.1058366296@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Message-Id: <200307171814.35145.albertca@jazzfree.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/39 X-Sequence-Number: 3100 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 A Dimecres 16 Juliol 2003 16:38, Tom Lane va escriure: > Albert Cervera Areny writes: > > I have a performance problem using postgresql when the connection is > > made via ODBC with a windows machine using the latests ODBC drivers > > (Windows) and PostgreSQL 7.3.3 (Linux). > > Do you have logging turned on in the ODBC driver? I recall hearing that > that adds a heck of a lot of overhead... After trying too many things I've finally been able to make it run in just = 1=20 or 2 seconds. I simply had to change the recordset type and set it to=20 dbOpenSnapshot (This one doesn't show changes made to the database once it'= s=20 been open) instead of the default dbDynaset (much more powerful but=20 unnecessary in this application). Take note that though it might seem obvious the performance loss against=20 Access isn't that much and thus VB users aren't probably used to change the= =20 recordset type. I think It would be nice a note with this performance=20 benchmarks (2 seconds against 15) in the Mini-Howto on Accessing PostgreSQL= =20 from Visual Basic. I'll contact Dave Page directly in case he finds it=20 interesting. I haven't seen any speed improvements desabling logging but thanks for your= =20 suggestion anyway! > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/FstfTK7ZP4pDOHcRArepAJ9rIhOKtztuPORbGkrVTOfC4UmUOQCeJ00u UxJegkvrs4TL3QVXNun3iFs=3D =3DitG7 -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Thu Jul 17 13:23:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 01B62CCA60 for ; Thu, 17 Jul 2003 16:23:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 48336-07 for ; Thu, 17 Jul 2003 16:23:19 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 9C2B4CCA46 for ; Thu, 17 Jul 2003 13:22:48 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1826380; Thu, 17 Jul 2003 08:49:19 -0700 Message-ID: <3F16CD0C.6090600@joeconway.com> Date: Thu, 17 Jul 2003 09:21:32 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jean-Luc Lachance Cc: Balazs Wellisch , pgsql-performance@postgresql.org Subject: Re: Hardware performance References: <004b01c34c0f$256bfb80$0600a8c0@home01> <3F162B7D.1020106@joeconway.com> <3F16CB27.23A29390@nsd.ca> In-Reply-To: <3F16CB27.23A29390@nsd.ca> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/266 X-Sequence-Number: 2559 Jean-Luc Lachance wrote: > I am currious. How can you have RAID 1+0 with only 2 drives? > If you are thinking about partitioning the drives, wont this defeate the > purpose? Yeah -- Hannu already pointed out that my mind was fuzzy when I made that statement :-(. See subsequent posts. Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 13:30:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 63266CCA62 for ; Thu, 17 Jul 2003 16:30:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 89318-08 for ; Thu, 17 Jul 2003 16:31:07 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 64C70CCA60 for ; Thu, 17 Jul 2003 13:30:36 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1826389; Thu, 17 Jul 2003 08:57:07 -0700 Message-ID: <3F16CEDE.2070807@joeconway.com> Date: Thu, 17 Jul 2003 09:29:18 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Adam Witney Cc: pgsql-performance Subject: Re: Hardware performance References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/267 X-Sequence-Number: 2560 Adam Witney wrote: > Actually I am going through the same questions myself at the moment.... I > would like to have a 2 disk RAID1 and a 4 disk RAID5, so need at least 6 > disks.... > > Anybody have any suggestions or experience with other hardware manufacturers > for this size of setup? (2U rack, up to 6 disks, 2 processors, ~2GB RAM, if > possible) I tend to use either 1U or 4U servers, depending on the application. But I've had good experiences with IBM recently, and a quick look on their site shows the x345 with these specs: � 2U, 2-way server delivers extreme performance and availability for demanding applications � Up to 2 Intel Xeon processors up to 3.06GHz with 533MHz front-side bus speed for outstanding performance � Features up to 8GB of DDR memory, 5 PCI (4 PCI-X) slots and up to 6 hard disk drives for robust expansion � Hot-swap redundant cooling, power and hard disk drives for high availability � Integrated dual Ultra320 SCSI with RAID-1 for data protection This may not wrap well, but here is the url: http://www-132.ibm.com/webapp/wcs/stores/servlet/CategoryDisplay?catalogId=-840&storeId=1&categoryId=2559454&langId=-1&dualCurrId=73 Handles 6 drives; maybe that fits the bill? Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 13:41:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id D0F8CCCA56 for ; Thu, 17 Jul 2003 16:41:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 93076-07 for ; Thu, 17 Jul 2003 16:42:10 +0000 (GMT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 39510CCA46 for ; Thu, 17 Jul 2003 13:41:40 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 1826409; Thu, 17 Jul 2003 09:08:11 -0700 Message-ID: <3F16D175.6000404@joeconway.com> Date: Thu, 17 Jul 2003 09:40:21 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: nickf@ontko.com Cc: Josh Berkus , "Pgsql-Performance@Postgresql. Org" Subject: Re: Sanity check requested 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-Archive-Number: 200307/268 X-Sequence-Number: 2561 Nick Fankhauser wrote: > Thanks for the correction- it sounds like this is one where usage > can't be precisely controlled in a dynamic user environment & I just > need to get a feel for what works under a load that approximates my > production system. > I think the most important point here is that if you set sort_mem too high, and you have a lot of simultaneous sorts, you can drive the server into swapping, which obviously is a very bad thing. You want it set as high as possible, but not so high given your usage patterns that you wind up swapping. Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 13:42:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 85618CCA5B for ; Thu, 17 Jul 2003 16:42:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 09203-01 for ; Thu, 17 Jul 2003 16:42:46 +0000 (GMT) Received: from beamish.nsd.ca (beamish.nsd.ca [205.150.156.194]) by svr1.postgresql.org (Postfix) with ESMTP id C542ACCA46 for ; Thu, 17 Jul 2003 13:42:15 -0300 (ADT) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id MAA09348; Thu, 17 Jul 2003 12:42:42 -0400 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma009344; Thu, 17 Jul 03 12:42:36 -0400 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id MAA32024; Thu, 17 Jul 2003 12:32:53 -0400 Message-ID: <3F16D251.73F84CD8@nsd.ca> Date: Thu, 17 Jul 2003 12:44:01 -0400 From: Jean-Luc Lachance X-Mailer: Mozilla 4.8 [en] (X11; U; Linux 2.4.18-24.7.x i686) X-Accept-Language: en MIME-Version: 1.0 To: Joe Conway Cc: Balazs Wellisch , pgsql-performance@postgresql.org Subject: Re: Hardware performance References: <004b01c34c0f$256bfb80$0600a8c0@home01> <3F162B7D.1020106@joeconway.com> <3F16CB27.23A29390@nsd.ca> <3F16CD0C.6090600@joeconway.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/269 X-Sequence-Number: 2562 Sorry for the redundant duplication of the repetition. I should have read the follow-up messages. Joe Conway wrote: > > Jean-Luc Lachance wrote: > > I am currious. How can you have RAID 1+0 with only 2 drives? > > If you are thinking about partitioning the drives, wont this defeate the > > purpose? > > Yeah -- Hannu already pointed out that my mind was fuzzy when I made > that statement :-(. See subsequent posts. > > Joe From pgsql-performance-owner@postgresql.org Thu Jul 17 13:54:06 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 74274CCA7F for ; Thu, 17 Jul 2003 16:54:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 09203-03 for ; Thu, 17 Jul 2003 16:54:33 +0000 (GMT) Received: from indygecko.com (h24-77-222-182.ok.shawcable.net [24.77.222.182]) by svr1.postgresql.org (Postfix) with ESMTP id 8DDC9CCA78 for ; Thu, 17 Jul 2003 13:53:59 -0300 (ADT) Received: from [192.168.10.10] ([::ffff:192.168.10.10]) by indygecko.com with esmtp; Thu, 17 Jul 2003 09:54:27 -0700 Subject: Re: Hardware performance From: Jord Tanner To: Adam Witney Cc: pgsql-performance In-Reply-To: References: Organization: Message-Id: <1058460866.2010.11.camel@gecko> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 17 Jul 2003 09:54:26 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/270 X-Sequence-Number: 2563 On Thu, 2003-07-17 at 08:20, Adam Witney wrote: > Anybody have any suggestions or experience with other hardware manufacturers > for this size of setup? (2U rack, up to 6 disks, 2 processors, ~2GB RAM, if > possible) > > Thanks > > adam Check out http://www.amaxit.com It is all white box stuff, but they have some really cool gear. -- Jord Tanner From pgsql-performance-owner@postgresql.org Thu Jul 17 15:02:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 531BECCA94 for ; Thu, 17 Jul 2003 18:02:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 86440-05 for ; Thu, 17 Jul 2003 18:03:07 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id EFBB3CCA41 for ; Thu, 17 Jul 2003 15:02:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6HI30Q3005495; Thu, 17 Jul 2003 14:03:00 -0400 (EDT) To: Paul Thomas Cc: Fabian Kreitner , "pgsql-performance @ postgresql . org" Subject: Re: index / sequential scan problem In-reply-to: <20030717153825.C27991@bacon> References: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <20030717111248.C27264@bacon> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <20030717133445.A27991@bacon> <5.1.0.14.0.20030717144625.039c4a10@195.145.148.245> <20030717153825.C27991@bacon> Comments: In-reply-to Paul Thomas message dated "Thu, 17 Jul 2003 15:38:25 +0100" Date: Thu, 17 Jul 2003 14:03:00 -0400 Message-ID: <5494.1058464980@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/271 X-Sequence-Number: 2564 Paul Thomas writes: > 2) enable_seqscan = false >> Seq Scan on notiz_objekt a (cost=100000000.00..100111719.36 rows=15561 >> width=12) (actual time=0.25..535.75 rows=31122 loops=1) > I've just noticed this. Something is not right here. Look at the crazy > cost estimation for the second query. No, that's exactly what it's supposed to do. enable_seqscan cannot simply suppress generation of a seqscan plan (because that might be the only way to do the query, if there's no applicable index). So it generates the plan, but sticks a large penalty into the cost estimate to keep the planner from choosing that alternative if there is any other. The "100000000.00" is that artificial penalty. We could probably hide this implementation detail from you if we tried hard enough, but it hasn't bothered anyone enough to try. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 17 15:12:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 35D2BCCAAA for ; Thu, 17 Jul 2003 18:12:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 87333-05 for ; Thu, 17 Jul 2003 18:12:57 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id B40FECCA95 for ; Thu, 17 Jul 2003 15:12:27 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6HICtQ3005587; Thu, 17 Jul 2003 14:12:55 -0400 (EDT) To: Fabian Kreitner Cc: pgsql-performance@postgresql.org Subject: Re: index / sequential scan problem In-reply-to: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> References: <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> Comments: In-reply-to Fabian Kreitner message dated "Thu, 17 Jul 2003 13:13:06 +0200" Date: Thu, 17 Jul 2003 14:12:55 -0400 Message-ID: <5586.1058465575@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/272 X-Sequence-Number: 2565 Fabian Kreitner writes: > That is what I read too and is why Im confused that the index is indeed > executing faster. Can this be a problem with the hardware and/or postgress > installation? I think the actual issue here is that you are executing the EXISTS subplan over and over, once for each outer row. The planner's cost estimate for EXISTS is based on the assumption that you do it once ... in which scenario the seqscan very possibly is cheaper. However, when you do the EXISTS subplan over and over for many outer rows, you get a savings from the fact that the index and table pages soon get cached in memory. The seqscan plan gets a savings too, since the table is small enough to fit in memory, but once everything is in memory the indexscan plan is faster. There's been some discussion on pghackers about how to teach the planner to account for repeated executions of subplans, but we have not come up with a good solution yet. For the moment, what people tend to do if they know their database is small enough to mostly stay in memory is to reduce random_page_cost to make the planner favor indexscans. If you know the database is entirely cached then the theoretically correct value of random_page_cost is 1.0 (since fetching any page will cost the same, if it's all in RAM). I'd recommend against adopting that as a default, but a lot of people find that setting it to 2.0 or so seems to model their situation better than the out-of-the-box 4.0. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 17 15:26:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id CB19DCBB94 for ; Thu, 17 Jul 2003 18:26:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 92790-10 for ; Thu, 17 Jul 2003 18:27:16 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 64D5ACC8D0 for ; Thu, 17 Jul 2003 15:26:46 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6HIRGQ3005741; Thu, 17 Jul 2003 14:27:16 -0400 (EDT) To: Bill Moran Cc: pgsql-performance@postgresql.org Subject: Re: Relation of indices to ANALYZE In-reply-to: <3F16B68F.7060207@potentialtech.com> References: <3F16B68F.7060207@potentialtech.com> Comments: In-reply-to Bill Moran message dated "Thu, 17 Jul 2003 10:45:35 -0400" Date: Thu, 17 Jul 2003 14:27:16 -0400 Message-ID: <5740.1058466436@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/273 X-Sequence-Number: 2566 Bill Moran writes: > Specifically, I'm wondering if I should do > the ANALYZE before or after I recreate the indexes, or whether it matters. At the moment it does not matter --- ANALYZE computes statistics for each column of a table regardless of what indexes exist. There has been some talk of trying to compute statistics for the contents of functional indexes. Also, if we ever do anything about computing multicolumn correlation statistics, we'd likely choose which ones are worth computing based on the presence of multicolumn indexes. So if you want to future-proof your code I'd recommend recreating the indexes before you ANALYZE. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 17 15:41:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 68035CC4E3 for ; Thu, 17 Jul 2003 18:41:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 91806-09 for ; Thu, 17 Jul 2003 18:41:29 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 3BA08CBB94 for ; Thu, 17 Jul 2003 15:40:59 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19dDh3-0000JG-00 for ; Thu, 17 Jul 2003 14:41:29 -0400 Received: by dba2 (Postfix, from userid 1019) id 173A5CEC9; Thu, 17 Jul 2003 14:41:52 -0400 (EDT) Date: Thu, 17 Jul 2003 14:41:52 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Hardware performance Message-ID: <20030717184152.GG479@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <004b01c34c0f$256bfb80$0600a8c0@home01> <3F162B7D.1020106@joeconway.com> <1058428609.4289.5.camel@fuji.krosing.net> <3F16B971.7050104@joeconway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F16B971.7050104@joeconway.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/274 X-Sequence-Number: 2567 On Thu, Jul 17, 2003 at 07:57:53AM -0700, Joe Conway wrote: > > As I said, I've never personally found it necessary to move WAL off to a > different physical drive. What do you think is the best configuration On our Solaris test boxes (where, alas, we do not have the luxury of 1/2 TB external RAID boxes :-( ), putting WAL on a disk of its own yielded something like 30% improvement in throughput on high transaciton volumes. So it's definitely important in some cases. A ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Thu Jul 17 15:50:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 182B6CC4E3 for ; Thu, 17 Jul 2003 18:50:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 81920-09 for ; Thu, 17 Jul 2003 18:51:11 +0000 (GMT) Received: from mta8.adelphia.net (mta8.adelphia.net [64.8.50.196]) by svr1.postgresql.org (Postfix) with ESMTP id 3CFBACC839 for ; Thu, 17 Jul 2003 15:50:41 -0300 (ADT) Received: from potentialtech.com ([24.53.179.151]) by mta8.adelphia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030717185111.YBVV27346.mta8.adelphia.net@potentialtech.com>; Thu, 17 Jul 2003 14:51:11 -0400 Message-ID: <3F16F01E.2040403@potentialtech.com> Date: Thu, 17 Jul 2003 14:51:10 -0400 From: Bill Moran User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3) Gecko/20030429 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Relation of indices to ANALYZE References: <3F16B68F.7060207@potentialtech.com> <5740.1058466436@sss.pgh.pa.us> In-Reply-To: <5740.1058466436@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-Archive-Number: 200307/275 X-Sequence-Number: 2568 Tom Lane wrote: > Bill Moran writes: > >>Specifically, I'm wondering if I should do >>the ANALYZE before or after I recreate the indexes, or whether it matters. > > > At the moment it does not matter --- ANALYZE computes statistics for > each column of a table regardless of what indexes exist. > > There has been some talk of trying to compute statistics for the > contents of functional indexes. Also, if we ever do anything about > computing multicolumn correlation statistics, we'd likely choose which > ones are worth computing based on the presence of multicolumn indexes. > So if you want to future-proof your code I'd recommend recreating the > indexes before you ANALYZE. Thanks, Tom (and everyone else who replied). I'm already recreating the indices prior to the VACUUM ANALYZE, since this puts the database back in a more usable state faster than doing the VACUUM first. It's good to know that it will probably be the proper way to do things in the future as well. -- Bill Moran Potential Technologies http://www.potentialtech.com From pgsql-performance-owner@postgresql.org Thu Jul 17 15:55:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A4226CC9B3 for ; Thu, 17 Jul 2003 18:55:33 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 11761-01 for ; Thu, 17 Jul 2003 18:55:30 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 5133DCC4E3 for ; Thu, 17 Jul 2003 15:55:00 -0300 (ADT) Received: from ALGOL.sollentuna.se (janus-en.sollentuna.se [195.84.163.194]) by mx-2.sollentuna.net (Postfix) with ESMTP id A87E434056; Thu, 17 Jul 2003 21:55:26 +0200 (CEST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: Re: Hardware performance Date: Thu, 17 Jul 2003 20:55:29 +0200 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE1714F4@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware performance Thread-Index: AcNMgPBfzoSlHqt1SXSaTP0oLgRXaAAEaNsw From: "Magnus Hagander" To: "Joe Conway" , "Adam Witney" Cc: "pgsql-performance" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/276 X-Sequence-Number: 2569 >Adam Witney wrote: >> Actually I am going through the same questions myself at the=20 >moment.... I >> would like to have a 2 disk RAID1 and a 4 disk RAID5, so=20 >need at least 6 >> disks.... >>=20 >> Anybody have any suggestions or experience with other=20 >hardware manufacturers >> for this size of setup? (2U rack, up to 6 disks, 2=20 >processors, ~2GB RAM, if >> possible) > >I tend to use either 1U or 4U servers, depending on the=20 >application. But=20 >I've had good experiences with IBM recently, and a quick look on their=20 >site shows the x345 with these specs: > >* 2U, 2-way server delivers extreme performance and availability for=20 >demanding applications >* Up to 2 Intel Xeon processors up to 3.06GHz with 533MHz front-side=20 >bus speed for outstanding performance >* Features up to 8GB of DDR memory, 5 PCI (4 PCI-X) slots and up to 6=20 >hard disk drives for robust expansion >* Hot-swap redundant cooling, power and hard disk drives for high=20 >availability >* Integrated dual Ultra320 SCSI with RAID-1 for data protection > >This may not wrap well, but here is the url: >http://www-132.ibm.com/webapp/wcs/stores/servlet/CategoryDispla > y?catalogId=3D-840&storeId=3D1&categoryId=3D2559454&langId=3D-1&dualCurrI= d=3D73 > > Handles 6 drives; maybe that fits the bill? [naturally, there should be one for each of the major server vendors, eh?] I've used mainly HP (as in former Compaq) machines here, with nothing but good experience. HPs machine in the scame class is the DL380G3. Almost identical specs to the IBM (I'd expect all major vendors have fairly similar machines). Holds 12Gb RAM. Only 3 PCI-X slots (2 of them hotplug). RPS. 6 disk slots (Ultra-320) that can be put on one or two SCSI chains (builtin RAID controller only handles a single channel, though, so you'd need an extra SmartArray controller if you want to split them). RAID0/1/1+0/5. If you would go with that one, make sure to get the optional BBWC (Battery Backed Write Cache). Without it the controller won't enable the write-back cache (which it really shouldn't, since it wouldn't be safe without the batteries). WB cache can really speed things on in many db situations - it's sort of like "speed of fsync off, security of fsync on". I've seen huge speedups with both postgresql and other databases on that. If you want to be "ready for more storage", I'd suggest looking at a 1U server with a 3U external disk rack. That'll give you 16 disks in 4U (2 in the server + 14 in the rack on 2 channels), which is hard to beat. If you have no need to go there, then sure, the 2U machine will be better. But I've found the "small machine with external rack" a lot more flexible than the "big machine with disks inside it". (For example, you can put two 1U servers to it, and have 7 disks assigned to each server) In HP world that would mean DL360G3 and the StorageWorks 4354. The mandatory link: http://h18004.www1.hp.com/products/servers/platforms/index-dl-ml.html Though if you are already equipped with servers from one vendor, I'd suggest sticking to it as long as the specs are fairly close. Then you only need one set of management software etc. //Magnus From pgsql-performance-owner@postgresql.org Thu Jul 17 16:11:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 0373BCC4E3 for ; Thu, 17 Jul 2003 19:11:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 76853-09 for ; Thu, 17 Jul 2003 19:11:22 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 19951CBB94 for ; Thu, 17 Jul 2003 16:10:53 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3225783 for pgsql-performance@postgresql.org; Thu, 17 Jul 2003 12:11:38 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Table clustering -- useful, or not? Date: Thu, 17 Jul 2003 12:10:25 -0700 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307171210.25747.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/277 X-Sequence-Number: 2570 Folks: On my projects, I haven't found PostgreSQL's implementation of clustered=20 indexes to be particularly useful ... gains of only a few percent in query= =20 efficiency in exchange for a substantial management task. Obviously, not= =20 everyone has had the same experience, or we wouldn't still have the feature. When I re-vamp my articles on indexing, I would like to include something= =20 about clustered indexes. Can people give me some examples of cases where= =20 they have found clustered indexes to be useful, preferably with some=20 statistics? --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 18 00:23:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id C7D0FCCBFF for ; Fri, 18 Jul 2003 03:23:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 44527-07 for ; Fri, 18 Jul 2003 03:23:36 +0000 (GMT) Received: from srvr3.iniquinet.com (srvr2.iniquinet.com [64.240.87.12]) by svr1.postgresql.org (Postfix) with SMTP id 31732CCBBB for ; Fri, 18 Jul 2003 00:23:04 -0300 (ADT) Received: (qmail 28750 invoked by uid 104); 18 Jul 2003 03:23:50 -0000 Received: from Robert_Creager@LogicalChaos.org by srvr3.iniquinet.com by uid 101 with qmail-scanner-1.15 (clamscan: 0.54. spamassassin: 2.55. Clear:SA:0(-7.8/6.0):. Processed in 6.367231 secs); 18 Jul 2003 03:23:50 -0000 Received: from vsat-148-64-8-86.c119.t7.mrt.starband.net (HELO chaos.mshome.net) (148.64.8.86) by srvr3.iniquinet.com with SMTP; 18 Jul 2003 03:23:43 -0000 Received: from localhost.localdomain (thunder.mshome.net [192.168.0.250]) by chaos.mshome.net (Postfix) with ESMTP id EF4FA1B151A; Thu, 17 Jul 2003 21:23:22 -0600 (MDT) Received: from logicalchaos.org (thunder.mshome.net [192.168.0.250]) by chaos.mshome.net (Postfix) with SMTP id A17361B151A; Thu, 17 Jul 2003 21:23:09 -0600 (MDT) Date: Thu, 17 Jul 2003 21:23:08 -0600 From: Robert Creager To: Adam Witney Cc: pgsql-performance Subject: Re: Hardware performance Message-Id: <20030717212308.18f30b8d.Robert_Creager@LogicalChaos.org> In-Reply-To: References: <3F16BC38.6070504@joeconway.com> Organization: Starlight Vision, LLC. X-Mailer: Sylpheed version 0.9.0claws (GTK+ 1.2.10; i586-mandrake-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="=.el8CPnV.YTisJS" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/278 X-Sequence-Number: 2571 --=.el8CPnV.YTisJS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 17 Jul 2003 16:20:42 +0100 Adam Witney said something like: > > Actually I am going through the same questions myself at the > moment.... I would like to have a 2 disk RAID1 and a 4 disk RAID5, so > need at least 6 disks.... > > Anybody have any suggestions or experience with other hardware > manufacturers for this size of setup? (2U rack, up to 6 disks, 2 > processors, ~2GB RAM, if possible) > We recently bought a couple of Compaq Proliant DL380 units. They are 2u, and support 6 disks, 2 CPU's, 12Gb max. We purchased 2 units of 1CPU, 4x72Gb RAID 0+1, 1Gb mem, redundant fans and power supplies for around $11,000 total. Unfortunately they are running Win2K with SQLAnywhere (ClearQuest/Web server) ;-) So far (5 months), they're real board... Cheers, Rob -- 21:16:04 up 1:19, 1 user, load average: 2.04, 1.99, 1.38 --=.el8CPnV.YTisJS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iEYEARECAAYFAj8XaBwACgkQgy51bQc2FFmIHgCgpSpot6xnhD2bvE3mSmszvgvS QdsAoNzB3UInQszDezr4y+dlGYTxQT6b =Kl/j -----END PGP SIGNATURE----- --=.el8CPnV.YTisJS-- From pgsql-performance-owner@postgresql.org Fri Jul 18 01:45:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 753F6CCC2C for ; Fri, 18 Jul 2003 04:45:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 83581-09 for ; Fri, 18 Jul 2003 04:45:42 +0000 (GMT) Received: from ainea-ag.de (unknown [195.145.148.245]) by svr1.postgresql.org (Postfix) with SMTP id B4DF1CCC1D for ; Fri, 18 Jul 2003 01:45:09 -0300 (ADT) Received: (qmail 30169 invoked from network); 18 Jul 2003 04:46:15 -0000 Received: from kanzler.ainea-ag.de (HELO allanon.ainea-ag.de) (@195.145.148.242) by grinch.ainea-ag.de with SMTP; 18 Jul 2003 04:46:15 -0000 Message-Id: <5.1.0.14.0.20030718063650.0397b238@195.145.148.245> X-Sender: fkreitner@195.145.148.245 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 18 Jul 2003 06:47:05 +0200 To: Tom Lane From: Fabian Kreitner Subject: Re: index / sequential scan problem Cc: pgsql-performance@postgresql.org In-Reply-To: <5586.1058465575@sss.pgh.pa.us> References: <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/279 X-Sequence-Number: 2572 At 20:12 17.07.2003, Tom Lane wrote: >Fabian Kreitner writes: > > That is what I read too and is why Im confused that the index is indeed > > executing faster. Can this be a problem with the hardware and/or postgress > > installation? > >I think the actual issue here is that you are executing the EXISTS >subplan over and over, once for each outer row. The planner's cost >estimate for EXISTS is based on the assumption that you do it once >... in which scenario the seqscan very possibly is cheaper. However, >when you do the EXISTS subplan over and over for many outer rows, you >get a savings from the fact that the index and table pages soon get >cached in memory. The seqscan plan gets a savings too, since the table >is small enough to fit in memory, but once everything is in memory the >indexscan plan is faster. > >There's been some discussion on pghackers about how to teach the planner >to account for repeated executions of subplans, but we have not come up >with a good solution yet. > >For the moment, what people tend to do if they know their database is >small enough to mostly stay in memory is to reduce random_page_cost to >make the planner favor indexscans. If you know the database is entirely >cached then the theoretically correct value of random_page_cost is 1.0 >(since fetching any page will cost the same, if it's all in RAM). I'd >recommend against adopting that as a default, but a lot of people find >that setting it to 2.0 or so seems to model their situation better than >the out-of-the-box 4.0. Thanks for the explanation :) However .... :( perg_1097=# vacuum analyze; VACUUM perg_1097=# set random_page_cost to 1.0; SET VARIABLE perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=0.00..56125.80 rows=15561 width=12) (actual time=0.27..2299.09 rows=31122 loops=1) SubPlan -> Seq Scan on notiz_gelesen b (cost=0.00..1.79 rows=1 width=0) (actual time=0.07..0.07 rows=0 loops=31122) Total runtime: 2328.05 msec EXPLAIN perg_1097=# ... perg_1097=# set enable_seqscan to false; SET VARIABLE perg_1097=# set random_page_cost to 1.0; SET VARIABLE perg_1097=# EXPLAIN ANALYZE select notiz_id, obj_id, obj_typ perg_1097-# from notiz_objekt a perg_1097-# where not exists perg_1097-# ( perg_1097(# select 1 perg_1097(# from notiz_gelesen b perg_1097(# where ma_id = 2001 perg_1097(# and ma_pid = 1097 perg_1097(# and a.notiz_id = b.notiz_id perg_1097(# ) perg_1097-# ; NOTICE: QUERY PLAN: Seq Scan on notiz_objekt a (cost=100000000.00..100093380.36 rows=15561 width=12) (actual time=0.07..550.07 rows=31122 loops=1) SubPlan -> Index Scan using idx_notiz_gelesen_2 on notiz_gelesen b (cost=0.00..2.98 rows=1 width=0) (actual time=0.01..0.01 rows=0 loops=31122) Total runtime: 582.90 msec EXPLAIN perg_1097=# Even with a random page cost of 1 it thinks using the index should/could take significantly longer which it doesnt for some reason :-/ From pgsql-performance-owner@postgresql.org Fri Jul 18 02:16:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A5A00CCC3C for ; Fri, 18 Jul 2003 05:16:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 20272-05 for ; Fri, 18 Jul 2003 05:16:26 +0000 (GMT) Received: from ainea-ag.de (unknown [195.145.148.245]) by svr1.postgresql.org (Postfix) with SMTP id 8D3C5CADB4 for ; Fri, 18 Jul 2003 02:15:54 -0300 (ADT) Received: (qmail 30419 invoked from network); 18 Jul 2003 05:17:00 -0000 Received: from kanzler.ainea-ag.de (HELO allanon.ainea-ag.de) (@195.145.148.242) by grinch.ainea-ag.de with SMTP; 18 Jul 2003 05:17:00 -0000 Message-Id: <5.1.0.14.0.20030718070624.0397b6b0@195.145.148.245> X-Sender: fkreitner@195.145.148.245 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 18 Jul 2003 07:18:27 +0200 To: pgsql-performance@postgresql.org From: Fabian Kreitner Subject: Re: index / sequential scan problem In-Reply-To: <5.1.0.14.0.20030718063650.0397b238@195.145.148.245> References: <5586.1058465575@sss.pgh.pa.us> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717105203.03d2b5c0@195.145.148.245> <5.1.0.14.0.20030717131157.03957fa0@195.145.148.245> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/280 X-Sequence-Number: 2573 Hi all, Adjusting the cpu_tuple_cost to 0.042 got the planner to choose the index. Anything I need to consider when raising it to such "high" values? Thanks for the help, Fabian From pgsql-performance-owner@postgresql.org Fri Jul 18 02:27:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 67A43CCC3C for ; Fri, 18 Jul 2003 05:25:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 81212-03 for ; Fri, 18 Jul 2003 05:26:01 +0000 (GMT) Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id C25A4CADB4 for ; Fri, 18 Jul 2003 02:25:29 -0300 (ADT) Received: from zigo.dhs.org (zigo [127.0.0.1]) by zigo.dhs.org (8.12.8/8.12.8) with ESMTP id h6I5PsWK018284; Fri, 18 Jul 2003 07:25:54 +0200 Received: from localhost (db@localhost) by zigo.dhs.org (8.12.8/8.12.8/Submit) with ESMTP id h6I5Ps9X018280; Fri, 18 Jul 2003 07:25:54 +0200 Date: Fri, 18 Jul 2003 07:25:54 +0200 (CEST) From: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= To: Fabian Kreitner Cc: pgsql-performance@postgresql.org Subject: Re: index / sequential scan problem In-Reply-To: <5.1.0.14.0.20030718070624.0397b6b0@195.145.148.245> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/281 X-Sequence-Number: 2574 On Fri, 18 Jul 2003, Fabian Kreitner wrote: > Adjusting the cpu_tuple_cost to 0.042 got the planner to choose the index. Doesn't sound very good and it will most likely make other queries slower. You could always turn off sequential scan before that query and turn it on after. > Anything I need to consider when raising it to such "high" values? You could fill the table with more data and it will probably come to a point where it will stop using the seq. scan. You could of course also change pg itself so it calculates a better estimate. -- /Dennis From pgsql-performance-owner@postgresql.org Fri Jul 18 03:37:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 25FE6CADB4 for ; Fri, 18 Jul 2003 06:33:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 60520-08 for ; Fri, 18 Jul 2003 06:34:13 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 094DBCC8BE for ; Fri, 18 Jul 2003 03:33:41 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6I6cOZM003646 for ; Fri, 18 Jul 2003 12:08:24 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6I6cN6O003633 for ; Fri, 18 Jul 2003 12:08:24 +0530 From: "Shridhar Daithankar" To: "Pgsql-Performance@Postgresql. Org" Date: Fri, 18 Jul 2003 12:05:54 +0530 MIME-Version: 1.0 Subject: Re: Sanity check requested Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F17E2A2.28685.45CC782@localhost> In-reply-to: References: <3F13E18A.21241.4B86CB0@localhost> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/282 X-Sequence-Number: 2575 On 17 Jul 2003 at 10:41, Nick Fankhauser wrote: > I'm using ext2. For now, I'll leave this and the OS version alone. If I I appreciate your approach but it almost proven that ext2 is not the best and fastest out there. IMO, you can safely change that to reiserfs or XFS. Or course, testing is always recommended. HTH Bye Shridhar -- Newton's Little-Known Seventh Law: A bird in the hand is safer than one overhead. From pgsql-performance-owner@postgresql.org Fri Jul 18 03:55:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id F02C0CCC6E for ; Fri, 18 Jul 2003 06:55:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 11761-04 for ; Fri, 18 Jul 2003 06:55:13 +0000 (GMT) Received: from ethereal-realms.org (callisto.ethereal-realms.org [142.179.222.204]) by svr1.postgresql.org (Postfix) with ESMTP id DDB42CADB4 for ; Fri, 18 Jul 2003 03:54:41 -0300 (ADT) Received: from ethereal-realms.org (ip14.ethereal-realms.COM [192.168.1.14]) by ethereal-realms.org (8.12.9/8.12.6) with ESMTP id h6I6tDjm029348 for ; Fri, 18 Jul 2003 00:55:13 -0600 (MDT) Message-ID: <3F1799D0.1010009@ethereal-realms.org> Date: Fri, 18 Jul 2003 00:55:12 -0600 From: Martin Foster Organization: Ethereal Realms User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: PostgreSQL Performance Subject: Clearing rows periodically References: <3F13E18A.21241.4B86CB0@localhost> <3F17E2A2.28685.45CC782@localhost> In-Reply-To: <3F17E2A2.28685.45CC782@localhost> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/283 X-Sequence-Number: 2576 I have two tables in the database which are used almost every time someone makes use of the webpages themselves. The first, is some sort of database side parameter list which stores parameters from session to session. While the other, is a table that handles the posting activity of all the rooms and chatters. The first is required in all authentication with the system and when entries are missing you are challenged by the system to prove your identity. This table is based on a randomized order, as in the unique number changes pseudo randomly and this table sees a reduction in entries every hour on the hour as to keep it's information fresh and manageable. The other table follows a sequential order and carries more columns of information. However, this table clears it's entry nightly and with current settings will delete roughly a days traffic sitting at 50K rows of information. The difference is as follows: Without making the use of vacuum every hour the parameter table performs very well, showing no loss in service or degradation. Since people authenticate more then post, it is safe to assume that it removes more rows daily then the posting table. The posting table often drags the system down in performance when a day has been skipped, which includes the use of VACUUM ANALYZE EXPLAIN. This seems to be an indication that the process of a daily delete is actually a very wise step to take, even if the information itself is not needed for very long. A VACUUM FULL will correct the issue, but put the site out of commission for roughly 20 minutes as the drive crunches the information. My question is, should the purging of rows be done more often then once a day for both tables. Is this why performance seems to take a hit specifically? As there were too many rows purged for vacuum to accurately keep track of? Martin Foster Creator/Designer Ethereal Realms martin@ethereal-realms.org From pgsql-performance-owner@postgresql.org Fri Jul 18 04:03:05 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 27202CCC70 for ; Fri, 18 Jul 2003 07:03:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 63528-09 for ; Fri, 18 Jul 2003 07:03:32 +0000 (GMT) Received: from cerebro.int-bytecraft.com (unknown [219.93.229.26]) by svr1.postgresql.org (Postfix) with ESMTP id E51B2CCC53 for ; Fri, 18 Jul 2003 04:02:56 -0300 (ADT) Received: from bytecraft.com.my (home.int-bytecraft.com [127.0.0.1]) by cerebro.int-bytecraft.com (8.11.6/8.11.6) with ESMTP id h6I70WA02601 for ; Fri, 18 Jul 2003 15:00:35 +0800 Message-ID: <3F179CF6.5070400@bytecraft.com.my> Date: Fri, 18 Jul 2003 15:08:38 +0800 From: Ang Chin Han User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Pgsql-Performance@Postgresql. Org" Subject: Re: Sanity check requested References: <3F13E18A.21241.4B86CB0@localhost> <3F17E2A2.28685.45CC782@localhost> In-Reply-To: <3F17E2A2.28685.45CC782@localhost> X-Enigmail-Version: 0.76.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig95FD033B917BFAD74E6511BE" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/284 X-Sequence-Number: 2577 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig95FD033B917BFAD74E6511BE Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Shridhar Daithankar wrote: > On 17 Jul 2003 at 10:41, Nick Fankhauser wrote: > >>I'm using ext2. For now, I'll leave this and the OS version alone. If I > > > I appreciate your approach but it almost proven that ext2 is not the best and > fastest out there. Agreed. > IMO, you can safely change that to reiserfs or XFS. Or course, testing is > always recommended. We've been using ext3fs for our production systems. (Red Hat Advanced Server 2.1) And since your (Nick) system is based on Debian, I have done some rough testing on Debian sarge (testing) (with custom 2.4.20) with ext3fs, reiserfs and jfs. Can't get XFS going easily on Debian, though. I used a single partition mkfs'd with ext3fs, reiserfs and jfs one after the other on an IDE disk. Ran pgbench and osdb-x0.15-0 on it. jfs's has been underperforming for me. Somehow the CPU usage is higher than the other two. As for ext3fs and reiserfs, I can't detect any significant difference. So if you're in a hurry, it'll be easier to convert your ext2 to ext3 (using tune2fs) and use that. Otherwise, it'd be nice if you could do your own testing, and post it to the list. -- Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux 2:30pm up 204 days, 5:35, 5 users, load average: 5.50, 5.18, 5.13 --------------enig95FD033B917BFAD74E6511BE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE/F5z5NYbTUIgzwfARAlOTAJ0dfrmjX5x2vN43XJDnZ8s2VroMlQCgrB8M WmeImydWP01V8KP7AEA2C9o= =fYEo -----END PGP SIGNATURE----- --------------enig95FD033B917BFAD74E6511BE-- From pgsql-performance-owner@postgresql.org Fri Jul 18 04:41:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4A0D8CCAF2 for ; Fri, 18 Jul 2003 07:41:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 49857-02 for ; Fri, 18 Jul 2003 07:42:16 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id EBA9CCCAE6 for ; Fri, 18 Jul 2003 04:41:45 -0300 (ADT) Received: from tmsl-adsl.demon.co.uk ([80.177.114.181] helo=bacon.tmsl.demon.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 19dPsf-0005Cl-0Z; Fri, 18 Jul 2003 08:42:17 +0100 Date: Fri, 18 Jul 2003 08:42:15 +0100 From: Paul Thomas To: Martin Foster Cc: "pgsql-performance @ postgresql . org" Subject: Re: Clearing rows periodically Message-ID: <20030718084215.A14240@bacon> References: <3F13E18A.21241.4B86CB0@localhost> <3F17E2A2.28685.45CC782@localhost> <3F1799D0.1010009@ethereal-realms.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 In-Reply-To: <3F1799D0.1010009@ethereal-realms.org>; from martin@ethereal-realms.org on Fri, Jul 18, 2003 at 07:55:12 +0100 X-Mailer: Balsa 1.2.3 Lines: 25 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/285 X-Sequence-Number: 2578 On 18/07/2003 07:55 Martin Foster wrote: > [snip] > A VACUUM FULL will correct the issue, but put the site out of commission > for roughly 20 minutes as the drive crunches the information. > > My question is, should the purging of rows be done more often then once > a day for both tables. Is this why performance seems to take a hit > specifically? As there were too many rows purged for vacuum to > accurately keep track of? ISTR that there are setting in postgresql.conf which affect how many tables/rows vacuum can reclaim. The docs say that the default setting of max_fsm_pages is 10000. Maybe this should be increased for your situation? HTH -- Paul Thomas +------------------------------+---------------------------------------------+ | Thomas Micro Systems Limited | Software Solutions for the Smaller Business | | Computer Consultants | http://www.thomas-micro-systems-ltd.co.uk | +------------------------------+---------------------------------------------+ From pgsql-performance-owner@postgresql.org Fri Jul 18 07:14:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 8E546CCCB8 for ; Fri, 18 Jul 2003 10:14:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 66628-01 for ; Fri, 18 Jul 2003 10:14:47 +0000 (GMT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by svr1.postgresql.org (Postfix) with ESMTP id E0A89CCCB4 for ; Fri, 18 Jul 2003 07:14:16 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030718101449.WYBG24359.lakemtao02.cox.net@[192.168.1.1]> for ; Fri, 18 Jul 2003 06:14:49 -0400 Subject: Re: Hardware performance From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCA3@pos_pdc.posportal.com> References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCA3@pos_pdc.posportal.com> Content-Type: text/plain Message-Id: <1058523288.2373.10.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 18 Jul 2003 05:14:48 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/286 X-Sequence-Number: 2579 On Wed, 2003-07-16 at 23:25, Roman Fail wrote: [snip] > has every bit of redundancy you can order. While uncommon, the > backplane is one one of the many single points of failure! Unless you go with a shared-disk cluster (Oracle 9iRAC or OpenVMS) or replication. Face it, if your pockets are deep enough, you can make everything redundant and burden-sharing (i.e., not just waiting for the master system to die). (And with some enterprise FC controllers, you can mirror the disks many kilometers away.) -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Fri Jul 18 07:18:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7C06ACCB30 for ; Fri, 18 Jul 2003 10:18:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 05341-09 for ; Fri, 18 Jul 2003 10:18:55 +0000 (GMT) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by svr1.postgresql.org (Postfix) with ESMTP id 22A96CC917 for ; Fri, 18 Jul 2003 07:18:25 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030718101857.YAUP23518.lakemtao03.cox.net@[192.168.1.1]> for ; Fri, 18 Jul 2003 06:18:57 -0400 Subject: Re: Hardware performance From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE1714F4@algol.sollentuna.se> References: <6BCB9D8A16AC4241919521715F4D8BCE1714F4@algol.sollentuna.se> Content-Type: text/plain Message-Id: <1058523536.2376.14.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 18 Jul 2003 05:18:57 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/287 X-Sequence-Number: 2580 On Thu, 2003-07-17 at 13:55, Magnus Hagander wrote: > >Adam Witney wrote: [snip] > If you would go with that one, make sure to get the optional BBWC > (Battery Backed Write Cache). Without it the controller won't enable the > write-back cache (which it really shouldn't, since it wouldn't be safe > without the batteries). WB cache can really speed things on in many db > situations - it's sort of like "speed of fsync off, security of fsync > on". I've seen huge speedups with both postgresql and other databases on > that. Don't forget to check the batteries!!! And if you have an HPaq service contract, don't rely on them to do it... -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Fri Jul 18 08:33:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2A458CCCC8 for ; Fri, 18 Jul 2003 11:33:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 51656-09 for ; Fri, 18 Jul 2003 11:34:14 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 448D9CCCBE for ; Fri, 18 Jul 2003 08:33:45 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19dTVB-0007dP-00 for ; Fri, 18 Jul 2003 07:34:17 -0400 Received: by dba2 (Postfix, from userid 1019) id 1BCB2CEC9; Fri, 18 Jul 2003 07:34:40 -0400 (EDT) Date: Fri, 18 Jul 2003 07:34:40 -0400 From: Andrew Sullivan To: PostgreSQL Performance Subject: Re: Clearing rows periodically Message-ID: <20030718113439.GA2503@libertyrms.info> Mail-Followup-To: Andrew Sullivan , PostgreSQL Performance References: <3F13E18A.21241.4B86CB0@localhost> <3F17E2A2.28685.45CC782@localhost> <3F1799D0.1010009@ethereal-realms.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F1799D0.1010009@ethereal-realms.org> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/288 X-Sequence-Number: 2581 On Fri, Jul 18, 2003 at 12:55:12AM -0600, Martin Foster wrote: > The other table follows a sequential order and carries more columns of > information. However, this table clears it's entry nightly and with > current settings will delete roughly a days traffic sitting at 50K rows > of information. > has been skipped, which includes the use of VACUUM ANALYZE EXPLAIN. > This seems to be an indication that the process of a daily delete is > actually a very wise step to take, even if the information itself is not > needed for very long. > > A VACUUM FULL will correct the issue, but put the site out of commission > for roughly 20 minutes as the drive crunches the information. During your "clearing period", why not do the deletes in batches, and VACUUM the table periodically. That will allow you to reclaim the space gradually, and ensure that you don't end up with a big "bald spot". But you probably want to increase your FSM settings. See the docs. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Fri Jul 18 09:51:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 32AA3CCCE7 for ; Fri, 18 Jul 2003 12:51:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 03835-03 for ; Fri, 18 Jul 2003 12:51:32 +0000 (GMT) Received: from rtlocal.trade-india.com (unknown [203.196.129.235]) by svr1.postgresql.org (Postfix) with SMTP id 748ACCB576 for ; Fri, 18 Jul 2003 09:50:59 -0300 (ADT) Received: (qmail 7484 invoked from network); 18 Jul 2003 12:59:35 -0000 Received: from unknown (HELO system67.trade-india-local.com) (unknown) by unknown with SMTP; 18 Jul 2003 12:59:35 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: pgsql-performance@postgresql.org Subject: Yet another slow join query.. Date: Fri, 18 Jul 2003 18:21:21 +0530 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307181821.21329.mallah@trade-india.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/289 X-Sequence-Number: 2582 Hi All, data_bank.updated_profiles and public.city_master are small tables with 21790 and 49303 records repectively. both have indexes on the join column. in first one on (city,source) and in second one on (city) The query below does not return for long durations > 10 mins. explain analyze select b.state,a.city from data_bank.updated_profiles a join public.city_master b using(city) where source='BRANDING' and a.state is NULL and b.country='India' ; simple explain returns below. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nested Loop (cost=0.00..83506.31 rows=14 width=35) Join Filter: ("outer".city = ("inner".city)::text) -> Seq Scan on updated_profiles a (cost=0.00..1376.39 rows=89 width=11) Filter: ((source = 'BRANDING'::character varying) AND (state IS NULL)) -> Index Scan using city_master_temp1 on city_master b (cost=0.00..854.87 rows=5603 width=24) Filter: (country = 'India'::character varying) (6 rows) ----------------------------------------- Any help is appreciated. Regds mallah. From pgsql-performance-owner@postgresql.org Fri Jul 18 10:24:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id D755ECCD18 for ; Fri, 18 Jul 2003 13:24:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 73294-08 for ; Fri, 18 Jul 2003 13:24:58 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 7ED04CB576 for ; Fri, 18 Jul 2003 10:24:29 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6IDOwQ3023378; Fri, 18 Jul 2003 09:24:58 -0400 (EDT) To: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= Cc: Fabian Kreitner , pgsql-performance@postgresql.org Subject: Re: index / sequential scan problem In-reply-to: References: Comments: In-reply-to =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= message dated "Fri, 18 Jul 2003 07:25:54 +0200" Date: Fri, 18 Jul 2003 09:24:58 -0400 Message-ID: <23376.1058534698@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/290 X-Sequence-Number: 2583 =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= writes: > On Fri, 18 Jul 2003, Fabian Kreitner wrote: >> Adjusting the cpu_tuple_cost to 0.042 got the planner to choose the index. > Doesn't sound very good and it will most likely make other queries slower. Seems like a reasonable approach to me --- certainly better than setting random_page_cost to physically nonsensical values. In a fully-cached situation it's entirely reasonable to inflate the various cpu_xxx costs, since by assumption you are not paying the normal price of physical disk I/O. Fetching a page from kernel buffer cache is certainly cheaper than getting it off the disk. But the CPU costs involved in processing the page contents don't change. Since our cost unit is defined as 1.0 = one sequential page fetch, you have to increase the cpu_xxx numbers instead of reducing the I/O cost estimate. I would recommend inflating all the cpu_xxx costs by the same factor, unless you have evidence that they are wrong in relation to each other. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 18 10:25:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 5DC7DCB576 for ; Fri, 18 Jul 2003 13:25:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 93813-05 for ; Fri, 18 Jul 2003 13:25:51 +0000 (GMT) Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) by svr1.postgresql.org (Postfix) with ESMTP id 22E0FCCD21 for ; Fri, 18 Jul 2003 10:25:22 -0300 (ADT) Received: from ALGOL.sollentuna.se (janus-en.sollentuna.se [195.84.163.194]) by mx-2.sollentuna.net (Postfix) with ESMTP id 8908E34068 for ; Fri, 18 Jul 2003 16:25:51 +0200 (CEST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: Re: Hardware performance Date: Fri, 18 Jul 2003 15:25:54 +0200 Message-ID: <6BCB9D8A16AC4241919521715F4D8BCE16F96B@algol.sollentuna.se> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Hardware performance Thread-Index: AcNNFiOa76J0U/aNShucWYrzN3HedQAGczUw From: "Magnus Hagander" To: "PgSQL Performance ML" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/291 X-Sequence-Number: 2584 > > >Adam Witney wrote: > [snip] > > If you would go with that one, make sure to get the optional BBWC=20 > > (Battery Backed Write Cache). Without it the controller=20 > won't enable=20 > > the write-back cache (which it really shouldn't, since it=20 > wouldn't be=20 > > safe without the batteries). WB cache can really speed things on in=20 > > many db situations - it's sort of like "speed of fsync off,=20 > security=20 > > of fsync on". I've seen huge speedups with both postgresql=20 > and other=20 > > databases on that. >=20 > Don't forget to check the batteries!!! And if you have an=20 > HPaq service contract, don't rely on them to do it... That's what management software is for.. :-) (Yes, it does check the batteries. They are also reported on reboot, but you don't want to do that often, of course) Under the service contract, HP will *replace* the batteries for free, though - but you have to know when to replace them. //Magnus From pgsql-performance-owner@postgresql.org Fri Jul 18 10:30:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 89767CCD10 for ; Fri, 18 Jul 2003 13:30:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 14635-03 for ; Fri, 18 Jul 2003 13:31:06 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 6A76FCCD0C for ; Fri, 18 Jul 2003 10:30:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6IDV8Q3023423; Fri, 18 Jul 2003 09:31:08 -0400 (EDT) To: Martin Foster Cc: PostgreSQL Performance Subject: Re: Clearing rows periodically In-reply-to: <3F1799D0.1010009@ethereal-realms.org> References: <3F13E18A.21241.4B86CB0@localhost> <3F17E2A2.28685.45CC782@localhost> <3F1799D0.1010009@ethereal-realms.org> Comments: In-reply-to Martin Foster message dated "Fri, 18 Jul 2003 00:55:12 -0600" Date: Fri, 18 Jul 2003 09:31:07 -0400 Message-ID: <23422.1058535067@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/292 X-Sequence-Number: 2585 Martin Foster writes: > My question is, should the purging of rows be done more often then once > a day for both tables. Is this why performance seems to take a hit > specifically? Given that the hourly purge seems to work well for you, I'd suggest trying it on both tables. Non-FULL vacuum is intended to be run *frequently*, say as often as you've updated or deleted 10% to 50% of the rows in a table. Delaying it until you've had multiple complete turnovers of the table contents will cost you. > As there were too many rows purged for vacuum to > accurately keep track of? Only possible if you don't have the FSM parameters set high enough. Infrequent vacuuming means you need more FSM space, btw. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jul 18 11:20:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B4452CCD1F for ; Fri, 18 Jul 2003 14:18:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 24243-06 for ; Fri, 18 Jul 2003 14:19:16 +0000 (GMT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 41F6ECCD3B for ; Fri, 18 Jul 2003 11:18:43 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6IEHuSZ000201; Fri, 18 Jul 2003 08:17:56 -0600 (MDT) Date: Fri, 18 Jul 2003 08:09:22 -0600 (MDT) From: "scott.marlowe" To: Tom Lane Cc: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= , Fabian Kreitner , Subject: Re: index / sequential scan problem In-Reply-To: <23376.1058534698@sss.pgh.pa.us> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/293 X-Sequence-Number: 2586 On Fri, 18 Jul 2003, Tom Lane wrote: > =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= writes: > > On Fri, 18 Jul 2003, Fabian Kreitner wrote: > >> Adjusting the cpu_tuple_cost to 0.042 got the planner to choose the index. > > > Doesn't sound very good and it will most likely make other queries slower. > > Seems like a reasonable approach to me --- certainly better than setting > random_page_cost to physically nonsensical values. > > In a fully-cached situation it's entirely reasonable to inflate the > various cpu_xxx costs, since by assumption you are not paying the normal > price of physical disk I/O. Fetching a page from kernel buffer cache > is certainly cheaper than getting it off the disk. But the CPU costs > involved in processing the page contents don't change. Since our cost > unit is defined as 1.0 = one sequential page fetch, you have to increase > the cpu_xxx numbers instead of reducing the I/O cost estimate. > > I would recommend inflating all the cpu_xxx costs by the same factor, > unless you have evidence that they are wrong in relation to each other. And don't forget to set effective_cache_size. It's the one I missed for the longest when I started. From pgsql-performance-owner@postgresql.org Fri Jul 18 11:32:53 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 764ABCCB1D for ; Fri, 18 Jul 2003 14:32:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 29765-02 for ; Fri, 18 Jul 2003 14:33:10 +0000 (GMT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id 13CB6CC00C for ; Fri, 18 Jul 2003 11:32:42 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6IEXE0P016039 for ; Fri, 18 Jul 2003 09:33:14 -0500 Reply-To: From: "Nick Fankhauser" To: "Pgsql-Performance@Postgresql. Org" Subject: File systems (RE: Sanity check requested) Date: Fri, 18 Jul 2003 09:31:46 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 In-Reply-To: <3F179CF6.5070400@bytecraft.com.my> Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/294 X-Sequence-Number: 2587 Thanks for the suggestions in the FS types- especially the Debian oriented info. I'll start by playing with the memory allocation parameters that I originally listed (seems like they should provide results in a way that is unaffected by the disk IO). Then once I have them at optimal values, move on to trying different file systems. I assume that as I make changes that affect the disk IO performance, I'll then need to do some testing to find new values for the IO cost for the planner- Do you folks have some ballpark numbers to start with for this based on your experience? I'm departing in three ways from the simple IDE model that (I presume) the default random page cost of 4 is based on- The disks are SCSI & RAID and the FS would be different. At this point, I can't think of any better way to test this than simply running my local test suite with various values and recording the wall-clock results. Is there a different approach that might make more sense? (This means that my results will be skewed to my environment, but I'll post them anyway.) I'll post results back to the list as I get to it- It might be a slow process Since I spend about 18 hours of each day keeping the business running, I'll have to cut back on sleep & do this in the other 10 hours. -NF > Shridhar Daithankar wrote: > I appreciate your approach but it almost proven that ext2 is > not the best and fastest out there. > > Agreed. > Ang Chin Han wrote: > We've been using ext3fs for our production systems. (Red Hat Advanced > Server 2.1) > > And since your (Nick) system is based on Debian, I have done some rough > testing on Debian sarge (testing) (with custom 2.4.20) with ext3fs, > reiserfs and jfs. Can't get XFS going easily on Debian, though. > > I used a single partition mkfs'd with ext3fs, reiserfs and jfs one after > the other on an IDE disk. Ran pgbench and osdb-x0.15-0 on it. > > jfs's has been underperforming for me. Somehow the CPU usage is higher > than the other two. As for ext3fs and reiserfs, I can't detect any > significant difference. So if you're in a hurry, it'll be easier to > convert your ext2 to ext3 (using tune2fs) and use that. Otherwise, it'd > be nice if you could do your own testing, and post it to the list. > > -- > Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 > GNU/Linux > 2:30pm up 204 days, 5:35, 5 users, load average: 5.50, 5.18, 5.13 > From pgsql-performance-owner@postgresql.org Fri Jul 18 12:51:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 682BECCD6C for ; Fri, 18 Jul 2003 15:51:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 35128-08 for ; Fri, 18 Jul 2003 15:51:30 +0000 (GMT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id B53EACCD6B for ; Fri, 18 Jul 2003 12:50:51 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6IFn4SZ012343; Fri, 18 Jul 2003 09:49:44 -0600 (MDT) Date: Fri, 18 Jul 2003 09:40:15 -0600 (MDT) From: "scott.marlowe" To: Ang Chin Han Cc: "Pgsql-Performance@Postgresql. Org" Subject: Re: Sanity check requested In-Reply-To: <3F179CF6.5070400@bytecraft.com.my> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/295 X-Sequence-Number: 2588 On Fri, 18 Jul 2003, Ang Chin Han wrote: > Shridhar Daithankar wrote: > > On 17 Jul 2003 at 10:41, Nick Fankhauser wrote: > > > >>I'm using ext2. For now, I'll leave this and the OS version alone. If I > > > > > > I appreciate your approach but it almost proven that ext2 is not the best and > > fastest out there. > > Agreed. Huh? How can journaled file systems hope to outrun a simple unjournaled file system? There's just less overhead for ext2 so it's quicker, it's just not as reliable. I point you to this link from IBM: http://www-124.ibm.com/developerworks/opensource/linuxperf/iozone/iozone.php While ext3 is a clear loser to jfs and rfs, ext2 wins most of the contests against both reiser and jfs. Note that xfs wasn't tested here. But in general, ext2 is quite fast nowadays. > > > IMO, you can safely change that to reiserfs or XFS. Or course, testing is > > always recommended. > > We've been using ext3fs for our production systems. (Red Hat Advanced > Server 2.1) > > And since your (Nick) system is based on Debian, I have done some rough > testing on Debian sarge (testing) (with custom 2.4.20) with ext3fs, > reiserfs and jfs. Can't get XFS going easily on Debian, though. > > I used a single partition mkfs'd with ext3fs, reiserfs and jfs one after > the other on an IDE disk. Ran pgbench and osdb-x0.15-0 on it. > > jfs's has been underperforming for me. Somehow the CPU usage is higher > than the other two. As for ext3fs and reiserfs, I can't detect any > significant difference. So if you're in a hurry, it'll be easier to > convert your ext2 to ext3 (using tune2fs) and use that. Otherwise, it'd > be nice if you could do your own testing, and post it to the list. I would like to see some tests on how they behave on top of large fast RAID arrays, like a 10 disk RAID5 or something. It's likely that on a single IDE drive the most limiting factor is the bandwidth of the drive, whereas on a large array, the limiting factor would likely be the file system code. From pgsql-performance-owner@postgresql.org Fri Jul 18 13:00:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id CC366CC00C for ; Fri, 18 Jul 2003 16:00:15 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 76893-01 for ; Fri, 18 Jul 2003 16:00:46 +0000 (GMT) Received: from mail2.mediadesign.nl (md2.mediadesign.nl [212.19.205.67]) by svr1.postgresql.org (Postfix) with SMTP id 1F9D9CCCE9 for ; Fri, 18 Jul 2003 13:00:12 -0300 (ADT) Received: (qmail 24973 invoked by uid 666); 18 Jul 2003 16:00:43 -0000 Date: Fri, 18 Jul 2003 18:00:43 +0200 From: Vincent van Leeuwen To: pgsql-performance@postgresql.org Subject: Re: Sanity check requested Message-ID: <20030718160042.GV21071@md2.mediadesign.nl> Mail-Followup-To: pgsql-performance@postgresql.org References: <3F13E18A.21241.4B86CB0@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/296 X-Sequence-Number: 2589 On 2003-07-17 10:41:35 -0500, Nick Fankhauser wrote: > I'm using ext2. For now, I'll leave this and the OS version alone. If I > I'd upgrade to a journaling filesystem as soon as possible for reliability. Testing in our own environment has shown that PostgreSQL performs best on ext3 (yes, better than XFS, JFS or ReiserFS) with a linux 2.4.21 kernel. Be sure to mount noatime and to create the ext3 partition with the correct stripe size of your RAID array using the '-R stride=foo' option (see man mke2fs). Vincent van Leeuwen Media Design - http://www.mediadesign.nl/ From pgsql-performance-owner@postgresql.org Fri Jul 18 13:09:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 277C7CCD6A for ; Fri, 18 Jul 2003 16:09:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 65795-06 for ; Fri, 18 Jul 2003 16:09:33 +0000 (GMT) Received: from megazone.bigpanda.com (unknown [66.180.233.26]) by svr1.postgresql.org (Postfix) with ESMTP id 9BB4ACCD62 for ; Fri, 18 Jul 2003 13:08:59 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 26E01D615; Fri, 18 Jul 2003 09:09:32 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 1C8715C10; Fri, 18 Jul 2003 09:09:32 -0700 (PDT) Date: Fri, 18 Jul 2003 09:09:31 -0700 (PDT) From: Stephan Szabo To: Rajesh Kumar Mallah Cc: Subject: Re: Yet another slow join query.. In-Reply-To: <200307181821.21329.mallah@trade-india.com> Message-ID: <20030718090729.Y95696-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/297 X-Sequence-Number: 2590 On Fri, 18 Jul 2003, Rajesh Kumar Mallah wrote: > Hi All, > > data_bank.updated_profiles and public.city_master are small tables > with 21790 and 49303 records repectively. both have indexes on the join > column. in first one on (city,source) and in second one on (city) > > The query below does not return for long durations > 10 mins. > > explain analyze select b.state,a.city from data_bank.updated_profiles a join > public.city_master b using(city) where source='BRANDING' and a.state is NULL > and b.country='India' ; > > > simple explain returns below. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Nested Loop (cost=0.00..83506.31 rows=14 width=35) > Join Filter: ("outer".city = ("inner".city)::text) > -> Seq Scan on updated_profiles a (cost=0.00..1376.39 rows=89 width=11) > Filter: ((source = 'BRANDING'::character varying) AND (state IS NULL)) > -> Index Scan using city_master_temp1 on city_master b (cost=0.00..854.87 > rows=5603 width=24) > Filter: (country = 'India'::character varying) > (6 rows) How many rows actually meet the filter conditions on updated_profiles and city_master? Are the two city columns of the same type? From pgsql-performance-owner@postgresql.org Fri Jul 18 13:18:29 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 6AF2ECCD77 for ; Fri, 18 Jul 2003 16:18:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 80377-02 for ; Fri, 18 Jul 2003 16:18:56 +0000 (GMT) Received: from deun2kex01.REALGARANT.DE (mail.realgarant.de [195.143.134.176]) by svr1.postgresql.org (Postfix) with ESMTP id B59BBCCD6F for ; Fri, 18 Jul 2003 13:18:22 -0300 (ADT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: Re: Sanity check requested Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Date: Fri, 18 Jul 2003 18:20:55 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sanity check requested Thread-Index: AcNNRg0eL7py0gX9RSGL04vop2pB7wAAjTwg From: "Oliver Scheit" To: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/298 X-Sequence-Number: 2591 > Be sure to mount noatime=20 I did "chattr -R +A /var/lib/pgsql/data" that should do the trick as well or am I wrong? regards, Oli From pgsql-performance-owner@postgresql.org Fri Jul 18 13:28:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 8BB3ACCD6F for ; Fri, 18 Jul 2003 16:28:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 40526-08 for ; Fri, 18 Jul 2003 16:29:06 +0000 (GMT) Received: from mail2.mediadesign.nl (md2.mediadesign.nl [212.19.205.67]) by svr1.postgresql.org (Postfix) with SMTP id 49917CCD6C for ; Fri, 18 Jul 2003 13:28:32 -0300 (ADT) Received: (qmail 795 invoked by uid 666); 18 Jul 2003 16:28:55 -0000 Date: Fri, 18 Jul 2003 18:28:55 +0200 From: Vincent van Leeuwen To: pgsql-performance@postgresql.org Subject: Re: Sanity check requested Message-ID: <20030718162854.GW21071@md2.mediadesign.nl> Mail-Followup-To: pgsql-performance@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/299 X-Sequence-Number: 2592 On 2003-07-18 18:20:55 +0200, Oliver Scheit wrote: > > Be sure to mount noatime > > I did "chattr -R +A /var/lib/pgsql/data" > that should do the trick as well or am I wrong? > According to the man page it gives the same effect. There are a few things you should consider though: - new files won't be created with the same options (I think), so you'll have to run this command as a daily cronjob or something to that effect - chattr is probably more filesystem-specific than a noatime mount, although this isn't a problem on ext[23] ofcourse Vincent van Leeuwen Media Design - http://www.mediadesign.nl/ From pgsql-performance-owner@postgresql.org Fri Jul 18 13:40:47 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id ACA22CCD8C for ; Fri, 18 Jul 2003 16:39:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 86782-01 for ; Fri, 18 Jul 2003 16:40:29 +0000 (GMT) Received: from deun2kex01.REALGARANT.DE (mail.realgarant.de [195.143.134.176]) by svr1.postgresql.org (Postfix) with ESMTP id 4C399CCD81 for ; Fri, 18 Jul 2003 13:39:55 -0300 (ADT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: Re: Sanity check requested Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Date: Fri, 18 Jul 2003 18:42:26 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Sanity check requested Thread-Index: AcNNSgZc3gDWmGArTKupuecP8JAMegAAKrNA From: "Oliver Scheit" To: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/300 X-Sequence-Number: 2593 >> > Be sure to mount noatime=20 >>=20 >> I did "chattr -R +A /var/lib/pgsql/data" >> that should do the trick as well or am I wrong? >>=20 > > According to the man page it gives the same effect. > There are a few things you should consider though: > - new files won't be created with the same options (I think), > so you'll have to run this command as a daily cronjob or > something to that effect This would be a really interesting point to know. I will look into this. I think the advantage of "chattr" is that the last access time is still available for the rest of the filesystem. (Of course you could have your own filesystem just for the database stuff, in this case the advantage would be obsolete) regards, Oli From pgsql-performance-owner@postgresql.org Fri Jul 18 14:40:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id A69D8CCD78 for ; Fri, 18 Jul 2003 17:40:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 00750-01 for ; Fri, 18 Jul 2003 17:40:54 +0000 (GMT) Received: from trade-india.com (ns1.trade-india.com [66.234.10.14]) by svr1.postgresql.org (Postfix) with SMTP id E5146CCD6F for ; Fri, 18 Jul 2003 14:40:20 -0300 (ADT) Received: (qmail 7212 invoked by uid 505); 18 Jul 2003 17:41:11 -0000 Received: from mallah@trade-india.com by ns1.trade-india.com by uid 502 with qmail-scanner-1.16 (clamscan: 0.54. spamassassin: 2.54. Clear:SA:0(-98.5/5.0):. Processed in 0.594262 secs); 18 Jul 2003 17:41:11 -0000 Received: from ns1.trade-india.com (HELO trade-india.com) (66.234.10.14) by ns1.trade-india.com with SMTP; 18 Jul 2003 17:41:10 -0000 Received: from 219.65.236.165 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Fri, 18 Jul 2003 23:11:10 +0530 (IST) Message-ID: <1062.219.65.236.165.1058550070.squirrel@mail.trade-india.com> Date: Fri, 18 Jul 2003 23:11:10 +0530 (IST) Subject: Re: Yet another slow join query.. [ SOLVED ] From: To: In-Reply-To: <20030718090729.Y95696-100000@megazone.bigpanda.com> References: <200307181821.21329.mallah@trade-india.com> <20030718090729.Y95696-100000@megazone.bigpanda.com> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) 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-Archive-Number: 200307/301 X-Sequence-Number: 2594 The Types of the join columns were different text vs varchar(100), now its working fine and using a Hash Join Thanks once again. regds mallah. explain analyze select b.state,a.city from data_bank.updated_profiles a join public.city_master b using(city) where source='BRANDING' and a.state is NULL and b.country='India' ; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=2806.09..3949.37 rows=28 width=92) (actual time=183.05..326.52 rows=18285 loops=1) Hash Cond: ("outer".city = "inner".city) -> Index Scan using city_master_temp1 on city_master b (cost=0.00..854.87 rows=5603 width=24) (actual time=0.17..45.70 rows=5603 loops=1) Filter: (country = 'India'::character varying) -> Hash (cost=2805.65..2805.65 rows=178 width=68) (actual time=181.74..181.74 rows=0 loops=1) -> Seq Scan on updated_profiles a (cost=0.00..2805.65 rows=178 width=68) (actual time=20.53..149.66 rows=17537 loops=1) Filter: ((source = 'BRANDING'::character varying) AND (state IS NULL)) Total runtime: 348.50 msec (8 rows) > On Fri, 18 Jul 2003, Rajesh Kumar Mallah wrote: > >> Hi All, >> >> data_bank.updated_profiles and public.city_master are small tables >> with 21790 and 49303 records repectively. both have indexes on the >> join column. in first one on (city,source) and in second one on (city) >> >> The query below does not return for long durations > 10 mins. >> >> explain analyze select b.state,a.city from data_bank.updated_profiles >> a join public.city_master b using(city) where source='BRANDING' and >> a.state is NULL and b.country='India' ; >> >> >> simple explain returns below. >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> Nested Loop (cost=0.00..83506.31 rows=14 width=35) >> Join Filter: ("outer".city = ("inner".city)::text) >> -> Seq Scan on updated_profiles a (cost=0.00..1376.39 rows=89 >> width=11) >> Filter: ((source = 'BRANDING'::character varying) AND (state >> IS NULL)) >> -> Index Scan using city_master_temp1 on city_master b >> (cost=0.00..854.87 >> rows=5603 width=24) >> Filter: (country = 'India'::character varying) >> (6 rows) > > How many rows actually meet the filter conditions on updated_profiles > and city_master? Are the two city columns of the same type? ----------------------------------------- Over 1,00,000 exporters are waiting for your order! Click below to get in touch with leading Indian exporters listed in the premier trade directory Exporters Yellow Pages. http://www.trade-india.com/dyn/gdh/eyp/ From pgsql-performance-owner@postgresql.org Fri Jul 18 15:43:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 30C1BCCBD1 for ; Fri, 18 Jul 2003 18:43:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 85035-10 for ; Fri, 18 Jul 2003 18:43:44 +0000 (GMT) Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 7510CCBA17 for ; Fri, 18 Jul 2003 15:43:11 -0300 (ADT) Received: from zigo.dhs.org (zigo [127.0.0.1]) by zigo.dhs.org (8.12.8/8.12.8) with ESMTP id h6IIhhWK024928; Fri, 18 Jul 2003 20:43:43 +0200 Received: from localhost (db@localhost) by zigo.dhs.org (8.12.8/8.12.8/Submit) with ESMTP id h6IIhfe4024924; Fri, 18 Jul 2003 20:43:41 +0200 Date: Fri, 18 Jul 2003 20:43:41 +0200 (CEST) From: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= To: Tom Lane Cc: Fabian Kreitner , Subject: Re: index / sequential scan problem In-Reply-To: <23376.1058534698@sss.pgh.pa.us> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/302 X-Sequence-Number: 2595 On Fri, 18 Jul 2003, Tom Lane wrote: > >> Adjusting the cpu_tuple_cost to 0.042 got the planner to choose the index. > > > Doesn't sound very good and it will most likely make other queries slower. > > Seems like a reasonable approach to me --- certainly better than setting > random_page_cost to physically nonsensical values. Hehe, just before this letter there was talk about changing random_page_cost. I kind of responed that 0.042 is not a good random page cost. But now of course I can see that it says cpu_tuple_cost :-) Sorry for adding confusion. -- /Dennis From pgsql-performance-owner@postgresql.org Fri Jul 18 16:03:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 7605CCCAA4 for ; Fri, 18 Jul 2003 19:03:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 69546-08 for ; Fri, 18 Jul 2003 19:03:29 +0000 (GMT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id BE05ECBA17 for ; Fri, 18 Jul 2003 16:02:56 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6IJ3P0P019603; Fri, 18 Jul 2003 14:03:25 -0500 Reply-To: From: "Nick Fankhauser" To: Cc: , "Vincent van Leeuwen" Subject: Re: Sanity check requested Date: Fri, 18 Jul 2003 14:01:57 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <20030718160042.GV21071@md2.mediadesign.nl> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/303 X-Sequence-Number: 2596 I'm confused: Ang Chin Han wrote: > We've been using ext3fs for our production systems. (Red Hat Advanced > Server 2.1) Vincent van Leeuwen wrote: > I'd upgrade to a journaling filesystem as soon as possible for > reliability. ...About one year ago I considered moving to a journaling file system, but opted not to because it seems like that's what WAL does for us already. How does putting a journaling file system under it add more reliability? I also guessed that a journaling file system would add overhead because now a write to the WAL file could itself be deferred and logged elsewhere. ...So now I'm really puzzled because folks are weighing in with solid anecdotal evidence saying that I'll get both better reliability and performance. Can someone explain what I'm missing about the concept? -A puzzled Nick From pgsql-performance-owner@postgresql.org Fri Jul 18 16:07:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 3CB61CCDB7 for ; Fri, 18 Jul 2003 19:07:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 15590-03 for ; Fri, 18 Jul 2003 19:07:57 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id F0F1ACCDB0 for ; Fri, 18 Jul 2003 16:07:24 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3229373; Fri, 18 Jul 2003 12:08:13 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: , Subject: Re: Sanity check requested Date: Fri, 18 Jul 2003 12:07:00 -0700 User-Agent: KMail/1.4.3 Cc: , "Vincent van Leeuwen" References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307181207.00746.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/304 X-Sequence-Number: 2597 Nick, > ...About one year ago I considered moving to a journaling file system, but > opted not to because it seems like that's what WAL does for us already. H= ow > does putting a journaling file system under it add more reliability? It lets you restart your server quickly after an unexpected power-out. Ext= 2=20 is notoriously bad about this. Also, WAL cannot necessarily recover properly if the underlying filesystem = is=20 corrupted. > I also guessed that a journaling file system would add overhead because n= ow > a write to the WAL file could itself be deferred and logged elsewhere. You are correct. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 18 16:11:49 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 13094CBA17 for ; Fri, 18 Jul 2003 19:11:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 76968-03 for ; Fri, 18 Jul 2003 19:12:10 +0000 (GMT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id EE596CCDAE for ; Fri, 18 Jul 2003 16:11:37 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 99D351025B; Fri, 18 Jul 2003 15:05:15 -0400 (EDT) Received: from [10.0.2.7] (unknown [10.0.2.7]) by mailav.tor1.inquent.com (Postfix) with ESMTP id B33AA10248; Fri, 18 Jul 2003 15:05:13 -0400 (EDT) Subject: Re: Sanity check requested From: Rod Taylor To: nickf@ontko.com Cc: Postgresql Performance , angch@bytecraft.com.my, Vincent van Leeuwen In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-mDqbai3k1GKtOcD0uZGT" Message-Id: <1058555567.31093.22.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 18 Jul 2003 19:12:47 +0000 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/305 X-Sequence-Number: 2598 --=-mDqbai3k1GKtOcD0uZGT Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > ...About one year ago I considered moving to a journaling file system, but > opted not to because it seems like that's what WAL does for us already. H= ow > does putting a journaling file system under it add more reliability? WAL only works if the WAL files are actually written to disk and can be read off it again. Ext2 has a number of deficiencies which can cause problems with this basic operation (inode corruptions, etc). Journaling does not directly help. --=-mDqbai3k1GKtOcD0uZGT Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/GEau6DETLow6vwwRAqB3AJ9/tgLKvLBqPCpSkhAIguxAi4qDLgCfQ4JW hgW2asTrLTpx8GjJvC2Kpz0= =RR+9 -----END PGP SIGNATURE----- --=-mDqbai3k1GKtOcD0uZGT-- From pgsql-performance-owner@postgresql.org Fri Jul 18 18:48:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 37785CCE04 for ; Fri, 18 Jul 2003 21:48:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 45498-07 for ; Fri, 18 Jul 2003 21:49:23 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id AE878CCE1A for ; Fri, 18 Jul 2003 18:48:51 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6ILnJQ3005894; Fri, 18 Jul 2003 17:49:19 -0400 (EDT) To: nickf@ontko.com Cc: "Pgsql-Performance@Postgresql. Org" Subject: Re: File systems (RE: Sanity check requested) In-reply-to: References: Comments: In-reply-to "Nick Fankhauser" message dated "Fri, 18 Jul 2003 09:31:46 -0500" Date: Fri, 18 Jul 2003 17:49:19 -0400 Message-ID: <5893.1058564959@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/306 X-Sequence-Number: 2599 "Nick Fankhauser" writes: > I'm departing in three ways from the simple IDE > model that (I presume) the default random page cost of 4 is based on- The > disks are SCSI & RAID and the FS would be different. Actually, the default 4 is based on experiments I did quite awhile back on HPUX (with a SCSI disk) and Linux (with an IDE disk, and a different filesystem). I didn't see too much difference between 'em. RAID might alter the equation, or not. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jul 19 18:21:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id E252FCBFF1 for ; Sat, 19 Jul 2003 21:21:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 89292-05 for ; Sat, 19 Jul 2003 21:21:43 +0000 (GMT) Received: from mail.blarg.net (zoot.blarg.net [206.124.128.9]) by svr1.postgresql.org (Postfix) with ESMTP id B51D8CB516 for ; Sat, 19 Jul 2003 18:21:08 -0300 (ADT) Received: from poindextrose.org (poindextrose.org [206.124.144.246]) by mail.blarg.net (Postfix) with ESMTP id 68E0733A14 for ; Sat, 19 Jul 2003 14:21:44 -0700 (PDT) Date: Sat, 19 Jul 2003 14:21:42 -0700 Mime-Version: 1.0 (Apple Message framework v552) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: storing files in Postgres From: Matthew Hixson To: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit Message-Id: X-Mailer: Apple Mail (2.552) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/307 X-Sequence-Number: 2600 I currently have a J2EE app that allows our users to upload files. The actual file gets stored on the same disk as the webserver is running on, while the information they entered about the file gets stored in the database. We now need to move the database to a different machine and I'm wondering if we should just start storing the files as BLOBs while we're at it so that the files and their data all stay together. This would make moving the database and backing up the data a lot easier. So, I'm wondering how many people out there are using Postgres to store binary data. Our new database server is Linux running on a dual Xeon 2.6Ghz with 1GB of RAM and two 36GB 10K RPM Ultra 320 SCSI hard drives in RAID 0. The files we're storing are small images and ringtones for cell phones. The average file size is about 40KB. I had originally chosen to store the files outside the database because I thought there was a need to be able to browse those files outside of the J2EE app. That turned out to not be the case. I also didn't realize how small these files were going to be. The total size of our file directory is 775MB. Should I have any concern that Postgres is going to have problems with handling that many files or that much data for the machine I described above? Thanks, -M@ From pgsql-performance-owner@postgresql.org Sat Jul 19 18:23:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 1C7A8CBFF1 for ; Sat, 19 Jul 2003 21:22:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 89292-06 for ; Sat, 19 Jul 2003 21:22:46 +0000 (GMT) Received: from ctg-msnex01.staff.berbee.com (msn-office1.binc.net [64.73.12.254]) by svr1.postgresql.org (Postfix) with ESMTP id 79482CB516 for ; Sat, 19 Jul 2003 18:22:11 -0300 (ADT) Received: from localhost ([172.30.254.220] RDNS failed) by ctg-msnex01.staff.berbee.com with Microsoft SMTPSVC(5.0.2195.5329); Sat, 19 Jul 2003 16:22:47 -0500 From: "Jeremy M. Guthrie" Reply-To: jeremy.guthrie@berbee.com Organization: Berbee Information Networks To: pgsql-performance@postgresql.org Subject: Poor delete performance AFTER vacuum analyze Date: Sat, 19 Jul 2003 16:22:40 -0500 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200307191622.46709.jeremy.guthrie@berbee.com> X-OriginalArrivalTime: 19 Jul 2003 21:22:47.0847 (UTC) FILETIME=[E6C8EB70:01C34E3B] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/308 X-Sequence-Number: 2601 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I have an application I wrote that uses two tables heavily. The first tab= le=20 is a queue table, the second table is an archive table. The queue table is= =20 constantly taking on new records at the rate of 10/second. My software pul= ls=20 the logs from the queue table, processes them, moves them to the archive=20 table, and then deletes the processed entries from the queue table. Symptoms: My system will run great after a full vacuum(as I would expect). It will = run=20 all day long taking only 3-5 seconds to run and deal with approximately=20 100megs of new data each day. However, the instant the system finishes onl= y=20 a 'vacuum analyze', the whole thing slows WAY down to where each run can ta= ke=20 10-15 minutes. ie. After a full analyze vacuum, my software will load, process, move, an= d=20 delete in under 3-4 seconds. After a analyze vacuum(notice: not full), it= =20 can load, process and move data in 3-5 seconds but the delete takes 10-15= =20 minutes! I submit the delete as one transaction to clear out the records= =20 processed. Trunactae won't work because other records are coming in while = I=20 process data. Mind you the archive table is 15 million records while the= =20 temporary table is maybe 10-20,000 records.=20 Now I just rewrote a portion of my application to change its behavior. Wh= at=20 it did before was that it would pile through a 10 gig archive table,=20 processed logs, etc... in about 3 minutes but I did not delete in the same= =20 way because everything is already in one table. My software has to run eve= ry=20 five minutes so the three minute runtime is getting close for process=20 overlap(yuck).=20 Recap The old system didn't delete records but plowed through the 10 gig db and= =20 takes 3 1/2 minutes to do its job. The new system flies through the smalle= r=20 queue table(100-200k) but it dies after conducting a non-full vacuum. Is the planner just that much better at analyzing a full then an regular= =20 analyze or is there something else I'm missing? The Box: The DB is a dual P4 2.4ghz Xeon w/ 1.5 gig of RAM. IBM 335 w/ 36gig mirror= ed. kernel.shmmax =3D 1342177280 shared_buffers =3D 115200 # 2*max_connections, min 16 sort_mem =3D 65536 # min 32 vacuum_mem =3D 196608 # min 1024 fsync =3D false - --=20 Jeremy M. Guthrie Systems Engineer Berbee 5520 Research Park Dr. Madison, WI 53711 Phone: 608-298-1061 Berbee...Decade 1. 1993-2003 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/GbajqtjaBHGZBeURAkKiAJ9zaqQISD47XycRcSgDKbNeuqqaKQCfcgim yCdaycBg4+99Epd7EuAAxsE=3D =3D9xlS -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Sun Jul 20 03:17:47 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 48553CD137 for ; Sun, 20 Jul 2003 04:44:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 80604-06 for ; Sun, 20 Jul 2003 04:44:55 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 78BD3CD135 for ; Sun, 20 Jul 2003 01:44:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6K4ipQ3019930; Sun, 20 Jul 2003 00:44:51 -0400 (EDT) To: jeremy.guthrie@berbee.com Cc: pgsql-performance@postgresql.org Subject: Re: Poor delete performance AFTER vacuum analyze In-reply-to: <200307191622.46709.jeremy.guthrie@berbee.com> References: <200307191622.46709.jeremy.guthrie@berbee.com> Comments: In-reply-to "Jeremy M. Guthrie" message dated "Sat, 19 Jul 2003 16:22:40 -0500" Date: Sun, 20 Jul 2003 00:44:51 -0400 Message-ID: <19929.1058676291@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/309 X-Sequence-Number: 2602 "Jeremy M. Guthrie" writes: > My system will run great after a full vacuum(as I would expect). It will run > all day long taking only 3-5 seconds to run and deal with approximately > 100megs of new data each day. However, the instant the system finishes only > a 'vacuum analyze', the whole thing slows WAY down to where each run can take > 10-15 minutes. Could we see EXPLAIN ANALYZE for the deletion query in both the fast and slow states? regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jul 20 03:34:38 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 4C866CD16B for ; Sun, 20 Jul 2003 05:41:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 06542-01 for ; Sun, 20 Jul 2003 05:42:14 +0000 (GMT) Received: from zigo.dhs.org (as2-4-3.an.g.bonet.se [194.236.34.191]) by svr1.postgresql.org (Postfix) with ESMTP id 8DA91CD162 for ; Sun, 20 Jul 2003 02:41:36 -0300 (ADT) Received: from zigo.dhs.org (zigo [127.0.0.1]) by zigo.dhs.org (8.12.8/8.12.8) with ESMTP id h6K5g8WK015503; Sun, 20 Jul 2003 07:42:08 +0200 Received: from localhost (db@localhost) by zigo.dhs.org (8.12.8/8.12.8/Submit) with ESMTP id h6K5g782015499; Sun, 20 Jul 2003 07:42:07 +0200 Date: Sun, 20 Jul 2003 07:42:07 +0200 (CEST) From: =?ISO-8859-1?Q?Dennis_Bj=F6rklund?= To: "Jeremy M. Guthrie" Cc: pgsql-performance@postgresql.org Subject: Re: Poor delete performance AFTER vacuum analyze In-Reply-To: <200307191622.46709.jeremy.guthrie@berbee.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/310 X-Sequence-Number: 2603 On Sat, 19 Jul 2003, Jeremy M. Guthrie wrote: > 100megs of new data each day. However, the instant the system finishes only > a 'vacuum analyze', the whole thing slows WAY down to where each run can take > 10-15 minutes. Have you run EXPLAIN ANALYZE on the delete query before and after the vacuum? Does it explain why it goes slower? -- /Dennis From pgsql-performance-owner@postgresql.org Sun Jul 20 16:21:36 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 13807CD211 for ; Sun, 20 Jul 2003 19:20:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 37959-01 for ; Sun, 20 Jul 2003 19:20:42 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 71E56CC305 for ; Sun, 20 Jul 2003 16:20:03 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6KJKQL10578; Sun, 20 Jul 2003 15:20:26 -0400 (EDT) From: Bruce Momjian Message-Id: <200307201920.h6KJKQL10578@candle.pha.pa.us> Subject: Re: Moving postgresql.conf tunables into 2003... In-Reply-To: <20030709233031.GF72567@perrin.int.nxad.com> To: Sean Chittenden Date: Sun, 20 Jul 2003 15:20:26 -0400 (EDT) Cc: Michael Mattox , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/312 X-Sequence-Number: 2605 Keep in mind that if we auto-tune, we will only be able to do it for some platforms, so we will need a table that shows which settings are autotuned for each platform. --------------------------------------------------------------------------- Sean Chittenden wrote: > > I don't have much to add because I'm pretty new to Postgres and have > > been soliciting advice here recently, but I totally agree with > > everything you said. I don't mind if it's in the postgres.conf file > > or in a faq that is easy to find, I just would like it to be in one > > place. A good example of the need for this is when I was tuning > > "effective_cache" I thought that was creating a cache for Postgres > > when in fact as it was pointed out to me, it's just hinting to > > postgres the size of the OS cache. Lots of ways for people to get > > really confused here. > > I looked through the src/doc/runtime.sgml for a good place to stick > this and couldn't find a place that this seemed appropriate, but on > FreeBSD, this can be determined with a great deal of precision in a > programmatic manner: > > echo "effective_cache_size = $((`sysctl -n vfs.hibufspace` / 8192))" > > The same OID is available via C too. It'd be slick if PostgreSQL > could tune itself (on FreeBSD) at initdb time with the above code. If > Linux exports this info via /proc and can whip out the appropriate > magic, even better. An uncommented out good guess that shows up in > postgresql.conf would be stellar and quite possible with the use of > sed. > > Maybe an initdb switch could be added to have initdb tune the config > it generates? If a -n is added, have it generate a config and toss it > to stdout? > > > case `uname` in > "FreeBSD") > echo "effective_cache_size = $((`sysctl -n vfs.hibufspace` / 8192))" > ;; > *) > echo "Unable to automatically determine the effective cache size" >> /dev/stderr > ;; > esac > > > -sc > > -- > Sean Chittenden > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- 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 Sun Jul 20 16:20:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 9EF68CD2A2 for ; Sun, 20 Jul 2003 19:20:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 37959-02 for ; Sun, 20 Jul 2003 19:21:17 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id B8A4BCD2A1 for ; Sun, 20 Jul 2003 16:20:38 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6KJL6a10673; Sun, 20 Jul 2003 15:21:06 -0400 (EDT) From: Bruce Momjian Message-Id: <200307201921.h6KJL6a10673@candle.pha.pa.us> Subject: Re: Moving postgresql.conf tunables into 2003... In-Reply-To: To: Michael Pohl Date: Sun, 20 Jul 2003 15:21:06 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/311 X-Sequence-Number: 2604 Michael Pohl wrote: > On Sun, 6 Jul 2003, Matthew Nuzum wrote: > > > At the very least, if there is good documentation for these parameters, > > maybe the conf file should provide a link to this info. > > I believe that is what Josh is proposing: > > http://archives.postgresql.org/pgsql-performance/2003-07/msg00102.php > > > [Apache httpd] uses a three phase (if not more) documentation level. > > The .conf file contains detailed instructions in an easy to read and > > not-to-jargon-ish structure. The docs provide detailed tutorials and > > papers that expand on configuration params in an easy to read format. > > Both of these refer to the thorough reference manual that breaks each > > possible option down into it's nitty gritty details so that a user can > > get more information if they so desire. > > I agree that Apache's approach is primo. Often the .conf comments are > enough to jog my memory about a directive I haven't used for a while. Or > the comments are enough to let me know I don't need a directive, or that I > need to go to the manual and read more. I appreciate that. Isn't that what we have now --- isn't postgresql.conf clear enough to jog people's memory. -- 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 Sun Jul 20 20:23:29 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id DC371D1C509 for ; Sun, 20 Jul 2003 23:23:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 68208-08 for ; Sun, 20 Jul 2003 23:23:23 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id A341AD1C508 for ; Sun, 20 Jul 2003 20:23:22 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6KNN8M00166; Sun, 20 Jul 2003 19:23:08 -0400 (EDT) From: Bruce Momjian Message-Id: <200307202323.h6KNN8M00166@candle.pha.pa.us> Subject: Re: PostgreSQL vs. MySQL In-Reply-To: To: "scott.marlowe" Date: Sun, 20 Jul 2003 19:23:08 -0400 (EDT) Cc: Brian Tarbox , michael.mattox@verideon.com, Rafal Kedziorski , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/313 X-Sequence-Number: 2606 I think the issue with multiple users is that a car is good for moving a few people, but it can't move lots of large boxes. A truck can move large boxes, but it can't move a few people efficiently. PostgreSQL is more like a truck, while MySQL is more like a car. As an aside, I think Solaris is slower than other OS's because it is built to scale efficiently to many CPU's, and that takes a performance hit in a machine with just a few CPU's, though they are working on tuning those cases. Of course, this is all just a generalization. --------------------------------------------------------------------------- scott.marlowe wrote: > On Fri, 4 Jul 2003, Brian Tarbox wrote: > > > I'm actually leaving this list but I can answer this question. Our results > > were with a single user and we were running Inodb. We were running on > > RedHat 8.0 / 9.0 with vanilla linux settings. > > Hi Brian, I just wanted to add that if you aren't testing your setup for > multiple users, you are doing yourself a disservice. The performance of > your app with one user is somewhat interesting, the performance of the > system with a dozen or a hundred users is of paramount importance. > > A server that dies under heavy parallel load is useless, no matter how > fast it ran when tested for one user. Conversely, one would prefer a > server that was a little slow for single users but can hold up under load. > > When I first built my test box a few years ago, I tested postgresql / > apache / php at 100 or more parallel users. That's where things start > getting ugly, and you've got to test for it now, before you commit to a > platform. > > Postgresql is designed to work on anything out of the box, which means > it's not optimized for high performance, but for running on old Sparc 2s > with 128 meg of ram. If you're going to test it against MySQL, be fair to > yourself and performance tune them both before testing, they're > performance on vanilla linux with vanilla configuration tuning teachs you > little about how they'll behave in production on heavy iron. > > Good luck on your testing, and please, don't quit testing at the first > sign one or the other is faster, be throrough and complete, including > heavy parallel load testing with reads AND writes. Know the point at > which each system begins to fail / become unresponsive, and how they > behave in overload. > > > > ---------------------------(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 Sun Jul 20 20:24:36 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7854DD1C7F4 for ; Sun, 20 Jul 2003 23:24:33 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 68493-06 for ; Sun, 20 Jul 2003 23:24:32 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id AF686D1C509 for ; Sun, 20 Jul 2003 20:24:31 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6KNONg00291; Sun, 20 Jul 2003 19:24:23 -0400 (EDT) From: Bruce Momjian Message-Id: <200307202324.h6KNONg00291@candle.pha.pa.us> Subject: Re: PostgreSQL vs. MySQL In-Reply-To: <000d01c344b3$db2add00$01000001@trouble> To: Brian Tarbox Date: Sun, 20 Jul 2003 19:24:23 -0400 (EDT) Cc: "scott.marlowe" , Brian Tarbox , michael.mattox@verideon.com, Rafal Kedziorski , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/314 X-Sequence-Number: 2607 Brian Tarbox wrote: > Oddly enough, the particular application in question will have an extremely > small user base...perhaps a few simultainous users at most. > > As to the testing, I neglected to say early in this thread that my manager > instructed me _not_ to do further performance testing...so as a good > consultant I complied. I'm not going to touch if that was a smart > instruction to give :-) Performance is probably 'good enough', and you can revisit it later when you have more time. -- 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 Sun Jul 20 20:51:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 4D100D1C50A for ; Sun, 20 Jul 2003 23:51:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 84495-01 for ; Sun, 20 Jul 2003 23:51:38 +0000 (GMT) Received: from ctg-msnex01.staff.berbee.com (msn-office1.binc.net [64.73.12.254]) by svr1.postgresql.org (Postfix) with ESMTP id BAB5DD1C509 for ; Sun, 20 Jul 2003 20:51:37 -0300 (ADT) Received: from localhost ([172.30.254.220] RDNS failed) by ctg-msnex01.staff.berbee.com with Microsoft SMTPSVC(5.0.2195.5329); Sun, 20 Jul 2003 18:51:40 -0500 From: "Jeremy M. Guthrie" Reply-To: jeremy.guthrie@berbee.com Organization: Berbee Information Networks To: Tom Lane Subject: Re: Poor delete performance AFTER vacuum analyze Date: Sun, 20 Jul 2003 18:51:39 -0500 User-Agent: KMail/1.5.1 Cc: pgsql-performance@postgresql.org References: <200307191622.46709.jeremy.guthrie@berbee.com> <19929.1058676291@sss.pgh.pa.us> In-Reply-To: <19929.1058676291@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200307201851.39756.jeremy.guthrie@berbee.com> X-OriginalArrivalTime: 20 Jul 2003 23:51:40.0933 (UTC) FILETIME=[DDBB6B50:01C34F19] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/315 X-Sequence-Number: 2608 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I looked back at my code and I also need to reclarify something. The delet= e=20 at the end is multiple delete statements within a transaction. After full vacuum with 160,000 records in Table: (takes a bit the first ti= me=20 through) Tlog=3D# explain analyze delete from Tlog where Tlog_ID <=3D 47766002 and= =20 host=3D'tbp-pp'; QUERY PLAN - -------------------------------------------------------------------------= ---------------------------------------------------- Index Scan using shost_idx on tlog (cost=3D0.00..6281.45 rows=3D136 width= =3D6)=20 (actual time=3D64529.43..64529.43 rows=3D0 loops=3D1) Index Cond: (host =3D 'tbp-pp'::character varying) Filter: (tlog_id <=3D 47766002) Total runtime: 64529.52 msec After zero records in table: ( Tlog=3D# explain analyze delete from Tlog where Tlog_ID <=3D 47766002 and= =20 host=3D'tbp-pp';=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20 QUERY PLAN - -------------------------------------------------------------------------= ---------------------------------------------- Index Scan using shost_idx on tlog (cost=3D0.00..6281.45 rows=3D136 width= =3D6)=20 (actual time=3D84.87..84.87 rows=3D0 loops=3D1) Index Cond: (host =3D 'tbp-pp'::character varying) Filter: (tlog_id <=3D 47766002) Total runtime: 84.96 msec Slow Explain after vacuum analyze: (this is when it gets bad) TLog=3D# explain analyze delete from Tlog where Tlog_ID <=3D 47766002 and= =20 shost=3D'tbp-pp'; QUERY PLAN - -------------------------------------------------------------------------= ----------------------------------------------------- Index Scan using shost_idx on tlog (cost=3D0.00..6128.52 rows=3D82 width= =3D6)=20 (actual time=3D262178.82..262178.82 rows=3D0 loops=3D1) Index Cond: (host =3D 'tbp-pp'::character varying) Filter: (tlog_id <=3D 47766002) Total runtime: 262178.96 msec - --=20 Jeremy M. Guthrie Systems Engineer Berbee 5520 Research Park Dr. Madison, WI 53711 Phone: 608-298-1061 Berbee...Decade 1. 1993-2003 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/GysLqtjaBHGZBeURAhNTAJ0QA2/eZM/DhSyxmXi89i6kXFQFwgCfacZY UIMUdK95O3N0UpOTxedM6Pw=3D =3DlaUO -----END PGP SIGNATURE----- From pgsql-advocacy-owner@postgresql.org Sun Jul 20 23:49:21 2003 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 0594BD1C933; Mon, 21 Jul 2003 02:49:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 55461-06; Mon, 21 Jul 2003 02:49:18 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 61979D1C932; Sun, 20 Jul 2003 23:49:17 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6L2n7315858; Sun, 20 Jul 2003 22:49:07 -0400 (EDT) From: Bruce Momjian Message-Id: <200307210249.h6L2n7315858@candle.pha.pa.us> Subject: Re: About the default performance In-Reply-To: To: "scott.marlowe" Date: Sun, 20 Jul 2003 22:49:07 -0400 (EDT) Cc: Josh Berkus , Kaarel , pgsql-advocacy@postgresql.org, pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/122 X-Sequence-Number: 1646 I can help with this too. --------------------------------------------------------------------------- scott.marlowe wrote: > I'm willing to help too. I'm basically a DBA / developer type, with mild > C hacking skills (I develop in PHP, so my C coding is quite rusty > nowadays.) > > If nothing else testing on different equipment / OSes. > > On Fri, 4 Jul 2003, Josh Berkus wrote: > > > Kaarel: > > > > (cross-posted back to Performance because I don't want to post twice on the > > same topic) > > > > > The problem is that people often benchmark the so called vanilla > > > installation of PostgreSQL. > > > > > I remember a discussion in the general list about having multiple > > > default conf files to choose from. Ala low-end, average and high-end > > > installations. A tool to read some system information and dynamically > > > generating a proper configuration file was also mentioned. > > > > Yes. So far, only Justin, Kevin B., Shridhar and I have volunteered to do any > > work on that task -- and all of us have been swamped with 7.4-related stuff. > > > > I would like to see, before the end of the year, some if not all of the stuff > > that Kaarel is posting about. Obviously, my first task is to set up a > > framework so that everyone can contribute to the project. > > > > > I'm not an expert of PostgreSQL by any means I have just been reading > > > PostgreSQL email lists for only about a month or so. So I believe I have > > > read that there is a auto-vacuum being worked on? In my opinion this > > > should be included in the main installation by default. This is just the > > > kind of job that a machine should do...when a big portion of data has > > > changed do VACUUM ANALYCE automagically. > > > > > > Is these improvements actually being implemented and how far are they? > > > > The auto-vacuum daemon (pgavd) is finished. However, it will still require > > the user to turn it on; we don't want to run potentially RAM-sucking > > background processes without user invitiation. So obviously that needs to be > > part of a comprehensive "quick start" guide. > > > > So, Kaarel .... you want to write the "quick start" guide for 7.4? All of > > the detail material is available online, you mainly need to provide narrative > > and links of the form of ... first, read this: , then do this ... > > > > > The technical side of these problems is not for this list of course. > > > However the "side-effects" (reputation of being slow) of these problems > > > direclty relate to advocacy and PostgreSQL popularity. Maybe these > > > problems are already worked on or maybe I'm over exaggerating the > > > situation but I do believe solving these issues would only benefit > > > PostgreSQL. > > > > You're absolutely correct .... so let's do something about it. From my > > perspective, the first step is improved docs, becuase we can have those out > > by 7.4 release. > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > -- 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 Jul 21 02:09:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id AF4CDD1C4B7 for ; Mon, 21 Jul 2003 05:09:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 22111-02 for ; Mon, 21 Jul 2003 05:09:07 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 1226BD1C510 for ; Mon, 21 Jul 2003 02:09:06 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6L592Q3027642; Mon, 21 Jul 2003 01:09:02 -0400 (EDT) To: jeremy.guthrie@berbee.com Cc: pgsql-performance@postgresql.org Subject: Re: Poor delete performance AFTER vacuum analyze In-reply-to: <200307201851.39756.jeremy.guthrie@berbee.com> References: <200307191622.46709.jeremy.guthrie@berbee.com> <19929.1058676291@sss.pgh.pa.us> <200307201851.39756.jeremy.guthrie@berbee.com> Comments: In-reply-to "Jeremy M. Guthrie" message dated "Sun, 20 Jul 2003 18:51:39 -0500" Date: Mon, 21 Jul 2003 01:09:02 -0400 Message-ID: <27641.1058764142@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/317 X-Sequence-Number: 2610 "Jeremy M. Guthrie" writes: > I looked back at my code and I also need to reclarify something. The delete > at the end is multiple delete statements within a transaction. I think you are going to have to show us all the details of what you're doing in between these queries. I was expecting to see a difference in query plans, but you've got the exact same plan in all three runs --- so it's not the planner making the difference here, nor the ANALYZE statistics. My best conjecture now is something odd about the way you are deleting the old data or loading the new. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 21 02:30:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id EB018D1C4BF for ; Mon, 21 Jul 2003 05:30:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 02494-07 for ; Mon, 21 Jul 2003 05:30:49 +0000 (GMT) Received: from mail.deltav.hu (oldmail.deltav.hu [213.163.0.192]) by svr1.postgresql.org (Postfix) with ESMTP id 24216D1C4B7 for ; Mon, 21 Jul 2003 02:30:49 -0300 (ADT) Received: from fejleszt4 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA6EEC for ; Mon, 21 Jul 2003 07:30:00 +0200 Message-ID: <00b901c34f49$1ed04b40$0403a8c0@fejleszt4> From: =?ISO-8859-1?Q?SZUCS_G=E1bor?= To: References: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> Subject: Re: Dual Xeon + HW RAID question Date: Mon, 21 Jul 2003 07:09:48 +0200 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/318 X-Sequence-Number: 2611 Alexandre, I missed your orig. post, but AFAIK multiprocessing kernels will handle HT CPUs as 2 CPUs each. Thus, our dual Xeon 2.4 is recognized as 4 Xeon 2.4 CPUs. This way, I don't think HT would improve any single query (afaik no postgres process uses more than one cpu), but overall multi-query performance has to improve. ----- Original Message ----- From: "Nikolaus Dilger" Sent: Saturday, July 12, 2003 8:25 PM Alexandre, Since you want the fastest speed I would do the 2 data disks in RAID 0 (striping) not RAID 1 (mirroring). If you would care about not loosing any transactions you would keep all 3 disks in RAID 5. Don't know the answer to the Hyperthreading question. Why don't you run a test to find out? Regards, Nikolaus On Thu, 10 Jul 2003 14:43:25 -0300 (BRT), "alexandre arruda paes :: aldeia digital" wrote: > > Hi, > > I have this machine with a 10 million records: > * Dual Xeon 2.0 (HyperThreading enabled), 3 7200 SCSI , > Adaptec 2110S, > RAID 5 - 32k chunk size, 1 GB Ram DDR 266 ECC, RH 8.0 - > 2.4.18 > > The database is mirrored with contrib/dbmirror in a P4 > 1 Gb Ram + IDE > > If a disk failure occurs, I can use the server in the > mirror. > > I will format the main server in this weekend and I > have seen in the list > some people that recomends a Software RAID instead HW. > > I think too remove the RAID 5 and turn a RAID 1 for > data in 2 HDs. > SO, WAL and swap in the thrid HD. > > My questions: > > 1) I will see best disk performance changing the disk > layout like above > 2) HyperThreading really improve a procces basead > program, like postgres > > Thank�s for all > > Alexandre From pgsql-performance-owner@postgresql.org Mon Jul 21 02:59:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 6B599D1C4DC for ; Mon, 21 Jul 2003 05:59:09 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 16833-03 for ; Mon, 21 Jul 2003 05:59:08 +0000 (GMT) Received: from mail.deltav.hu (oldmail.deltav.hu [213.163.0.192]) by svr1.postgresql.org (Postfix) with ESMTP id 93BCDD1C4BF for ; Mon, 21 Jul 2003 02:59:01 -0300 (ADT) Received: from fejleszt4 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA152F for ; Mon, 21 Jul 2003 07:59:00 +0200 Message-ID: <00f801c34f4d$2bf8d630$0403a8c0@fejleszt4> From: "=?iso-8859-2?B?U1rbQ1MgR+Fib3I=?=" To: Subject: Re: ugly query slower in 7.3, even slower after vacuum full analyze Date: Mon, 21 Jul 2003 07:58:56 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/319 X-Sequence-Number: 2612 Dear Gurus, I have a query discussed here earlier that suffers heavily from "lack of view flattening" in v7.3. Following Tom's guidance, I made a conclusion to that thread (http://archives.postgresql.org/pgsql-performance/2003-05/msg00215.php) and asked it to be confirmed or fixed, but I didn't get any responses. Here are some times, for which I'd like to get some response. Old machine is New machine is * PIII 800, * Dual Xeon 2.4, * IDE 7200, * 5xSCSI 10000 HW RAID 5, * psql 7.2.1, * psql 7.3.3, * orig conf * orig and crude conf, as below. * old: 18 sec * new: 24 sec * new w/ vacuum full verbose analyze: 30-31 sec (!!!) 1. Are these times (18 vs 24) believable with such heavy HW change or is there something fishy about it? * I know multiprocessing doesn't come in view with a single query * but cpu and hw speed should * I know 7.3 is slower because of unflattened views 2. What may be the cause of VACUUM slowing the query? 3. Disabling any one of mergejoin, hashjoin, seqscan did no good. Disabling sort prevented query from finishing in several minutes. 4. I have tried to crudely carve optimizer settings as below, but it changed nothing according to this query. Any further ideas? Note that time tests were taken in close succession (test; killall -HUP postmaster; test; ...) If needed, I can attach query, exp-ana outputs before and after vacuum (carved and uncarved conf file), and the vacuum log itself. TIA, G. ------------------------------- cut here ------------------------------- shared_bufers = 4096 sort_mem = 4096 effective_cache_size = 20000 random_page_cost = 1.5 ------------------------------- cut here ------------------------------- From pgsql-performance-owner@postgresql.org Mon Jul 21 05:29:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7E85BD1C929 for ; Mon, 21 Jul 2003 08:28:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 67197-02 for ; Mon, 21 Jul 2003 08:28:56 +0000 (GMT) Received: from mail.deltav.hu (oldmail.deltav.hu [213.163.0.192]) by svr1.postgresql.org (Postfix) with ESMTP id BF967D1C928 for ; Mon, 21 Jul 2003 05:28:55 -0300 (ADT) Received: from fejleszt4 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA2F12 for ; Mon, 21 Jul 2003 10:25:55 +0200 Message-ID: <012201c34f61$b20993e0$0403a8c0@fejleszt4> From: =?ISO-8859-1?Q?SZUCS_G=E1bor?= To: References: <1057587455.6466.26.camel@takin.private.nexcerpt.com> <200307071540.30041.dev@archonet.com> Subject: Re: Optimizer differences between 7.2 and 7.3 Date: Mon, 21 Jul 2003 10:25:51 +0200 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/320 X-Sequence-Number: 2613 A bit OT: do regex ops (~, ~*) use index scan in non-"C" locales? Is it worth to convert LIKE to regex? G. ------------------------------- cut here ------------------------------- ----- Original Message ----- From: "Richard Huxton" Sent: Monday, July 07, 2003 4:40 PM Check the locale the database was initdb'd to. You'll probably find 7.2.4 is in the "C" locale whereas 7.3.3 isn't. The "like" comparison can only use indexes in the "C" locale. I believe you might need to initdb again to fix this. -- Richard Huxton ---------------------------(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 Mon Jul 21 05:30:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id D425BD1C92A for ; Mon, 21 Jul 2003 08:30:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 61332-08 for ; Mon, 21 Jul 2003 08:30:13 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 58945D1C929 for ; Mon, 21 Jul 2003 05:30:12 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886 for ; Mon, 21 Jul 2003 10:30:06 +0200 Message-ID: <002a01c34f62$75c01de0$b696a8c0@APR> From: "Alexander Priem" To: Subject: Tuning PostgreSQL Date: Mon, 21 Jul 2003 10:31:19 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0027_01C34F73.39211A90" 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.3 tagged_above=0.0 required=5.0 tests=BAYES_30, HTML_30_40, HTML_FONT_BIG, HTML_FONT_COLOR_BLUE, HTML_FONT_FACE_ODD X-Spam-Level: X-Archive-Number: 200307/321 X-Sequence-Number: 2614 This is a multi-part message in MIME format. ------=_NextPart_000_0027_01C34F73.39211A90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi guys, I am new to PostgreSQL and have done some "extensive" research already. If = you could give me some advice/confirmation, I would be really grateful. I am going to build a PostgreSQL database server for a client. This databas= e will contain many tables (over 100, maybe more), with some of them contai= ning over 1 million records pretty soon. This database will be accessed via= a desktop application (Windows) and a web application (PHP/Apache). There = may be over 100 people accessing the database at any given time (selecting,= inserting and updating), but I don't think it will be a lot more than 100 = at any given time. Most of the time, it will be less. What I am thinking about is buying a server with the following specificatio= ns: * 1 or 2 Intel Xeon processors (2.4 GHz). * 2 Gigabytes of RAM (DDR/ECC). * Three 36Gb SCSI160 disks (10.000rpm) in a RAID-5 config, giving 72Gb stor= age space (right?). The RAID-5 controller has a (hardware) cache of 128Mb. * 100Mbit ethernet. I will run RedHat Linux 9 (kernel 2.40) with PostgreSQL 7.3.3 on this serve= r. What would you think of this hardware config? Would it do? Of would 4Gb RAM= be a lot better? What do you think about the need for two Xeon procs? Finally, I have some questions about postgresql.conf (who doesnt?). After s= ome research, I think I will go for the following settings initially. Maybe= benchmarking will lead to other values, but I think these settings will be= a fine starting point : shared_buffers =3D 6000 (kernel.shmmax =3D 60000000) sort_mem =3D 4096 max_connections =3D 150 vacuum_mem =3D 65536 What do you think of these settings? Do you have any other hints for optimi= zing PostgreSQL Many many thanks in advance :) Kind regards, Alexander Priem CICT Solutions Email: ap@cict.nl Internet: www.cict.nl ------=_NextPart_000_0027_01C34F73.39211A90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi guys,
 
I am new to PostgreSQL and have done some= =20 "extensive" research already. If you could give me some advice/confirmation= , I=20 would be really grateful.
 
I am going to build a PostgreSQL database = server=20 for a client. This database will contain many tables (over 100,=20 maybe more), with some of them containing over 1 million records prett= y=20 soon. This database will be accessed via a desktop application (Windows) an= d a=20 web application (PHP/Apache). There may be over 100 people accessing t= he=20 database at any given time (selecting, inserting and updating), b= ut I=20 don't think it will be a lot more than 100 at any given time. Most of the t= ime,=20 it will be less.
 
What I am thinking about is buying a serve= r with=20 the following specifications:
 
* 1 or 2 Intel Xeon processors (2.4=20 GHz).
* 2 Gigabytes of RAM (DDR/ECC).
* Three 36Gb SCSI160 disks (10.000rpm) in = a RAID-5=20 config, giving 72Gb storage space (right?). The RAID-5 controller has=20 a (hardware) cache of 128Mb.
* 100Mbit ethernet.
 
I will run RedHat Linux 9 (kernel 2.40) wi= th=20 PostgreSQL 7.3.3 on this server.
 
What would you think of this hardware conf= ig? Would=20 it do? Of would 4Gb RAM be a lot better? What do you think about the need f= or=20 two Xeon procs?
 
Finally, I have some questions about=20 postgresql.conf (who doesnt?). After some research, I think I will go for t= he=20 following settings initially. Maybe benchmarking will lead to other values,= but=20 I think these settings will be a fine starting point :
 
shared_buffers =3D 6000 (kernel.shmma= x =3D=20 60000000)
sort_mem =3D 4096
max_connections =3D 150
vacuum_mem =3D 65536
 
What do you think of these settings? Do yo= u have=20 any other hints for optimizing PostgreSQL
 
Many many thanks in advance  &nb= sp;=20 :)
 

Kind regards,

Alexander Priem
CICT Solutions
Email: ap@cict.nl
Internet: www.cict.nl
------=_NextPart_000_0027_01C34F73.39211A90-- From pgsql-performance-owner@postgresql.org Mon Jul 21 05:51:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id BC128D1C924 for ; Mon, 21 Jul 2003 08:50:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 65044-05 for ; Mon, 21 Jul 2003 08:50:12 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 5A516D1C923 for ; Mon, 21 Jul 2003 05:50:10 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6L8tFfL029097 for ; Mon, 21 Jul 2003 14:25:15 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6L8tF6O029084 for ; Mon, 21 Jul 2003 14:25:15 +0530 From: "Shridhar Daithankar" To: Date: Mon, 21 Jul 2003 14:21:53 +0530 MIME-Version: 1.0 Subject: Re: Tuning PostgreSQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F1BF701.248.144C5B84@localhost> In-reply-to: <002a01c34f62$75c01de0$b696a8c0@APR> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/322 X-Sequence-Number: 2615 On 21 Jul 2003 at 10:31, Alexander Priem wrote: > What I am thinking about is buying a server with the following specifications: > > * 1 or 2 Intel Xeon processors (2.4 GHz). > * 2 Gigabytes of RAM (DDR/ECC). > * Three 36Gb SCSI160 disks (10.000rpm) in a RAID-5 config, giving 72Gb storage > space (right?). The RAID-5 controller has a(hardware) cache of 128Mb. > * 100Mbit ethernet. > > I will run RedHat Linux 9 (kernel 2.40) with PostgreSQL 7.3.3 on this server. You might scale down a little on hardware front if required. Of course, if you can get it, get it. > What would you think of this hardware config? Would it do? Of would 4Gb RAM be > a lot better? What do you think about the need for two Xeon procs? I would say get an SMP board with one processor in it. If requierd you can upgrade. I suppose that would make hefty difference in price. > shared_buffers = 6000(kernel.shmmax = 60000000) > sort_mem = 4096 > max_connections = 150 > vacuum_mem = 65536 effective_cache_size noatime for data partition A good filesystem. WAL on separate drive. Now that is a good start.. Bye Shridhar -- QOTD: "I'm on a seafood diet -- I see food and I eat it." From pgsql-performance-owner@postgresql.org Mon Jul 21 06:32:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 755B5D1C4B7 for ; Mon, 21 Jul 2003 09:32:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 83648-01 for ; Mon, 21 Jul 2003 09:32:25 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id E2D9ED1C4CC for ; Mon, 21 Jul 2003 06:32:09 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6L9aer2009734 for ; Mon, 21 Jul 2003 15:06:40 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6L9aa6Q009679; Mon, 21 Jul 2003 15:06:39 +0530 From: "Shridhar Daithankar" To: "Alexander Priem" Date: Mon, 21 Jul 2003 15:03:14 +0530 MIME-Version: 1.0 Subject: Re: Tuning PostgreSQL Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-performance@postgresql.org Message-ID: <3F1C00B2.20319.147235A4@localhost> In-reply-to: <006901c34f69$d04f6390$b696a8c0@APR> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/323 X-Sequence-Number: 2616 Hi Alexander , On 21 Jul 2003 at 11:23, Alexander Priem wrote: > So the memory settings I specified are pretty much OK? As of now yes, You need to test with these settings and make sure that they perform as per your requirement. That tweaking will always be there... > What would be good guidelines for setting effective_cache_size, noatime ? I suggest you look at http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html. That should help you. > I use ext3 filesystem, which probably is not the best performer, is it? No. You also need to check ext2, reiser and XFS. There is no agreement between users as in what works best. You need to benchmark and decide. > I will set the WAL on a separate drive. What do I need to change in the conf > files to achive this? No. You need to shutdown postgresql server process and symlink WAL and clog directories in postgresql database cluster to another place. That should do it. HTH Bye Shridhar -- Meade's Maxim: Always remember that you are absolutely unique, just like everyone else. From pgsql-performance-owner@postgresql.org Mon Jul 21 06:40:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id B1826D1C4C1 for ; Mon, 21 Jul 2003 09:40:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 82165-03 for ; Mon, 21 Jul 2003 09:39:32 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 4F51AD1C4B7 for ; Mon, 21 Jul 2003 06:39:31 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Mon, 21 Jul 2003 11:39:30 +0200 Message-ID: <008e01c34f6c$27325c60$b696a8c0@APR> From: "Alexander Priem" To: Cc: References: <3F1C00B2.20319.147235A4@localhost> Subject: Re: Tuning PostgreSQL Date: Mon, 21 Jul 2003 11:40:42 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/324 X-Sequence-Number: 2617 Thanks, I will look at the site you sent me and purchase some hardware. Then I will run some benchmarks. Kind regards, Alexander. ----- Original Message ----- From: "Shridhar Daithankar" To: "Alexander Priem" Cc: Sent: Monday, July 21, 2003 11:33 AM Subject: Re: [PERFORM] Tuning PostgreSQL > Hi Alexander , > > On 21 Jul 2003 at 11:23, Alexander Priem wrote: > > So the memory settings I specified are pretty much OK? > > As of now yes, You need to test with these settings and make sure that they > perform as per your requirement. That tweaking will always be there... > > > What would be good guidelines for setting effective_cache_size, noatime ? > > I suggest you look at > http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html. > > That should help you. > > > I use ext3 filesystem, which probably is not the best performer, is it? > > No. You also need to check ext2, reiser and XFS. There is no agreement between > users as in what works best. You need to benchmark and decide. > > > I will set the WAL on a separate drive. What do I need to change in the conf > > files to achive this? > > No. You need to shutdown postgresql server process and symlink WAL and clog > directories in postgresql database cluster to another place. That should do it. > > HTH > > Bye > Shridhar > > -- > Meade's Maxim: Always remember that you are absolutely unique, just like everyone else. > From pgsql-performance-owner@postgresql.org Mon Jul 21 07:16:05 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 53C59D1C4C8 for ; Mon, 21 Jul 2003 10:04:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 70823-06 for ; Mon, 21 Jul 2003 10:04:53 +0000 (GMT) Received: from cerebro.int-bytecraft.com (unknown [219.93.229.26]) by svr1.postgresql.org (Postfix) with ESMTP id 82C73D1C4C7 for ; Mon, 21 Jul 2003 07:04:51 -0300 (ADT) Received: from bytecraft.com.my (home.int-bytecraft.com [127.0.0.1]) by cerebro.int-bytecraft.com (8.11.6/8.11.6) with ESMTP id h6LA1LA16718; Mon, 21 Jul 2003 18:01:22 +0800 Message-ID: <3F1BBBD3.6070405@bytecraft.com.my> Date: Mon, 21 Jul 2003 18:09:23 +0800 From: Ang Chin Han User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in Cc: Alexander Priem , pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL References: <3F1C00B2.20319.147235A4@localhost> In-Reply-To: <3F1C00B2.20319.147235A4@localhost> X-Enigmail-Version: 0.76.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF96D9C786CF7C34E614F978A" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/325 X-Sequence-Number: 2618 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF96D9C786CF7C34E614F978A Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Shridhar Daithankar wrote: > On 21 Jul 2003 at 11:23, Alexander Priem wrote: >>I use ext3 filesystem, which probably is not the best performer, is it? > > No. You also need to check ext2, reiser and XFS. There is no agreement between > users as in what works best. You need to benchmark and decide. Need? Maybe I'm a bit disillusioned, but are the performances between the filesystems differ so much as to warrant the additional effort? (e.g. XFS doesn't come with Red Hat 9 -- you'll have to patch the source, and compile it yourself). Benchmarking it properly before deployment is tough: are the test load on the db/fs representative of actual load? Is 0.5% reduction in CPU usage worth it? Did you test for catastrophic failure by pulling the plug during write operations (ext2) to test if the fs can handle it? Is the code base for the particular fs stable enough? Obscure bugs in the fs? For the record, we tried several filesystems, but stuck with 2.4.9's ext3 (Red Hat Advanced Server). Didn't hit a load high enough for the filesystem choices to matter after all. :( -- Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux 5:30pm up 207 days, 8:35, 5 users, load average: 5.33, 5.16, 5.21 --------------enigF96D9C786CF7C34E614F978A Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE/G7vVNYbTUIgzwfARAoDaAJ48oC9cSnTNx6KxdMy+0eSw5rK3YQCggQ9H JvL8onI2xgHgc2/hyCmNpCQ= =ISi4 -----END PGP SIGNATURE----- --------------enigF96D9C786CF7C34E614F978A-- From pgsql-performance-owner@postgresql.org Mon Jul 21 07:32:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7EEF7D1C4CC for ; Mon, 21 Jul 2003 10:30:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 65044-09 for ; Mon, 21 Jul 2003 10:29:57 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 3C199D1C4C9 for ; Mon, 21 Jul 2003 07:29:56 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6LAZ4HF027230 for ; Mon, 21 Jul 2003 16:05:04 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6LAZ46O027217 for ; Mon, 21 Jul 2003 16:05:04 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Mon, 21 Jul 2003 16:01:41 +0530 MIME-Version: 1.0 Subject: Re: Tuning PostgreSQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F1C0E65.27609.14A7BA43@localhost> In-reply-to: <3F1BBBD3.6070405@bytecraft.com.my> References: <3F1C00B2.20319.147235A4@localhost> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/326 X-Sequence-Number: 2619 On 21 Jul 2003 at 18:09, Ang Chin Han wrote: > Shridhar Daithankar wrote: > > On 21 Jul 2003 at 11:23, Alexander Priem wrote: > > >>I use ext3 filesystem, which probably is not the best performer, is it? > > > > No. You also need to check ext2, reiser and XFS. There is no agreement between > > users as in what works best. You need to benchmark and decide. > > Need? Maybe I'm a bit disillusioned, but are the performances between > the filesystems differ so much as to warrant the additional effort? > (e.g. XFS doesn't come with Red Hat 9 -- you'll have to patch the > source, and compile it yourself). Well, the benchmarking is not to prove which filesystem is fastest and feature rich but to find out which one suits your needs best. > Benchmarking it properly before deployment is tough: are the test load > on the db/fs representative of actual load? Is 0.5% reduction in CPU > usage worth it? Did you test for catastrophic failure by pulling the > plug during write operations (ext2) to test if the fs can handle it? Is > the code base for the particular fs stable enough? Obscure bugs in the fs? Well, that is what that 'benchmark' is supposed to find out. Call it pre- deployment testing or whatever other fancy name one sees fit. But it is a must in almost all serious usage. > For the record, we tried several filesystems, but stuck with 2.4.9's > ext3 (Red Hat Advanced Server). Didn't hit a load high enough for the > filesystem choices to matter after all. :( Good for you. You have time at hand to find out which one suits you best. Do the testing before you have load that needs another FS..:-) Bye Shridhar -- It would be illogical to assume that all conditions remain stable. -- Spock, "The Enterprise" Incident", stardate 5027.3 From pgsql-performance-owner@postgresql.org Mon Jul 21 08:24:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 62BA7D1C4C7 for ; Mon, 21 Jul 2003 11:22:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 00308-05 for ; Mon, 21 Jul 2003 11:22:54 +0000 (GMT) Received: from cerebro.int-bytecraft.com (unknown [219.93.229.26]) by svr1.postgresql.org (Postfix) with ESMTP id C5EBED1C4CA for ; Mon, 21 Jul 2003 08:22:52 -0300 (ADT) Received: from bytecraft.com.my (home.int-bytecraft.com [127.0.0.1]) by cerebro.int-bytecraft.com (8.11.6/8.11.6) with ESMTP id h6LBJqA16776; Mon, 21 Jul 2003 19:19:52 +0800 Message-ID: <3F1BCE3A.5080402@bytecraft.com.my> Date: Mon, 21 Jul 2003 19:27:54 +0800 From: Ang Chin Han User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: shridhar_daithankar@persistent.co.in Cc: pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL References: <3F1C00B2.20319.147235A4@localhost> <3F1C0E65.27609.14A7BA43@localhost> In-Reply-To: <3F1C0E65.27609.14A7BA43@localhost> X-Enigmail-Version: 0.76.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig6BA4B68749CB87984025A765" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/327 X-Sequence-Number: 2620 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig6BA4B68749CB87984025A765 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Shridhar Daithankar wrote: > Good for you. You have time at hand to find out which one suits you best. Do > the testing before you have load that needs another FS..:-) Kinda my point is that when we've more load, we'd be using RAID-0 over RAID-5, or getting faster SCSI drives, or even turn fsync off if that's a bottleneck, because the different filesystems do not have that much performance difference[1] -- the filesystem is not a bottleneck. Just need to tweak most of them a bit, like noatime,data=writeback. [1] That is, AFAIK, from our testing. Please, please correct me if I'm wrong: has anyone found that different filesystems produces wildly different performance for postgresql, FreeBSD's filesystems not included? -- Linux homer 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386 GNU/Linux 7:00pm up 207 days, 10:05, 5 users, load average: 5.00, 5.03, 5.06 --------------enig6BA4B68749CB87984025A765 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE/G848NYbTUIgzwfARAiK+AKCtNjt53kaBUR9RkNeIlyQqJ5ch/ACg32gd BLoG6cHM1L4yagcZvF630yI= =RzxQ -----END PGP SIGNATURE----- --------------enig6BA4B68749CB87984025A765-- From pgsql-performance-owner@postgresql.org Mon Jul 21 08:43:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 31F91D1C4CC for ; Mon, 21 Jul 2003 11:37:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 94600-10 for ; Mon, 21 Jul 2003 11:37:46 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 0E08AD1C4CB for ; Mon, 21 Jul 2003 08:37:45 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6LBgtL2018047 for ; Mon, 21 Jul 2003 17:12:55 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6LBgsEN018034 for ; Mon, 21 Jul 2003 17:12:54 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Mon, 21 Jul 2003 17:09:30 +0530 MIME-Version: 1.0 Subject: Re: Tuning PostgreSQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F1C1E4A.31965.14E5CFC2@localhost> In-reply-to: <3F1BCE3A.5080402@bytecraft.com.my> References: <3F1C0E65.27609.14A7BA43@localhost> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/328 X-Sequence-Number: 2621 On 21 Jul 2003 at 19:27, Ang Chin Han wrote: > [1] That is, AFAIK, from our testing. Please, please correct me if I'm > wrong: has anyone found that different filesystems produces wildly > different performance for postgresql, FreeBSD's filesystems not included? well, when postgresql starts splitting table files after a gig, filesystem sure makes difference. IIRC, frommy last test XFS was at least 10-15% faster than reiserfs for such databases. That was around an year back, with mandrake 8.0. Bye Shridhar -- modesty, n.: Being comfortable that others will discover your greatness. From pgsql-performance-owner@postgresql.org Mon Jul 21 09:11:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id E73CFD1C4C8 for ; Mon, 21 Jul 2003 11:43:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 05932-07 for ; Mon, 21 Jul 2003 11:43:55 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 88CCED1C4C7 for ; Mon, 21 Jul 2003 08:43:54 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Mon, 21 Jul 2003 13:43:53 +0200 Message-ID: <010801c34f7d$87f39620$b696a8c0@APR> From: "Alexander Priem" To: , References: <3F1C00B2.20319.147235A4@localhost> <3F1C0E65.27609.14A7BA43@localhost> Subject: Re: Tuning PostgreSQL Date: Mon, 21 Jul 2003 13:45:06 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/329 X-Sequence-Number: 2622 So where can I set the noatime & data=writeback variables? They are not PostgreSQL settings, but rather Linux settings, right? Where can I find these? Kind regards, Alexander Priem. ----- Original Message ----- From: "Shridhar Daithankar" To: Sent: Monday, July 21, 2003 12:31 PM Subject: Re: [PERFORM] Tuning PostgreSQL > On 21 Jul 2003 at 18:09, Ang Chin Han wrote: > > > Shridhar Daithankar wrote: > > > On 21 Jul 2003 at 11:23, Alexander Priem wrote: > > > > >>I use ext3 filesystem, which probably is not the best performer, is it? > > > > > > No. You also need to check ext2, reiser and XFS. There is no agreement between > > > users as in what works best. You need to benchmark and decide. > > > > Need? Maybe I'm a bit disillusioned, but are the performances between > > the filesystems differ so much as to warrant the additional effort? > > (e.g. XFS doesn't come with Red Hat 9 -- you'll have to patch the > > source, and compile it yourself). > > Well, the benchmarking is not to prove which filesystem is fastest and feature > rich but to find out which one suits your needs best. > > > Benchmarking it properly before deployment is tough: are the test load > > on the db/fs representative of actual load? Is 0.5% reduction in CPU > > usage worth it? Did you test for catastrophic failure by pulling the > > plug during write operations (ext2) to test if the fs can handle it? Is > > the code base for the particular fs stable enough? Obscure bugs in the fs? > > Well, that is what that 'benchmark' is supposed to find out. Call it pre- > deployment testing or whatever other fancy name one sees fit. But it is a must > in almost all serious usage. > > > For the record, we tried several filesystems, but stuck with 2.4.9's > > ext3 (Red Hat Advanced Server). Didn't hit a load high enough for the > > filesystem choices to matter after all. :( > > Good for you. You have time at hand to find out which one suits you best. Do > the testing before you have load that needs another FS..:-) > > Bye > Shridhar > > -- > It would be illogical to assume that all conditions remain stable. -- Spock, "The Enterprise" Incident", stardate 5027.3 > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Mon Jul 21 09:23:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 6FCF4D1C4C8 for ; Mon, 21 Jul 2003 12:03:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 05909-07 for ; Mon, 21 Jul 2003 12:03:19 +0000 (GMT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 68166D1C4C7 for ; Mon, 21 Jul 2003 09:03:18 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6LC8SZr015305 for ; Mon, 21 Jul 2003 17:38:28 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by smtp.pspl.co.in (8.12.9/8.12.9) with ESMTP id h6LC8Rv6015273 for ; Mon, 21 Jul 2003 17:38:27 +0530 From: "Shridhar Daithankar" To: Date: Mon, 21 Jul 2003 17:35:03 +0530 MIME-Version: 1.0 Subject: Re: Tuning PostgreSQL Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F1C2447.25130.14FD34E4@localhost> In-reply-to: <010801c34f7d$87f39620$b696a8c0@APR> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/330 X-Sequence-Number: 2623 On 21 Jul 2003 at 13:45, Alexander Priem wrote: > So where can I set the noatime & data=writeback variables? They are not > PostgreSQL settings, but rather Linux settings, right? Where can I find > these? These are typicaly set in /etc/fstab.conf. These are mount settings. man mount for more details. The second setting data=writeback is ext3 specific, IIRC. HTH Bye Shridhar -- History tends to exaggerate. -- Col. Green, "The Savage Curtain", stardate 5906.4 From pgsql-performance-owner@postgresql.org Mon Jul 21 09:52:37 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id ED07CD1C4DC for ; Mon, 21 Jul 2003 12:42:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 31826-01 for ; Mon, 21 Jul 2003 12:42:10 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 16138D1C4C7 for ; Mon, 21 Jul 2003 09:42:10 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Mon, 21 Jul 2003 14:42:09 +0200 Message-ID: <012e01c34f85$ab8990f0$b696a8c0@APR> From: "Alexander Priem" To: , References: <3F1C2447.25130.14FD34E4@localhost> Subject: Re: Tuning PostgreSQL Date: Mon, 21 Jul 2003 14:43:22 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/331 X-Sequence-Number: 2624 Thanks, i'll look further into these mount setting. I was just thinking, the server will have a (RAID) controller containing 128Mb of battery-backed cache memory. This would really speed up inserts to the disk and would prevent data loss in case of a power-down also. What would you guys think of not using RAID5 in that case, but just a really fast 15.000 rpm SCSI-320 disk? Kind regards, Alexander. ----- Original Message ----- From: "Shridhar Daithankar" To: Sent: Monday, July 21, 2003 2:05 PM Subject: Re: [PERFORM] Tuning PostgreSQL > On 21 Jul 2003 at 13:45, Alexander Priem wrote: > > > So where can I set the noatime & data=writeback variables? They are not > > PostgreSQL settings, but rather Linux settings, right? Where can I find > > these? > > These are typicaly set in /etc/fstab.conf. These are mount settings. man mount > for more details. > > The second setting data=writeback is ext3 specific, IIRC. > > HTH > > Bye > Shridhar > > -- > History tends to exaggerate. -- Col. Green, "The Savage Curtain", stardate > 5906.4 > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Mon Jul 21 10:42:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A1C2FD1C4BF for ; Mon, 21 Jul 2003 13:38:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 02647-02 for ; Mon, 21 Jul 2003 13:38:15 +0000 (GMT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 331F7D1C4F1 for ; Mon, 21 Jul 2003 10:38:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6LDc2Q3004058; Mon, 21 Jul 2003 09:38:03 -0400 (EDT) To: =?ISO-8859-1?Q?SZUCS_G=E1bor?= Cc: pgsql-performance@postgresql.org Subject: Re: Optimizer differences between 7.2 and 7.3 In-reply-to: <012201c34f61$b20993e0$0403a8c0@fejleszt4> References: <1057587455.6466.26.camel@takin.private.nexcerpt.com> <200307071540.30041.dev@archonet.com> <012201c34f61$b20993e0$0403a8c0@fejleszt4> Comments: In-reply-to =?ISO-8859-1?Q?SZUCS_G=E1bor?= message dated "Mon, 21 Jul 2003 10:25:51 +0200" Date: Mon, 21 Jul 2003 09:38:02 -0400 Message-ID: <4057.1058794682@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/332 X-Sequence-Number: 2625 =?ISO-8859-1?Q?SZUCS_G=E1bor?= writes: > do regex ops (~, ~*) use index scan in non-"C" locales? Is it worth to > convert LIKE to regex? The locale issues are the same either way. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 21 10:45:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id A72DAD1C4E3 for ; Mon, 21 Jul 2003 13:45:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 02637-03 for ; Mon, 21 Jul 2003 13:45:33 +0000 (GMT) Received: from pos_pdc.posportal.com (unknown [12.158.169.100]) by svr1.postgresql.org (Postfix) with ESMTP id 3722FD1C4F1 for ; Mon, 21 Jul 2003 10:45:33 -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: Tuning PostgreSQL Date: Mon, 21 Jul 2003 06:45:32 -0700 Message-ID: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Tuning PostgreSQL Thread-Index: AcNPh0qASfeb+tsNSVKzYBPz8kcOFwABbenK From: "Roman Fail" To: "Alexander Priem" , , X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/333 X-Sequence-Number: 2626 PiBXaGF0IHdvdWxkIHlvdSBndXlzIHRoaW5rIG9mIG5vdCB1c2luZyBSQUlE NSBpbiB0aGF0IGNhc2UsIGJ1dCBqdXN0IGEgcmVhbGx5DQo+IGZhc3QgMTUu MDAwIHJwbSBTQ1NJLTMyMCBkaXNrPw0KDQogDQpJJ2Qgc2F5IHlvdSBtdXN0 IGJlIGFibGUgdG8gdG9sZXJhdGUgbG9zaW5nIGFsbCB0aGUgZGF0YSBzaW5j ZSB5b3VyIGxhc3QgZGF0YWJhc2UgYmFja3VwLiAgWW91ciBiYXR0ZXJ5IGJh Y2tlZCBjYWNoZSwgcm90YXRpb25hbCBzcGVlZCwgYW5kIHRyYW5zZmVyIHJh dGUgYXJlbid0IGdvaW5nIHRvIGhlbHAgYXQgYWxsIHdoZW4gdGhlIGRyaXZl IGl0c2VsZiBkZWdyYWRlcyBhbmQgY29ycnVwdHMgZGF0YS4gIElmIHlvdSBj YW4gcmVhbGx5IG9ubHkgYWZmb3JkIDMgZHJpdmVzLCBJJ2QgaGF2ZSBhIHNp bmdsZSBkcml2ZSB3aXRoIHRoZSBPUyAmIFdBTCBvbiBpdCwgYW5kIHRoZSBk YXRhIG9uIGEgUkFJRC0xIG1pcnJvciBzZXQgdXNpbmcgdGhlIG90aGVyIDIg ZHJpdmVzLiAgSWYgeW91IG5lZWQgbW9yZSBzcGFjZSBmb3IgZGF0YSwgb3Ig d2FudCB5b3VyIE9TIGRyaXZlcyB0byBiZSBtaXJyb3JlZCAtIGl0J3MgZ29p bmcgdG8gY29zdCBtb3JlLiAgU2VlIGlmIHlvdSBjYW4gZ2V0IDJ4MThHQiBk cml2ZXMgZm9yIHRoZSBPUyBhbmQgMng3M0dCIGRyaXZlcyBmb3IgdGhlIGRh dGEuICAgIA0KIA0KWW91IGhhdmUgdG8gY29uc2lkZXIgaG93IG11Y2ggaGVh ZGFjaGUgdGhhdCBzbWFsbCBhbW91bnQgb2YgYWRkaXRpb25hbCBtb25leSBp cyBnb2luZyB0byBzYXZlIHlvdSAoYW5kIHlvdXIgdXNlcnMpIGRvd24gdGhl IHJvYWQuDQogDQpSb21hbg0KDQoJLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0t LS0gDQoJRnJvbTogQWxleGFuZGVyIFByaWVtIFttYWlsdG86YXBAY2ljdC5u bF0gDQoJU2VudDogTW9uIDcvMjEvMjAwMyA1OjQzIEFNIA0KCVRvOiBzaHJp ZGhhcl9kYWl0aGFua2FyQHBlcnNpc3RlbnQuY28uaW47IHBnc3FsLXBlcmZv cm1hbmNlQHBvc3RncmVzcWwub3JnIA0KCUNjOiANCglTdWJqZWN0OiBSZTog W1BFUkZPUk1dIFR1bmluZyBQb3N0Z3JlU1FMDQoJDQoJDQoNCglUaGFua3Ms IGknbGwgbG9vayBmdXJ0aGVyIGludG8gdGhlc2UgbW91bnQgc2V0dGluZy4N CgkNCglJIHdhcyBqdXN0IHRoaW5raW5nLCB0aGUgc2VydmVyIHdpbGwgaGF2 ZSBhIChSQUlEKSBjb250cm9sbGVyIGNvbnRhaW5pbmcNCgkxMjhNYiBvZiBi YXR0ZXJ5LWJhY2tlZCBjYWNoZSBtZW1vcnkuIFRoaXMgd291bGQgcmVhbGx5 IHNwZWVkIHVwIGluc2VydHMgdG8NCgl0aGUgZGlzayBhbmQgd291bGQgcHJl dmVudCBkYXRhIGxvc3MgaW4gY2FzZSBvZiBhIHBvd2VyLWRvd24gYWxzby4N CgkNCglXaGF0IHdvdWxkIHlvdSBndXlzIHRoaW5rIG9mIG5vdCB1c2luZyBS QUlENSBpbiB0aGF0IGNhc2UsIGJ1dCBqdXN0IGEgcmVhbGx5DQoJZmFzdCAx NS4wMDAgcnBtIFNDU0ktMzIwIGRpc2s/DQoJDQoJS2luZCByZWdhcmRzLA0K CUFsZXhhbmRlci4NCgkNCgkNCgktLS0tLSBPcmlnaW5hbCBNZXNzYWdlIC0t LS0tDQoJRnJvbTogIlNocmlkaGFyIERhaXRoYW5rYXIiIDxzaHJpZGhhcl9k YWl0aGFua2FyQHBlcnNpc3RlbnQuY28uaW4+DQoJVG86IDxwZ3NxbC1wZXJm b3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZz4NCglTZW50OiBNb25kYXksIEp1bHkg MjEsIDIwMDMgMjowNSBQTQ0KCVN1YmplY3Q6IFJlOiBbUEVSRk9STV0gVHVu aW5nIFBvc3RncmVTUUwNCgkNCgkNCgk+IE9uIDIxIEp1bCAyMDAzIGF0IDEz OjQ1LCBBbGV4YW5kZXIgUHJpZW0gd3JvdGU6DQoJPg0KCT4gPiBTbyB3aGVy ZSBjYW4gSSBzZXQgdGhlIG5vYXRpbWUgJiBkYXRhPXdyaXRlYmFjayB2YXJp YWJsZXM/IFRoZXkgYXJlIG5vdA0KCT4gPiBQb3N0Z3JlU1FMIHNldHRpbmdz LCBidXQgcmF0aGVyIExpbnV4IHNldHRpbmdzLCByaWdodD8gV2hlcmUgY2Fu IEkgZmluZA0KCT4gPiB0aGVzZT8NCgk+DQoJPiBUaGVzZSBhcmUgdHlwaWNh bHkgc2V0IGluIC9ldGMvZnN0YWIuY29uZi4gVGhlc2UgYXJlIG1vdW50IHNl dHRpbmdzLiBtYW4NCgltb3VudA0KCT4gZm9yIG1vcmUgZGV0YWlscy4NCgk+ DQoJPiBUaGUgc2Vjb25kIHNldHRpbmcgZGF0YT13cml0ZWJhY2sgaXMgZXh0 MyBzcGVjaWZpYywgSUlSQy4NCgk+DQoJPiBIVEgNCgk+DQoJPiBCeWUNCgk+ ICBTaHJpZGhhcg0KCT4NCgk+IC0tDQoJPiBIaXN0b3J5IHRlbmRzIHRvIGV4 YWdnZXJhdGUuIC0tIENvbC4gR3JlZW4sICJUaGUgU2F2YWdlIEN1cnRhaW4i LCBzdGFyZGF0ZQ0KCT4gNTkwNi40DQoJPg0KCT4NCgk+IC0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLShlbmQgb2YgYnJvYWRjYXN0KS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLQ0KCT4gVElQIDE6IHN1YnNjcmliZSBhbmQgdW5z dWJzY3JpYmUgY29tbWFuZHMgZ28gdG8gbWFqb3Jkb21vQHBvc3RncmVzcWwu b3JnDQoJDQoJDQoJLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBv ZiBicm9hZGNhc3QpLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQoJVElQ IDQ6IERvbid0ICdraWxsIC05JyB0aGUgcG9zdG1hc3Rlcg0KCQ0KDQo= From pgsql-performance-owner@postgresql.org Mon Jul 21 10:59:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4B5FCD1C910 for ; Mon, 21 Jul 2003 13:59:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 02631-04 for ; Mon, 21 Jul 2003 13:59:27 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 6E729D1C50D for ; Mon, 21 Jul 2003 10:59:26 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Mon, 21 Jul 2003 15:59:22 +0200 Message-ID: <014a01c34f90$74bc2c80$b696a8c0@APR> From: "Alexander Priem" To: "Roman Fail" , , References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> Subject: Re: Tuning PostgreSQL Date: Mon, 21 Jul 2003 16:00:34 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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-Archive-Number: 200307/334 X-Sequence-Number: 2627 That's true, certainly, and with four disks (2x18 and 2x72 or 36), I would be able to (a) be safe and (b) split the data and WAL. Hmmm. Seems to me that this setup would be better than one RAID5 with three 36Gb disks, wouldn't you think so? With one RAID5 array, I would still have the data and the WAL on one volume... Thanks for all your help so far. Kind regards, Alexander Priem. ----- Original Message ----- From: "Roman Fail" To: "Alexander Priem" ; ; Sent: Monday, July 21, 2003 3:45 PM Subject: Re: [PERFORM] Tuning PostgreSQL > > What would you guys think of not using RAID5 in that case, but just a really > > fast 15.000 rpm SCSI-320 disk? > > > I'd say you must be able to tolerate losing all the data since your last database backup. Your battery backed cache, rotational speed, and transfer rate aren't going to help at all when the drive itself degrades and corrupts data. If you can really only afford 3 drives, I'd have a single drive with the OS & WAL on it, and the data on a RAID-1 mirror set using the other 2 drives. If you need more space for data, or want your OS drives to be mirrored - it's going to cost more. See if you can get 2x18GB drives for the OS and 2x73GB drives for the data. > > You have to consider how much headache that small amount of additional money is going to save you (and your users) down the road. > > Roman > > -----Original Message----- > From: Alexander Priem [mailto:ap@cict.nl] > Sent: Mon 7/21/2003 5:43 AM > To: shridhar_daithankar@persistent.co.in; pgsql-performance@postgresql.org > Cc: > Subject: Re: [PERFORM] Tuning PostgreSQL > > > > Thanks, i'll look further into these mount setting. > > I was just thinking, the server will have a (RAID) controller containing > 128Mb of battery-backed cache memory. This would really speed up inserts to > the disk and would prevent data loss in case of a power-down also. > > What would you guys think of not using RAID5 in that case, but just a really > fast 15.000 rpm SCSI-320 disk? > > Kind regards, > Alexander. > > > ----- Original Message ----- > From: "Shridhar Daithankar" > To: > Sent: Monday, July 21, 2003 2:05 PM > Subject: Re: [PERFORM] Tuning PostgreSQL > > > > On 21 Jul 2003 at 13:45, Alexander Priem wrote: > > > > > So where can I set the noatime & data=writeback variables? They are not > > > PostgreSQL settings, but rather Linux settings, right? Where can I find > > > these? > > > > These are typicaly set in /etc/fstab.conf. These are mount settings. man > mount > > for more details. > > > > The second setting data=writeback is ext3 specific, IIRC. > > > > HTH > > > > Bye > > Shridhar > > > > -- > > History tends to exaggerate. -- Col. Green, "The Savage Curtain", stardate > > 5906.4 > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Mon Jul 21 13:08:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 80D74D1C513 for ; Mon, 21 Jul 2003 16:08:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 88831-03 for ; Mon, 21 Jul 2003 16:07:55 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id DE106D1C50D for ; Mon, 21 Jul 2003 13:07:54 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3239800; Mon, 21 Jul 2003 09:08:01 -0700 Content-Type: text/plain; charset="utf-8" From: Josh Berkus Organization: Aglio Database Solutions To: "Alexander Priem" , "Roman Fail" , , Subject: Re: Tuning PostgreSQL Date: Mon, 21 Jul 2003 09:06:10 -0700 User-Agent: KMail/1.4.3 References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> In-Reply-To: <014a01c34f90$74bc2c80$b696a8c0@APR> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307210906.10226.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/335 X-Sequence-Number: 2628 Alexander, > Hmmm. Seems to me that this setup would be better than one RAID5 with three > 36Gb disks, wouldn't you think so? With one RAID5 array, I would still have > the data and the WAL on one volume... Definitely. As I've said, my experience with RAID5 is that with less than 5 disks, it performs around 40% of a single scsi disk for large read-write operation on Postgres. If you have only 3 disks, I'd advocate one disk for WAL and one RAID 1 array for the database. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 21 13:32:33 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id BD7A5D1C50D for ; Mon, 21 Jul 2003 16:28:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 78634-09 for ; Mon, 21 Jul 2003 16:28:58 +0000 (GMT) Received: from mail2.mediadesign.nl (md2.mediadesign.nl [212.19.205.67]) by svr1.postgresql.org (Postfix) with SMTP id C8AF2D1C4F1 for ; Mon, 21 Jul 2003 13:28:57 -0300 (ADT) Received: (qmail 1705 invoked by uid 666); 21 Jul 2003 16:28:52 -0000 Date: Mon, 21 Jul 2003 18:28:52 +0200 From: Vincent van Leeuwen To: pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL Message-ID: <20030721162852.GN19009@md2.mediadesign.nl> Mail-Followup-To: pgsql-performance@postgresql.org References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200307210906.10226.josh@agliodbs.com> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/336 X-Sequence-Number: 2629 On 2003-07-21 09:06:10 -0700, Josh Berkus wrote: > Alexander, > > > Hmmm. Seems to me that this setup would be better than one RAID5 with three > > 36Gb disks, wouldn't you think so? With one RAID5 array, I would still have > > the data and the WAL on one volume... > > Definitely. As I've said, my experience with RAID5 is that with less than 5 > disks, it performs around 40% of a single scsi disk for large read-write > operation on Postgres. > > If you have only 3 disks, I'd advocate one disk for WAL and one RAID 1 array > for the database. > In this setup your database is still screwed if a single disk (the WAL disk) stops working. You'll have to revert to your last backup if this happens. The RAID-1 redundancy on your data disks buys you almost nothing: marginally better performance and no real redundancy should a single disk fail. I'd use RAID-5 if you absolutely cannot use more disks, but I would use RAID-10 or two RAID-1 partitions if you can afford to use 4 disks. Vincent van Leeuwen Media Design - http://www.mediadesign.nl/ From pgsql-performance-owner@postgresql.org Mon Jul 21 15:06:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 3F8FBD1C4E1 for ; Mon, 21 Jul 2003 18:06:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 20952-04 for ; Mon, 21 Jul 2003 18:06:04 +0000 (GMT) Received: from spirit.aldeiadigital.com.br (iplus-fac-225-213-137.xdsl-fixo.ctbcnetsuper.com.br [200.225.213.137]) by svr1.postgresql.org (Postfix) with ESMTP id 02398D1C914 for ; Mon, 21 Jul 2003 15:06:01 -0300 (ADT) Received: from webmail.ad2.com.br (localhost.localdomain [127.0.0.1]) by spirit.aldeiadigital.com.br (8.11.6/8.11.6) with SMTP id h6LI75q04991 for ; Mon, 21 Jul 2003 15:07:06 -0300 Received: from 192.168.1.100 (SquirrelMail authenticated user alepaes) by webmail.ad2.com.br with HTTP; Mon, 21 Jul 2003 15:07:06 -0300 (BRT) Message-ID: <1330.192.168.1.100.1058810826.squirrel@webmail.ad2.com.br> In-Reply-To: <00b901c34f49$1ed04b40$0403a8c0@fejleszt4> References: <20030712112515.15711.h022.c001.wm@mail.dilger.cc.criticalpath.net> <00b901c34f49$1ed04b40$0403a8c0@fejleszt4> Date: Mon, 21 Jul 2003 15:07:06 -0300 (BRT) Subject: Re: Dual Xeon + HW RAID question From: "alexandre paes :: aldeia digital" To: pgsql-performance@postgresql.org User-Agent: SquirrelMail/1.4.0 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 X-Priority: 3 Importance: Normal X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/337 X-Sequence-Number: 2630 SZUCS, In my tests, I don�t a great performance enhacement with HT. I suspect that my problem resides on I/O performance. I will wait for a best moment to resinstall the system with other disk configurations and then I will report here. Thanks for all replys! Alexandre > Alexandre, > > I missed your orig. post, but AFAIK multiprocessing kernels will handle HT > CPUs as 2 CPUs each. Thus, our dual Xeon 2.4 is recognized as 4 Xeon 2.4 > CPUs. > > This way, I don't think HT would improve any single query (afaik no > postgres > process uses more than one cpu), but overall multi-query performance has > to > improve. > > ----- Original Message ----- > From: "Nikolaus Dilger" > Sent: Saturday, July 12, 2003 8:25 PM > > > Alexandre, > > Since you want the fastest speed I would do the 2 data > disks in RAID 0 (striping) not RAID 1 (mirroring). > > If you would care about not loosing any transactions > you would keep all 3 disks in RAID 5. > > Don't know the answer to the Hyperthreading question. > Why don't you run a test to find out? > > Regards, > Nikolaus > > On Thu, 10 Jul 2003 14:43:25 -0300 (BRT), "alexandre > arruda paes :: aldeia digital" wrote: > >> >> Hi, >> >> I have this machine with a 10 million records: >> * Dual Xeon 2.0 (HyperThreading enabled), 3 7200 SCSI > , >> Adaptec 2110S, >> RAID 5 - 32k chunk size, 1 GB Ram DDR 266 ECC, RH 8.0 > - >> 2.4.18 >> >> The database is mirrored with contrib/dbmirror in a P4 >> 1 Gb Ram + IDE >> >> If a disk failure occurs, I can use the server in the >> mirror. >> >> I will format the main server in this weekend and I >> have seen in the list >> some people that recomends a Software RAID instead HW. >> >> I think too remove the RAID 5 and turn a RAID 1 for >> data in 2 HDs. >> SO, WAL and swap in the thrid HD. >> >> My questions: >> >> 1) I will see best disk performance changing the disk >> layout like above >> 2) HyperThreading really improve a procces basead >> program, like postgres >> >> Thank�s for all >> >> Alexandre > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Mon Jul 21 17:05:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E51E6D1C922 for ; Mon, 21 Jul 2003 20:04:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 04944-10 for ; Mon, 21 Jul 2003 20:04:46 +0000 (GMT) Received: from colsweeper.cranel.com (newmail.cranel.com [12.32.71.147]) by svr1.postgresql.org (Postfix) with ESMTP id 55756D1C4E0 for ; Mon, 21 Jul 2003 17:04:46 -0300 (ADT) Received: from colmail01.cranel.com (colmail01.cranel.com) by colsweeper.cranel.com (Content Technologies SMTPRS 4.2.5) with ESMTP id for ; Mon, 21 Jul 2003 15:58:01 -0400 Received: from cranel.com (gspiegelberg.cranel.com [192.168.11.134]) by colmail01.cranel.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id PLSRD8ZR; Mon, 21 Jul 2003 16:07:07 -0400 Message-ID: <3F1C3638.8060100@cranel.com> Date: Mon, 21 Jul 2003 14:51:36 -0400 From: Greg Spiegelberg Organization: Cranel, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Mass file imports Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/341 X-Sequence-Number: 2634 Hello, I'm hunting for some advice on loading 50,000+ files all less than 32KB to a 7.3.2 database. The table is simple. create table files ( id int8 not null primary key, file text not null, size int8 not null, uid int not null, raw oid ); The script (currently bash) pulls a TAR file out of a queue, unpacks it to a large ramdisk mounted with noatime and performs a battery of tests on the files included in the TAR file. For each file in the TAR is will add the following to a SQL file... update files set raw=lo_import('/path/to/file/from/tar') where file='/path/to/file/from/tar'; This file begins with BEGIN; and ends with END; and is fed to Postgres via a "psql -f sqlfile" command. This part of the process can take anywhere from 30 to over 90 minutes depending on the number of files included in the TAR file. System is a RedHat 7.3 running a current 2.4.20 RedHat kernel and dual PIII 1.4GHz 2GB of memory 512MB ramdisk (mounted noatime) mirrored internal SCSI160 10k rpm drives for OS and swap 1 PCI 66MHz 64bit QLA2300 1 Gbit SAN with several RAID5 LUN's on a Hitachi 9910 All filesystems are ext3. Any thoughts? Greg -- Greg Spiegelberg Sr. Product Development Engineer Cranel, Incorporated. Phone: 614.318.4314 Fax: 614.431.8388 Email: gspiegelberg@Cranel.com Cranel. Technology. Integrity. Focus. From pgsql-performance-owner@postgresql.org Mon Jul 21 16:07:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 45D11D1C4E3 for ; Mon, 21 Jul 2003 19:07:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 46109-02 for ; Mon, 21 Jul 2003 19:07:54 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 35E8ED1C4C8 for ; Mon, 21 Jul 2003 16:07:52 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6LJ7YV03382; Mon, 21 Jul 2003 15:07:34 -0400 (EDT) From: Bruce Momjian Message-Id: <200307211907.h6LJ7YV03382@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question In-Reply-To: <00b901c34f49$1ed04b40$0403a8c0@fejleszt4> To: =?ISO-8859-1?Q?SZUCS_G=E1bor?= Date: Mon, 21 Jul 2003 15:07:32 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UNKNOWN-8BIT X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/338 X-Sequence-Number: 2631 SZUCS G�bor wrote: > Alexandre, > > I missed your orig. post, but AFAIK multiprocessing kernels will handle HT > CPUs as 2 CPUs each. Thus, our dual Xeon 2.4 is recognized as 4 Xeon 2.4 > CPUs. > > This way, I don't think HT would improve any single query (afaik no postgres > process uses more than one cpu), but overall multi-query performance has to > improve. When you use hyperthreading, each virtual cpu runs at 70% of a full CPU, so hyperthreading could be slower than non-hyperthreading. On a fully loaded dual cpu system, you are looking at 2.8 cpu's (0.70 * 4), while if it isn't loaded, you are looking at slowing down if you are only using 1 or 2 cpu's. -- 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 Jul 21 16:47:10 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2F1FFD1C4C8 for ; Mon, 21 Jul 2003 19:47:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 18154-09 for ; Mon, 21 Jul 2003 19:46:57 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 1F033D1C94F for ; Mon, 21 Jul 2003 16:46:55 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6LJkmj08231; Mon, 21 Jul 2003 15:46:48 -0400 (EDT) From: Bruce Momjian Message-Id: <200307211946.h6LJkmj08231@candle.pha.pa.us> Subject: Re: Help disk-pages In-Reply-To: <20030713121859.14444.qmail@community9.interfree.it> To: lax@interfree.it Date: Mon, 21 Jul 2003 15:46:48 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UNKNOWN-8BIT X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/339 X-Sequence-Number: 2632 See postgres -t and the statistics tables to see block read, and the chapter on Disk Space Monitor to find disk sizes. --------------------------------------------------------------------------- lax@interfree.it wrote: > > Hi all! I'm new to Postgresql and I'm trying solve a problem: is there a way to know how many disk-pages are read during a query? Because I found out only how many disk-pages a relation has and I'd like to know if there is a system > catalog or something else that stores this information > > thanks, > Andrea Lazzarotto > > ----------------------------------------------------- > > Salve, il messaggio che hai ricevuto > � stato inviato per mezzo del sistema > di web mail interfree. Se anche tu vuoi > una casella di posta free visita il > sito http://club.interfree.it > Ti aspettiamo! > > ----------------------------------------------------- > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > -- 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 Jul 21 16:52:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 3C441D1C4C9 for ; Mon, 21 Jul 2003 19:52:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 40258-10 for ; Mon, 21 Jul 2003 19:52:21 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id D6F92D1C913 for ; Mon, 21 Jul 2003 16:52:20 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3240632 for pgsql-performance@postgresql.org; Mon, 21 Jul 2003 12:52:37 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Commenting postgresql.conf Date: Mon, 21 Jul 2003 12:51:22 -0700 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307211251.22937.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/340 X-Sequence-Number: 2633 Folks, There was a general consensus (I think) on this list that we want more verb= ose=20 comments in postgresql.conf for 7.4. Is anyone available to do the work?= =20=20 We'll need the patch this week ... --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 21 17:27:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 6D5D0D1C512 for ; Mon, 21 Jul 2003 20:27:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 31601-04 for ; Mon, 21 Jul 2003 20:27:12 +0000 (GMT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 005E9D1C50F for ; Mon, 21 Jul 2003 17:27:12 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6LKPTT5024077; Mon, 21 Jul 2003 14:25:29 -0600 (MDT) Date: Mon, 21 Jul 2003 14:16:31 -0600 (MDT) From: "scott.marlowe" To: Josh Berkus Cc: Subject: Re: Commenting postgresql.conf In-Reply-To: <200307211251.22937.josh@agliodbs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/342 X-Sequence-Number: 2635 On Mon, 21 Jul 2003, Josh Berkus wrote: > Folks, > > There was a general consensus (I think) on this list that we want more verbose > comments in postgresql.conf for 7.4. Is anyone available to do the work? > We'll need the patch this week ... I'll help. this is probably the kind of thing that needs a bit of round robin to get it right... From pgsql-performance-owner@postgresql.org Mon Jul 21 17:41:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id E9252D1C50F for ; Mon, 21 Jul 2003 20:41:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 22218-09 for ; Mon, 21 Jul 2003 20:41:42 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 40F38D1C50D for ; Mon, 21 Jul 2003 17:41:41 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6LKfbi14090; Mon, 21 Jul 2003 16:41:37 -0400 (EDT) From: Bruce Momjian Message-Id: <200307212041.h6LKfbi14090@candle.pha.pa.us> Subject: Re: Tunning FreeeBSD and PostgreSQL In-Reply-To: To: Vivek Khera Date: Mon, 21 Jul 2003 16:41:37 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/343 X-Sequence-Number: 2636 Vivek Khera wrote: > >>>>> "SH" == Stephen Howie writes: > > SH> Richard- > SH> That was very helpfull Thanks! > SH> I still would like some guidance on tunning FreeBSD (shmmax and shmmaxpgs). > SH> Do I need to even touch these settings? > > Here's what I use on FreeBSD 4.7/4.8. The kernel settings don't hurt > anything being too large for the SHM values, since they are limits, > not anything pre-allocated (from my understanding). These settings > allow for up to 100,000 shared buffers (I currently only use 30,000 > buffers) I think the only downside to making them too big is that you allocate page tables and prevent that address range from being used by other processes. Of course, if you have much less than 4 gigs of RAM in the machine, it probably isn't an issue. -- 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 Jul 21 17:50:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 58768D1C4E3 for ; Mon, 21 Jul 2003 20:50:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 40024-05 for ; Mon, 21 Jul 2003 20:50:16 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 43E5CD1C4C8 for ; Mon, 21 Jul 2003 17:50:16 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3240861 for pgsql-performance@postgresql.org; Mon, 21 Jul 2003 13:50:34 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: PGAvd Date: Mon, 21 Jul 2003 13:49:19 -0700 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307211349.19336.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/344 X-Sequence-Number: 2637 Folks, Is the auto-vacuum daemon a new feature for 7.4, or is there a version for= =20 7.3.3? It's a bit unclear from the PGAvd page ... --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 21 17:54:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 94C7ED1C4C8 for ; Mon, 21 Jul 2003 20:54:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 24894-09 for ; Mon, 21 Jul 2003 20:54:10 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 137BCD1C50F for ; Mon, 21 Jul 2003 17:54:09 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6LKs5v15525; Mon, 21 Jul 2003 16:54:05 -0400 (EDT) From: Bruce Momjian Message-Id: <200307212054.h6LKs5v15525@candle.pha.pa.us> Subject: Re: PGAvd In-Reply-To: <200307211349.19336.josh@agliodbs.com> To: josh@agliodbs.com Date: Mon, 21 Jul 2003 16:54:05 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/345 X-Sequence-Number: 2638 I think it is new for 7.4. I don't see it in 7.3.X CVS. --------------------------------------------------------------------------- Josh Berkus wrote: > Folks, > > Is the auto-vacuum daemon a new feature for 7.4, or is there a version for > 7.3.3? It's a bit unclear from the PGAvd page ... > > -- > -Josh Berkus > Aglio Database Solutions > San Francisco > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > -- 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 Jul 21 18:58:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id F02F2D1C50B for ; Mon, 21 Jul 2003 21:58:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 59342-04 for ; Mon, 21 Jul 2003 21:58:42 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 9E1ECD1C4E0 for ; Mon, 21 Jul 2003 18:58:42 -0300 (ADT) Received: from dev6.int.libertyrms.com ([10.1.2.212] helo=libertyrms.info) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19eig5-0006FE-00; Mon, 21 Jul 2003 17:58:41 -0400 Message-ID: <3F1C627E.4030408@libertyrms.info> Date: Mon, 21 Jul 2003 18:00:30 -0400 From: Christopher Browne User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030714 Debian/1.4-2 X-Accept-Language: en MIME-Version: 1.0 To: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: PGAvd Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/346 X-Sequence-Number: 2639 >Is the auto-vacuum daemon a new feature for 7.4, or is there a version for >7.3.3? It's a bit unclear from the PGAvd page ... It was added to CVS as of 7.4. It works perfectly well with 7.3.x -- let name="cbbrowne" and tld="libertyrms.info" in String.concat "@" [name;tld];; Christopher Browne (416) 646 3304 x124 (land) From pgsql-performance-owner@postgresql.org Tue Jul 22 04:03:44 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 05B9CD1C91B for ; Tue, 22 Jul 2003 07:03:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 17266-10 for ; Tue, 22 Jul 2003 07:03:30 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 00E6DD1C913 for ; Tue, 22 Jul 2003 04:03:30 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Tue, 22 Jul 2003 09:03:28 +0200 Message-ID: <002901c3501f$86565940$b696a8c0@APR> From: "Alexander Priem" To: "Vincent van Leeuwen" , References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> Subject: Re: Tuning PostgreSQL Date: Tue, 22 Jul 2003 09:04:42 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/347 X-Sequence-Number: 2640 Hi all, Vincent, You said that using RAID1, you don't have real redundancy. But RAID1 is mirroring, right? So if one of the two disks should fail, there should be no data lost, right? I have been thinking some more. 18Gb drives are cheaper than 36 or 72Gb drives. I don't know if I can get the money for this, but how would the following setup sound? Two 18Gb (15.000rpm) disks in RAID1 array for Operating System + WAL. Four 18Gb (15.000rpm) disks in RAID5 array for data. For the same amount of money, I could also get: Two 36Gb (10.000rpm) disks in RAID1 array for Operating System + WAL. Five/Six 36Gb (10.000rpm) disks in RAID5 array for data. Which would be the best of the above? The one with four 15k-rpm disks or the one with five/six 10k-rpm disks? Would these configs be better than all disks in one huge RAID5 array? There are so many possible configs with RAID....... Kind regards, Alexander Priem. ----- Original Message ----- From: "Vincent van Leeuwen" To: Sent: Monday, July 21, 2003 6:28 PM Subject: Re: [PERFORM] Tuning PostgreSQL > On 2003-07-21 09:06:10 -0700, Josh Berkus wrote: > > Alexander, > > > > > Hmmm. Seems to me that this setup would be better than one RAID5 with three > > > 36Gb disks, wouldn't you think so? With one RAID5 array, I would still have > > > the data and the WAL on one volume... > > > > Definitely. As I've said, my experience with RAID5 is that with less than 5 > > disks, it performs around 40% of a single scsi disk for large read-write > > operation on Postgres. > > > > If you have only 3 disks, I'd advocate one disk for WAL and one RAID 1 array > > for the database. > > > > In this setup your database is still screwed if a single disk (the WAL disk) > stops working. You'll have to revert to your last backup if this happens. The > RAID-1 redundancy on your data disks buys you almost nothing: marginally > better performance and no real redundancy should a single disk fail. > > I'd use RAID-5 if you absolutely cannot use more disks, but I would use > RAID-10 or two RAID-1 partitions if you can afford to use 4 disks. > > Vincent van Leeuwen > Media Design - http://www.mediadesign.nl/ > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Tue Jul 22 04:23:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 100C7D1C4E6 for ; Tue, 22 Jul 2003 07:23:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 16442-06 for ; Tue, 22 Jul 2003 07:23:19 +0000 (GMT) Received: from ns1.bee.lt (ns.bi.lt [213.226.131.131]) by svr1.postgresql.org (Postfix) with ESMTP id 58125D1C4DC for ; Tue, 22 Jul 2003 04:23:18 -0300 (ADT) Received: from B027543 (inet.bee.lt [213.226.131.30]) by ns1.bee.lt (8.11.6/8.11.6) with SMTP id h6M7NIi06298 for ; Tue, 22 Jul 2003 10:23:18 +0300 Message-ID: <057401c35022$204ea140$f20214ac@bite.lt> From: "Mindaugas Riauba" To: References: <200307211907.h6LJ7YV03382@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question Date: Tue, 22 Jul 2003 10:23:14 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1257" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/348 X-Sequence-Number: 2641 > > I missed your orig. post, but AFAIK multiprocessing kernels will handle HT > > CPUs as 2 CPUs each. Thus, our dual Xeon 2.4 is recognized as 4 Xeon 2.4 > > CPUs. > > > > This way, I don't think HT would improve any single query (afaik no postgres > > process uses more than one cpu), but overall multi-query performance has to > > improve. > > When you use hyperthreading, each virtual cpu runs at 70% of a full CPU, > so hyperthreading could be slower than non-hyperthreading. On a fully > loaded dual cpu system, you are looking at 2.8 cpu's (0.70 * 4), while > if it isn't loaded, you are looking at slowing down if you are only > using 1 or 2 cpu's. Virtual cpus are not running at 70% of real cpus :). Slowdown will happen if scheduler will run 2 processes on the same real cpu. And I read that there are patches for Linux kernel to fix that. Sooner rather than later they will appear in Linus kernel. Mindaugas From pgsql-performance-owner@postgresql.org Tue Jul 22 06:44:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id B4D6DD1C94F for ; Tue, 22 Jul 2003 09:42:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 40472-05 for ; Tue, 22 Jul 2003 09:40:56 +0000 (GMT) Received: from mail2.mediadesign.nl (md2.mediadesign.nl [212.19.205.67]) by svr1.postgresql.org (Postfix) with SMTP id EEDD1D1C7F5 for ; Tue, 22 Jul 2003 06:40:54 -0300 (ADT) Received: (qmail 16016 invoked by uid 666); 22 Jul 2003 09:40:35 -0000 Date: Tue, 22 Jul 2003 11:40:35 +0200 From: Vincent van Leeuwen To: pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL Message-ID: <20030722094035.GU19009@md2.mediadesign.nl> Mail-Followup-To: pgsql-performance@postgresql.org References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002901c3501f$86565940$b696a8c0@APR> User-Agent: Mutt/1.3.28i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/349 X-Sequence-Number: 2642 On 2003-07-22 09:04:42 +0200, Alexander Priem wrote: > Hi all, > > Vincent, You said that using RAID1, you don't have real redundancy. But > RAID1 is mirroring, right? So if one of the two disks should fail, there > should be no data lost, right? > Right. But the proposal was a single disk for WAL, without redundancy, and I argued that wasn't really safe. RAID1 by itself is extremely safe, possibly even the safest RAID type there is. > I have been thinking some more. 18Gb drives are cheaper than 36 or 72Gb > drives. I don't know if I can get the money for this, but how would the > following setup sound? > > Two 18Gb (15.000rpm) disks in RAID1 array for Operating System + WAL. > Four 18Gb (15.000rpm) disks in RAID5 array for data. > Our own testing has shown that a 6 disk RAID-10 array is faster than what you describe. Of course, this is very much dependant on how much INSERT/UPDATES you generate (which taxes your WAL more), so your mileage may vary. > For the same amount of money, I could also get: > > Two 36Gb (10.000rpm) disks in RAID1 array for Operating System + WAL. > Five/Six 36Gb (10.000rpm) disks in RAID5 array for data. > It is said that a higher RPM is particularly useful for a WAL disk. So you might consider using two 18GB 15K rpm drives for a RAID-1 WAL disk (+OS and swap), and using 36GB 10K rpm disks in a RAID-5 array if you need that diskspace. > Which would be the best of the above? The one with four 15k-rpm disks or the > one with five/six 10k-rpm disks? > Would these configs be better than all disks in one huge RAID5 array? There > are so many possible configs with RAID....... > 15K rpm disks are significantly faster than 10K rpm disks. If your only concern is performance, buy 15K rpm disks. If you want more diskspace for your money, fall back to larger 10K rpm disks. I personally think seperate WAL disks are vastly overrated, since they haven't shown a big performance gain in our own tests. But as I have said, this is extremely dependant on the type of load you generate, so only your own tests can tell you what you should do in this respect. About RAID types: the fastest RAID type by far is RAID-10. However, this will cost you a lot of useable diskspace, so it isn't for everyone. You need at least 4 disks for a RAID-10 array. RAID-5 is a nice compromise if you want as much useable diskspace as possible and still want to be redundant. RAID-1 is very useful for small (2-disk) arrays. If you have the time and are settled on buying 6 disks, I'd test the following scenarios: - 6-disk RAID-10 array (should perform best) - 4-disk RAID-10 array containing data, 2-disk RAID-1 array for WAL, OS, etc - 4-disk RAID-5 array containing data, 2-disk RAID-1 array for WAL, OS, etc - 6-disk RAID-5 array (will probably perform worst) Hope this helps. Vincent van Leeuwen Media Design - http://www.mediadesign.nl/ From pgsql-performance-owner@postgresql.org Tue Jul 22 07:12:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 80161D1C94F for ; Tue, 22 Jul 2003 09:55:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 59804-01 for ; Tue, 22 Jul 2003 09:54:55 +0000 (GMT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id BBEA0D1C7F5 for ; Tue, 22 Jul 2003 06:54:47 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030722095256.FCQK7142.lakemtao01.cox.net@[192.168.1.1]> for ; Tue, 22 Jul 2003 05:52:56 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <3F1C00B2.20319.147235A4@localhost> References: <3F1C00B2.20319.147235A4@localhost> Content-Type: text/plain Message-Id: <1058867576.15449.17.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 04:52:56 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/350 X-Sequence-Number: 2643 On Mon, 2003-07-21 at 04:33, Shridhar Daithankar wrote: > Hi Alexander , > > On 21 Jul 2003 at 11:23, Alexander Priem wrote: [snip] > > I use ext3 filesystem, which probably is not the best performer, is it? > > No. You also need to check ext2, reiser and XFS. There is no agreement between > users as in what works best. You need to benchmark and decide. According to Jeremy Allison of SAMBA, ""They used ext3, which is one of the slowest filesystems on Linux," Allison said. "In a real comparative test, you would use XFS". http://www.linuxworld.com/story/32673.htm -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 22 11:05:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 65BF4D1C946 for ; Tue, 22 Jul 2003 12:52:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 08814-02 for ; Tue, 22 Jul 2003 12:52:46 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id D29CDD1C90F for ; Tue, 22 Jul 2003 09:52:44 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886 for ; Tue, 22 Jul 2003 14:52:45 +0200 Message-ID: <006801c35050$518c49a0$b696a8c0@APR> From: "Alexander Priem" To: "PgSQL Performance ML" References: <3F1C00B2.20319.147235A4@localhost> <1058867576.15449.17.camel@haggis> Subject: Re: Tuning PostgreSQL Date: Tue, 22 Jul 2003 14:53:58 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/352 X-Sequence-Number: 2645 Wow, I never figured how many different RAID configurations one could think of :) After reading lots of material, forums and of course, this mailing-list, I think I am going for a RAID5 configuration of 6 disks (18Gb, 15.000 rpm each), one of those six disks will be a 'hot spare'. I will just put the OS, the WAL and the data one one volume. RAID10 is way to expensive :) If I understand correctly, this will give great read-performance, but less write-performance. But since this server will be equipped with an embedded RAID controller featuring 128Mb of battery-backed cache, I figure that this controller will negate that (at least somewhat). I will need to find out whether this cache can be configured so that it will ONLY cache WRITES, not READS.... Also because of this battery backed cache controller, I will go for the ext2 file system, mounted with 'noatime'. I will use a UPS, so I don't think I need the journaling of ext3. XFS is not natively supported by RedHat and I will go for the easy way here :) 1 Gb of RAM should be enough, I think. That is about the only point that almost everyone agrees on :) Do you think ECC is very important? The server I have in mind does not support it. Another one does, but is is about 1.000 euros more expensive :( One CPU should also be enough. As for postgresql.conf settings, I think I will start with the following : max_connections = 128 superuser_reserved_connections = 1 shared_buffers = 8192 max_fsm_relations = 1000 max_fsm_pages = 100000 wal_buffers = 32 sort_mem = 2048 vacuum_mem = 32768 effective_cache_size = 28672 (this one I'm not sure about, maybe this one needs to be higher) random_page_cost = 2 geq0_threshold = 20 This pretty much sums it up. What do you think about this config? It may not be the fastest, but a server like this will cost about 4750 euros, and that is including an Intel Xeon 2.4GHz cpu, redundant power supply, WITHOUT the UPS. Seems very reasonable to me... Kind regards, Alexander Priem. From pgsql-performance-owner@postgresql.org Tue Jul 22 10:54:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 9FF05D1C513 for ; Tue, 22 Jul 2003 13:26:35 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 08658-03 for ; Tue, 22 Jul 2003 13:26:18 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 6F2DCD1C50B for ; Tue, 22 Jul 2003 10:26:16 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Tue, 22 Jul 2003 15:26:07 +0200 Message-ID: <009901c35054$fad824d0$b696a8c0@APR> From: "Alexander Priem" To: "Vincent van Leeuwen" , References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> Subject: Re: Tuning PostgreSQL Date: Tue, 22 Jul 2003 15:27:20 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/351 X-Sequence-Number: 2644 Wow, I never figured how many different RAID configurations one could think of :) After reading lots of material, forums and of course, this mailing-list, I think I am going for a RAID5 configuration of 6 disks (18Gb, 15.000 rpm each), one of those six disks will be a 'hot spare'. I will just put the OS, the WAL and the data one one volume. RAID10 is way to expensive :) If I understand correctly, this will give great read-performance, but less write-performance. But since this server will be equipped with an embedded RAID controller featuring 128Mb of battery-backed cache, I figure that this controller will negate that (at least somewhat). I will need to find out whether this cache can be configured so that it will ONLY cache WRITES, not READS.... Also because of this battery backed cache controller, I will go for the ext2 file system, mounted with 'noatime'. I will use a UPS, so I don't think I need the journaling of ext3. XFS is not natively supported by RedHat and I will go for the easy way here :) 1 Gb of RAM should be enough, I think. That is about the only point that almost everyone agrees on :) Do you think ECC is very important? The server I have in mind does not support it. Another one does, but is is about 1.000 euros more expensive :( One CPU should also be enough. As for postgresql.conf settings, I think I will start with the following : max_connections = 128 superuser_reserved_connections = 1 shared_buffers = 8192 max_fsm_relations = 1000 max_fsm_pages = 100000 wal_buffers = 32 sort_mem = 2048 vacuum_mem = 32768 effective_cache_size = 28672 (this one I'm not sure about, maybe this one needs to be higher) random_page_cost = 2 geq0_threshold = 20 This pretty much sums it up. What do you think about this config? It may not be the fastest, but a server like this will cost about 4750 euros, and that is including an Intel Xeon 2.4GHz cpu, redundant power supply, WITHOUT the UPS. Seems very reasonable to me... Kind regards, Alexander Priem. ----- Original Message ----- From: "Vincent van Leeuwen" To: Sent: Tuesday, July 22, 2003 11:40 AM Subject: Re: [PERFORM] Tuning PostgreSQL > On 2003-07-22 09:04:42 +0200, Alexander Priem wrote: > > Hi all, > > > > Vincent, You said that using RAID1, you don't have real redundancy. But > > RAID1 is mirroring, right? So if one of the two disks should fail, there > > should be no data lost, right? > > > > Right. But the proposal was a single disk for WAL, without redundancy, and I > argued that wasn't really safe. RAID1 by itself is extremely safe, possibly > even the safest RAID type there is. > > > I have been thinking some more. 18Gb drives are cheaper than 36 or 72Gb > > drives. I don't know if I can get the money for this, but how would the > > following setup sound? > > > > Two 18Gb (15.000rpm) disks in RAID1 array for Operating System + WAL. > > Four 18Gb (15.000rpm) disks in RAID5 array for data. > > > > Our own testing has shown that a 6 disk RAID-10 array is faster than what you > describe. Of course, this is very much dependant on how much INSERT/UPDATES > you generate (which taxes your WAL more), so your mileage may vary. > > > For the same amount of money, I could also get: > > > > Two 36Gb (10.000rpm) disks in RAID1 array for Operating System + WAL. > > Five/Six 36Gb (10.000rpm) disks in RAID5 array for data. > > > > It is said that a higher RPM is particularly useful for a WAL disk. So you > might consider using two 18GB 15K rpm drives for a RAID-1 WAL disk (+OS and > swap), and using 36GB 10K rpm disks in a RAID-5 array if you need that > diskspace. > > > Which would be the best of the above? The one with four 15k-rpm disks or the > > one with five/six 10k-rpm disks? > > Would these configs be better than all disks in one huge RAID5 array? There > > are so many possible configs with RAID....... > > > > 15K rpm disks are significantly faster than 10K rpm disks. If your only > concern is performance, buy 15K rpm disks. If you want more diskspace for your > money, fall back to larger 10K rpm disks. > > I personally think seperate WAL disks are vastly overrated, since they haven't > shown a big performance gain in our own tests. But as I have said, this is > extremely dependant on the type of load you generate, so only your own tests > can tell you what you should do in this respect. > > About RAID types: the fastest RAID type by far is RAID-10. However, this will > cost you a lot of useable diskspace, so it isn't for everyone. You need at > least 4 disks for a RAID-10 array. RAID-5 is a nice compromise if you want as > much useable diskspace as possible and still want to be redundant. RAID-1 is > very useful for small (2-disk) arrays. > > If you have the time and are settled on buying 6 disks, I'd test the following > scenarios: > - 6-disk RAID-10 array (should perform best) > - 4-disk RAID-10 array containing data, 2-disk RAID-1 array for WAL, OS, etc > - 4-disk RAID-5 array containing data, 2-disk RAID-1 array for WAL, OS, etc > - 6-disk RAID-5 array (will probably perform worst) > > > Hope this helps. > > Vincent van Leeuwen > Media Design - http://www.mediadesign.nl/ > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Tue Jul 22 11:12:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 79867D1C4B7 for ; Tue, 22 Jul 2003 14:11:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 93519-09 for ; Tue, 22 Jul 2003 14:11:07 +0000 (GMT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id A887ED1C4CA for ; Tue, 22 Jul 2003 11:11:09 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19exrB-0002sg-00 for ; Tue, 22 Jul 2003 10:11:09 -0400 Received: by dba2 (Postfix, from userid 1019) id 78A8ACEC9; Tue, 22 Jul 2003 10:12:20 -0400 (EDT) Date: Tue, 22 Jul 2003 10:12:20 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL Message-ID: <20030722141219.GA5158@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> <009901c35054$fad824d0$b696a8c0@APR> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <009901c35054$fad824d0$b696a8c0@APR> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/353 X-Sequence-Number: 2646 On Tue, Jul 22, 2003 at 03:27:20PM +0200, Alexander Priem wrote: > file system, mounted with 'noatime'. I will use a UPS, so I don't think I > need the journaling of ext3. XFS is not natively supported by RedHat and I Just in case you're still thinking, why do you suppose that only power failures lead to system crashes? Surprise kernel panics due to bad hardware or OS upgrades with bugs in them, sudden failures because of bad memory, &c: all these things also can lead to crashes, and though super-redundant hardware can mitigate that risk, they can't eliminate them completely. This is not advice, of course, but for my money, its a bad idea not to use a journalled filesystem (or something similar) for production systems. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Tue Jul 22 11:25:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 49A46D1C50C for ; Tue, 22 Jul 2003 14:20:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 03713-04 for ; Tue, 22 Jul 2003 14:20:18 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) by svr1.postgresql.org (Postfix) with ESMTP id 8964FD1C94D for ; Tue, 22 Jul 2003 11:20:18 -0300 (ADT) Received: by yertle.kcilink.com (Postfix, from userid 100) id 6A1352178C; Tue, 22 Jul 2003 10:20:19 -0400 (EDT) From: Vivek Khera MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16157.18467.310482.384436@yertle.int.kciLink.com> Date: Tue, 22 Jul 2003 10:20:19 -0400 To: pgsql-performance@postgresql.org Subject: Re: Tunning FreeeBSD and PostgreSQL In-Reply-To: <200307212041.h6LKfbi14090@candle.pha.pa.us> References: <200307212041.h6LKfbi14090@candle.pha.pa.us> X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/354 X-Sequence-Number: 2647 >>>>> "BM" == Bruce Momjian writes: >> not anything pre-allocated (from my understanding). These settings >> allow for up to 100,000 shared buffers (I currently only use 30,000 >> buffers) BM> I think the only downside to making them too big is that you allocate BM> page tables and prevent that address range from being used by other Does this apply in general or just on FreeBSD? BM> processes. Of course, if you have much less than 4 gigs of RAM in the BM> machine, it probably isn't an issue. Probably, but wasting page table entries is never a good idea... -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Tue Jul 22 11:41:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 14F6ED1C516 for ; Tue, 22 Jul 2003 14:33:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 28918-02 for ; Tue, 22 Jul 2003 14:33:35 +0000 (GMT) Received: from flake.decibel.org (unknown [66.143.173.58]) by svr1.postgresql.org (Postfix) with SMTP id F164AD1C50A for ; Tue, 22 Jul 2003 11:33:34 -0300 (ADT) Received: (qmail 24306 invoked by uid 1001); 22 Jul 2003 14:33:35 -0000 Date: Tue, 22 Jul 2003 09:33:35 -0500 From: "Jim C. Nasby" To: Alexander Priem Cc: Vincent van Leeuwen , pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL Message-ID: <20030722143335.GH55392@nasby.net> References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> <009901c35054$fad824d0$b696a8c0@APR> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <009901c35054$fad824d0$b696a8c0@APR> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/356 X-Sequence-Number: 2649 On Tue, Jul 22, 2003 at 03:27:20PM +0200, Alexander Priem wrote: > Wow, I never figured how many different RAID configurations one could think > of :) > > After reading lots of material, forums and of course, this mailing-list, I > think I am going for a RAID5 configuration of 6 disks (18Gb, 15.000 rpm > each), one of those six disks will be a 'hot spare'. I will just put the OS, > the WAL and the data one one volume. RAID10 is way to expensive :) > > If I understand correctly, this will give great read-performance, but less > write-performance. But since this server will be equipped with an embedded > RAID controller featuring 128Mb of battery-backed cache, I figure that this > controller will negate that (at least somewhat). I will need to find out > whether this cache can be configured so that it will ONLY cache WRITES, not > READS.... I think the bigger isssue with RAID5 write performance in a database is that it hits every spindle. The real performance bottleneck you run into is latency, especially the latency of positioning the heads. I don't have any proof to this theory, but I believe this is why moving WAL and/or temp_db to seperate drives from the main database files can be a big benefit for some applications; not because of disk bandwidth but because it drastically cuts down the amount of time the heads have to spend flying around the disk. Of course, this is also highly dependant on how the filesystem operates, too. If it puts your WALs, temp_db, and database files very close to each other on the drive, splitting them out to seperate spindles won't help as much. -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Tue Jul 22 11:38:53 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 053DFD1C4B7 for ; Tue, 22 Jul 2003 14:37:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 21904-07 for ; Tue, 22 Jul 2003 14:37:44 +0000 (GMT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 60504D1C513 for ; Tue, 22 Jul 2003 11:37:45 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030722143746.HIVE7142.lakemtao01.cox.net@[192.168.1.1]> for ; Tue, 22 Jul 2003 10:37:46 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <006801c35050$518c49a0$b696a8c0@APR> References: <3F1C00B2.20319.147235A4@localhost> <1058867576.15449.17.camel@haggis> <006801c35050$518c49a0$b696a8c0@APR> Content-Type: text/plain Message-Id: <1058884665.15452.57.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 09:37:45 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/355 X-Sequence-Number: 2648 On Tue, 2003-07-22 at 07:53, Alexander Priem wrote: > Wow, I never figured how many different RAID configurations one could think [snip] > Also because of this battery backed cache controller, I will go for the ext2 > file system, mounted with 'noatime'. I will use a UPS, so I don't think I > need the journaling of ext3. Oooooo, I don't think I'd do that!!!!! It's akin to saying, "I don't need to make backups, because I have RAID[1,5,10,1+0] If the power is out for 26 minutes and your UPS only lasts for 25 minutes, you could be in be in for a long, painful boot process if the box crashes. (For example, the UPS auto-shutdown daemon doesn't work properly, and no one can get to the console to shut it down properly before the batteries die.) -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 22 12:00:59 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 19096D1C516 for ; Tue, 22 Jul 2003 15:00:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 28927-06 for ; Tue, 22 Jul 2003 15:00:28 +0000 (GMT) Received: from mail.cict.nl (vnd-7521.mxs.adsl.euronet.nl [62.234.149.33]) by svr1.postgresql.org (Postfix) with ESMTP id 467CFD1C50A for ; Tue, 22 Jul 2003 12:00:27 -0300 (ADT) Received: from APR ([192.168.150.182]) by mail.cict.nl (Merak 5.9.4) with SMTP id DUC73886; Tue, 22 Jul 2003 17:00:22 +0200 Message-ID: <00d301c35062$25c943b0$b696a8c0@APR> From: "Alexander Priem" To: "Jim C. Nasby" Cc: "Vincent van Leeuwen" , References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> <009901c35054$fad824d0$b696a8c0@APR> <20030722143335.GH55392@nasby.net> Subject: Re: Tuning PostgreSQL Date: Tue, 22 Jul 2003 17:01:36 +0200 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.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/357 X-Sequence-Number: 2650 OK, another change of plans :) ext2 seems to be a bad idea. So i'll stick with ext3. Better safe than sorry... About the RAID-config: Maybe RAID-10 with six disks is affordable after all. I would have to take the smallest disks in this case, 18Gb per disk. So six 18Gb disks (15000rpm) would result in a total capacity of 54 Gb, right? This volume would hold OS, WAL and data, but since RAID10 appears to deliver such great performance (according to several people), in combination with the 128Mb of battery backed cache, this would be a good solution? Hmmm. I keep changing my mind about this. My Db would be mostly 'selecting', but there would also be pretty much inserting and updating done. But most of the work would be selects. So would this config be OK? Kind regards, Alexander. ----- Original Message ----- From: "Jim C. Nasby" To: "Alexander Priem" Cc: "Vincent van Leeuwen" ; Sent: Tuesday, July 22, 2003 4:33 PM Subject: Re: [PERFORM] Tuning PostgreSQL > On Tue, Jul 22, 2003 at 03:27:20PM +0200, Alexander Priem wrote: > > Wow, I never figured how many different RAID configurations one could think > > of :) > > > > After reading lots of material, forums and of course, this mailing-list, I > > think I am going for a RAID5 configuration of 6 disks (18Gb, 15.000 rpm > > each), one of those six disks will be a 'hot spare'. I will just put the OS, > > the WAL and the data one one volume. RAID10 is way to expensive :) > > > > If I understand correctly, this will give great read-performance, but less > > write-performance. But since this server will be equipped with an embedded > > RAID controller featuring 128Mb of battery-backed cache, I figure that this > > controller will negate that (at least somewhat). I will need to find out > > whether this cache can be configured so that it will ONLY cache WRITES, not > > READS.... > > I think the bigger isssue with RAID5 write performance in a database is > that it hits every spindle. The real performance bottleneck you run into > is latency, especially the latency of positioning the heads. I don't > have any proof to this theory, but I believe this is why moving WAL > and/or temp_db to seperate drives from the main database files can be a > big benefit for some applications; not because of disk bandwidth but > because it drastically cuts down the amount of time the heads have to > spend flying around the disk. > > Of course, this is also highly dependant on how the filesystem operates, > too. If it puts your WALs, temp_db, and database files very close to > each other on the drive, splitting them out to seperate spindles won't > help as much. > -- > Jim C. Nasby, Database Consultant jim@nasby.net > Member: Triangle Fraternity, Sports Car Club of America > Give your computer some brain candy! www.distributed.net Team #1828 > > Windows: "Where do you want to go today?" > Linux: "Where do you want to go tomorrow?" > FreeBSD: "Are you guys coming, or what?" > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend From pgsql-performance-owner@postgresql.org Tue Jul 22 12:36:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 0458CD1C4DB for ; Tue, 22 Jul 2003 15:36:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 49112-06 for ; Tue, 22 Jul 2003 15:36:31 +0000 (GMT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 94B73D1C93C for ; Tue, 22 Jul 2003 12:36:31 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030722153631.HYXP7142.lakemtao01.cox.net@[192.168.1.1]> for ; Tue, 22 Jul 2003 11:36:31 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <00d301c35062$25c943b0$b696a8c0@APR> References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> <009901c35054$fad824d0$b696a8c0@APR> <20030722143335.GH55392@nasby.net> <00d301c35062$25c943b0$b696a8c0@APR> Content-Type: text/plain Message-Id: <1058888190.15449.94.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 10:36:30 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/358 X-Sequence-Number: 2651 On Tue, 2003-07-22 at 10:01, Alexander Priem wrote: > OK, another change of plans :) > > ext2 seems to be a bad idea. So i'll stick with ext3. Better safe than > sorry... Don't forget noatime! > About the RAID-config: Maybe RAID-10 with six disks is affordable after all. > I would have to take the smallest disks in this case, 18Gb per disk. So six > 18Gb disks (15000rpm) would result in a total capacity of 54 Gb, right? This > volume would hold OS, WAL and data, but since RAID10 appears to deliver such > great performance (according to several people), in combination with the > 128Mb of battery backed cache, this would be a good solution? > > Hmmm. I keep changing my mind about this. My Db would be mostly 'selecting', > but there would also be pretty much inserting and updating done. But most of > the work would be selects. So would this config be OK? Others may disagree, but I'd put the OS and executables on a separate disk from the db and WAL, and make it an IDE drive, since it's so much less expensive than SCSI disks. (Make a copy of the disk, and if it craps out, pop out the old disk, stick in the new disk, and fire the box right back up...) Thus, you'll have an OS/executables disk, and a separate DB disk, and never the twain shall meet. Theoretically, you could pick up those 6 drives and controller, move them to another machine, and the data should be just as it was on the other box. -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 22 13:13:17 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 62117D1C935 for ; Tue, 22 Jul 2003 16:13:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 62032-02 for ; Tue, 22 Jul 2003 16:13:05 +0000 (GMT) Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id E6D85D1C4C8 for ; Tue, 22 Jul 2003 13:13:04 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kciLink.com (Postfix) with ESMTP id DF1F03E3B for ; Tue, 22 Jul 2003 12:13:04 -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 SMTP id 68669-07 for ; Tue, 22 Jul 2003 12:12:54 -0400 (EDT) Received: by lorax.kciLink.com (Postfix, from userid 8) id 81E6C3E26; Tue, 22 Jul 2003 12:12:54 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Tuning PostgreSQL Date: Tue, 22 Jul 2003 12:12:54 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 32 Message-ID: References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> <009901c35054$fad824d0$b696a8c0@APR> <20030722143335.GH55392@nasby.net> <00d301c35062$25c943b0$b696a8c0@APR> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kciLink.com 1058890374 76195 216.194.193.105 (22 Jul 2003 16:12:54 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Tue, 22 Jul 2003 16:12:54 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, berkeley-unix) Cancel-Lock: sha1:8aP6W9ol3HlIvl3jbYTzRQpKJZ4= X-Virus-Scanned: by amavisd-new at kciLink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/359 X-Sequence-Number: 2652 >>>>> "AP" == Alexander Priem writes: AP> Hmmm. I keep changing my mind about this. My Db would be mostly AP> 'selecting', but there would also be pretty much inserting and AP> updating done. But most of the work would be selects. So would AP> this config be OK? I'm about to order a new server. I haven't decided exactly how many disks I will get, but my plan is to get an 8-disk RAID10 with 15k RPM drives. I don't need the volume, just the speed and number of spindles, so I'm buying the smallest drives that meet my speed probably 18Gb each (sheesh! I remember getting my first 5Mb disk for my 8088 PC in college and thinking that was too much space). My mix is nearly even read/write, but probably a little biased towards the reading. This machine is replacing a 5-disk box that was switched from RAID5 to 4-disk RAID10 for data plus one system disk in January (what a pain that was to re-index, but that's another story). The switch from RAID5 to RAID10 made an enormous improvement in performance. The speedup wasn't from recreating the database: It was restored from a file-level backup so the actual files were not compacted or secretly "improved" in any way, other than my occasional reindexing. So I think your 6-disk RAID10 will be good. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Tue Jul 22 13:26:22 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4F78ED1C941 for ; Tue, 22 Jul 2003 16:26:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 61745-04 for ; Tue, 22 Jul 2003 16:26:10 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id E5D7ED1C7F1 for ; Tue, 22 Jul 2003 13:26:08 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6MGQ1824547; Tue, 22 Jul 2003 12:26:01 -0400 (EDT) From: Bruce Momjian Message-Id: <200307221626.h6MGQ1824547@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question In-Reply-To: <057401c35022$204ea140$f20214ac@bite.lt> To: Mindaugas Riauba Date: Tue, 22 Jul 2003 12:26:01 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/360 X-Sequence-Number: 2653 Mindaugas Riauba wrote: > > > > I missed your orig. post, but AFAIK multiprocessing kernels will handle > HT > > > CPUs as 2 CPUs each. Thus, our dual Xeon 2.4 is recognized as 4 Xeon 2.4 > > > CPUs. > > > > > > This way, I don't think HT would improve any single query (afaik no > postgres > > > process uses more than one cpu), but overall multi-query performance has > to > > > improve. > > > > When you use hyperthreading, each virtual cpu runs at 70% of a full CPU, > > so hyperthreading could be slower than non-hyperthreading. On a fully > > loaded dual cpu system, you are looking at 2.8 cpu's (0.70 * 4), while > > if it isn't loaded, you are looking at slowing down if you are only > > using 1 or 2 cpu's. > > Virtual cpus are not running at 70% of real cpus :). Slowdown will happen > if > scheduler will run 2 processes on the same real cpu. And I read that there > are > patches for Linux kernel to fix that. Sooner rather than later they will > appear > in Linus kernel. Right, I simplified it. The big deal is whether the OS favors the second real CPU over one of the virtual CPU's on the same die --- by default, it doesn't. Ever if it did work perfectly, you are talking about going from 1 to 1.4 or 2 to 2.8, which doesn't seem like much. -- 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-admin-owner@postgresql.org Tue Jul 22 14:11:36 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 0B2BED1C50D; Tue, 22 Jul 2003 17:10:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 69979-09; Tue, 22 Jul 2003 17:10:15 +0000 (GMT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id 5295CD1C954; Tue, 22 Jul 2003 14:10:12 -0300 (ADT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h6MHDtq24674; Tue, 22 Jul 2003 19:13:58 +0200 Received: from GMENDOLA2 (gmendola2.mm.eutelsat.org [194.214.173.26]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with SMTP id h6MH7LR15207; Tue, 22 Jul 2003 19:07:21 +0200 Message-ID: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> From: "Mendola Gaetano" To: , Subject: Wrong plan or what ? Date: Tue, 22 Jul 2003 19:10:14 +0200 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.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/212 X-Sequence-Number: 9552 Hi all, I'm running Postgres7.3.3 and I'm performing this simple select: select * from user_logs ul, user_data ud, class_default cd where ul.id_user = ud.id_user and ud.id_class = cd.id_class and cd.id_provider = 39; these are the number of rows for each table: user_logs: 1258955 class_default: 31 ( only one with id_provider = 39 ) user_data: 10274; this is the explain analyze for that query: QUERY PLAN Hash Join (cost=265.64..32000.76 rows=40612 width=263) (actual time=11074.21..11134.28 rows=10 loops=1) Hash Cond: ("outer".id_user = "inner".id_user) -> Seq Scan on user_logs ul (cost=0.00..24932.65 rows=1258965 width=48) (actual time=0.02..8530.21 rows=1258966 loops=1) -> Hash (cost=264.81..264.81 rows=331 width=215) (actual time=30.22..30.22 rows=0 loops=1) -> Nested Loop (cost=0.00..264.81 rows=331 width=215) (actual time=29.95..30.20 rows=6 loops=1) -> Seq Scan on class_default cd (cost=0.00..1.39 rows=1 width=55) (actual time=0.08..0.10 rows=1 loops=1) Filter: (id_provider = 39) -> Index Scan using idx_user_data_class on user_data ud (cost=0.00..258.49 rows=395 width=160) (actual time=29.82..29.96 rows=6 loops=1) Index Cond: (ud.id_class = "outer".id_class) Total runtime: 11135.65 msec (10 rows) I'm able to performe that select with these 3 steps: SELECT id_class from class_default where id_provider = 39; id_class ---------- 48 (1 row) SELECT id_user from user_data where id_class in ( 48 ); id_user --------- 10943 10942 10934 10927 10910 10909 (6 rows) SELECT * from user_logs where id_user in ( 10943, 10942, 10934, 10927, 10910, 10909 ); [SNIPPED] and the time ammount is a couple of milliseconds. Why the planner or the executor ( I don't know ) do not follow the same strategy ? Thank you Gaetano Mendola From pgsql-performance-owner@postgresql.org Tue Jul 22 14:07:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 031A1D1C50D for ; Tue, 22 Jul 2003 17:06:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 77869-02 for ; Tue, 22 Jul 2003 17:05:57 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 72791D1C950 for ; Tue, 22 Jul 2003 14:05:56 -0300 (ADT) Received: (qmail 3873 invoked by uid 500); 22 Jul 2003 17:10:33 -0000 Date: Tue, 22 Jul 2003 12:10:33 -0500 From: Bruno Wolff III To: pgsql-performance@postgresql.org Subject: Re: Tuning PostgreSQL Message-ID: <20030722171033.GB2686@wolff.to> Mail-Followup-To: pgsql-performance@postgresql.org References: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB1@pos_pdc.posportal.com> <014a01c34f90$74bc2c80$b696a8c0@APR> <200307210906.10226.josh@agliodbs.com> <20030721162852.GN19009@md2.mediadesign.nl> <002901c3501f$86565940$b696a8c0@APR> <20030722094035.GU19009@md2.mediadesign.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030722094035.GU19009@md2.mediadesign.nl> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/361 X-Sequence-Number: 2654 On Tue, Jul 22, 2003 at 11:40:35 +0200, Vincent van Leeuwen wrote: > > About RAID types: the fastest RAID type by far is RAID-10. However, this will > cost you a lot of useable diskspace, so it isn't for everyone. You need at > least 4 disks for a RAID-10 array. RAID-5 is a nice compromise if you want as > much useable diskspace as possible and still want to be redundant. RAID-1 is > very useful for small (2-disk) arrays. Note that while raid 10 requires 4 disks, you get the space of 2 disks. This is the same ratio as for raid 1. From pgsql-performance-owner@postgresql.org Tue Jul 22 14:11:21 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id AD2B0D1C4C8 for ; Tue, 22 Jul 2003 17:11:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 63640-10 for ; Tue, 22 Jul 2003 17:11:09 +0000 (GMT) Received: from mail.deltav.hu (oldmail.deltav.hu [213.163.0.192]) by svr1.postgresql.org (Postfix) with ESMTP id 43A53D1C935 for ; Tue, 22 Jul 2003 14:11:09 -0300 (ADT) Received: from fejleszt4 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA9F3 for ; Tue, 22 Jul 2003 19:11:04 +0200 Message-ID: <000701c35074$3800a2a0$0403a8c0@fejleszt4> From: =?ISO-8859-1?Q?SZUCS_G=E1bor?= To: References: <200307221626.h6MGQ1824547@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question Date: Tue, 22 Jul 2003 19:10:52 +0200 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/363 X-Sequence-Number: 2656 "by default" -- do you mean there is a way to tell Linux to favor the second real cpu over the HT one? how? G. ------------------------------- cut here ------------------------------- ----- Original Message ----- From: "Bruce Momjian" Sent: Tuesday, July 22, 2003 6:26 PM Subject: Re: [PERFORM] Dual Xeon + HW RAID question > Right, I simplified it. The big deal is whether the OS favors the > second real CPU over one of the virtual CPU's on the same die --- by > default, it doesn't. Ever if it did work perfectly, you are talking > about going from 1 to 1.4 or 2 to 2.8, which doesn't seem like much. From pgsql-performance-owner@postgresql.org Tue Jul 22 14:32:40 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id F3C2CD1C4C8 for ; Tue, 22 Jul 2003 17:32:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 87806-04 for ; Tue, 22 Jul 2003 17:32:27 +0000 (GMT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id DC661D1C50D for ; Tue, 22 Jul 2003 14:32:26 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6MHTbT5016357; Tue, 22 Jul 2003 11:29:38 -0600 (MDT) Date: Tue, 22 Jul 2003 11:19:51 -0600 (MDT) From: "scott.marlowe" To: "Jim C. Nasby" Cc: Alexander Priem , Vincent van Leeuwen , Subject: Re: Tuning PostgreSQL In-Reply-To: <20030722143335.GH55392@nasby.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/365 X-Sequence-Number: 2658 On Tue, 22 Jul 2003, Jim C. Nasby wrote: > On Tue, Jul 22, 2003 at 03:27:20PM +0200, Alexander Priem wrote: > > Wow, I never figured how many different RAID configurations one could think > > of :) > > > > After reading lots of material, forums and of course, this mailing-list, I > > think I am going for a RAID5 configuration of 6 disks (18Gb, 15.000 rpm > > each), one of those six disks will be a 'hot spare'. I will just put the OS, > > the WAL and the data one one volume. RAID10 is way to expensive :) > > > > If I understand correctly, this will give great read-performance, but less > > write-performance. But since this server will be equipped with an embedded > > RAID controller featuring 128Mb of battery-backed cache, I figure that this > > controller will negate that (at least somewhat). I will need to find out > > whether this cache can be configured so that it will ONLY cache WRITES, not > > READS.... > > I think the bigger isssue with RAID5 write performance in a database is > that it hits every spindle. This is a common, and wrong misconception. If you are writing 4k out to a RAID5 of 10 disks, this is what happens: (assumiung 64k stipes...) READ data stripe (64k read) READ parity stripe (64k read) make changes to data stripe XOR new data stripe with old parity stripe to get a new parity stripe write new parity stripe (64k) write new data stripe (64k) So it's not as bad as you might think. No modern controller (or sw raid for linux) hits all the spindles anymore for writes. As you add more drives to a RAID5 writes actually get faster on average, because there's less chance of having contention for the same drives (remember, parity moves about in RAID5 so the parity disk isn't a choke point in RAID5 like it is in RAID4.) > The real performance bottleneck you run into > is latency, especially the latency of positioning the heads. I don't > have any proof to this theory, but I believe this is why moving WAL > and/or temp_db to seperate drives from the main database files can be a > big benefit for some applications; not because of disk bandwidth but > because it drastically cuts down the amount of time the heads have to > spend flying around the disk. This is absolutely true. moving the heads costs hugely. while most modern drives have SEEK times <10 ms, the SETTLE times tend to be about that as well, followed by the average of about 3 ms for rotational latency to allow the proper sector to be under the head (10krpm drives rotate once about every 6 ms.) From pgsql-performance-owner@postgresql.org Tue Jul 22 14:29:21 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 3A8DAD1C7F1 for ; Tue, 22 Jul 2003 17:29:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 87615-04 for ; Tue, 22 Jul 2003 17:29:09 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 55E7AD1C7EF for ; Tue, 22 Jul 2003 14:29:08 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6MHT7M02341; Tue, 22 Jul 2003 13:29:07 -0400 (EDT) From: Bruce Momjian Message-Id: <200307221729.h6MHT7M02341@candle.pha.pa.us> Subject: Re: Tunning FreeeBSD and PostgreSQL In-Reply-To: <16157.18467.310482.384436@yertle.int.kciLink.com> To: Vivek Khera Date: Tue, 22 Jul 2003 13:29:07 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/364 X-Sequence-Number: 2657 Vivek Khera wrote: > >>>>> "BM" == Bruce Momjian writes: > > >> not anything pre-allocated (from my understanding). These settings > >> allow for up to 100,000 shared buffers (I currently only use 30,000 > >> buffers) > > BM> I think the only downside to making them too big is that you allocate > BM> page tables and prevent that address range from being used by other > > Does this apply in general or just on FreeBSD? Let me tell you how it traditionally worked --- each process has the kernel address space accessible at a fixed address --- it has to so the process can make kernel calls and run those kernel calls in its own address space, though with a kernel stack and data space. What they did with shared memory was to put shared memory in the same address space with the kernel, because everyone had that address range mapped into their address space already. If each process had its own private copy of the kernel page tables, there is bloat in having the kernel address space be larger than required. However, if the kernel page tables are shared by all processes, then there isn't much bloat, just less addressable user memory, and if you don't have anything near 4 gigs of RAM, it isn't a problem. I know Linux has pagable shared memory, and you can resize the maximum in a running kernel, so it seems they must have abandonded the linkage between shared page tables and the kernel. This looks interesting: http://www.linux-tutorial.info/cgi-bin/display.pl?312&0&0&0&3 and the Contents on the left show additional info like the i386 virtual directory/page tables: http://www.linux-tutorial.info/cgi-bin/display.pl?261&0&0&0&3 So it seems Linux has moved in the direction of making shared memory act just like ordinary allocated memory, except it is shared, meaning I think each process has its own pages tables for the shared memory. Once you do that, you get the ability to size it however you want, but you lose shared page tables, and it can now be swapped out, which can be bad for performance. -- 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 Jul 22 14:35:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 9433CD1C50D for ; Tue, 22 Jul 2003 17:35:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 80635-06 for ; Tue, 22 Jul 2003 17:35:55 +0000 (GMT) Received: from indygecko.com (h24-77-222-182.ok.shawcable.net [24.77.222.182]) by svr1.postgresql.org (Postfix) with ESMTP id A69D6D1C4C8 for ; Tue, 22 Jul 2003 14:35:54 -0300 (ADT) Received: from [192.168.10.10] ([::ffff:192.168.10.10]) by indygecko.com with esmtp; Tue, 22 Jul 2003 10:35:52 -0700 Subject: Re: Dual Xeon + HW RAID question From: Jord Tanner To: "SZUCS =?ISO-8859-1?Q?G=E1bor?=" Cc: pgsql-performance@postgresql.org In-Reply-To: <000701c35074$3800a2a0$0403a8c0@fejleszt4> References: <200307221626.h6MGQ1824547@candle.pha.pa.us> <000701c35074$3800a2a0$0403a8c0@fejleszt4> Content-Type: text/plain; charset=UTF-8 Organization: Message-Id: <1058895352.4339.32.camel@gecko> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 22 Jul 2003 10:35:52 -0700 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/366 X-Sequence-Number: 2659 The Linux 2.6 kernel will have the ability to set CPU affinity for specific processes. There is a patch for the 2.4 kernel at http://www.kernel.org/pub/linux/kernel/people/rml/cpu-affinity RedHat 9 already has support for CPU affinity build in. The July 2003 issue of Linux Journal includes a little C program (on page 20) that gives you a shell level interface to the CPU affinity system calls, so you can dynamically assign processes to specific CPUs. I haven't tried it, but it looks very cool (my only SMP machine is in production, and I don't want to mess with it). If you try it out, please share your experiences with the list. Jord Tanner Independent Gecko Consultants On Tue, 2003-07-22 at 10:10, SZUCS Gábor wrote: > "by default" -- do you mean there is a way to tell Linux to favor the second > real cpu over the HT one? how? > > G. > ------------------------------- cut here ------------------------------- > ----- Original Message ----- > From: "Bruce Momjian" > Sent: Tuesday, July 22, 2003 6:26 PM > Subject: Re: [PERFORM] Dual Xeon + HW RAID question > > > > Right, I simplified it. The big deal is whether the OS favors the > > second real CPU over one of the virtual CPU's on the same die --- by > > default, it doesn't. Ever if it did work perfectly, you are talking > > about going from 1 to 1.4 or 2 to 2.8, which doesn't seem like much. > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend -- Jord Tanner From pgsql-performance-owner@postgresql.org Tue Jul 22 14:38:30 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 8BAB2D1C4BF for ; Tue, 22 Jul 2003 17:38:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 91556-02 for ; Tue, 22 Jul 2003 17:38:18 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 5D016D1C946 for ; Tue, 22 Jul 2003 14:38:16 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6MHcBF03404; Tue, 22 Jul 2003 13:38:11 -0400 (EDT) From: Bruce Momjian Message-Id: <200307221738.h6MHcBF03404@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question In-Reply-To: <000701c35074$3800a2a0$0403a8c0@fejleszt4> To: =?ISO-8859-1?Q?SZUCS_G=E1bor?= Date: Tue, 22 Jul 2003 13:38:11 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UNKNOWN-8BIT X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/367 X-Sequence-Number: 2660 SZUCS G�bor wrote: > "by default" -- do you mean there is a way to tell Linux to favor the second > real cpu over the HT one? how? Right now there is no way the kernel can tell which virtual cpu's are on each physical cpu's, and that is the problem. Once there is a way, hyperthreading will be more useful, but even then, it doesn't double your CPU throughput, just increases by 40%. > > Right, I simplified it. The big deal is whether the OS favors the > > second real CPU over one of the virtual CPU's on the same die --- by > > default, it doesn't. Ever if it did work perfectly, you are talking > > about going from 1 to 1.4 or 2 to 2.8, which doesn't seem like much. > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > -- 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 Jul 22 14:39:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 177ABD1C4BF for ; Tue, 22 Jul 2003 17:39:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 89885-03 for ; Tue, 22 Jul 2003 17:39:39 +0000 (GMT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id B5DB3D1C957 for ; Tue, 22 Jul 2003 14:39:35 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6MHdGd03573; Tue, 22 Jul 2003 13:39:16 -0400 (EDT) From: Bruce Momjian Message-Id: <200307221739.h6MHdGd03573@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question In-Reply-To: <1058895352.4339.32.camel@gecko> To: Jord Tanner Date: Tue, 22 Jul 2003 13:39:16 -0400 (EDT) Cc: "SZUCS =?ISO-8859-1?Q?G=E1bor?=" , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/368 X-Sequence-Number: 2661 But CPU affinity isn't realated to hyperthreading, as far as I know. CPU affinity tries to keep processes on the same cpu in case there is still valuable info in the cpu cache. --------------------------------------------------------------------------- Jord Tanner wrote: > The Linux 2.6 kernel will have the ability to set CPU affinity for > specific processes. There is a patch for the 2.4 kernel at > http://www.kernel.org/pub/linux/kernel/people/rml/cpu-affinity > > RedHat 9 already has support for CPU affinity build in. > > The July 2003 issue of Linux Journal includes a little C program (on > page 20) that gives you a shell level interface to the CPU affinity > system calls, so you can dynamically assign processes to specific CPUs. > I haven't tried it, but it looks very cool (my only SMP machine is in > production, and I don't want to mess with it). If you try it out, please > share your experiences with the list. > > > Jord Tanner > Independent Gecko Consultants > > On Tue, 2003-07-22 at 10:10, SZUCS G?bor wrote: > > "by default" -- do you mean there is a way to tell Linux to favor the second > > real cpu over the HT one? how? > > > > G. > > ------------------------------- cut here ------------------------------- > > ----- Original Message ----- > > From: "Bruce Momjian" > > Sent: Tuesday, July 22, 2003 6:26 PM > > Subject: Re: [PERFORM] Dual Xeon + HW RAID question > > > > > > > Right, I simplified it. The big deal is whether the OS favors the > > > second real CPU over one of the virtual CPU's on the same die --- by > > > default, it doesn't. Ever if it did work perfectly, you are talking > > > about going from 1 to 1.4 or 2 to 2.8, which doesn't seem like much. > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 8: explain analyze is your friend > -- > Jord Tanner > > > ---------------------------(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 > -- 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-admin-owner@postgresql.org Tue Jul 22 23:53:21 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 75C08D1C4DC; Tue, 22 Jul 2003 17:41:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 92251-02; Tue, 22 Jul 2003 17:41:28 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id E3735D1C4BF; Tue, 22 Jul 2003 14:41:27 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3244567; Tue, 22 Jul 2003 10:41:45 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Mendola Gaetano" , , Subject: Re: [PERFORM] Wrong plan or what ? Date: Tue, 22 Jul 2003 10:40:28 -0700 User-Agent: KMail/1.4.3 References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> In-Reply-To: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307221040.28653.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/236 X-Sequence-Number: 9576 Gaetano, > SELECT * from user_logs where id_user in ( > 10943, 10942, 10934, 10927, 10910, 10909 > ); > [SNIPPED] > Why the planner or the executor ( I don't know ) do not follow > the same strategy ? It is, actually, according to the query plan.=20=20=20 Can you post the EXPLAIN ANALYZE for the above query? --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-admin-owner@postgresql.org Tue Jul 22 14:48:30 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 2E14ED1C7F1; Tue, 22 Jul 2003 17:48:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 92251-03; Tue, 22 Jul 2003 17:48:18 +0000 (GMT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id 505A4D1C4BF; Tue, 22 Jul 2003 14:48:17 -0300 (ADT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h6MHq0S24908; Tue, 22 Jul 2003 19:52:01 +0200 Received: from GMENDOLA2 (gmendola2.mm.eutelsat.org [194.214.173.26]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with SMTP id h6MHjQR15349; Tue, 22 Jul 2003 19:45:26 +0200 Message-ID: <00ee01c35079$707a6440$152aa8c0@GMENDOLA2> From: "Mendola Gaetano" To: , , References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> <200307221040.28653.josh@agliodbs.com> Subject: Re: [PERFORM] Wrong plan or what ? Date: Tue, 22 Jul 2003 19:48:20 +0200 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.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/214 X-Sequence-Number: 9554 "Josh Berkus" > Gaetano, > > > SELECT * from user_logs where id_user in ( > > 10943, 10942, 10934, 10927, 10910, 10909 > > ); > > [SNIPPED] > > > Why the planner or the executor ( I don't know ) do not follow > > the same strategy ? > > It is, actually, according to the query plan. > > Can you post the EXPLAIN ANALYZE for the above query? Index Scan using idx_user_user_logs, idx_user_user_logs, idx_user_user_logs, idx_user_user_logs, idx_user_user_logs, idx_user_user_logs on user_logs (cost=0.00..5454.21 rows=2498 width=48) (actual time=0.09..0.28 rows=10 loops=1) Index Cond: ((id_user = 10943) OR (id_user = 10942) OR (id_user = 10934) OR (id_user = 10927) OR (id_user = 10910) OR (id_user = 10909)) Total runtime: 0.41 msec (3 rows) Thank you Gaetano PS: if I execute the query I obtain 10 rows instead of 3 that say the explain analyze. From pgsql-performance-owner@postgresql.org Tue Jul 22 14:54:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id CA979D1C4C8 for ; Tue, 22 Jul 2003 17:54:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 96653-03 for ; Tue, 22 Jul 2003 17:54:27 +0000 (GMT) Received: from indygecko.com (h24-77-222-182.ok.shawcable.net [24.77.222.182]) by svr1.postgresql.org (Postfix) with ESMTP id 53604D1C4BF for ; Tue, 22 Jul 2003 14:54:27 -0300 (ADT) Received: from [192.168.10.10] ([::ffff:192.168.10.10]) by indygecko.com with esmtp; Tue, 22 Jul 2003 10:54:25 -0700 Subject: Re: Dual Xeon + HW RAID question From: Jord Tanner To: Bruce Momjian Cc: "SZUCS =?ISO-8859-1?Q?G=E1bor?=" , pgsql-performance@postgresql.org In-Reply-To: <200307221739.h6MHdGd03573@candle.pha.pa.us> References: <200307221739.h6MHdGd03573@candle.pha.pa.us> Organization: Message-Id: <1058896464.4339.46.camel@gecko> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 22 Jul 2003 10:54:24 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/371 X-Sequence-Number: 2664 On Tue, 2003-07-22 at 10:39, Bruce Momjian wrote: > But CPU affinity isn't realated to hyperthreading, as far as I know. > CPU affinity tries to keep processes on the same cpu in case there is > still valuable info in the cpu cache. > It is true that CPU affinity is designed to prevent the dump of valuable CPU cache. My thought is that if you are trying to prevent CPU contention, you could use CPU affinity to prevent 2 postmaster processes from running simultaneously on the same die. Am I out to lunch here? I've not worked with CPU affinity before, so I'm not familiar with the intimate details. -- Jord Tanner From pgsql-performance-owner@postgresql.org Tue Jul 22 14:58:06 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 60F56D1C4BF for ; Tue, 22 Jul 2003 17:57:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 88888-08 for ; Tue, 22 Jul 2003 17:57:30 +0000 (GMT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id B8011D1C4C8 for ; Tue, 22 Jul 2003 14:57:29 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3244654; Tue, 22 Jul 2003 10:57:32 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Mendola Gaetano" , Subject: Re: Wrong plan or what ? Date: Tue, 22 Jul 2003 10:56:14 -0700 User-Agent: KMail/1.4.3 References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> In-Reply-To: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307221056.14913.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/373 X-Sequence-Number: 2666 Gaetano, > QUERY PLAN > Hash Join (cost=3D265.64..32000.76 rows=3D40612 width=3D263) (actual > time=3D11074.21..11134.28 rows=3D10 loops=3D1) > Hash Cond: ("outer".id_user =3D "inner".id_user) > -> Seq Scan on user_logs ul (cost=3D0.00..24932.65 rows=3D1258965 wi= dth=3D48) > (actual time=3D0.02..8530.21 rows=3D1258966 loops=3D1) OK, here's your problem The planner thinks that you're going to get 40162 rows out of the final joi= n,=20 not 10. If the row estimate was correct, then the Seq Scan would be a=20 reasonable plan. But it's not. Here's some steps you can take to clear= =20 things up for the planner: 1) Make sure you've VACUUM ANALYZED 2) Adjust the following postgresql.conf statistics: a) effective_cache_size: increase to 70% of available (not used by other= =20 processes) RAM. b) random_page_cost: decrease, maybe to 2. c) default_statistics_target: try increasing to 100 (warning: this will significantly increase the time required to do ANALYZ= E) Then test again! --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-admin-owner@postgresql.org Tue Jul 22 14:56:29 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 91E16D1C4C8; Tue, 22 Jul 2003 17:56:28 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 87840-05; Tue, 22 Jul 2003 17:56:26 +0000 (GMT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id CF49FD1C4BF; Tue, 22 Jul 2003 14:56:25 -0300 (ADT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h6MI0Bv24949; Tue, 22 Jul 2003 20:00:12 +0200 Received: from GMENDOLA2 (gmendola2.mm.eutelsat.org [194.214.173.26]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with SMTP id h6MHrbR15380; Tue, 22 Jul 2003 19:53:37 +0200 Message-ID: <00fd01c3507a$951269f0$152aa8c0@GMENDOLA2> From: "Mendola Gaetano" To: , , References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> <200307221040.28653.josh@agliodbs.com> Subject: Re: [PERFORM] Wrong plan or what ? Date: Tue, 22 Jul 2003 19:56:30 +0200 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.1158 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.0 tagged_above=0.0 required=5.0 tests=REFERENCES X-Spam-Level: X-Archive-Number: 200307/215 X-Sequence-Number: 9555 Forget my PS to last message. From pgsql-performance-owner@postgresql.org Tue Jul 22 15:18:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 4C6D5D1C4DC for ; Tue, 22 Jul 2003 18:18:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 08070-03 for ; Tue, 22 Jul 2003 18:18:29 +0000 (GMT) Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) by svr1.postgresql.org (Postfix) with ESMTP id 6F966D1C4C1 for ; Tue, 22 Jul 2003 15:18:29 -0300 (ADT) Received: by yertle.kcilink.com (Postfix, from userid 100) id 5E77E2178C; Tue, 22 Jul 2003 14:18:15 -0400 (EDT) From: Vivek Khera MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16157.32743.251607.358718@yertle.int.kciLink.com> Date: Tue, 22 Jul 2003 14:18:15 -0400 To: pgsql-performance@postgresql.org Subject: Re: Tunning FreeeBSD and PostgreSQL In-Reply-To: <200307221729.h6MHT7M02341@candle.pha.pa.us> References: <16157.18467.310482.384436@yertle.int.kciLink.com> <200307221729.h6MHT7M02341@candle.pha.pa.us> X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/374 X-Sequence-Number: 2667 >>>>> "BM" == Bruce Momjian writes: BM> I know Linux has pagable shared memory, and you can resize the maximum BM> in a running kernel, so it seems they must have abandonded the linkage BM> between shared page tables and the kernel. This looks interesting: Thanks for the info. You can resize it in FreeBSD as well, using the sysctl command to set the various kern.ipc.shm* values. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-admin-owner@postgresql.org Tue Jul 22 15:35:43 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C8D58D1C511; Tue, 22 Jul 2003 18:35:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 84391-01; Tue, 22 Jul 2003 15:34:56 -0300 (ADT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id 44E30D1C50A; Tue, 22 Jul 2003 15:35:39 -0300 (ADT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h6MIdP025166; Tue, 22 Jul 2003 20:39:25 +0200 Received: from GMENDOLA2 (gmendola2.mm.eutelsat.org [194.214.173.26]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with SMTP id h6MIWpR15557; Tue, 22 Jul 2003 20:32:51 +0200 Message-ID: <010601c35080$10256cf0$152aa8c0@GMENDOLA2> From: "Mendola Gaetano" To: , Cc: References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> <200307221056.14913.josh@agliodbs.com> Subject: Re: [PERFORM] Wrong plan or what ? Date: Tue, 22 Jul 2003 20:35:45 +0200 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.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/216 X-Sequence-Number: 9556 "Josh Berkus" > Gaetano, > > > QUERY PLAN > > Hash Join (cost=265.64..32000.76 rows=40612 width=263) (actual > > time=11074.21..11134.28 rows=10 loops=1) > > Hash Cond: ("outer".id_user = "inner".id_user) > > -> Seq Scan on user_logs ul (cost=0.00..24932.65 rows=1258965 width=48) > > (actual time=0.02..8530.21 rows=1258966 loops=1) > > OK, here's your problem > > The planner thinks that you're going to get 40162 rows out of the final join, > not 10. If the row estimate was correct, then the Seq Scan would be a > reasonable plan. But it's not. Here's some steps you can take to clear > things up for the planner: > > 1) Make sure you've VACUUM ANALYZED > 2) Adjust the following postgresql.conf statistics: > a) effective_cache_size: increase to 70% of available (not used by other > processes) RAM. > b) random_page_cost: decrease, maybe to 2. > c) default_statistics_target: try increasing to 100 > (warning: this will significantly increase the time required to do ANALYZE) > > Then test again! No improvement at all, I pushed default_statistics_target to 1000 but the rows expected are still 40612 :-( Of course I restarted the postmaster and I vacuumed analyze the DB Thank you Gaetano From pgsql-performance-owner@postgresql.org Tue Jul 22 15:51:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 01F1BD1C4B7 for ; Tue, 22 Jul 2003 18:51:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85783-02 for ; Tue, 22 Jul 2003 15:50:25 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 7893CD1C4E6 for ; Tue, 22 Jul 2003 15:51:08 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6MIocK10571; Tue, 22 Jul 2003 14:50:38 -0400 (EDT) From: Bruce Momjian Message-Id: <200307221850.h6MIocK10571@candle.pha.pa.us> Subject: Re: Dual Xeon + HW RAID question In-Reply-To: <1058896464.4339.46.camel@gecko> To: Jord Tanner Date: Tue, 22 Jul 2003 14:50:37 -0400 (EDT) Cc: "SZUCS =?ISO-8859-1?Q?G=E1bor?=" , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/376 X-Sequence-Number: 2669 Jord Tanner wrote: > On Tue, 2003-07-22 at 10:39, Bruce Momjian wrote: > > But CPU affinity isn't realated to hyperthreading, as far as I know. > > CPU affinity tries to keep processes on the same cpu in case there is > > still valuable info in the cpu cache. > > > > It is true that CPU affinity is designed to prevent the dump of valuable > CPU cache. My thought is that if you are trying to prevent CPU > contention, you could use CPU affinity to prevent 2 postmaster processes > from running simultaneously on the same die. Am I out to lunch here? > I've not worked with CPU affinity before, so I'm not familiar with the > intimate details. I guess you could but it is the backends that use the cpu. I don't think manually specifying affinity will work for most applications. -- 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 Jul 22 16:18:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 73B73D1C4C1 for ; Tue, 22 Jul 2003 19:18:55 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85772-06 for ; Tue, 22 Jul 2003 16:18:10 -0300 (ADT) Received: from indygecko.com (h24-77-222-182.ok.shawcable.net [24.77.222.182]) by svr1.postgresql.org (Postfix) with ESMTP id 19D5DD1C4B7 for ; Tue, 22 Jul 2003 16:18:53 -0300 (ADT) Received: from [192.168.10.10] ([::ffff:192.168.10.10]) by indygecko.com with esmtp; Tue, 22 Jul 2003 12:18:52 -0700 Subject: Re: Dual Xeon + HW RAID question From: Jord Tanner To: Bruce Momjian Cc: "SZUCS =?ISO-8859-1?Q?G=E1bor?=" , pgsql-performance@postgresql.org In-Reply-To: <200307221850.h6MIocK10571@candle.pha.pa.us> References: <200307221850.h6MIocK10571@candle.pha.pa.us> Organization: Message-Id: <1058901531.4339.57.camel@gecko> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.2.2 (1.2.2-5) Date: 22 Jul 2003 12:18:52 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/377 X-Sequence-Number: 2670 On Tue, 2003-07-22 at 11:50, Bruce Momjian wrote: > Jord Tanner wrote: > > On Tue, 2003-07-22 at 10:39, Bruce Momjian wrote: > > > But CPU affinity isn't realated to hyperthreading, as far as I know. > > > CPU affinity tries to keep processes on the same cpu in case there is > > > still valuable info in the cpu cache. > > > > > > > It is true that CPU affinity is designed to prevent the dump of valuable > > CPU cache. My thought is that if you are trying to prevent CPU > > contention, you could use CPU affinity to prevent 2 postmaster processes > > from running simultaneously on the same die. Am I out to lunch here? > > I've not worked with CPU affinity before, so I'm not familiar with the > > intimate details. > > I guess you could but it is the backends that use the cpu. I don't > think manually specifying affinity will work for most applications. This is beating a dead horse, but I'll take one more kick at it. CPU affinity is defined by a bit mask, so multiple processors can be selected. It is also inherited by child processes, so assigning CPU 0 and CPU 2 (which I assume would be on different dies in a dual processor hyper-threading system) to the parent postmaster should prevent CPU contention with respect to the postgres backend. I would be very interested to see if any advantage could be gained by a combination of multiple HT processors and cpu affinity over multiple non-HT processors. Yet Another Performance Testing To Do (YAPTTD)! -- Jord Tanner From pgsql-performance-owner@postgresql.org Tue Jul 22 21:38:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2AAF1D1C4D0 for ; Wed, 23 Jul 2003 00:35:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08446-04 for ; Tue, 22 Jul 2003 21:34:17 -0300 (ADT) Received: from symler1.mail.eds.com (symler1.mail.eds.com [207.169.189.141]) by svr1.postgresql.org (Postfix) with ESMTP id 118ABD1C4C1 for ; Tue, 22 Jul 2003 21:34:58 -0300 (ADT) Received: from nnsy.eds.com ([192.85.216.78]) by symler1.mail.eds.com (8.11.6/8.11.6) with ESMTP id h6N0Z0I02675 for ; Wed, 23 Jul 2003 10:35:00 +1000 Received: from nnsy.eds.com (localhost [127.0.0.1]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N0Ytu05087 for ; Wed, 23 Jul 2003 10:34:55 +1000 (EST) Received: from ausym000.exau01.exch.eds.com ([134.251.177.117]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N0YnE05026 for ; Wed, 23 Jul 2003 10:34:52 +1000 (EST) Received: by ausym000.exau01.exch.eds.com with Internet Mail Service (5.5.2656.59) id ; Wed, 23 Jul 2003 10:34:49 +1000 Message-ID: From: "Castle, Lindsay" To: pgsql-performance@postgresql.org Subject: One table or many tables for data set Date: Wed, 23 Jul 2003 10:34:41 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain 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: 200307/378 X-Sequence-Number: 2671 Hi all, I'm working on a project that has a data set of approximately 6million rows with about 12,000 different elements, each element has 7 columns of data. I'm wondering what would be faster from a scanning perspective (SELECT statements with some calculations) for this type of set up; one table for all the data one table for each data element (12,000 tables) one table per subset of elements (eg all elements that start with "a" in a table) The data is static once its in the database, only new records are added on a regular basis. I'd like to run quite a few different formulated scans in the longer term so having efficient scans is a high priority. Can I do anything with Indexing to help with performance? I suspect for the majority of scans I will need to evaluate an outcome based on 4 or 5 of the 7 columns of data. Thanks in advance :-) Linz From pgsql-admin-owner@postgresql.org Tue Jul 22 21:48:40 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 56F31D1C4C8; Wed, 23 Jul 2003 00:40:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08450-02; Tue, 22 Jul 2003 21:39:18 -0300 (ADT) Received: from efreet.gene.com (efreet-open.gene.com [192.12.78.77]) by svr1.postgresql.org (Postfix) with ESMTP id 1C7B4D1C4C1; Tue, 22 Jul 2003 21:39:59 -0300 (ADT) Received: from faraday.gene.com (ldapmta.gene.com [128.137.49.205]) by efreet.gene.com (8.12.9/8.12.9) with ESMTP id h6N0e2iU125554; Tue, 22 Jul 2003 17:40:02 -0700 (PDT) Received: from tallac.gene.com (ldappxy.gene.com [128.137.49.207]) by faraday.gene.com (Switch-3.1.0/Switch-3.1.0) with ESMTP id h6N0e2ca012642; Tue, 22 Jul 2003 17:40:02 -0700 (PDT) Subject: slow table updates From: Reece Hart To: "pgsql-performance@postgresql.org" , "pgsql-admin@postgresql.org" , SF PostgreSQL Content-Type: multipart/alternative; boundary="=-5FRQwYdkbFkPAaNtNeR5" Message-Id: <1058920801.7281.67.camel@tallac> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 17:40:01 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=HTML_20_30, HTML_FONT_COLOR_RED, HTML_MESSAGE, SUSPICIOUS_RECIPS, USER_AGENT_XIMIAN X-Spam-Level: * X-Archive-Number: 200307/233 X-Sequence-Number: 9573 --=-5FRQwYdkbFkPAaNtNeR5 Content-Type: text/plain Content-Transfer-Encoding: 7bit I'm trying to update a table but it's taking a very long time. I would appreciate any tips folks may have about ways to speed it up. The table is paprospect2, as below: \d paprospect2 Column | Type | Modifiers -------------+---------+------------------------------------------------------------------- pfeature_id | integer | not null default nextval('unison.pfeature_pfeature_id_seq'::text) pseq_id | integer | not null pftype_id | integer | not null start | integer | stop | integer | confidence | real | run_id | integer | not null [snip 13 integer and real columns] run_id_new | integer | Indexes: paprospect2_redundant_alignment unique btree (pseq_id, "start", stop, run_id, pmodel_id), p2thread_p2params_id btree (run_id), p2thread_pmodel_id btree (pmodel_id) Foreign Key constraints: pftype_id_exists FOREIGN KEY (pftype_id) REFERENCES pftype(pftype_id) ON UPDATE CASCADE ON DELETE CASCADE, p2thread_pmodel_id_exists FOREIGN KEY (pmodel_id) REFERENCES pmprospect2(pmodel_id) ON UPDATE CASCADE ON DELETE CASCADE, pseq_id_exists FOREIGN KEY (pseq_id) REFERENCES pseq(pseq_id) ON UPDATE CASCADE ON DELETE CASCADE Triggers: p2thread_i_trigger The columns pfeature_id..confidence and run_id_new (in red) are from an inherited table. Although the inheritance itself is probably not relevant here (correction welcome), I suspect it may be relevant that all existing rows were written before the table definition included run_id_new. p2thread_i_trigger is defined fires on insert only (not update). paprospect2 contains ~40M rows. The goal now is to migrate the data to the supertable-inherited column with update paprospect2 set run_id_new=run_id; The update's been running for 5 hours (unloaded dual 2.4 GHz Xeon w/2GB RAM, SCSI160 10K drive). There are no other jobs running. Load is ~1.2 and the update's using ~3-5% of the CPU. $ ps -ostime,time,pcpu,cmd 28701 STIME TIME %CPU CMD 12:18 00:07:19 2.3 postgres: admin csb 128.137.116.213 UPDATE This suggests that the update is I/O bound (duh) and vmstat supports this: $ 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 1 0 0 11288 94632 3558960 0 0 14 6 12 21 1 0 6 0 1 0 0 12044 94632 3558956 0 0 0 972 332 16 0 1 99 0 1 0 0 11092 94632 3558932 0 0 16 4420 309 25 0 2 97 0 1 0 0 11456 94636 3558928 0 0 0 980 326 23 0 1 99 1 0 0 0 12340 94636 3558924 0 0 16 532 329 14 0 0 100 0 1 0 0 12300 94636 3558916 0 0 0 1376 324 16 1 0 99 0 1 0 0 12252 94636 3558904 0 0 16 1888 325 18 0 0 99 0 1 0 0 11452 94636 3558888 0 0 16 2864 324 23 1 1 98 0 1 0 0 12172 94636 3558884 0 0 0 940 320 12 0 1 99 0 1 0 0 12180 94636 3558872 0 0 16 1840 318 22 0 1 99 0 1 0 0 11588 94636 3558856 0 0 0 2752 312 16 1 2 97 Presumably the large number of blocks written (bo) versus blocks read (bi) reflects an enormous amount of bookkeeping that has to be done for MVCC, logging, perhaps rewriting a row for the new definition (a guess -- I don't know how this is handled), indicies, etc. There's no swapping and no processes are waiting. In short, it seems that this is ENTIRELY an I/O issue. Obviously, faster drives will help (but probably only by small factor). Any ideas how I might speed this up? Presumably this is all getting wrapped in a transaction -- does that hurt me for such a large update? Thanks, Reece Bonus diversionary topic: In case it's not obvious, the motivation for this is that the subtable (paprospect2) contains a column (run_id) whose definition I would like to migrate to the inherited table (i.e., the 'super-table'). Although postgresql permits adding a column to a supertable with the same name as an extant column in a subtable, it appears that such "merged definition" columns do not have the same properties as a typical inherited column. In particular, dropping the column from the supertable does not drop it from the subtable (but renaming it does change both names). Hmm. -- Reece Hart, Ph.D. rkh@gene.com, http://www.gene.com/ Genentech, Inc. 650/225-6133 (voice), -5389 (fax) Bioinformatics and Protein Engineering 1 DNA Way, MS-93 http://www.in-machina.com/~reece/ South San Francisco, CA 94080-4990 reece@in-machina.com, GPG: 0x25EC91A0 --=-5FRQwYdkbFkPAaNtNeR5 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit I'm trying to update a table but it's taking a very long time. I would appreciate any tips folks may have about ways to speed it up.

The table is paprospect2, as below:
\d paprospect2
   Column    |  Type   |                             Modifiers
-------------+---------+-------------------------------------------------------------------
 pfeature_id | integer | not null default nextval('unison.pfeature_pfeature_id_seq'::text)
 pseq_id     | integer | not null
 pftype_id   | integer | not null
 start       | integer |
 stop        | integer |
 confidence  | real    |
 run_id      | integer | not null
 [snip 13 integer and real columns]
 run_id_new  | integer |

Indexes: paprospect2_redundant_alignment unique btree (pseq_id, "start", stop, run_id, pmodel_id),
         p2thread_p2params_id btree (run_id),
         p2thread_pmodel_id btree (pmodel_id)
Foreign Key constraints: pftype_id_exists FOREIGN KEY (pftype_id) REFERENCES pftype(pftype_id) ON UPDATE CASCADE ON DELETE CASCADE,
                         p2thread_pmodel_id_exists FOREIGN KEY (pmodel_id) REFERENCES pmprospect2(pmodel_id) ON UPDATE CASCADE ON DELETE CASCADE,
                         pseq_id_exists FOREIGN KEY (pseq_id) REFERENCES pseq(pseq_id) ON UPDATE CASCADE ON DELETE CASCADE
Triggers: p2thread_i_trigger
The columns pfeature_id..confidence and run_id_new (in red) are from an inherited table. Although the inheritance itself is probably not relevant here (correction welcome), I suspect it may be relevant that all existing rows were written before the table definition included run_id_new. p2thread_i_trigger is defined fires on insert only (not update).

paprospect2 contains ~40M rows. The goal now is to migrate the data to the supertable-inherited column with
update paprospect2 set run_id_new=run_id;

The update's been running for 5 hours (unloaded dual 2.4 GHz Xeon w/2GB RAM, SCSI160 10K drive). There are no other jobs running. Load is ~1.2 and the update's using ~3-5% of the CPU.
$ ps -ostime,time,pcpu,cmd 28701
STIME     TIME %CPU CMD
12:18 00:07:19  2.3 postgres: admin csb 128.137.116.213 UPDATE
This suggests that the update is I/O bound (duh) and vmstat supports this:
$ 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  1  0      0  11288  94632 3558960   0   0    14     6   12    21   1   0   6
 0  1  0      0  12044  94632 3558956   0   0     0   972  332    16   0   1  99
 0  1  0      0  11092  94632 3558932   0   0    16  4420  309    25   0   2  97
 0  1  0      0  11456  94636 3558928   0   0     0   980  326    23   0   1  99
 1  0  0      0  12340  94636 3558924   0   0    16   532  329    14   0   0 100
 0  1  0      0  12300  94636 3558916   0   0     0  1376  324    16   1   0  99
 0  1  0      0  12252  94636 3558904   0   0    16  1888  325    18   0   0  99
 0  1  0      0  11452  94636 3558888   0   0    16  2864  324    23   1   1  98
 0  1  0      0  12172  94636 3558884   0   0     0   940  320    12   0   1  99
 0  1  0      0  12180  94636 3558872   0   0    16  1840  318    22   0   1  99
 0  1  0      0  11588  94636 3558856   0   0     0  2752  312    16   1   2  97

Presumably the large number of blocks written (bo) versus blocks read (bi) reflects an enormous amount of bookkeeping that has to be done for MVCC, logging, perhaps rewriting a row for the new definition (a guess -- I don't know how this is handled), indicies, etc. There's no swapping and no processes are waiting. In short, it seems that this is ENTIRELY an I/O issue. Obviously, faster drives will help (but probably only by small factor).

Any ideas how I might speed this up? Presumably this is all getting wrapped in a transaction -- does that hurt me for such a large update?

Thanks,
Reece


Bonus diversionary topic: In case it's not obvious, the motivation for this is that the subtable (paprospect2) contains a column (run_id) whose definition I would like to migrate to the inherited table (i.e., the 'super-table'). Although postgresql permits adding a column to a supertable with the same name as an extant column in a subtable, it appears that such "merged definition" columns do not have the same properties as a typical inherited column. In particular, dropping the column from the supertable does not drop it from the subtable (but renaming it does change both names). Hmm.

-- 
Reece Hart, Ph.D.                       rkh@gene.com, http://www.gene.com/
Genentech, Inc.                         650/225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93                        http://www.in-machina.com/~reece/
South San Francisco, CA  94080-4990     reece@in-machina.com, GPG: 0x25EC91A0
--=-5FRQwYdkbFkPAaNtNeR5-- From pgsql-performance-owner@postgresql.org Tue Jul 22 21:53:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3031ED1C4C8 for ; Wed, 23 Jul 2003 00:53:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08978-02 for ; Tue, 22 Jul 2003 21:52:33 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 85398D1C4C1 for ; Tue, 22 Jul 2003 21:53:14 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 9469F10258; Tue, 22 Jul 2003 20:46:13 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 238CB10248; Tue, 22 Jul 2003 20:46:11 -0400 (EDT) Subject: Re: One table or many tables for data set From: Rod Taylor To: "Castle, Lindsay" Cc: Postgresql Performance In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-KiTgnQ3C08o9+H3BDlOf" Message-Id: <1058921636.47745.0.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 20:53:56 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/380 X-Sequence-Number: 2673 --=-KiTgnQ3C08o9+H3BDlOf Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2003-07-22 at 20:34, Castle, Lindsay wrote: > Hi all, >=20 > I'm working on a project that has a data set of approximately 6million ro= ws > with about 12,000 different elements, each element has 7 columns of data. Are these 7 columns the same for each element? --=-KiTgnQ3C08o9+H3BDlOf Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Hdyj6DETLow6vwwRAl+eAJ4jpd4nUH0+Vpmxll2Id5qdGfH0GwCdHLvn qwENTDH83WTgmvlUgjIq5uY= =/uL8 -----END PGP SIGNATURE----- --=-KiTgnQ3C08o9+H3BDlOf-- From pgsql-performance-owner@postgresql.org Tue Jul 22 22:04:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 83B8CD1C942 for ; Wed, 23 Jul 2003 01:04:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 07707-09 for ; Tue, 22 Jul 2003 22:03:47 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 12D3CD1C508 for ; Tue, 22 Jul 2003 22:04:28 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 12073; Tue, 22 Jul 2003 17:29:10 -0700 Message-ID: <3F1DDE9D.4010108@joeconway.com> Date: Tue, 22 Jul 2003 18:02:21 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Castle, Lindsay" Cc: pgsql-performance@postgresql.org Subject: Re: One table or many tables for data set 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-Archive-Number: 200307/381 X-Sequence-Number: 2674 Castle, Lindsay wrote: > I'm working on a project that has a data set of approximately 6million rows > with about 12,000 different elements, each element has 7 columns of data. > > I'm wondering what would be faster from a scanning perspective (SELECT > statements with some calculations) for this type of set up; > one table for all the data > one table for each data element (12,000 tables) > one table per subset of elements (eg all elements that start with > "a" in a table) > I, for one, am having difficulty understanding exactly what your data looks like, so it's hard to give advice. Maybe some concrete examples of what you are calling "rows", "elements", and "columns" would help. Does each of 6 million rows have 12000 elements, each with 7 columns? Or do you mean that out of 6 million rows, there are 12000 distinct kinds of elements? > Can I do anything with Indexing to help with performance? I suspect for the > majority of scans I will need to evaluate an outcome based on 4 or 5 of the > 7 columns of data. > Again, this isn't clear to me -- but maybe I'm just being dense ;-) Does this mean you expect 4 or 5 items in your WHERE clause? Joe From pgsql-performance-owner@postgresql.org Tue Jul 22 22:25:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F03B2D1C93E for ; Wed, 23 Jul 2003 01:25:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 10418-05 for ; Tue, 22 Jul 2003 22:24:33 -0300 (ADT) Received: from symler1.mail.eds.com (symler1.mail.eds.com [207.169.189.141]) by svr1.postgresql.org (Postfix) with ESMTP id 02855D1C508 for ; Tue, 22 Jul 2003 22:25:14 -0300 (ADT) Received: from nnsy.eds.com ([192.85.216.78]) by symler1.mail.eds.com (8.11.6/8.11.6) with ESMTP id h6N1PDI10771; Wed, 23 Jul 2003 11:25:13 +1000 Received: from nnsy.eds.com (localhost [127.0.0.1]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N1PBu29179; Wed, 23 Jul 2003 11:25:11 +1000 (EST) Received: from ausym000.exau01.exch.eds.com ([134.251.177.117]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N1PAE29173; Wed, 23 Jul 2003 11:25:10 +1000 (EST) Received: by ausym000.exau01.exch.eds.com with Internet Mail Service (5.5.2656.59) id ; Wed, 23 Jul 2003 11:25:10 +1000 Message-ID: From: "Castle, Lindsay" To: "'Joe Conway'" , pgsql-performance@postgresql.org Subject: Re: One table or many tables for data set Date: Wed, 23 Jul 2003 11:25:07 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/382 X-Sequence-Number: 2675 Apologies, let me clear this up a bit (hopefully) :-) The data structure looks like this: element date num1 num2 num3 num4 units There are approx 12,000 distinct elements for a total of about 6 million rows of data. The scanning technology I want to use may need a different number of rows and different columns depending on the scan formula; eg scan1 may need num1, num2 and num3 from the last 200 rows for element "x" scan2 may need num1, units from the last 10 rows for element "y" I can either do the scans and calculate what i need within SQL or drag the data out and process it outside of SQL, my preference is to go inside SQL as I've assumed that would be faster and less development work. If I went with the many tables design I would not expect to need to join between tables, there is no relationship between the different elements that I need to cater for. Cheers, Linz Castle, Lindsay wrote and : > I'm working on a project that has a data set of approximately 6million rows > with about 12,000 different elements, each element has 7 columns of data. > > I'm wondering what would be faster from a scanning perspective (SELECT > statements with some calculations) for this type of set up; > one table for all the data > one table for each data element (12,000 tables) > one table per subset of elements (eg all elements that start with > "a" in a table) > I, for one, am having difficulty understanding exactly what your data looks like, so it's hard to give advice. Maybe some concrete examples of what you are calling "rows", "elements", and "columns" would help. Does each of 6 million rows have 12000 elements, each with 7 columns? Or do you mean that out of 6 million rows, there are 12000 distinct kinds of elements? > Can I do anything with Indexing to help with performance? I suspect for the > majority of scans I will need to evaluate an outcome based on 4 or 5 of the > 7 columns of data. > Again, this isn't clear to me -- but maybe I'm just being dense ;-) Does this mean you expect 4 or 5 items in your WHERE clause? From pgsql-performance-owner@postgresql.org Tue Jul 22 22:38:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 33606D1C942 for ; Wed, 23 Jul 2003 01:38:33 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 10729-05 for ; Tue, 22 Jul 2003 22:37:47 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id D8958D1C508 for ; Tue, 22 Jul 2003 22:38:27 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 12092; Tue, 22 Jul 2003 18:03:11 -0700 Message-ID: <3F1DE694.30201@joeconway.com> Date: Tue, 22 Jul 2003 18:36:20 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Castle, Lindsay" Cc: pgsql-performance@postgresql.org Subject: Re: One table or many tables for data set 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-Archive-Number: 200307/383 X-Sequence-Number: 2676 Castle, Lindsay wrote: > The data structure looks like this: > element > date > num1 > num2 > num3 > num4 > units > > There are approx 12,000 distinct elements for a total of about 6 million > rows of data. Ahh, that helps! So are the elements evenly distributed, i.e. are there approx 500 rows of each element? If so, it should be plenty quick to put all the data in one table with an index on "element" (and maybe a multicolumn key, depending on other factors). > The scanning technology I want to use may need a different number of rows > and different columns depending on the scan formula; > eg scan1 may need num1, num2 and num3 from the last 200 rows for > element "x" > scan2 may need num1, units from the last 10 rows for element "y" When you say "last X rows", do you mean sorted by "date"? If so, you might want that index to be on (element, date). Then do: SELECT num1, num2, num3 FROM mytable WHERE element = 'an_element' order by date DESC LIMIT 20; Replace num1, num2, num3 by whatever columns you want, and "LIMIT X" as the number of rows you want. HTH, Joe From pgsql-performance-owner@postgresql.org Tue Jul 22 22:53:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9E2C4D1C93E for ; Wed, 23 Jul 2003 01:52:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08316-09 for ; Tue, 22 Jul 2003 22:51:29 -0300 (ADT) Received: from symler1.mail.eds.com (symler1.mail.eds.com [207.169.189.141]) by svr1.postgresql.org (Postfix) with ESMTP id 88D10D1C508 for ; Tue, 22 Jul 2003 22:52:08 -0300 (ADT) Received: from nnsy.eds.com ([192.85.216.78]) by symler1.mail.eds.com (8.11.6/8.11.6) with ESMTP id h6N1q8I14706; Wed, 23 Jul 2003 11:52:08 +1000 Received: from nnsy.eds.com (localhost [127.0.0.1]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N1q4u11398; Wed, 23 Jul 2003 11:52:04 +1000 (EST) Received: from ausym000.exau01.exch.eds.com ([134.251.177.117]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N1pvE11289; Wed, 23 Jul 2003 11:51:59 +1000 (EST) Received: by ausym000.exau01.exch.eds.com with Internet Mail Service (5.5.2656.59) id ; Wed, 23 Jul 2003 11:51:55 +1000 Message-ID: From: "Castle, Lindsay" To: "'Joe Conway'" Cc: pgsql-performance@postgresql.org Subject: Re: One table or many tables for data set Date: Wed, 23 Jul 2003 11:47:29 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/385 X-Sequence-Number: 2678 Thanks Joe, This certainly helps me get going on the right path. Lindsay Castle EDS Australia Midrange & Distributed Tools Infrastructure Tools AP Ph: +61 (0)8 8464 7101 Fax: +61 (0)8 8464 2135 -----Original Message----- From: Joe Conway [mailto:mail@joeconway.com] Sent: Wednesday, 23 July 2003 11:06 AM To: Castle, Lindsay Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] One table or many tables for data set Castle, Lindsay wrote: > The data structure looks like this: > element > date > num1 > num2 > num3 > num4 > units > > There are approx 12,000 distinct elements for a total of about 6 million > rows of data. Ahh, that helps! So are the elements evenly distributed, i.e. are there approx 500 rows of each element? If so, it should be plenty quick to put all the data in one table with an index on "element" (and maybe a multicolumn key, depending on other factors). > The scanning technology I want to use may need a different number of rows > and different columns depending on the scan formula; > eg scan1 may need num1, num2 and num3 from the last 200 rows for > element "x" > scan2 may need num1, units from the last 10 rows for element "y" When you say "last X rows", do you mean sorted by "date"? If so, you might want that index to be on (element, date). Then do: SELECT num1, num2, num3 FROM mytable WHERE element = 'an_element' order by date DESC LIMIT 20; Replace num1, num2, num3 by whatever columns you want, and "LIMIT X" as the number of rows you want. HTH, Joe From pgsql-performance-owner@postgresql.org Tue Jul 22 22:49:29 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4FB16D1C942 for ; Wed, 23 Jul 2003 01:49:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08244-10 for ; Tue, 22 Jul 2003 22:48:37 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 846BED1C941 for ; Tue, 22 Jul 2003 22:49:18 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 864E41024D; Tue, 22 Jul 2003 21:42:20 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id D989910248; Tue, 22 Jul 2003 21:42:17 -0400 (EDT) Subject: Re: One table or many tables for data set From: Rod Taylor To: "Castle, Lindsay" Cc: Postgresql Performance In-Reply-To: References: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-aEEpN1kbFtlwEv74U2+d" Message-Id: <1058925003.47745.15.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 21:50:03 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/384 X-Sequence-Number: 2677 --=-aEEpN1kbFtlwEv74U2+d Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Ok.. Unless I'm missing something, the data will be static (or near static). It also sounds as if the structure is common for elements, so you probably only want 2 tables. One with 6 million rows and any row information. The other with 6 million * 12000 rows with the element data linking to the row information line with an identifier, and have an 'element type' (I assume there are 12000 types of elements -- or something of that nature). Unique constraint on (row_identifier, element_type) The speed you achieve will be based on what indexes you create. If you spend most of your time with one or a few (5% or less of the structure) element types, create a partial index for those element types only, and a partial index for all of the others. If you have a standard mathematical operation on num1, num2, etc. you may want to make use of functional indexes to index the result of the calculation. Be sure to create the tables WITHOUT OIDS and be prepared for the dataload to take a while, and CLUSTER the table based on your most commonly used index (once they've been setup). To help with speed, we would need to see EXPLAIN ANALYZE results and the query being performed. On Tue, 2003-07-22 at 21:00, Castle, Lindsay wrote: > All rows have the same structure, the data itself will be different for e= ach > row, the structure is something like this: >=20 > element > date > num1 > num2 > num3 > num4 > units >=20 > Thanks, >=20 >=20 > Lindsay Castle > EDS Australia > Midrange & Distributed Tools > Infrastructure Tools AP > Ph: +61 (0)8 8464 7101 > Fax: +61 (0)8 8464 2135 >=20 >=20 > -----Original Message----- > From: Rod Taylor [mailto:rbt@rbt.ca] > Sent: Wednesday, 23 July 2003 10:24 AM > To: Castle, Lindsay > Cc: Postgresql Performance > Subject: Re: One table or many tables for data set >=20 >=20 > On Tue, 2003-07-22 at 20:34, Castle, Lindsay wrote: > > Hi all, > >=20 > > I'm working on a project that has a data set of approximately 6million > rows > > with about 12,000 different elements, each element has 7 columns of dat= a. >=20 > Are these 7 columns the same for each element? >=20 --=-aEEpN1kbFtlwEv74U2+d Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/HenK6DETLow6vwwRAr4KAJ9dApcv+0YiGFx2lrbBcatzYDXgugCeKovS sNrvuScUN6A4PZ06LG0RgLw= =Am3Q -----END PGP SIGNATURE----- --=-aEEpN1kbFtlwEv74U2+d-- From pgsql-performance-owner@postgresql.org Tue Jul 22 23:10:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 09DBDD1C941 for ; Wed, 23 Jul 2003 02:10:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 12067-03 for ; Tue, 22 Jul 2003 23:09:34 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 28552D1C4BF for ; Tue, 22 Jul 2003 23:10:15 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 6952B10258; Tue, 22 Jul 2003 22:03:17 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id E83BD1024D; Tue, 22 Jul 2003 22:03:14 -0400 (EDT) Subject: Re: One table or many tables for data set From: Rod Taylor To: "Castle, Lindsay" Cc: Postgresql Performance In-Reply-To: <1058925003.47745.15.camel@jester> References: <1058925003.47745.15.camel@jester> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-zT3BZMtxJMXfN9v6wb7l" Message-Id: <1058926258.47745.20.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 22 Jul 2003 22:10:59 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/386 X-Sequence-Number: 2679 --=-zT3BZMtxJMXfN9v6wb7l Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2003-07-22 at 21:50, Rod Taylor wrote: > Ok.. Unless I'm missing something, the data will be static (or near > static). It also sounds as if the structure is common for elements, so > you probably only want 2 tables. I misunderstood. Do what Joe suggested. --=-zT3BZMtxJMXfN9v6wb7l Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/He6y6DETLow6vwwRAhXSAJoDl/cUd3vyGXxB0BrogLYnZYRXHgCfXi8P Jp6rOaeuIs8o/yAOucPOAgw= =G24L -----END PGP SIGNATURE----- --=-zT3BZMtxJMXfN9v6wb7l-- From pgsql-performance-owner@postgresql.org Tue Jul 22 23:14:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5E6BDD1C946 for ; Wed, 23 Jul 2003 02:14:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 13080-03 for ; Tue, 22 Jul 2003 23:13:37 -0300 (ADT) Received: from symler1.mail.eds.com (symler1.mail.eds.com [207.169.189.141]) by svr1.postgresql.org (Postfix) with ESMTP id 9612CD1C942 for ; Tue, 22 Jul 2003 23:14:17 -0300 (ADT) Received: from nnsy.eds.com ([192.85.216.78]) by symler1.mail.eds.com (8.11.6/8.11.6) with ESMTP id h6N2EII18166; Wed, 23 Jul 2003 12:14:18 +1000 Received: from nnsy.eds.com (localhost [127.0.0.1]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N2EFu22114; Wed, 23 Jul 2003 12:14:15 +1000 (EST) Received: from ausym000.exau01.exch.eds.com ([134.251.177.117]) by nnsy.eds.com (8.11.6p2/8.11.6) with ESMTP id h6N2EEE22100; Wed, 23 Jul 2003 12:14:14 +1000 (EST) Received: by ausym000.exau01.exch.eds.com with Internet Mail Service (5.5.2656.59) id ; Wed, 23 Jul 2003 12:14:13 +1000 Message-ID: From: "Castle, Lindsay" To: "'Rod Taylor'" Cc: Postgresql Performance Subject: Re: One table or many tables for data set Date: Wed, 23 Jul 2003 12:14:04 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: text/plain X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/387 X-Sequence-Number: 2680 Thanks Rod My explanations will be better next time. :-) -----Original Message----- From: Rod Taylor [mailto:rbt@rbt.ca] Sent: Wednesday, 23 July 2003 11:41 AM To: Castle, Lindsay Cc: Postgresql Performance Subject: Re: One table or many tables for data set On Tue, 2003-07-22 at 21:50, Rod Taylor wrote: > Ok.. Unless I'm missing something, the data will be static (or near > static). It also sounds as if the structure is common for elements, so > you probably only want 2 tables. I misunderstood. Do what Joe suggested. From pgsql-general-owner@postgresql.org Wed Jul 23 05:47:40 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 77501D1C990 for ; Wed, 23 Jul 2003 08:47:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08840-03 for ; Wed, 23 Jul 2003 05:46:24 -0300 (ADT) Received: from ns.mega-bucks.co.jp (ns.mega-bucks.co.jp [219.118.175.241]) by svr1.postgresql.org (Postfix) with ESMTP id BBB8DD1C91A for ; Wed, 23 Jul 2003 04:07:15 -0300 (ADT) Received: from mega-bucks.co.jp (dhcp4.mega-bucks.co.jp [192.168.255.103]) by ns.mega-bucks.co.jp (8.12.9/8.12.5) with ESMTP id h6N6xVdT011102 for ; Wed, 23 Jul 2003 15:59:35 +0900 Message-ID: <3F1E339C.7010304@mega-bucks.co.jp> Date: Wed, 23 Jul 2003 16:05:00 +0900 From: Jean-Christian Imbeault User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 X-Accept-Language: en-us, en, ko MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Performance hit of foreign key constraints? Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1053 X-Sequence-Number: 45906 I have a database which is constantly being written to. A web server's log file (and extras) is being written to it. There are no deletions or updates (at least I think so :). As the web traffic increases so will the write intensity. Right now the database tables have no foreign keys defined even though there are foreign keys. The code that inserts into the DB is simple enough (now) that we can make sure that nothing is inserted if the corresponding fk does not exist and that all fk checks pass. I want to add foreign key constraints to the table definitions but I am worried that it might be a big performance hit. Can anyone tell me how much of a performance hit adding one foreign key constraint to one field in a table will roughly be? Also, for a DB that is write-intensive and rarely read, what are some things I can do to increase performance? (Keeping in mind that there is more than on DB on the same pg server). Thanks, Jean-Christian Imbeault From pgsql-performance-owner@postgresql.org Wed Jul 23 06:17:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AB8A3D1C4E3; Wed, 23 Jul 2003 08:49:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 05795-10; Wed, 23 Jul 2003 05:48:38 -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 AB819D1C4D0; Wed, 23 Jul 2003 05:49:16 -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 19fFJF-000GMt-0X; Wed, 23 Jul 2003 09:49:17 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id AF0681675C; Wed, 23 Jul 2003 09:49:15 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id EB07D1661A; Wed, 23 Jul 2003 09:49:11 +0100 (BST) From: Richard Huxton To: Reece Hart , "pgsql-performance@postgresql.org" , "pgsql-admin@postgresql.org" , SF PostgreSQL Subject: Re: slow table updates Date: Wed, 23 Jul 2003 09:49:09 +0100 User-Agent: KMail/1.5 References: <1058920801.7281.67.camel@tallac> In-Reply-To: <1058920801.7281.67.camel@tallac> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307230949.10028.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/388 X-Sequence-Number: 2681 On Wednesday 23 July 2003 01:40, Reece Hart wrote: > I'm trying to update a table but it's taking a very long time. I would > appreciate any tips folks may have about ways to speed it up. [snip] > paprospect2 contains ~40M rows. The goal now is to migrate the data to > the supertable-inherited column with > > update paprospect2 set run_id_new=run_id; > > > The update's been running for 5 hours (unloaded dual 2.4 GHz Xeon w/2GB > RAM, SCSI160 10K drive). There are no other jobs running. Load is ~1.2 > and the update's using ~3-5% of the CPU. [snip] > This suggests that the update is I/O bound (duh) and vmstat supports > this: [snip] > Presumably the large number of blocks written (bo) versus blocks read > (bi) reflects an enormous amount of bookkeeping that has to be done for > MVCC, logging, perhaps rewriting a row for the new definition (a guess > -- I don't know how this is handled), indicies, etc. There's no swapping > and no processes are waiting. In short, it seems that this is ENTIRELY > an I/O issue. Obviously, faster drives will help (but probably only by > small factor). > > Any ideas how I might speed this up? Presumably this is all getting > wrapped in a transaction -- does that hurt me for such a large update? Well, it needs to keep enought bookkeeping to be able to rollback the whole transaction if it encounters a problem, or 40M rows in your case. Looks like you're right and it's an I/O issue. I must admit, I'm a bit puzzled that your CPU is quite so low, but I suppose you've got two fast CPUs so it shouldn't be high. [note the following is more speculation than experience] What might be happening is that the drive is spending all its time seeking between the WAL, index and table as it updates. I would also tend to be suspicious of the foreign keys - PG might be re-checking these, and obviously that would take time too. What you might want to try in future: 1. begin transaction 2. drop indexes, foreign keys 3. update table 4. vacuum it 5. recreate indexes, foreign keys etc 6. commit Now that's just moving the index updating/fk stuff to the end of the task, but it does seem to help sometimes. HTH -- Richard Huxton Archonet Ltd From pgsql-general-owner@postgresql.org Wed Jul 23 07:43:28 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7D483D1C932 for ; Wed, 23 Jul 2003 09:52:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14819-08 for ; Wed, 23 Jul 2003 06:51:41 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 39CE6D1C949 for ; Wed, 23 Jul 2003 06:52:17 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6N9vwRj021329 for ; Wed, 23 Jul 2003 15:27:58 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6N9vvsW021316; Wed, 23 Jul 2003 15:27:58 +0530 From: "Shridhar Daithankar" To: pgsql-general@postgresql.org Date: Wed, 23 Jul 2003 15:24:01 +0530 MIME-Version: 1.0 Subject: Re: Performance hit of foreign key constraints? Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-performance@postgresql.org Message-ID: <3F1EA891.16257.43E80B6@localhost> In-reply-to: <3F1E339C.7010304@mega-bucks.co.jp> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1059 X-Sequence-Number: 45912 On 23 Jul 2003 at 16:05, Jean-Christian Imbeault wrote: > I have a database which is constantly being written to. A web server's > log file (and extras) is being written to it. There are no deletions or > updates (at least I think so :). > > As the web traffic increases so will the write intensity. > > Right now the database tables have no foreign keys defined even though > there are foreign keys. The code that inserts into the DB is simple > enough (now) that we can make sure that nothing is inserted if the > corresponding fk does not exist and that all fk checks pass. > > I want to add foreign key constraints to the table definitions but I am > worried that it might be a big performance hit. Can anyone tell me how > much of a performance hit adding one foreign key constraint to one field > in a table will roughly be? > > Also, for a DB that is write-intensive and rarely read, what are some > things I can do to increase performance? (Keeping in mind that there is > more than on DB on the same pg server). 1. Insert them in batches. Proper size of transactions can speed the write performance heavily. 2. What kind of foreign keys you have? It might be possible to reduce FK overhead if you are checking against small number of records. 3. Tune your hardware for write performance like getting a good-for-write RAID. I forgot which performs which for read and write. 4. Tune WAL and move it to separate drive. That should win you some performance. HTH Bye Shridhar -- Beauty: What's in your eye when you have a bee in your hand. From pgsql-performance-owner@postgresql.org Wed Jul 23 07:29:06 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0C0C0D1C4E3 for ; Wed, 23 Jul 2003 10:21:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14986-09 for ; Wed, 23 Jul 2003 07:20:52 -0300 (ADT) Received: from rtlocal.trade-india.com (unknown [203.196.129.235]) by svr1.postgresql.org (Postfix) with SMTP id 41593D1C4D0 for ; Wed, 23 Jul 2003 07:21:27 -0300 (ADT) Received: (qmail 20148 invoked from network); 23 Jul 2003 10:30:08 -0000 Received: from unknown (HELO system67.trade-india-local.com) (unknown) by unknown with SMTP; 23 Jul 2003 10:30:08 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: pgsql-performance@postgresql.org Subject: factoring problem with view in 7.3.3 Date: Wed, 23 Jul 2003 15:51:48 +0530 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307231551.48444.mallah@trade-india.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=USER_AGENT_KMAIL X-Spam-Level: X-Archive-Number: 200307/389 X-Sequence-Number: 2682 Hi , I have a view which is a union of select of certain feilds from indentical tables. The problem is when we query a column on which index exists exists foreach of the tables does not use the indexes. But when we query individual tables it uses indexes. Regds Mallah. tradein_clients=# create view sent_enquiry_eyp_iid_ip_cat1 as select rfi_id,sender_uid,receiver_uid,subject,generated from eyp_rfi UNION select rfi_id,sender_uid,receiver_uid,subject,generated from iid_rfi UNION select rfi_id,sender_uid,receiver_uid,subject,generated from ip_rfi UNION select rfi_id,sender_uid,receiver_uid,subject,generated from catalog_rfi ; CREATE VIEW tradein_clients=# tradein_clients=# explain analyze select rfi_id from sent_enquiry_eyp_iid_ip_cat1 where sender_uid = 34866; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------- Subquery Scan sent_enquiry_eyp_iid_ip_cat1 (cost=173347.05..182139.66 rows=58617 width=55) (actual time=57514.58..62462.15 rows=73 loops=1) Filter: (sender_uid = 34866) -> Unique (cost=173347.05..182139.66 rows=58617 width=55) (actual time=57514.54..61598.82 rows=586230 loops=1) -> Sort (cost=173347.05..174812.49 rows=586174 width=55) (actual time=57514.54..58472.01 rows=586231 loops=1) Sort Key: rfi_id, sender_uid, receiver_uid, subject, generated -> Append (cost=0.00..90563.74 rows=586174 width=55) (actual time=13.17..50500.95 rows=586231 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..57800.63 rows=369463 width=42) (actual time=13.17..30405.33 rows=369536 loops=1) -> Seq Scan on eyp_rfi (cost=0.00..57800.63 rows=369463 width=42) (actual time=13.14..28230.00 rows=369536 loops=1) -> Subquery Scan "*SELECT* 2" (cost=0.00..7317.11 rows=45811 width=47) (actual time=0.04..534.89 rows=45811 loops=1) -> Seq Scan on iid_rfi (cost=0.00..7317.11 rows=45811 width=47) (actual time=0.03..359.88 rows=45811 loops=1) -> Subquery Scan "*SELECT* 3" (cost=0.00..22335.44 rows=145244 width=42) (actual time=0.08..17815.66 rows=145251 loops=1) -> Seq Scan on ip_rfi (cost=0.00..22335.44 rows=145244 width=42) (actual time=0.05..16949.03 rows=145251 loops=1) -> Subquery Scan "*SELECT* 4" (cost=0.00..3110.56 rows=25656 width=55) (actual time=0.07..469.60 rows=25633 loops=1) -> Seq Scan on catalog_rfi (cost=0.00..3110.56 rows=25656 width=55) (actual time=0.06..380.64 rows=25633 loops=1) Total runtime: 62504.24 msec (15 rows) tradein_clients=# explain analyze select rfi_id from eyp_rfi where sender_uid = 34866; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- Index Scan using eyp_sender_uid_idx on eyp_rfi (cost=0.00..376.11 rows=117 width=4) (actual time=9.88..69.10 rows=12 loops=1) Index Cond: (sender_uid = 34866) Total runtime: 69.17 msec (3 rows) tradein_clients=# From pgsql-performance-owner@postgresql.org Wed Jul 23 11:13:23 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BA249D1C90F for ; Wed, 23 Jul 2003 14:13:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 27823-04 for ; Wed, 23 Jul 2003 11:12:38 -0300 (ADT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by svr1.postgresql.org (Postfix) with ESMTP id 00117D1C517 for ; Wed, 23 Jul 2003 11:13:18 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19fKMo-0007QC-0U; Wed, 23 Jul 2003 15:13:18 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id BBE6516C86; Wed, 23 Jul 2003 15:13:16 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 2300116B07; Wed, 23 Jul 2003 15:13:16 +0100 (BST) From: Richard Huxton To: Rajesh Kumar Mallah , pgsql-performance@postgresql.org Subject: Re: factoring problem with view in 7.3.3 Date: Wed, 23 Jul 2003 15:13:14 +0100 User-Agent: KMail/1.5 References: <200307231551.48444.mallah@trade-india.com> In-Reply-To: <200307231551.48444.mallah@trade-india.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307231513.14574.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/391 X-Sequence-Number: 2684 On Wednesday 23 July 2003 11:21, Rajesh Kumar Mallah wrote: > Hi , > > I have a view which is a union of select of certain feilds from > indentical tables. The problem is when we query a column on > which index exists exists foreach of the tables does not use the > indexes. > > > But when we query individual tables it uses indexes. > > tradein_clients=# create view sent_enquiry_eyp_iid_ip_cat1 as > select rfi_id,sender_uid,receiver_uid,subject,generated from eyp_rfi UNION > select rfi_id,sender_uid,receiver_uid,subject,generated from iid_rfi UNION > select rfi_id,sender_uid,receiver_uid,subject,generated from ip_rfi UNION > select rfi_id,sender_uid,receiver_uid,subject,generated from catalog_rfi ; > > CREATE VIEW > tradein_clients=# > tradein_clients=# explain analyze select rfi_id from > sent_enquiry_eyp_iid_ip_cat1 where sender_uid = 34866; [snip query plan showing full selects being done and then filtering on the outputs] I do remember some talk about issues with pushing where clauses down into unions on a view (sorry - can't remember when - maybe check the archives). Actually, I thought work had been done on that for 7.3.3, but it might have been 7.4 If you generally do that particular query (checking agains sender_uid) then the simplest solution is to build an SQL query to push the comparison down for you: CREATE my_function(int4) RETURNS SETOF my_type AS ' SELECT ... FROM eyp_rfi WHERE sender_uid = $1 UNION ...etc... ' LANGUAGE 'SQL'; Note that you may get an error about an operator "=$" if you miss the spaces around the "=". HTH -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Jul 23 11:29:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 90666D1C96D for ; Wed, 23 Jul 2003 14:29:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 32913-01 for ; Wed, 23 Jul 2003 11:28:26 -0300 (ADT) Received: from www.sgbs.de (www.sgbs.de [62.225.75.154]) by svr1.postgresql.org (Postfix) with ESMTP id 70469D1C965 for ; Wed, 23 Jul 2003 11:29:05 -0300 (ADT) From: =?iso-8859-1?q?J=F6rg=20Schulz?= To: pgsql-performance@postgresql.org Subject: different query plan for same select Date: Wed, 23 Jul 2003 16:28:54 +0200 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200307231628.54295.jschulz@sgbs.de> X-Virus-Scanned: by AMaViS X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests=USER_AGENT_KMAIL X-Spam-Level: X-Archive-Number: 200307/392 X-Sequence-Number: 2685 I have these two tables with the same data on two different machines (SuSE 8.2 and Gentoo both with 7.3.2): schulz=3D> \d rechnung Table "jschulz.rechnung" Column | Type | Modifiers=20 ----------------+----------+----------- system | smallint | not null jahr | smallint | not null monat | smallint | not null rechnungsnr | integer | not null rechnungsdatum | date | not null kundennr | integer | not null seiten | smallint | not null formularnr | smallint |=20 text | text | not null Indexes: rechnung_pkey primary key btree (system, jahr, rechnungsnr), rechnung_kundennr btree (kundennr), rechnung_rechnungsdatum btree (rechnungsdatum), rechnung_rechnungsnr btree (rechnungsnr) schulz=3D> \d rechnung_zusatz Table "jschulz.rechnung_zusatz" Column | Type | Modifiers=20 -------------+----------+----------- system | smallint | not null jahr | smallint | not null rechnungsnr | integer | not null objektnr | integer |=20 Indexes: rechnung_zusatz_uniq_objektnr unique btree (system, jahr,=20 rechnungsnr, objektnr), rechnung_zusatz_objektnr btree (objektnr) Foreign Key constraints: $1 FOREIGN KEY (system, jahr, rechnungsnr) REFEREN= CES=20 rechnung(system, jahr, rechnungsnr) ON UPDATE NO ACTION ON DELETE NO ACTION schulz=3D>=20 On the SuSE machine an explain gives the following: schulz=3D> explain select system, jahr, rechnungsnr from (rechnung natural = left=20 join rechnung_zusatz) where objektnr=3D1; QUERY PLAN=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 ---------------------------------------------------------------------------= ----------- Hash Join (cost=3D0.00..25.04 rows=3D1000 width=3D20) Hash Cond: ("outer".rechnungsnr =3D "inner".rechnungsnr) Join Filter: (("outer".system =3D "inner".system) AND ("outer".jahr =3D= =20 "inner".jahr)) Filter: ("inner".objektnr =3D 1) -> Seq Scan on rechnung (cost=3D0.00..20.00 rows=3D1000 width=3D8) -> Hash (cost=3D0.00..0.00 rows=3D1 width=3D12) -> Seq Scan on rechnung_zusatz (cost=3D0.00..0.00 rows=3D1 width= =3D12) (7 rows) schulz=3D> On the Gentoo machine the same explain gives: schulz=3D> explain select system, jahr, rechnungsnr from (rechnung natural = left=20 join rechnung_zusatz) where objektnr=3D1; QUERY PLAN=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 ---------------------------------------------------------------------------= ------ Merge Join (cost=3D0.00..109.00 rows=3D1000 width=3D20) Merge Cond: (("outer".system =3D "inner".system) AND ("outer".jahr =3D= =20 "inner".jahr) AND ("outer".rechnungsnr =3D "inner".rechnungsnr)) Filter: ("inner".objektnr =3D 1) -> Index Scan using rechnung_pkey on rechnung (cost=3D0.00..52.00 rows= =3D1000=20 width=3D8) -> Index Scan using rechnung_zusatz_uni_objektnr on rechnung_zusatz=20= =20 (cost=3D0.00..52.00 rows=3D1000 width=3D12) (5 Zeilen) schulz=3D> The select on the SuSE machine finishes in about 3 seconds and on the Gentoo machine it doesn't seem to come to an end at all. Each table has about 80.000 rows. I'm not very familar with the output of the explain command but can you tell me why I get two different query plans? J=F6rg From pgsql-general-owner@postgresql.org Wed Jul 23 11:49:16 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AE284D1C515 for ; Wed, 23 Jul 2003 14:49:15 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 34885-01 for ; Wed, 23 Jul 2003 11:48:33 -0300 (ADT) Received: from megazone.bigpanda.com (unknown [66.180.233.26]) by svr1.postgresql.org (Postfix) with ESMTP id 73C26D1C4DA for ; Wed, 23 Jul 2003 11:49:13 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 1E049D67F; Wed, 23 Jul 2003 07:49:13 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 139AE5C12; Wed, 23 Jul 2003 07:49:13 -0700 (PDT) Date: Wed, 23 Jul 2003 07:49:12 -0700 (PDT) From: Stephan Szabo To: Jean-Christian Imbeault Cc: Subject: Re: Performance hit of foreign key constraints? In-Reply-To: <3F1E339C.7010304@mega-bucks.co.jp> Message-ID: <20030723074442.L69170-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1070 X-Sequence-Number: 45923 On Wed, 23 Jul 2003, Jean-Christian Imbeault wrote: > I have a database which is constantly being written to. A web server's > log file (and extras) is being written to it. There are no deletions or > updates (at least I think so :). > > As the web traffic increases so will the write intensity. > > Right now the database tables have no foreign keys defined even though > there are foreign keys. The code that inserts into the DB is simple > enough (now) that we can make sure that nothing is inserted if the > corresponding fk does not exist and that all fk checks pass. > > I want to add foreign key constraints to the table definitions but I am > worried that it might be a big performance hit. Can anyone tell me how > much of a performance hit adding one foreign key constraint to one field > in a table will roughly be? Well, generally speaking it'll be (assuming no ref actions - and covering actions you aren't doing): one select for each insert to the table with the constraint one select for each update to the table with the constraint, in current releases unpatched one select for each update to the table with the constraint if the key is changed in patched 7.3 or 7.4beta. one select for each delete to the referenced table one select for each update to the referenced table if the key is changed plus management of the trigger queue (this can be an issue in long transactions since the queue can get big) and some misc. work in the triggers. You really want the foregin key on the table with the constraint to be indexed and using the index if you expect eitherof the referenced table conditions to happen. From pgsql-general-owner@postgresql.org Wed Jul 23 12:05:22 2003 X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1AFC3D1C517 for ; Wed, 23 Jul 2003 15:02:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 33822-06 for ; Wed, 23 Jul 2003 12:02:10 -0300 (ADT) Received: from megazone.bigpanda.com (unknown [66.180.233.26]) by svr1.postgresql.org (Postfix) with ESMTP id DB454D1C513 for ; Wed, 23 Jul 2003 12:02:50 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id EEC95D639; Wed, 23 Jul 2003 08:02:49 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id E47085C12; Wed, 23 Jul 2003 08:02:49 -0700 (PDT) Date: Wed, 23 Jul 2003 08:02:49 -0700 (PDT) From: Stephan Szabo To: Jean-Christian Imbeault Cc: Subject: Re: Performance hit of foreign key constraints? In-Reply-To: <20030723074442.L69170-100000@megazone.bigpanda.com> Message-ID: <20030723075933.N69662-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/1072 X-Sequence-Number: 45925 On Wed, 23 Jul 2003, Stephan Szabo wrote: > > On Wed, 23 Jul 2003, Jean-Christian Imbeault wrote: > > > I have a database which is constantly being written to. A web server's > > log file (and extras) is being written to it. There are no deletions or > > updates (at least I think so :). > > > > As the web traffic increases so will the write intensity. > > > > Right now the database tables have no foreign keys defined even though > > there are foreign keys. The code that inserts into the DB is simple > > enough (now) that we can make sure that nothing is inserted if the > > corresponding fk does not exist and that all fk checks pass. > > > > I want to add foreign key constraints to the table definitions but I am > > worried that it might be a big performance hit. Can anyone tell me how > > much of a performance hit adding one foreign key constraint to one field > > in a table will roughly be? > > Well, generally speaking it'll be (assuming no ref actions - and covering > actions you aren't doing): > one select for each insert to the table with the constraint > one select for each update to the table with the constraint, in current > releases unpatched > one select for each update to the table with the constraint if the > key is changed in patched 7.3 or 7.4beta. > one select for each delete to the referenced table > one select for each update to the referenced table if the key is changed So much for answering questions before I take my shower and wake up. Make those last two be two selects, and in 7.3 and earlier, one of those selects on update to referenced happens even if the key isn't changed (there's a patch that should work to change that on -patches archive). From pgsql-performance-owner@postgresql.org Wed Jul 23 12:21:14 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A71EFD1C4DC for ; Wed, 23 Jul 2003 15:21:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 34827-08 for ; Wed, 23 Jul 2003 12:20:26 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id A9FBDD1C4DA for ; Wed, 23 Jul 2003 12:21:07 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6NFL7Q3013277; Wed, 23 Jul 2003 11:21:07 -0400 (EDT) To: =?iso-8859-1?q?J=F6rg=20Schulz?= Cc: pgsql-performance@postgresql.org Subject: Re: different query plan for same select In-reply-to: <200307231628.54295.jschulz@sgbs.de> References: <200307231628.54295.jschulz@sgbs.de> Comments: In-reply-to =?iso-8859-1?q?J=F6rg=20Schulz?= message dated "Wed, 23 Jul 2003 16:28:54 +0200" Date: Wed, 23 Jul 2003 11:21:06 -0400 Message-ID: <13276.1058973666@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/393 X-Sequence-Number: 2686 =?iso-8859-1?q?J=F6rg=20Schulz?= writes: > I'm not very familar with the output of the explain command but can you > tell me why I get two different query plans? Judging from the suspiciously round numbers in the cost estimates, you've never done a VACUUM ANALYZE on any of these tables. Try that and then see what plans you get... regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jul 23 12:43:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BD8BAD1C4E1 for ; Wed, 23 Jul 2003 15:43:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 38387-03 for ; Wed, 23 Jul 2003 12:42:41 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id BF7E8D1C4DA for ; Wed, 23 Jul 2003 12:43:22 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6NFhMQ3013447; Wed, 23 Jul 2003 11:43:22 -0400 (EDT) To: Rajesh Kumar Mallah Cc: pgsql-performance@postgresql.org Subject: Re: factoring problem with view in 7.3.3 In-reply-to: <200307231551.48444.mallah@trade-india.com> References: <200307231551.48444.mallah@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Wed, 23 Jul 2003 15:51:48 +0530" Date: Wed, 23 Jul 2003 11:43:21 -0400 Message-ID: <13446.1058975001@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/394 X-Sequence-Number: 2687 Rajesh Kumar Mallah writes: > I have a view which is a union of select of certain feilds from > indentical tables. The problem is when we query a column on > which index exists exists foreach of the tables does not use the > indexes. Hard to be certain since you didn't show us the table definitions, but I suspect the culprit is a datatype mismatch. Here are the comments for 7.3's subquery_is_pushdown_safe, which determines whether it's okay to push down a qualifier: * Conditions checked here: * * 1. If the subquery has a LIMIT clause or a DISTINCT ON clause, we must * not push down any quals, since that could change the set of rows * returned. (Actually, we could push down quals into a DISTINCT ON * subquery if they refer only to DISTINCT-ed output columns, but * checking that seems more work than it's worth. In any case, a * plain DISTINCT is safe to push down past.) * * 2. If the subquery has any functions returning sets in its target list, * we do not push down any quals, since the quals * might refer to those tlist items, which would mean we'd introduce * functions-returning-sets into the subquery's WHERE/HAVING quals. * (It'd be sufficient to not push down quals that refer to those * particular tlist items, but that's much clumsier to check.) * * 3. If the subquery contains EXCEPT or EXCEPT ALL set ops we cannot push * quals into it, because that would change the results. For subqueries * using UNION/UNION ALL/INTERSECT/INTERSECT ALL, we can push the quals * into each component query, so long as all the component queries share * identical output types. (That restriction could probably be relaxed, * but it would take much more code to include type coercion code into * the quals, and I'm also concerned about possible semantic gotchas.) 1 and 2 don't seem to apply to your problem, which leaves 3 ... (BTW, 7.4 has addressed all of the possible improvements noted in the parenthetical remarks here.) regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jul 23 13:36:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 27857D1C4C1 for ; Wed, 23 Jul 2003 16:36:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 39798-07 for ; Wed, 23 Jul 2003 13:36:04 -0300 (ADT) Received: from trade-india.com (ns1.trade-india.com [66.234.10.14]) by svr1.postgresql.org (Postfix) with SMTP id 05986D1C4B7 for ; Wed, 23 Jul 2003 13:36:45 -0300 (ADT) Received: (qmail 3672 invoked by uid 505); 23 Jul 2003 16:37:10 -0000 Received: from mallah@trade-india.com by ns1.trade-india.com by uid 502 with qmail-scanner-1.16 (clamscan: 0.54. spamassassin: 2.54. Clear:SA:0(-98.5/5.0):. Processed in 0.609591 secs); 23 Jul 2003 16:37:10 -0000 Received: from ns1.trade-india.com (HELO trade-india.com) (66.234.10.14) by ns1.trade-india.com with SMTP; 23 Jul 2003 16:37:09 -0000 Received: from 219.65.226.100 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Wed, 23 Jul 2003 22:07:09 +0530 (IST) Message-ID: <1270.219.65.226.100.1058978229.squirrel@mail.trade-india.com> Date: Wed, 23 Jul 2003 22:07:09 +0530 (IST) Subject: Re: factoring problem with view in 7.3.3 [ PARTIALLY SOLVED ] From: To: In-Reply-To: <13446.1058975001@sss.pgh.pa.us> References: <200307231551.48444.mallah@trade-india.com> <13446.1058975001@sss.pgh.pa.us> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) 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=1.5 tagged_above=0.0 required=5.0 tests=CLICK_BELOW, IN_REP_TO, MISSING_MIMEOLE, MISSING_OUTLOOK_NAME, NO_REAL_NAME, QUOTED_EMAIL_TEXT, REFERENCES, REPLY_WITH_QUOTES, SEARCH_ENGINE_PROMO X-Spam-Level: * X-Archive-Number: 200307/395 X-Sequence-Number: 2688 > Rajesh Kumar Mallah writes: >> I have a view which is a union of select of certain feilds from >> indentical tables. The problem is when we query a column on >> which index exists exists foreach of the tables does not use the >> indexes. > > Hard to be certain since you didn't show us the table definitions, but > I suspect the culprit is a datatype mismatch. Rightly guessed , one of the columns in the view was having a diffrent type (date vs timestamp ). The column was removed from the view it worked. the column 'generated' was timestamp in 2 place and date in 2 place, i wanted it in my and did a typecasting in the view below but it suffers from the same problem . I could use Richards suggestion then ? regds mallah. CREATE VIEW sent_enquiry_eyp_iid_ip_cat2 as ((((((SELECT eyp_rfi.rfi_id, eyp_rfi.sender_uid, eyp_rfi.receiver_uid, eyp_rfi.subject, eyp_rfi.generated::timestamp FROM ONLY eyp_rfi) UNION (SELECT iid_rfi.rfi_id, iid_rfi.sender_uid, iid_rfi.receiver_uid, iid_rfi.subject, iid_rfi.generated FROM ONLY iid_rfi))) UNION (SELECT ip_rfi.rfi_id, ip_rfi.sender_uid, ip_rfi.receiver_uid, ip_rfi.subject, ip_rfi.generated::timestamp FROM ONLY ip_rfi))) UNION (SELECT catalog_rfi.rfi_id, catalog_rfi.sender_uid, catalog_rfi.receiver_uid, catalog_rfi.subject, catalog_rfi.generated FROM ONLY catalog_rfi)); Here are the > comments for 7.3's subquery_is_pushdown_safe, which determines whether > it's okay to push down a qualifier: > > * Conditions checked here: > * > * 1. If the subquery has a LIMIT clause or a DISTINCT ON clause, we > must * not push down any quals, since that could change the set of rows > * returned. (Actually, we could push down quals into a DISTINCT ON * > subquery if they refer only to DISTINCT-ed output columns, but > * checking that seems more work than it's worth. In any case, a > * plain DISTINCT is safe to push down past.) > * > * 2. If the subquery has any functions returning sets in its target > list, * we do not push down any quals, since the quals > * might refer to those tlist items, which would mean we'd introduce * > functions-returning-sets into the subquery's WHERE/HAVING quals. * > (It'd be sufficient to not push down quals that refer to those > * particular tlist items, but that's much clumsier to check.) > * > * 3. If the subquery contains EXCEPT or EXCEPT ALL set ops we cannot > push * quals into it, because that would change the results. For > subqueries * using UNION/UNION ALL/INTERSECT/INTERSECT ALL, we can push > the quals * into each component query, so long as all the component > queries share * identical output types. (That restriction could > probably be relaxed, * but it would take much more code to include type > coercion code into * the quals, and I'm also concerned about possible > semantic gotchas.) > > 1 and 2 don't seem to apply to your problem, which leaves 3 ... > > (BTW, 7.4 has addressed all of the possible improvements noted in the > parenthetical remarks here.) > > regards, tom lane ----------------------------------------- Over 1,00,000 exporters are waiting for your order! Click below to get in touch with leading Indian exporters listed in the premier trade directory Exporters Yellow Pages. http://www.trade-india.com/dyn/gdh/eyp/ From pgsql-performance-owner@postgresql.org Wed Jul 23 13:47:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 455FDD1C510 for ; Wed, 23 Jul 2003 16:47:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 42041-03 for ; Wed, 23 Jul 2003 13:47:02 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 56214D1C50A for ; Wed, 23 Jul 2003 13:47:43 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6NGlhQ3013917; Wed, 23 Jul 2003 12:47:43 -0400 (EDT) To: mallah@trade-india.com Cc: pgsql-performance@postgresql.org Subject: Re: factoring problem with view in 7.3.3 [ PARTIALLY SOLVED ] In-reply-to: <1270.219.65.226.100.1058978229.squirrel@mail.trade-india.com> References: <200307231551.48444.mallah@trade-india.com> <13446.1058975001@sss.pgh.pa.us> <1270.219.65.226.100.1058978229.squirrel@mail.trade-india.com> Comments: In-reply-to message dated "Wed, 23 Jul 2003 22:07:09 +0530" Date: Wed, 23 Jul 2003 12:47:43 -0400 Message-ID: <13916.1058978863@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/396 X-Sequence-Number: 2689 writes: > the column 'generated' was timestamp in 2 place and date in 2 place, > i wanted it in my and did a typecasting in the view below > but it suffers from the same problem . AFAIR it should work if you insert casts into the UNION's member selects. Maybe you didn't get the casting quite right? (For instance, "timestamp" isn't "timestamp with time zone" ...) regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jul 23 14:20:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 217FBD1C50F for ; Wed, 23 Jul 2003 17:20:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 46290-01 for ; Wed, 23 Jul 2003 14:20:11 -0300 (ADT) Received: from trade-india.com (ns1.trade-india.com [66.234.10.14]) by svr1.postgresql.org (Postfix) with SMTP id 14C40D1C511 for ; Wed, 23 Jul 2003 14:20:52 -0300 (ADT) Received: (qmail 9745 invoked by uid 505); 23 Jul 2003 17:21:17 -0000 Received: from mallah@trade-india.com by ns1.trade-india.com by uid 502 with qmail-scanner-1.16 (clamscan: 0.54. spamassassin: 2.54. Clear:SA:0(-98.5/5.0):. Processed in 0.613497 secs); 23 Jul 2003 17:21:17 -0000 Received: from ns1.trade-india.com (HELO trade-india.com) (66.234.10.14) by ns1.trade-india.com with SMTP; 23 Jul 2003 17:21:16 -0000 Received: from 219.65.226.100 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Wed, 23 Jul 2003 22:51:16 +0530 (IST) Message-ID: <1360.219.65.226.100.1058980876.squirrel@mail.trade-india.com> Date: Wed, 23 Jul 2003 22:51:16 +0530 (IST) Subject: Re: factoring problem with view in 7.3.3 [ SOLVED ] From: To: In-Reply-To: <13916.1058978863@sss.pgh.pa.us> References: <200307231551.48444.mallah@trade-india.com> <13446.1058975001@sss.pgh.pa.us> <1270.219.65.226.100.1058978229.squirrel@mail.trade-india.com> <13916.1058978863@sss.pgh.pa.us> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: X-Mailer: SquirrelMail (version 1.2.6) 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=1.5 tagged_above=0.0 required=5.0 tests=CLICK_BELOW, IN_REP_TO, MISSING_MIMEOLE, MISSING_OUTLOOK_NAME, NO_REAL_NAME, QUOTED_EMAIL_TEXT, REFERENCES, REPLY_WITH_QUOTES, SEARCH_ENGINE_PROMO X-Spam-Level: * X-Archive-Number: 200307/397 X-Sequence-Number: 2690 Yep! it works perfectly now. CREATE or replace VIEW sent_enquiry_eyp_iid_ip_cat2 as ((((((SELECT eyp_rfi.rfi_id, eyp_rfi.sender_uid, eyp_rfi.receiver_uid, eyp_rfi.subject, cast(eyp_rfi.generated as timestamp with time zone ) FROM ONLY eyp_rfi) UNION (SELECT iid_rfi.rfi_id, iid_rfi.sender_uid, iid_rfi.receiver_uid, iid_rfi.subject, iid_rfi.generated FROM ONLY iid_rfi))) UNION (SELECT ip_rfi.rfi_id, ip_rfi.sender_uid, ip_rfi.receiver_uid, ip_rfi.subject, cast(ip_rfi.generated as timestamp with time zone ) FROM ONLY ip_rfi))) UNION (SELECT catalog_rfi.rfi_id, catalog_rfi.sender_uid, catalog_rfi.receiver_uid, catalog_rfi.subject, catalog_rfi.generated FROM ONLY catalog_rfi)); tradein_clients=# explain analyze SELECT rfi_id from sent_enquiry_eyp_iid_ip_cat2 where sender_uid=38466; QUERY PLAN------------------------------------------------------------------------------------------------------------------------------------------------------------------ Subquery Scan sent_enquiry_eyp_iid_ip_cat2 (cost=641.62..644.67 rows=20 width=55) (actual time=0.17..0.17 rows=0 loops=1) -> Unique (cost=641.62..644.67 rows=20 width=55) (actual time=0.17..0.17 rows=0 loops=1) -> Sort (cost=641.62..642.12 rows=204 width=55) (actual time=0.17..0.17 rows=0 loops=1) Sort Key: rfi_id, sender_uid, receiver_uid, subject, generated -> Append (cost=0.00..633.80 rows=204 width=55) (actual time=0.08..0.08 rows=0 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..376.11 rows=117 width=42) (actual time=0.03..0.03 rows=0 loops=1) -> Index Scan using eyp_sender_uid_idx on eyp_rfi (cost=0.00..376.11 rows=117 width=42) (actual time=0.03..0.03 rows=0 loops=1) Index Cond: (sender_uid = 38466) -> Subquery Scan "*SELECT* 2" (cost=0.00..81.33 rows=21 width=47) (actual time=0.02..0.02 rows=0 loops=1) -> Index Scan using iid_sender_uid_idx on iid_rfi (cost=0.00..81.33 rows=21 width=47) (actual time=0.02..0.02 rows=0 loops=1) Index Cond: (sender_uid = 38466) -> Subquery Scan "*SELECT* 3" (cost=0.00..160.18 rows=57 width=42) (actual time=0.02..0.02 rows=0 loops=1) -> Index Scan using ip_sender_uid_idx on ip_rfi (cost=0.00..160.18 rows=57 width=42) (actual time=0.02..0.02 rows=0 loops=1) Index Cond: (sender_uid = 38466) -> Subquery Scan "*SELECT* 4" (cost=0.00..16.19 rows=8 width=55) (actual time=0.01..0.01 rows=0 loops=1) -> Index Scan using catalog_sender_uid_idx on catalog_rfi (cost=0.00..16.19 rows=8 width=55) (actual time=0.01..0.01 rows=0 loops=1) Index Cond: (sender_uid = 38466) Total runtime: 0.41 msec (18 rows) regds mallah. > writes: >> the column 'generated' was timestamp in 2 place and date in 2 place, i >> wanted it in my and did a typecasting in the view below >> but it suffers from the same problem . > > AFAIR it should work if you insert casts into the UNION's member > selects. Maybe you didn't get the casting quite right? (For instance, > "timestamp" isn't "timestamp with time zone" ...) > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- TIP 6: Have you searched our list > archives? > > http://archives.postgresql.org ----------------------------------------- Over 1,00,000 exporters are waiting for your order! Click below to get in touch with leading Indian exporters listed in the premier trade directory Exporters Yellow Pages. http://www.trade-india.com/dyn/gdh/eyp/ From pgsql-admin-owner@postgresql.org Wed Jul 23 14:44:45 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C2902D1C7EB; Wed, 23 Jul 2003 17:44:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 47439-02; Wed, 23 Jul 2003 14:44:02 -0300 (ADT) Received: from djinn.gene.com (socks-open.gene.com [192.12.78.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7EC0AD1C515; Wed, 23 Jul 2003 14:44:42 -0300 (ADT) Received: from faraday.gene.com (faraday.gene.com [128.137.49.205]) by djinn.gene.com (8.12.9/8.12.9) with ESMTP id h6NHibDe216316; Wed, 23 Jul 2003 10:44:37 -0700 (PDT) Received: from tallac.gene.com (ldappxy.gene.com [128.137.55.36]) by faraday.gene.com (Switch-3.1.0/Switch-3.1.0) with ESMTP id h6NHiaca024400; Wed, 23 Jul 2003 10:44:36 -0700 (PDT) Subject: Re: [PERFORM] slow table updates From: Reece Hart To: Richard Huxton Cc: "pgsql-performance@postgresql.org" , "pgsql-admin@postgresql.org" , SF PostgreSQL In-Reply-To: <200307230949.10028.dev@archonet.com> References: <1058920801.7281.67.camel@tallac> <200307230949.10028.dev@archonet.com> Content-Type: multipart/alternative; boundary="=-9hmJexnaeMy5n3vdHDR2" Organization: Genentech, Inc. Message-Id: <1058982275.7281.83.camel@tallac> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 23 Jul 2003 10:44:36 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/245 X-Sequence-Number: 9585 --=-9hmJexnaeMy5n3vdHDR2 Content-Type: text/plain Content-Transfer-Encoding: 7bit Richard- Thanks for the suggestions. I too had thought about the FK checks, even though the columns aren't getting updated. I'm flabbergasted that the update is still running (~22 hours elapsed). By comparison, the database takes only 4 hours to recreate from backup! Something funny is happening here. I just interrupted the update and will find another way. But hang on, what's this: PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND 30164 compbio 25 0 6056 6056 3568 R 98.8 0.1 29:55 postgres: admin csb [local] COPY I am the only user and I'm not doing a copy... this must be part of the update process. Does anyone out there know whether updates do a table copy instead of in-table udpating (perhaps as a special case for whole-table updates)? Of course, I can't help but wonder whether I just killed it when it was nearly done... Thanks, Reece -- Reece Hart, Ph.D. rkh@gene.com, http://www.gene.com/ Genentech, Inc. 650/225-6133 (voice), -5389 (fax) Bioinformatics and Protein Engineering 1 DNA Way, MS-93 http://www.in-machina.com/~reece/ South San Francisco, CA 94080-4990 reece@in-machina.com, GPG: 0x25EC91A0 --=-9hmJexnaeMy5n3vdHDR2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Richard-

Thanks for the suggestions. I too had thought about the FK checks, even though the columns aren't getting updated.

I'm flabbergasted that the update is still running (~22 hours elapsed). By comparison, the database takes only 4 hours to recreate from backup! Something funny is happening here. I just interrupted the update and will find another way.

But hang on, what's this:
  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME COMMAND
30164 compbio   25   0  6056 6056  3568 R    98.8  0.1  29:55 postgres: admin csb [local] COPY

I am the only user and I'm not doing a copy... this must be part of the update process. Does anyone out there know whether updates do a table copy instead of in-table udpating (perhaps as a special case for whole-table updates)?

Of course, I can't help but wonder whether I just killed it when it was nearly done...

Thanks,
Reece

-- 
Reece Hart, Ph.D.                       rkh@gene.com, http://www.gene.com/
Genentech, Inc.                         650/225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93                        http://www.in-machina.com/~reece/
South San Francisco, CA  94080-4990     reece@in-machina.com, GPG: 0x25EC91A0
--=-9hmJexnaeMy5n3vdHDR2-- From pgsql-admin-owner@postgresql.org Wed Jul 23 15:07:18 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 57204D1C7F2; Wed, 23 Jul 2003 18:07:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 46319-09; Wed, 23 Jul 2003 15:06:36 -0300 (ADT) Received: from djinn.gene.com (socks-open.gene.com [192.12.78.2]) by svr1.postgresql.org (Postfix) with ESMTP id E8F66D1C7EB; Wed, 23 Jul 2003 15:07:15 -0300 (ADT) Received: from faraday.gene.com (smtp.gene.com [128.137.49.205]) by djinn.gene.com (8.12.9/8.12.9) with ESMTP id h6NI7BDe224917; Wed, 23 Jul 2003 11:07:11 -0700 (PDT) Received: from tallac.gene.com (mail.gene.com [128.137.49.207]) by faraday.gene.com (Switch-3.1.0/Switch-3.1.0) with ESMTP id h6NI7Aca012343; Wed, 23 Jul 2003 11:07:11 -0700 (PDT) Subject: Re: [PERFORM] slow table updates From: Reece Hart To: "Guthrie, Jeremy" Cc: "pgsql-admin@postgresql.org" , "pgsql-performance@postgresql.org" , SF PostgreSQL In-Reply-To: References: Content-Type: multipart/alternative; boundary="=-Ru+lwTMy1GLQ47eoVyFi" Organization: Genentech, Inc. Message-Id: <1058983630.7281.101.camel@tallac> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 23 Jul 2003 11:07:10 -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/247 X-Sequence-Number: 9587 --=-Ru+lwTMy1GLQ47eoVyFi Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2003-07-23 at 10:47, Guthrie, Jeremy wrote: > Have you checked the sizes of your indexes? You may need to rebuild them... > > Multiply the relpages colum by 8192. So, what does this tell me? I'm guessing that you're implying that I should expect 8192 keys per page, and that this therefore indicates the sparseness of the key pages. Guessing that, I did: rkh@csb=> SELECT c2.relname, c2.relpages, c2.relpages*8192 as "*8192", 43413476::real/(c2.relpages*8192) FROM pg_class c, pg_class c2, pg_index i where c.oid = i.indrelid AND c2.oid = i.indexrelid and c2.relname~'^p2th|^papro' ORDER BY c2.relname; relname | relpages | *8192 | ?column? ---------------------------------+----------+------------+-------------------- p2thread_p2params_id | 122912 | 1006895104 | 0.0431161854174633 p2thread_pmodel_id | 123243 | 1009606656 | 0.0430003860830331 paprospect2_redundant_alignment | 229934 | 1883619328 | 0.0230479032332376 What do you make of 'em apples? Thanks, Reece -- Reece Hart, Ph.D. rkh@gene.com, http://www.gene.com/ Genentech, Inc. 650/225-6133 (voice), -5389 (fax) Bioinformatics and Protein Engineering 1 DNA Way, MS-93 http://www.in-machina.com/~reece/ South San Francisco, CA 94080-4990 reece@in-machina.com, GPG: 0x25EC91A0 --=-Ru+lwTMy1GLQ47eoVyFi Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit On Wed, 2003-07-23 at 10:47, Guthrie, Jeremy wrote:
Have you checked the sizes of your indexes?  You may need to rebuild them...

Multiply the relpages colum by 8192.

So, what does this tell me? I'm guessing that you're implying that I should expect 8192 keys per page, and that this therefore indicates the sparseness of the key pages. Guessing that, I did:

rkh@csb=> SELECT c2.relname, c2.relpages, c2.relpages*8192 as "*8192",
   43413476::real/(c2.relpages*8192) FROM pg_class c, pg_class c2, pg_index i
   where c.oid = i.indrelid AND c2.oid = i.indexrelid and c2.relname~'^p2th|^papro'
   ORDER BY c2.relname;

             relname             | relpages |   *8192    |      ?column?
---------------------------------+----------+------------+--------------------
 p2thread_p2params_id            |   122912 | 1006895104 | 0.0431161854174633
 p2thread_pmodel_id              |   123243 | 1009606656 | 0.0430003860830331
 paprospect2_redundant_alignment |   229934 | 1883619328 | 0.0230479032332376

What do you make of 'em apples?

Thanks,
Reece

-- 
Reece Hart, Ph.D.                       rkh@gene.com, http://www.gene.com/
Genentech, Inc.                         650/225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93                        http://www.in-machina.com/~reece/
South San Francisco, CA  94080-4990     reece@in-machina.com, GPG: 0x25EC91A0
--=-Ru+lwTMy1GLQ47eoVyFi-- From pgsql-performance-owner@postgresql.org Wed Jul 23 15:38:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5CCE4D1C4D0; Wed, 23 Jul 2003 18:38:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 52864-01; Wed, 23 Jul 2003 15:37:22 -0300 (ADT) Received: from ctg-msnex01.staff.berbee.com (msn-office1.binc.net [64.73.12.254]) by svr1.postgresql.org (Postfix) with ESMTP id 58A77D1C4CC; Wed, 23 Jul 2003 15:38:02 -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="Windows-1252" Content-Transfer-Encoding: quoted-printable Subject: Re: slow table updates Date: Wed, 23 Jul 2003 13:38:03 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] slow table updates Thread-Index: AcNRRUC/KbIK4kqvQ7ycam+wE1ouqQAA2F7v From: "Guthrie, Jeremy" To: "Reece Hart" Cc: , , "SF PostgreSQL" 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: 200307/400 X-Sequence-Number: 2693 Look at it like this(this is how this affected me): I had a table that use to be the primary home for my data(6 gigs worth). I= copied out and copied to another table. I purged and then I 'vacuum full'= 'd the database. After a day things really started going to hell. SLOOOW.= . like 30 minutes to run my software versus the 1-5 seconds it normally tak= es. The old table is still used but I use it to queue up data. After the data = is processed, it is deleted. Mind you that the repurposed 'queue' table us= ually has no more than 3000-10000 entries in it. Guess what the index size= was..... all told I had 7 gigs of indexes. Why? Because vacuum doesn't = reoptimize the indexes. If postgresql can't use a deleted row's index entr= y, it creates a new one. The docs make it sound that if the difference bet= ween the values of the deleted rows vs the new row aren't close, it can't u= se the old index space. Look in the docs about reindexing to see their exp= lanation. So back to my example, my table should maybe be 100K w/ indexes = but it was more like 7 gigs. I re-indexed and BAM! My times were sub-seco= nd.=20 Based on the information you have below, you have 3 gigs worth of indexes. = Do you have that much data(in terms of rows)? -----Original Message----- From: Reece Hart [mailto:rkh@gene.COM] Sent: Wed 7/23/2003 1:07 PM To: Guthrie, Jeremy Cc: pgsql-admin@postgresql.org; pgsql-performance@postgresql.org; SF Postgr= eSQL Subject: RE: [PERFORM] slow table updates On Wed, 2003-07-23 at 10:47, Guthrie, Jeremy wrote: > Have you checked the sizes of your indexes? You may need to rebuild them= ... >=20 > Multiply the relpages colum by 8192. So, what does this tell me? I'm guessing that you're implying that I should expect 8192 keys per page, and that this therefore indicates the sparseness of the key pages. Guessing that, I did: rkh@csb=3D> SELECT c2.relname, c2.relpages, c2.relpages*8192 as "*8192", 43413476::real/(c2.relpages*8192) FROM pg_class c, pg_class c2, pg_index= i where c.oid =3D i.indrelid AND c2.oid =3D i.indexrelid and c2.relname~'^= p2th|^papro' ORDER BY c2.relname; relname | relpages | *8192 | ?column? ---------------------------------+----------+------------+-----------------= --- p2thread_p2params_id | 122912 | 1006895104 | 0.04311618541746= 33 p2thread_pmodel_id | 123243 | 1009606656 | 0.04300038608303= 31 paprospect2_redundant_alignment | 229934 | 1883619328 | 0.02304790323323= 76 What do you make of 'em apples? Thanks, Reece --=20 Reece Hart, Ph.D. rkh@gene.com, http://www.gene.com/ Genentech, Inc. 650/225-6133 (voice), -5389 (fax) Bioinformatics and Protein Engineering 1 DNA Way, MS-93 http://www.in-machina.com/~reece/ South San Francisco, CA 94080-4990 reece@in-machina.com, GPG: 0x25EC91= A0 From pgsql-performance-owner@postgresql.org Thu Jul 24 03:10:30 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 24DCCD1C4DF for ; Thu, 24 Jul 2003 06:07:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 09559-10 for ; Thu, 24 Jul 2003 03:05:53 -0300 (ADT) Received: from www.sgbs.de (www.sgbs.de [62.225.75.154]) by svr1.postgresql.org (Postfix) with ESMTP id 728B2D1C944 for ; Thu, 24 Jul 2003 03:06:34 -0300 (ADT) From: =?iso-8859-15?q?J=F6rg=20Schulz?= To: pgsql-performance@postgresql.org Subject: Re: different query plan for same select Date: Thu, 24 Jul 2003 08:06:22 +0200 User-Agent: KMail/1.5.1 References: <200307231628.54295.jschulz@sgbs.de> <13276.1058973666@sss.pgh.pa.us> In-Reply-To: <13276.1058973666@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200307240806.22941.jschulz@sgbs.de> X-Virus-Scanned: by AMaViS X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/401 X-Sequence-Number: 2694 > > I'm not very familar with the output of the explain command but can you > > tell me why I get two different query plans? > > Judging from the suspiciously round numbers in the cost estimates, > you've never done a VACUUM ANALYZE on any of these tables. Try that and > then see what plans you get... Oops.. You were right! Thank you anyway. J=F6rg From pgsql-performance-owner@postgresql.org Thu Jul 24 10:52:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A245DD1C510 for ; Thu, 24 Jul 2003 13:07:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 37363-05 for ; Thu, 24 Jul 2003 10:07:00 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id C1A2AD1C50F for ; Thu, 24 Jul 2003 10:07:38 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6ODDg4u026226 for ; Thu, 24 Jul 2003 18:43:42 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6ODDfRZ026213 for ; Thu, 24 Jul 2003 18:43:41 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Thu, 24 Jul 2003 18:39:26 +0530 MIME-Version: 1.0 Subject: Re: hardware performance and some more Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F2027DE.15489.A17C705@localhost> In-reply-to: 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/403 X-Sequence-Number: 2696 On 24 Jul 2003 at 15:54, Kasim Oztoprak wrote: > The questions for this explanation are: > 1 - Can we use postgresql within clustered environment? > 2 - if the answer is yes, in which method can we use postgresql within a cluster? > active - passive or active - active? Coupled with linux-HA( See http://linux-ha.org) heartbeat service, it *should* be possible to run postgresql in active-passive clustering. If postgresql supported read-only database so that several nodes could read off a single disk but only one could update that, a sort of active-active should be possible as well. But postgresql can not have a read only database. That would be a handy addition in such cases.. > Now, the second question is related to the performance of the database. Assuming we have a > dell's poweredge 6650 with 4 x 2.8 Ghz Xeon processors having 2 MB of cache for each, with the > main memory of lets say 32 GB. We can either use a small SAN from EMC or we can put all disks > into the machines with the required raid confiuration. > > We will install RedHat Advanced Server 2.1 to the machine as the operating system and postgresql as > the database server. We have a database having 25 millions records having the length of 250 bytes > on average for each record. And there are 1000 operators accessing the database concurrently. The main > operation on the database (about 95%) is select rather than insert, so do you have any idea about > the performance of the system? Assumig 325 bytes per tuple(250 bytes field+24-28 byte header+varchar fields) gives 25 tuples per 8K page, there would be 8GB of data. This configuration could fly with 12-16GB of RAM. After all data is read that is. You can cut down on other requirements as well. May be a 2x opteron with 16GB RAMmight be a better fit but check out how much CPU cache it has. A grep -rwn across data directory would fill the disk cache pretty well..:-) HTH Bye Shridhar -- Egotism, n: Doing the New York Times crossword puzzle with a pen.Egotist, n: A person of low taste, more interested in himself than me. -- Ambrose Bierce, "The Devil's Dictionary" From pgsql-performance-owner@postgresql.org Thu Jul 24 12:29:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 684B3D1C4F1 for ; Thu, 24 Jul 2003 15:27:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 48291-07 for ; Thu, 24 Jul 2003 12:27:03 -0300 (ADT) Received: from pos_pdc.posportal.com (unknown [12.158.169.100]) by svr1.postgresql.org (Postfix) with ESMTP id 3C0F6D1C4EB for ; Thu, 24 Jul 2003 12:27:47 -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: hardware performance and some more Date: Thu, 24 Jul 2003 08:27:31 -0700 Message-ID: <9B1C77393DED0D4B9DAA1AA1742942DA3BCCB9@pos_pdc.posportal.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] hardware performance and some more Thread-Index: AcNR6xeubtZKq0V7QPywefa9nGNfywACTkjC From: "Roman Fail" To: , "Kasim Oztoprak" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/405 X-Sequence-Number: 2698 PiBOb3csIHRoZSBzZWNvbmQgcXVlc3Rpb24gaXMgcmVsYXRlZCB0byB0aGUg cGVyZm9ybWFuY2Ugb2YgdGhlIGRhdGFiYXNlLiBBc3N1bWluZyB3ZSBoYXZl IGENCj4gZGVsbCdzIHBvd2VyZWRnZSA2NjUwIHdpdGggNCB4IDIuOCBHaHog WGVvbiBwcm9jZXNzb3JzIGhhdmluZyAyIE1CIG9mIGNhY2hlIGZvciBlYWNo LCB3aXRoIHRoZQ0KPiBtYWluIG1lbW9yeSBvZiBsZXRzIHNheSAzMiBHQi4g V2UgY2FuIGVpdGhlciB1c2UgYSBzbWFsbCBTQU4gZnJvbSBFTUMgb3Igd2Ug Y2FuIHB1dCBhbGwgZGlza3MNCj4gaW50byB0aGUgbWFjaGluZXMgd2l0aCB0 aGUgcmVxdWlyZWQgcmFpZCBjb25maXVyYXRpb24uDQo+DQo+IFdlIHdpbGwg aW5zdGFsbCBSZWRIYXQgQWR2YW5jZWQgU2VydmVyIDIuMSB0byB0aGUgbWFj aGluZSBhcyB0aGUgb3BlcmF0aW5nIHN5c3RlbSBhbmQgcG9zdGdyZXNxbCBh cw0KPiB0aGUgZGF0YWJhc2Ugc2VydmVyLiBXZSBoYXZlIGEgZGF0YWJhc2Ug aGF2aW5nIDI1IG1pbGxpb25zIHJlY29yZHMgIGhhdmluZyB0aGUgbGVuZ3Ro IG9mIDI1MCBieXRlcw0KPiBvbiBhdmVyYWdlIGZvciBlYWNoIHJlY29yZC4g QW5kIHRoZXJlIGFyZSAxMDAwIG9wZXJhdG9ycyBhY2Nlc3NpbmcgdGhlIGRh dGFiYXNlIGNvbmN1cnJlbnRseS4gVGhlIG1haW4NCj4gb3BlcmF0aW9uIG9u IHRoZSBkYXRhYmFzZSAoYWJvdXQgOTUlKSBpcyBzZWxlY3QgcmF0aGVyIHRo YW4gaW5zZXJ0LCBzbyBkbyB5b3UgaGF2ZSBhbnkgaWRlYSBhYm91dA0KPiB0 aGUgcGVyZm9ybWFuY2Ugb2YgdGhlIHN5c3RlbT8NCg0KSSBoYXZlIGEgdmVy eSBzaW1pbGFyIGluc3RhbGxhdGlvbjogRGVsbCBQRTY2MDAgd2l0aCBkdWFs IDIuMCBYZW9ucy8yTUIgY2FjaGUsIDQgR0IgbWVtb3J5LCA2LWRpc2sgUkFJ RC0xMCBmb3IgZGF0YSwgMi1kaXNrIFJBSUQtMSBmb3IgUkggTGludXggOC4g IE15IGRhdGFiYXNlIGhhcyBvdmVyIDYwIG1pbGxpb24gcmVjb3JkcyBhdmVy YWdpbmcgIDIwMCBieXRlcyBwZXIgdHVwbGUuICBJIGhhdmUgYSBsYXJnZSBu aWdodGx5IGRhdGEgbG9hZCwgdGhlbiB2ZXJ5IGNvbXBsZXggbXVsdGktdGFi bGUgam9pbiBxdWVyaWVzIGFsbCBkYXkgd2l0aCBhIGZldyBJTlNFUlQgdHJh bnNhY3Rpb25zLiAgV2hpbGUgSSBkbyBub3QgaGF2ZSAxMDAwIGNvbmN1cnJl bnQgdXNlcnMgKG1vcmUgbGlrZSAzMCBmb3IgbWUpLCBteSBwcm9jZXNzb3Jz IGFuZCBkaXNrcyBzZWVtIHRvIGJlIGlkbGUgdGhlIHZhc3QgbWFqb3JpdHkg b2YgdGhlIHRpbWUgLSB0aGlzIG1hY2hpbmUgaXMgb3ZlcmtpbGwuICBTbyBJ IHRoaW5rIHlvdSB3aWxsIGhhdmUgbm8gcHJvYmxlbSB3aXRoIHlvdXIgaGFy ZHdhcmUsIGFuZCBjb3VsZCBwcm9iYWJseSBlYXNpbHkgZ2V0IGF3YXkgd2l0 aCBvbmx5IHR3byBwcm9jZXNzb3JzLiAgU29tZWRheSwgaWYgeW91IGNhbiBk ZXRlcm1pbmUgd2l0aCBjZXJ0YWludHkgdGhhdCB0aGUgQ1BVIGlzIGEgYm90 dGxlbmVjaywgZHJvcCBpbiB0aGUgM3JkIGFuZCA0dGggcHJvY2Vzc29ycyAo YW5kICQxMCwwMDApLiAgIEFuZCBzYXZlIHlvdXJzZWxmIG1vbmV5IG9uIHRo ZSBSQU0gYXMgd2VsbCAtIGl0J3MgaW5jcmVkaWJseSBlYXN5IHRvIHB1dCBp biBtb3JlIGlmIHlvdSBuZWVkIGl0LiAgSWYgeW91IHJlYWxseSB3YW50IHRv IHNwZW5kIG1vbmV5LCBzZXQgdXAgdGhlIGZhc3Rlc3QgZGlzayBhcnJheXMg eW91IGNhbiBpbWFnaW5lLg0KIA0KSSBjYW5ub3QgZW1waGFzaXplIGVub3Vn aDogYWxsb2NhdGUgYSBiaWcgY2h1bmsgb2YgdGltZSBmb3IgdHVuaW5nIHlv dXIgZGF0YWJhc2UgYW5kIGxlYXJuaW5nIGZyb20gdGhpcyBsaXN0LiAgSSBt aWdyYXRlZCBmcm9tIE1pY3Jvc29mdCBTUUwgU2VydmVyLiAgT3V0IG9mIHRo ZSBib3ggUG9zdGdyZVNRTCB3YXMgaG9ycmlibGUgZm9yIG1lLCBhbmQgZXZl biBhZnRlciBzaWduaWZpY2FudCB0dW5pbmcgaXQgY3Jhd2xlZCBvbiBjZXJ0 YWluIHF1ZXJpZXMgKGNvbXBhcmVkIHRvIE1TU1FMKS4gIFRoZSBsaXN0IGhl bHBlZCBtZSBmaW5kIGEgZGF0YSB0eXBlIG1pc21hdGNoIGluIGEgSk9JTiBj bGF1c2UsIGFuZCBzaW5jZSB0aGVuIHRoZSBwZXJmb3JtYW5jZSBvZiBQb3N0 Z3JlU1FMIGhhcyBibG93biB0aGUgZG9vcnMgb2ZmIG9mIE1TU1FMLiAgU2lu Y2UgSSBvbmx5IGdhdmUgbXlzZWxmIGEgY291cGxlIGRheXMgdG8gZG8gdHVu aW5nIGJlZm9yZSB0aGUgZGIgaGFkIHRvIGdvIGluIHByb2R1Y3Rpb24sIEkg YWxtb3N0IGhhZCB0byBhYmFuZG9uIFBvc3RncmVTUUwgYW5kIHJldmVydCB0 byBNUy4gIE15IHByb2JsZW1zIHdlcmUgc29sdmVkIGluIHRoZSBuaWNrIG9m IHRpbWUsIGJ1dCBJIHJlYWxseSB3aXNoIEkgaGFkIG1hZGUgbW9yZSB0aW1l IGZvciB0dW5pbmcuICANCiANClJ1bm5pbmcgc3Ryb25nIGluIHByb2R1Y3Rp b24gZm9yIDcgbW9udGhzIG5vdyB3aXRoIFBvc3RncmVTUUwgNy4zLCBhbmQg ZWFnZXJseSBhd2FpdGluZyA3LjQhDQogDQpSb21hbiBGYWlsDQpQT1MgUG9y dGFsLCBJbmMuDQogDQogDQogDQogDQogDQo= From pgsql-performance-owner@postgresql.org Thu Jul 24 09:43:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 29584D1C50D for ; Thu, 24 Jul 2003 12:40:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 32353-08 for ; Thu, 24 Jul 2003 09:39:56 -0300 (ADT) Received: from sandal.saglik.gov.tr (unknown [212.175.175.10]) by svr1.postgresql.org (Postfix) with ESMTP id B63C9D1C510 for ; Thu, 24 Jul 2003 09:40:34 -0300 (ADT) Received: from 212.174.57.164 (sandal.saglik.gov.tr [212.175.175.10]) by sandal.saglik.gov.tr (8.11.6/8.11.6) with SMTP id h6OCsri22819 for ; Thu, 24 Jul 2003 15:54:53 +0300 Message-ID: X-Mailer: BasiliX 1.1.0 -- http://basilix.org X-SenderIP: 212.174.57.164 Date: Thu, 24 Jul 2003 15:54:52 EEST From: Kasim Oztoprak Reply-To: "Kasim Oztoprak" Subject: hardware performance and some more To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/402 X-Sequence-Number: 2695 hello, some of my questions may not be related to this group however, I know that some of them are directly related to this list. first of all I would like to learn that, any of you use the postgresql within the clustered environment? Or, let me ask you the question, in different manner, can we use postgresql in a cluster environment? If we can do what is the support method of the postgresql for clusters? I would like to know two main clustering methods. (let us assume we use 2 machines in the clustering system) in the first case we have two machines running in a cluster however, the second one does not run the database server untill the observation of the failure of the first machine, the oracle guys call this situation as active-passive configuration. There is only one machine running the database server at the same time. Hence, in the case of failure there are some time to be waited untill the second machine comes up. In the second option both machines run the database server at the same time. Again oracle supports this method using some additional applications called Real Application Cluster (RAC). Again oracle guys call this method as active-active configuration. The questions for this explanation are: 1 - Can we use postgresql within clustered environment? 2 - if the answer is yes, in which method can we use postgresql within a cluster? active - passive or active - active? Now, the second question is related to the performance of the database. Assuming we have a dell's poweredge 6650 with 4 x 2.8 Ghz Xeon processors having 2 MB of cache for each, with the main memory of lets say 32 GB. We can either use a small SAN from EMC or we can put all disks into the machines with the required raid confiuration. We will install RedHat Advanced Server 2.1 to the machine as the operating system and postgresql as the database server. We have a database having 25 millions records having the length of 250 bytes on average for each record. And there are 1000 operators accessing the database concurrently. The main operation on the database (about 95%) is select rather than insert, so do you have any idea about the performance of the system? best regards, -kas�m From pgsql-performance-owner@postgresql.org Thu Jul 24 13:43:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 43FCBD1C4BC for ; Thu, 24 Jul 2003 16:43:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 51302-10 for ; Thu, 24 Jul 2003 13:42:14 -0300 (ADT) Received: from pdc.talisys.com (h-64-105-38-242.SNVACAID.covad.net [64.105.38.242]) by svr1.postgresql.org (Postfix) with ESMTP id 2DBAAD1C4D0 for ; Thu, 24 Jul 2003 13:42:57 -0300 (ADT) Received: from talisys.com (Administrators@localhost) by pdc.talisys.com (8.8.8/8.8.7) with ESMTP id JAA00107 for ; Thu, 24 Jul 2003 09:42:52 -0700 (Pacific Daylight Time) Resent-Date: Thu, 24 Jul 2003 09:42:52 -0700 (Pacific Daylight Time) Resent-From: wyu@talisys.com Resent-Message-Id: <200307241642.JAA00107@pdc.talisys.com> Message-ID: <3F200C90.5050001@talisys.com> Date: Thu, 24 Jul 2003 09:42:56 -0700 From: William Yu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: hardware performance and some more Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/407 X-Sequence-Number: 2700 | first of all I would like to learn that, any of you use the postgresql | within the clustered environment? Or, let me ask you the question, in | different manner, can we use postgresql in a cluster environment? If | we can do what is the support method of the postgresql for clusters? You could do active-active but it would require work on your end. I did a recent check on all the Postgres replication packages and they all seem to be single master -> single/many slaves. Updating on more than 1 server looks to be problematic. I run an active-active now but I had to develop my own custom replication strategy. As a background, we develop & host web-based apps that use Postgres as the DB engine. Since our clients access our server over the internet, uptime is a big issue. Hence, we have two server farms: one colocated in San Francisco and the other in Sterling, VA. In addition to redudancy, we also wanted to spread the load across the servers. To do this, we went with the expedient method of 1-minute DNS zonemaps where if both servers are up, 70% traffic is sent to the faster farm and 30% to the other. Both servers are constantly monitored and if one goes down, a new zonemap is pushed out listing only the servers that are up. The first step in making this work was converting all integer keys to character keys. By making keys into characters, we could prepend a server location code so ID 100 generated at SF would not conflict with ID 100 generated in Sterling. Instead, they would be marked as S00000100 and V00000100. Another benefit is the increase of possible key combinations by being able to use alpha characters. (36^(n-1) versus 10^n) At this time, the method we use is a periodic sweep of all updated records. In every table, we add extra fields to mark the date/time the record was last inserted/updated/deleted. All records touched as of the last resync are extracted, zipped up, pgp-encrypted and then posted on an ftp server. Files are then transfered between servers, records unpacked and inserted/updated. Some checks are needed to determine what takes precedence if users updated the same record on both servers but otherwise it's a straightforward process. As far as I can tell, the performance impact seems to be minimal. There's a periodic storm of replication updates in cases where there's mass updates sync last resync. But if you have mostly reads and few writes, you shouldn't see this situation. The biggest performance impact seems to be the CPU power needed to zip/unzip/encrypt/decrypt files. I'm thinking over strats to get more "real-time" replication working. I suppose I could just make the resync program run more often but that's a bit inelegant. Perhaps I could capture every update/delete/insert/alter statement from the postgres logs, parsing them out to commands and then zipping/encrypting every command as a separate item to be processed. Or add triggers to every table where updated records are pushed to a custom "updated log". The biggest problem is of course locks -- especially at the application level. I'm still thinking over what to do here. From pgsql-performance-owner@postgresql.org Thu Jul 24 12:22:02 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5A42DD1C944 for ; Thu, 24 Jul 2003 15:11:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 48569-02 for ; Thu, 24 Jul 2003 12:10:53 -0300 (ADT) Received: from sandal.saglik.gov.tr (unknown [212.175.175.10]) by svr1.postgresql.org (Postfix) with ESMTP id AD10BD1C941 for ; Thu, 24 Jul 2003 12:11:36 -0300 (ADT) Received: from 212.174.57.164 (sandal.saglik.gov.tr [212.175.175.10]) by sandal.saglik.gov.tr (8.11.6/8.11.6) with SMTP id h6OFPci26987; Thu, 24 Jul 2003 18:25:38 +0300 Message-ID: X-Mailer: BasiliX 1.1.0 -- http://basilix.org X-SenderIP: 212.174.57.164 Date: Thu, 24 Jul 2003 18:25:38 EEST From: Kasim Oztoprak Reply-To: "Kasim Oztoprak" Subject: Re: hardware performance and some more To: shridhar_daithankar@persistent.co.in To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/404 X-Sequence-Number: 2697 On 24 Jul 2003 17:08 EEST you wrote: > On 24 Jul 2003 at 15:54, Kasim Oztoprak wrote: > > > The questions for this explanation are: > > 1 - Can we use postgresql within clustered environment? > > 2 - if the answer is yes, in which method can we use postgresql within a cluster? > > active - passive or active - active? > > Coupled with linux-HA( See http://linux-ha.org) heartbeat service, it *should* > be possible to run postgresql in active-passive clustering. > > If postgresql supported read-only database so that several nodes could read off > a single disk but only one could update that, a sort of active-active should be > possible as well. But postgresql can not have a read only database. That would > be a handy addition in such cases.. > so in the master and slave configuration we can use the system within clustering environment. > > Now, the second question is related to the performance of the database. Assuming we have a > > dell's poweredge 6650 with 4 x 2.8 Ghz Xeon processors having 2 MB of cache for each, with the > > main memory of lets say 32 GB. We can either use a small SAN from EMC or we can put all disks > > into the machines with the required raid confiuration. > > > > We will install RedHat Advanced Server 2.1 to the machine as the operating system and postgresql as > > the database server. We have a database having 25 millions records having the length of 250 bytes > > on average for each record. And there are 1000 operators accessing the database concurrently. The main > > operation on the database (about 95%) is select rather than insert, so do you have any idea about > > the performance of the system? > > Assumig 325 bytes per tuple(250 bytes field 24-28 byte header varchar fields) > gives 25 tuples per 8K page, there would be 8GB of data. This configuration > could fly with 12-16GB of RAM. After all data is read that is. You can cut down > on other requirements as well. May be a 2x opteron with 16GB RAMmight be a > better fit but check out how much CPU cache it has. we do not have memory problem or disk problems. as I have seen in the list the best way to use disks are using raid 10 for data and raid 1 for os. we can put as much memory as we require. now the question, if we have 100 searches per second and in each search if we need 30 sql instruction, what will be the performance of the system in the order of time. Let us say we have two machines described aove in a cluster. > > A grep -rwn across data directory would fill the disk cache pretty well..:-) > > HTH > > Bye > Shridhar > > -- > Egotism, n: Doing the New York Times crossword puzzle with a pen.Egotist, n: A > person of low taste, more interested in himself than me. -- Ambrose Bierce, > "The Devil's Dictionary" > > > ---------------------------(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 Thu Jul 24 15:36:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 94D85D1C4DC for ; Thu, 24 Jul 2003 18:30:00 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 63013-02 for ; Thu, 24 Jul 2003 15:29:15 -0300 (ADT) Received: from sabre.velocet.net (sabre.velocet.net [216.138.209.205]) by svr1.postgresql.org (Postfix) with ESMTP id 73B54D1C4B7 for ; Thu, 24 Jul 2003 15:29:58 -0300 (ADT) Received: from stark.dyndns.tv (H162.C233.tor.velocet.net [216.138.233.162]) by sabre.velocet.net (Postfix) with ESMTP id 83A6A139CC0; Thu, 24 Jul 2003 14:29:34 -0400 (EDT) Received: from localhost ([127.0.0.1] helo=stark.dyndns.tv ident=foobar) by stark.dyndns.tv with smtp (Exim 3.36 #1 (Debian)) id 19fkqM-00070S-00; Thu, 24 Jul 2003 14:29:34 -0400 To: "scott.marlowe" Cc: "Jim C. Nasby" , Alexander Priem , Vincent van Leeuwen , Subject: Re: Tuning PostgreSQL References: In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 24 Jul 2003 14:29:33 -0400 Message-ID: <873cgvpylu.fsf@stark.dyndns.tv> Lines: 33 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-Archive-Number: 200307/408 X-Sequence-Number: 2701 "scott.marlowe" writes: > If you are writing 4k out to a RAID5 of 10 disks, this is what happens: > > (assumiung 64k stipes...) > READ data stripe (64k read) > READ parity stripe (64k read) > make changes to data stripe > XOR new data stripe with old parity stripe to get a new parity stripe > write new parity stripe (64k) > write new data stripe (64k) > > So it's not as bad as you might think. The main negative for RAID5 is that it had to do that extra READ. If you're doing lots of tiny updates then the extra latency to have to go read the parity block before it can write the parity block out is a real killer. For that reason people prefer 0+1 for OLTP systems. But you have to actually test your setup in practice to see if it hurts. A big data warehousing system will be faster under RAID5 than under RAID1+0 because of the extra disks in the stripeset. The more disks in the stripeset the more bandwidth you get. Even for OLTP systems I've had success with RAID5 or not depending largely on the quality of the implementation. The Hitachi systems were amazing. They had enough battery backed cache that the extra latency for the parity read/write cycle really never showed up at all. But it had a lot more than 128M. I think it had 1G and could be expanded. -- greg From pgsql-performance-owner@postgresql.org Thu Jul 24 12:51:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id ADCFCD1C4EB for ; Thu, 24 Jul 2003 15:51:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50507-05 for ; Thu, 24 Jul 2003 12:51:08 -0300 (ADT) Received: from sandal.saglik.gov.tr (unknown [212.175.175.10]) by svr1.postgresql.org (Postfix) with ESMTP id 63101D1C4BC for ; Thu, 24 Jul 2003 12:51:51 -0300 (ADT) Received: from 212.174.57.164 (sandal.saglik.gov.tr [212.175.175.10]) by sandal.saglik.gov.tr (8.11.6/8.11.6) with SMTP id h6OG61i27712; Thu, 24 Jul 2003 19:06:02 +0300 Message-ID: X-Mailer: BasiliX 1.1.0 -- http://basilix.org X-SenderIP: 212.174.57.164 Date: Thu, 24 Jul 2003 19:06:01 EEST From: Kasim Oztoprak Reply-To: "Kasim Oztoprak" Subject: Re: hardware performance and some more To: "Roman Fail" To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/406 X-Sequence-Number: 2699 On 24 Jul 2003 18:44 EEST you wrote: > > Now, the second question is related to the performance of the database. Assuming we have a > > dell's poweredge 6650 with 4 x 2.8 Ghz Xeon processors having 2 MB of cache for each, with the > > main memory of lets say 32 GB. We can either use a small SAN from EMC or we can put all disks > > into the machines with the required raid confiuration. > > > > We will install RedHat Advanced Server 2.1 to the machine as the operating system and postgresql as > > the database server. We have a database having 25 millions records having the length of 250 bytes > > on average for each record. And there are 1000 operators accessing the database concurrently. The main > > operation on the database (about 95%) is select rather than insert, so do you have any idea about > > the performance of the system? > > I have a very similar installation: Dell PE6600 with dual 2.0 Xeons/2MB cache, 4 GB memory, 6-disk RAID-10 for data, 2-disk RAID-1 for RH Linux 8. My database has over 60 million records averaging 200 bytes per tuple. I have a large nightly data load, then very complex multi-table join queries all day with a few INSERT transactions. While I do not have 1000 concurrent users (more like 30 for me), my processors and disks seem to be idle the vast majority of the time - this machine is overkill. So I think you will have no problem with your hardware, and could probably easily get away with only two processors. Someday, if you can determine with certainty that the CPU is a bottleneck, drop in the 3rd and 4th processors (and $10,000). And save yourself money on the RAM as well - it's incredibly easy to put in more if you need it. If you really want to spend money, set up the fastest disk arrays you can imagine. > i have some time for the production, therefore, i can wait for the beta and production of version 7.4. as i have seeen from your comments, you have 30 clients reaching to the database. assuming the maximum number of search for each client is 5 then, search per second will be atmost 3. in my case, there will be around 100 search per second. so the main bothleneck comes from there. and finally, the rate for the insert operation is about %0.1 (1 in every thousand). I've started to learn about my limitations a few days ago, i would like to learn whether i can solve my problem with postgresql or not. > I cannot emphasize enough: allocate a big chunk of time for tuning your database and learning from this list. I migrated from Microsoft SQL Server. Out of the box PostgreSQL was horrible for me, and even after significant tuning it crawled on certain queries (compared to MSSQL). The list helped me find a data type mismatch in a JOIN clause, and since then the performance of PostgreSQL has blown the doors off of MSSQL. Since I only gave myself a couple days to do tuning before the db had to go in production, I almost had to abandon PostgreSQL and revert to MS. My problems were solved in the nick of time, but I really wish I had made more time for tuning. > > Running strong in production for 7 months now with PostgreSQL 7.3, and eagerly awaiting 7.4! > > Roman Fail > POS Portal, Inc. > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Thu Jul 24 17:09:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F1551D1C513 for ; Thu, 24 Jul 2003 20:09:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67762-09 for ; Thu, 24 Jul 2003 17:08:36 -0300 (ADT) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by svr1.postgresql.org (Postfix) with ESMTP id D3EC5D1C50D for ; Thu, 24 Jul 2003 17:09:18 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030724200921.PWXO13930.lakemtao04.cox.net@[192.168.1.1]> for ; Thu, 24 Jul 2003 16:09:21 -0400 Subject: Re: hardware performance and some more From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1059077354.23571.66.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 24 Jul 2003 15:09:14 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/409 X-Sequence-Number: 2702 On Thu, 2003-07-24 at 13:25, Kasim Oztoprak wrote: > On 24 Jul 2003 17:08 EEST you wrote: > > > On 24 Jul 2003 at 15:54, Kasim Oztoprak wrote: [snip] > > we do not have memory problem or disk problems. as I have seen in the list the best way to > use disks are using raid 10 for data and raid 1 for os. we can put as much memory as > we require. > > now the question, if we have 100 searches per second and in each search if we need 30 sql > instruction, what will be the performance of the system in the order of time. Let us say > we have two machines described aove in a cluster. That's 3000 sql statements per second, 180 thousand per minute!!!! What the heck is this database doing!!!!! A quad-CPU Opteron sure is looking useful right about now... Or an quad-CPU AlphaServer ES45 running Linux, if 4x Opterons aren't available. How complicated are each of these SELECT statements? -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 24 17:17:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 06798D1C7EB for ; Thu, 24 Jul 2003 20:13:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 71116-03 for ; Thu, 24 Jul 2003 17:13:04 -0300 (ADT) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by svr1.postgresql.org (Postfix) with ESMTP id AEE00D1C4E1 for ; Thu, 24 Jul 2003 17:13:46 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030724201347.SHFN23518.lakemtao03.cox.net@[192.168.1.1]> for ; Thu, 24 Jul 2003 16:13:47 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <873cgvpylu.fsf@stark.dyndns.tv> References: <873cgvpylu.fsf@stark.dyndns.tv> Content-Type: text/plain Message-Id: <1059077626.23571.71.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 24 Jul 2003 15:13:47 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/410 X-Sequence-Number: 2703 On Thu, 2003-07-24 at 13:29, Greg Stark wrote: > "scott.marlowe" writes: > > > If you are writing 4k out to a RAID5 of 10 disks, this is what happens: > > > > (assumiung 64k stipes...) > > READ data stripe (64k read) > > READ parity stripe (64k read) > > make changes to data stripe > > XOR new data stripe with old parity stripe to get a new parity stripe > > write new parity stripe (64k) > > write new data stripe (64k) > > > > So it's not as bad as you might think. > > The main negative for RAID5 is that it had to do that extra READ. If you're > doing lots of tiny updates then the extra latency to have to go read the > parity block before it can write the parity block out is a real killer. For > that reason people prefer 0+1 for OLTP systems. > > But you have to actually test your setup in practice to see if it hurts. A big > data warehousing system will be faster under RAID5 than under RAID1+0 because > of the extra disks in the stripeset. The more disks in the stripeset the more > bandwidth you get. > > Even for OLTP systems I've had success with RAID5 or not depending largely on > the quality of the implementation. The Hitachi systems were amazing. They had > enough battery backed cache that the extra latency for the parity read/write > cycle really never showed up at all. But it had a lot more than 128M. I think > it had 1G and could be expanded. Your last paragraph just stole the objection to the 1st paragraph right out of my mouth, since enough cache will allow it to "batch" all those tiny updates into big updates. But those Hitachi controllers weren't plugged into x86-type boxen, were they? -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Sat Jul 26 05:38:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CBF5DD1C4D0 for ; Sat, 26 Jul 2003 08:38:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 29241-01 for ; Sat, 26 Jul 2003 05:37:15 -0300 (ADT) Received: from kant.catalyst.net.nz (203-96-145-102.adsl.paradise.net.nz [203.96.145.102]) by svr1.postgresql.org (Postfix) with ESMTP id 79ED2D1C4BA for ; Sat, 26 Jul 2003 05:38:00 -0300 (ADT) Received: from 127.0.0.1 (ident=unknown) by kant.catalyst.net.nz with esmtp (masqmail 0.2.20) id 19g04w-6uZ-00; Fri, 25 Jul 2003 22:45:38 +1200 Subject: Re: Tuning PostgreSQL From: Andrew McMillan To: Alexander Priem Cc: PgSQL Performance ML In-Reply-To: <006801c35050$518c49a0$b696a8c0@APR> References: <3F1C00B2.20319.147235A4@localhost> <1058867576.15449.17.camel@haggis> <006801c35050$518c49a0$b696a8c0@APR> Content-Type: text/plain Message-Id: <1059129938.6896.1109.camel@kant.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 25 Jul 2003 22:45:38 +1200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/424 X-Sequence-Number: 2717 On Wed, 2003-07-23 at 00:53, Alexander Priem wrote: > Wow, I never figured how many different RAID configurations one could think > of :) > > After reading lots of material, forums and of course, this mailing-list, I > think I am going for a RAID5 configuration of 6 disks (18Gb, 15.000 rpm > each), one of those six disks will be a 'hot spare'. I will just put the OS, > the WAL and the data one one volume. RAID10 is way to expensive :) The general heuristic is that RAID-5 is not the way to deal with databases. Now surely someone will disagree with me, but as I understand it RAID-5 has a bottleneck on a single disk for the (checksum) information. Bottleneck is not the word you want to hear in the context of "database server". RAID-1 (mirroring) or RAID-10 (sort-of-mirrored-RAID-5) is the best choice. As far as FS performance goes, a year or two ago I remember someone doing an evaluation of FS performance for PostgreSQL and they found that the best performance was... FAT Yep: FAT The reason is that a lot of what the database is doing, especially guaranteeing writes (WAL) and so forth is best handled through a filesystem that does not get in the way. The fundamentals will not have changed. It is for this reason that ext2 is very much likely to be better than ext3. XFS is possibly (maybe, perhaps) OK, because there are optimisations in there for databases, but the best optimisation is to not be there at all. That's why Oracle want direct IO to disk partitions so they can implement their own "filesystem" (i.e. record system... table system...) on a raw partition. Personally I don't plan to reboot my DB server more than once a year (if that (even my_laptop currently has 37 days uptime, not including suspend). On our DB servers I use ext2 (rather than ext3) mounted with noatime, and I bite the 15 minutes to fsck (once a year) rather than screw general performance with journalling database on top of journalling FS. I split pg_xlog onto a separate physical disk, if performance requirements are extreme. Catalyst's last significant project was to write the Domain Name registration system for .nz (using PostgreSQL). Currently we are developing the electoral roll for the same country (2.8 million electors living at 1.4 million addresses). We use Oracle (or Progress, or MySQL) if a client demands them, but we use PostgreSQL if we get to choose. Increasingly we get to choose. Good. 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 Survey for nothing with http://survey.net.nz/ --------------------------------------------------------------------- From pgsql-performance-owner@postgresql.org Fri Jul 25 10:57:25 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AA166D1C4BC for ; Fri, 25 Jul 2003 13:57:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 40384-07 for ; Fri, 25 Jul 2003 10:56:41 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 7AF5BD1C4B7 for ; Fri, 25 Jul 2003 10:57:21 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6PE3fdP002070 for ; Fri, 25 Jul 2003 19:33:41 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6PE3eRZ002057 for ; Fri, 25 Jul 2003 19:33:40 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Fri, 25 Jul 2003 19:29:08 +0530 MIME-Version: 1.0 Subject: Re: hardware performance and some more Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F218504.3163.25E942@localhost> In-reply-to: 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/412 X-Sequence-Number: 2705 On 25 Jul 2003 at 16:38, Kasim Oztoprak wrote: > this is kind of directory assistance application. actually the select statements are not > very complex. the database contain 25 million subscriber records and the operators searches > for the subscriber numbers or addresses. there are not much update operations actually the > update ratio is approximately %0.1 . > > i will use at least 4 machines each having 4 cpu with the speed of 2.8 ghz xeon processors. > and suitable memory capacity with it. Are you going to duplicate the data? If you are going to have 3000 sql statements per second, I would suggest, 1. Get quad CPU. You probably need that horsepower 2. Use prepared statements and stored procedures to avoid parsing overhead. I doubt you would need cluster of machines though. If you run it thr. a pilot program, that would give you an idea whether or not you need a cluster.. Bye Shridhar -- Default, n.: The hardware's, of course. From pgsql-performance-owner@postgresql.org Fri Jul 25 11:01:40 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3CE1ED1C923 for ; Fri, 25 Jul 2003 14:01:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 40406-08 for ; Fri, 25 Jul 2003 11:00:56 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 5972BD1C924 for ; Fri, 25 Jul 2003 11:01:37 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6PE7xkh002864 for ; Fri, 25 Jul 2003 19:37:59 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6PE7wRZ002851; Fri, 25 Jul 2003 19:37:58 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Fri, 25 Jul 2003 19:33:26 +0530 MIME-Version: 1.0 Subject: Re: hardware performance and some more Reply-To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org Message-ID: <3F218606.25557.29D818@localhost> In-reply-to: <3F200C90.5050001@talisys.com> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/413 X-Sequence-Number: 2706 On 24 Jul 2003 at 9:42, William Yu wrote: > As far as I can tell, the performance impact seems to be minimal. > There's a periodic storm of replication updates in cases where there's > mass updates sync last resync. But if you have mostly reads and few > writes, you shouldn't see this situation. The biggest performance impact > seems to be the CPU power needed to zip/unzip/encrypt/decrypt files. Can you use WAL based replication? I don't have a URL handy but there are replication projects which transmit WAL files to another server when they fill in. OTOH, I was thinking of a simple replication theme. If postgresql provides a hook where it calls an external library routine for each heapinsert in WAL, there could be a simple multi-slave replication system. One doesn't have to wait till WAL file fills up. Of course, it's upto the library to make sure that it does not hold postgresql commits for too long that would hamper the performance. Also there would need a receiving hook which would directly heapinsert the data on another node. But if the external library is threaded, will that work well with postgresql? Just a thought. If it works, load-balancing could be lot easy and near- realtime.. Bye Shridhar -- We fight only when there is no other choice. We prefer the ways ofpeaceful contact. -- Kirk, "Spectre of the Gun", stardate 4385.3 From pgsql-performance-owner@postgresql.org Fri Jul 25 11:19:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 857A1D1C925 for ; Fri, 25 Jul 2003 14:19:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 43564-03 for ; Fri, 25 Jul 2003 11:19:10 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 4D8B8D1C924 for ; Fri, 25 Jul 2003 11:19:52 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030725141957.MSW7142.lakemtao01.cox.net@[192.168.1.1]> for ; Fri, 25 Jul 2003 10:19:57 -0400 Subject: Re: hardware performance and some more From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1059142796.26034.106.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 25 Jul 2003 09:19:56 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/414 X-Sequence-Number: 2707 On Fri, 2003-07-25 at 11:38, Kasim Oztoprak wrote: > On 24 Jul 2003 23:25 EEST you wrote: > > > On Thu, 2003-07-24 at 13:25, Kasim Oztoprak wrote: > > > On 24 Jul 2003 17:08 EEST you wrote: > > > > > > > On 24 Jul 2003 at 15:54, Kasim Oztoprak wrote: > > [snip] > > > > > > we do not have memory problem or disk problems. as I have seen in the list the best way to > > > use disks are using raid 10 for data and raid 1 for os. we can put as much memory as > > > we require. > > > > > > now the question, if we have 100 searches per second and in each search if we need 30 sql > > > instruction, what will be the performance of the system in the order of time. Let us say > > > we have two machines described aove in a cluster. > > > > That's 3000 sql statements per second, 180 thousand per minute!!!! > > What the heck is this database doing!!!!! > > > > A quad-CPU Opteron sure is looking useful right about now... Or > > an quad-CPU AlphaServer ES45 running Linux, if 4x Opterons aren't > > available. > > > > How complicated are each of these SELECT statements? > > this is kind of directory assistance application. actually the select statements are not > very complex. the database contain 25 million subscriber records and the operators searches > for the subscriber numbers or addresses. there are not much update operations actually the > update ratio is approximately %0.1 . > > i will use at least 4 machines each having 4 cpu with the speed of 2.8 ghz xeon processors. > and suitable memory capacity with it. > > i hope it will overcome with this problem. any similar implementation? Since PG doesn't have active-active clustering, that's out, but since the database will be very static, why not have, say 8 machines, each with it's own copy of the database? (Since there are so few updates, you feed the updates to a litle Perl app that then makes the changes on each machine.) (A round-robin load balancer would do the trick in utilizing them all.) Also, with lots of machines, you could get away with less expensive machines, say 2GHz CPU, 1GB RAM and a 40GB IDE drive. Then, if one goes down for some reason, you've only lost a small portion of your capacity, and replacing a part will be very inexpensive. And if volume increases, just add more USD1000 machines... -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Fri Jul 25 12:30:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id B4F70D1C922 for ; Fri, 25 Jul 2003 15:30:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50229-02 for ; Fri, 25 Jul 2003 12:29:14 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 09CDDD1C91E for ; Fri, 25 Jul 2003 12:30:00 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6PFaHqp020078 for ; Fri, 25 Jul 2003 21:06:17 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6PFaHRZ020065 for ; Fri, 25 Jul 2003 21:06:17 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Fri, 25 Jul 2003 21:01:44 +0530 MIME-Version: 1.0 Subject: Re: hardware performance and some more Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F219AB8.30544.7AAEEB@localhost> In-reply-to: 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/416 X-Sequence-Number: 2709 On 25 Jul 2003 at 18:41, Kasim Oztoprak wrote: > what exactly do you mean from a pilot program? Like get a quad CPU box, load the data and ask only 10 operators to test the system.. Beta testing basically.. Bye Shridhar -- The man on tops walks a lonely street; the "chain" of command is often a noose. From pgsql-performance-owner@postgresql.org Fri Jul 25 13:14:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F02DBD1C928 for ; Fri, 25 Jul 2003 16:13:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 53211-05 for ; Fri, 25 Jul 2003 13:12:55 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 3A2C9D1C921 for ; Fri, 25 Jul 2003 13:13:41 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3255524; Fri, 25 Jul 2003 09:13:59 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Ron Johnson , PgSQL Performance ML Subject: Re: hardware performance and some more Date: Fri, 25 Jul 2003 09:13:10 -0700 User-Agent: KMail/1.4.3 References: <1059142796.26034.106.camel@haggis> In-Reply-To: <1059142796.26034.106.camel@haggis> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307250913.10103.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/417 X-Sequence-Number: 2710 Folks, > Since PG doesn't have active-active clustering, that's out, but since > the database will be very static, why not have, say 8 machines, each > with it's own copy of the database? (Since there are so few updates, > you feed the updates to a litle Perl app that then makes the changes > on each machine.) (A round-robin load balancer would do the trick > in utilizing them all.) Another approach I've seen work is to have several servers connect to one SAN or NAS where the data lives. Only one server is enabled to handle "write" requests; all the rest are read-only. This does mean having dispacting middleware that parcels out requests among the servers, but works very well for the java-based company that's using it. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 25 10:34:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 985D5D1C923 for ; Fri, 25 Jul 2003 13:24:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 36113-10 for ; Fri, 25 Jul 2003 10:23:27 -0300 (ADT) Received: from sandal.saglik.gov.tr (unknown [212.175.175.10]) by svr1.postgresql.org (Postfix) with ESMTP id 690E0D1C924 for ; Fri, 25 Jul 2003 10:24:07 -0300 (ADT) Received: from 193.255.70.123 (sandal.saglik.gov.tr [212.175.175.10]) by sandal.saglik.gov.tr (8.11.6/8.11.6) with SMTP id h6PDcWi12447; Fri, 25 Jul 2003 16:38:32 +0300 Message-ID: X-Mailer: BasiliX 1.1.0 -- http://basilix.org X-SenderIP: 193.255.70.123 Date: Fri, 25 Jul 2003 16:38:31 EEST From: Kasim Oztoprak Reply-To: "Kasim Oztoprak" Subject: Re: hardware performance and some more To: "Ron Johnson" To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/411 X-Sequence-Number: 2704 On 24 Jul 2003 23:25 EEST you wrote: > On Thu, 2003-07-24 at 13:25, Kasim Oztoprak wrote: > > On 24 Jul 2003 17:08 EEST you wrote: > > > > > On 24 Jul 2003 at 15:54, Kasim Oztoprak wrote: > [snip] > > > > we do not have memory problem or disk problems. as I have seen in the list the best way to > > use disks are using raid 10 for data and raid 1 for os. we can put as much memory as > > we require. > > > > now the question, if we have 100 searches per second and in each search if we need 30 sql > > instruction, what will be the performance of the system in the order of time. Let us say > > we have two machines described aove in a cluster. > > That's 3000 sql statements per second, 180 thousand per minute!!!! > What the heck is this database doing!!!!! > > A quad-CPU Opteron sure is looking useful right about now... Or > an quad-CPU AlphaServer ES45 running Linux, if 4x Opterons aren't > available. > > How complicated are each of these SELECT statements? this is kind of directory assistance application. actually the select statements are not very complex. the database contain 25 million subscriber records and the operators searches for the subscriber numbers or addresses. there are not much update operations actually the update ratio is approximately %0.1 . i will use at least 4 machines each having 4 cpu with the speed of 2.8 ghz xeon processors. and suitable memory capacity with it. i hope it will overcome with this problem. any similar implementation? > > -- > ----------------------------------------------------------------- > | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | > | Jefferson, LA USA | > | | > | "I'm not a vegetarian because I love animals, I'm a vegetarian | > | because I hate vegetables!" | > | unknown | > ----------------------------------------------------------------- > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Fri Jul 25 13:49:22 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D511AD1C921 for ; Fri, 25 Jul 2003 16:49:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 55676-03 for ; Fri, 25 Jul 2003 13:48:33 -0300 (ADT) Received: from lucifer.akyasociados.com.ar (unknown [200.69.203.237]) by svr1.postgresql.org (Postfix) with ESMTP id 9DA88D1C91D for ; Fri, 25 Jul 2003 13:49:18 -0300 (ADT) Received: from taz.oficina (taz.oficina [192.168.1.99]) (authenticated bits=0) by lucifer.akyasociados.com.ar (8.12.9/8.12.9) with ESMTP id h6PGrLso031523 for ; Fri, 25 Jul 2003 13:53:22 -0300 (ART) (envelope-from franco@akyasociados.com.ar) Subject: index questions From: Franco Bruno Borghesi To: pgsql-performance@postgresql.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-t96Net/9du4gesUrepoA" Organization: AK y Asociados S.R.L. Message-Id: <1059151963.1183.14.camel@taz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 25 Jul 2003 13:52:43 -0300 X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/418 X-Sequence-Number: 2711 --=-t96Net/9du4gesUrepoA Content-Type: multipart/alternative; boundary="=-sIlLrYTowgWsSvWGel50" --=-sIlLrYTowgWsSvWGel50 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi everyone. I have created a simplified example of a real case, to show you what I'm tryng to do. I have a table, like this: CREATE TABLE sales ( saleId SERIAL, clientId INTEGER, branchId INTEGER, productId INTEGER, employeeId INTEGER, saleDate DATE, price NUMERIC(12, 2), qty INTEGER, PRIMARY KEY(saleId) ); CREATE INDEX sales_k1 ON sales(clientId, branchId, productId, employeeId, saleDate, price, qty); This table will grow to *many* rows in the future. I want to make a function that returns the FIRS saleId of the sale that matches some conditions. I will always receive the Client Id, but not always the other arguments (sent as NULLs). The fetched resultset shoud prioritize the passed arguments, and after that, the saleDate, price and quantity. /** * Finds the first sale that matches the conditions received. * @param $1 Client Id. * @param $2 Preferred Branch Id. * @param $3 Preferred Product Id. * @param $4 Preferred Employee Id. * @return Sale Id if found, NULL if not. */ CREATE OR REPLACE FUNCTION findSale(INTEGER, INTEGER, INTEGER, INTEGER) RETURNS INTEGER AS ' DECLARE a_clientId ALIAS FOR $1; a_branchId ALIAS FOR $1; a_productId ALIAS FOR $1; a_employeeId ALIAS FOR $1; r_result INTEGER; BEGIN SELECT INTO r_result employeeId FROM sales WHERE clientId=3Da_clientId AND branchId=3Dcoalesce(a_branchId, branchId) AND /*branchId is null? anything will be ok*/ productId=3Dcoalesce(a_productId, productId) AND /*productId is null? anything will be ok*/ employeeId=3Dcoalesce(a_employeeId, employeeId) /*employeeId is null? anything will be ok*/ ORDER BY clientId, branchId, productId, employeeId, saleDate, price, qty LIMIT 1; RETURN r_result; END; ' LANGUAGE 'plpgsql'; Will findSale() in the future, when I have *many* rows still use the index when only the first couple of arguments are passed to the function? If not, should I create more indexes (and functions) for each possible argument combination? (of course, with the given order) The thing here is that I don't understand how postgreSQL solves the query when the COALESCEs are used... it uses the index now, with a few thowsand records, but what will happen in a few months? Thanks in advance. --=-sIlLrYTowgWsSvWGel50 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi everyone.

I have created a simplified example of a real case, to show you what I'm tr= yng to do. I have
a table, like this:

CREATE TABLE sales (
   saleId SERIAL,
   clientId INTEGER,
   branchId INTEGER,
   productId INTEGER,
   employeeId INTEGER,
   saleDate DATE,
   price NUMERIC(12, 2),
   qty INTEGER,
   PRIMARY KEY(saleId)
);
CREATE INDEX sales_k1 ON sales(clientId, branchId, productId, employeeId, s= aleDate, price, qty);

This table will grow to *many* rows in the future.

I want to make a function that returns the FIRS saleId of the sale that mat= ches some conditions. I will
always receive the Client Id, but not always the other arguments (sent as N= ULLs).

The fetched resultset shoud prioritize the passed arguments, and after that= , the saleDate, price
and quantity.


/**
* Finds the first sale that matches the conditions received.
* @param $1 Client Id.
* @param $2 Preferred Branch Id.
* @param $3 Preferred Product Id.
* @param $4 Preferred Employee Id.
* @return Sale Id if found, NULL if not.
*/
CREATE OR REPLACE FUNCTION findSale(INTEGER, INTEGER, INTEGER, INTEGER) RET= URNS INTEGER AS '
DECLARE
   a_clientId ALIAS FOR $1;
   a_branchId ALIAS FOR $1;
   a_productId ALIAS FOR $1;
   a_employeeId ALIAS FOR $1;
   r_result INTEGER;
BEGIN
   SELECT
      INTO r_result employeeId
   FROM
      sales
   WHERE
      clientId=3Da_clientId AND
      branchId=3Dcoalesce(a_branchId, branchId) AN= D /*branchId is null? anything will be ok*/
      productId=3Dcoalesce(a_productId, productId)= AND /*productId is null? anything will be ok*/
      employeeId=3Dcoalesce(a_employeeId, employee= Id) /*employeeId is null? anything will be ok*/
   ORDER BY
      clientId, branchId, productId, employeeId, s= aleDate, price, qty
   LIMIT 1;

   RETURN r_result;
END;
' LANGUAGE 'plpgsql';


Will findSale() in the future, when I have *many* rows still use the index = when only the first couple of
arguments are passed to the function?
If not, should I create more indexes (and functions) for each possible argu= ment combination? (of course, with
the given order)

The thing here is that I don't understand how postgreSQL solves the query w= hen the COALESCEs are used... it uses
the index now, with a few thowsand records, but what will happen in a few m= onths?

Thanks in advance. --=-sIlLrYTowgWsSvWGel50-- --=-t96Net/9du4gesUrepoA Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/IWBb21dVnhLsBV0RAp5uAJ493JzXwtvu4eO1zKBFW9ZAtMMBEwCghIxZ lis+TGLkVIi1XMhTXEq0pBY= =ADDY -----END PGP SIGNATURE----- --=-t96Net/9du4gesUrepoA-- From pgsql-performance-owner@postgresql.org Fri Jul 25 14:13:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8C671D1C91D for ; Fri, 25 Jul 2003 17:13:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 53905-08 for ; Fri, 25 Jul 2003 14:12:10 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 9B989D1C928 for ; Fri, 25 Jul 2003 14:12:56 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030725171257.CAUK7142.lakemtao01.cox.net@[192.168.1.1]>; Fri, 25 Jul 2003 13:12:57 -0400 Subject: Re: hardware performance and some more From: Ron Johnson To: Josh Berkus Cc: PgSQL Performance ML In-Reply-To: <200307250913.10103.josh@agliodbs.com> References: <1059142796.26034.106.camel@haggis> <200307250913.10103.josh@agliodbs.com> Content-Type: text/plain Message-Id: <1059153176.26037.130.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 25 Jul 2003 12:12:56 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/419 X-Sequence-Number: 2712 On Fri, 2003-07-25 at 11:13, Josh Berkus wrote: > Folks, > > > Since PG doesn't have active-active clustering, that's out, but since > > the database will be very static, why not have, say 8 machines, each > > with it's own copy of the database? (Since there are so few updates, > > you feed the updates to a litle Perl app that then makes the changes > > on each machine.) (A round-robin load balancer would do the trick > > in utilizing them all.) > > Another approach I've seen work is to have several servers connect to one SAN > or NAS where the data lives. Only one server is enabled to handle "write" > requests; all the rest are read-only. This does mean having dispacting > middleware that parcels out requests among the servers, but works very well > for the java-based company that's using it. Wouldn't the cache on the read-only databases get out of sync with the true on-disk data? -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Fri Jul 25 14:21:29 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8201AD1C921 for ; Fri, 25 Jul 2003 17:21:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 54025-08 for ; Fri, 25 Jul 2003 14:20:39 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 7ECC9D1C91D for ; Fri, 25 Jul 2003 14:21:25 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030725172126.CCTK7142.lakemtao01.cox.net@[192.168.1.1]> for ; Fri, 25 Jul 2003 13:21:26 -0400 Subject: Re: index questions From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <1059151963.1183.14.camel@taz> References: <1059151963.1183.14.camel@taz> Content-Type: text/plain Message-Id: <1059153685.26037.135.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 25 Jul 2003 12:21:25 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/420 X-Sequence-Number: 2713 On Fri, 2003-07-25 at 11:52, Franco Bruno Borghesi wrote: [snip] > > > Will findSale() in the future, when I have *many* rows still use the > index when only the first couple of > arguments are passed to the function? > If not, should I create more indexes (and functions) for each possible > argument combination? (of course, with > the given order) > > The thing here is that I don't understand how postgreSQL solves the > query when the COALESCEs are used... it uses > the index now, with a few thowsand records, but what will happen in a > few months? When faced with cases like this, I cobble together a script/program that generates a few million rows of random data (within the confines of FKs, of course) to populate these tables like "sales", and then I see how things perform. -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Fri Jul 25 14:29:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1B9E7D1C91D for ; Fri, 25 Jul 2003 17:29:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 54729-08 for ; Fri, 25 Jul 2003 14:28:48 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id 069BBD1C92A for ; Fri, 25 Jul 2003 14:29:34 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3255824; Fri, 25 Jul 2003 10:29:46 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Franco Bruno Borghesi , pgsql-performance@postgresql.org Subject: Re: index questions Date: Fri, 25 Jul 2003 10:28:27 -0700 User-Agent: KMail/1.4.3 References: <1059151963.1183.14.camel@taz> In-Reply-To: <1059151963.1183.14.camel@taz> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307251028.27261.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/421 X-Sequence-Number: 2714 Franco, > CREATE INDEX sales_k1 ON sales(clientId, branchId, productId, > employeeId, saleDate, price, qty); A 7-column index is unlikely to be effective -- the index will be almost as= =20 large as the table. Try indexing only the first 3-4 columns instead.=20= =20 > I want to make a function that returns the FIRS saleId of the sale that > matches some conditions. I will > always receive the Client Id, but not always the other arguments (sent > as NULLs). Well, keep in mind that your multi-column index will only be useful if all= =20 columns are queried starting from the left. That is, the index will be=20 ignored if you have a "where productId =3D x" without a "where branchid =3D= y". > CREATE OR REPLACE FUNCTION findSale(INTEGER, INTEGER, INTEGER, INTEGER) > RETURNS INTEGER AS ' > DECLARE > a_clientId ALIAS FOR $1; > a_branchId ALIAS FOR $1; > a_productId ALIAS FOR $1; > a_employeeId ALIAS FOR $1; Your aliases are wrong here. > branchId=3Dcoalesce(a_branchId, branchId) AND /*branchId is null? > anything will be ok*/ > productId=3Dcoalesce(a_productId, productId) AND /*productId is > null? anything will be ok*/ On a very large table this will be very inefficient. you'll be comparing = the=20 productid, for example, even if no productid is passed ... and the index=20 won't do you any good because the planner should figure out that 100% of ro= ws=20 match the condition.=20=20 Instead, I recommend that you build up a dynamic query as a string and then= =20 pass only the conditions sent by the user. You can then EXECUTE the query= =20 and loop through it for a result. Of course, YMMV. My approach will require you to create more indexes whic= h=20 could be a problem if you have limited disk space. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jul 25 15:30:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3C2FCD1C4BB for ; Fri, 25 Jul 2003 18:30:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 64033-01 for ; Fri, 25 Jul 2003 15:29:54 -0300 (ADT) Received: from lucifer.akyasociados.com.ar (unknown [200.69.203.237]) by svr1.postgresql.org (Postfix) with ESMTP id 94CC4D1C4E1 for ; Fri, 25 Jul 2003 15:30:39 -0300 (ADT) Received: from taz.oficina (taz.oficina [192.168.1.99]) (authenticated bits=0) by lucifer.akyasociados.com.ar (8.12.9/8.12.9) with ESMTP id h6PIYVso033750; Fri, 25 Jul 2003 15:34:32 -0300 (ART) (envelope-from franco@akyasociados.com.ar) Subject: Re: index questions From: Franco Bruno Borghesi To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org In-Reply-To: <200307251028.27261.josh@agliodbs.com> References: <1059151963.1183.14.camel@taz> <200307251028.27261.josh@agliodbs.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-Cs5rownaEIGVqUgz1wmU" Organization: AK y Asociados S.R.L. Message-Id: <1059158034.1183.43.camel@taz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 25 Jul 2003 15:33:54 -0300 X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/422 X-Sequence-Number: 2715 --=-Cs5rownaEIGVqUgz1wmU Content-Type: multipart/alternative; boundary="=-VDkwkZh9iPNnZ25QZjzB" --=-VDkwkZh9iPNnZ25QZjzB Content-Type: text/plain Content-Transfer-Encoding: quoted-printable what you say is that the index is not effective because of its size, but it would still be used *if* the conditions are right... In this case, I care about performance, not space.=20 But what you say about the index not being good because 100% of rows match the condition confirms what I suspected.=20 Thanks for your help. On Fri, 2003-07-25 at 14:28, Josh Berkus wrote: > Franco, >=20 > > CREATE INDEX sales_k1 ON sales(clientId, branchId, productId, > > employeeId, saleDate, price, qty); >=20 > A 7-column index is unlikely to be effective -- the index will be almost = as=20 > large as the table. Try indexing only the first 3-4 columns instead.=20= =20 >=20 > > I want to make a function that returns the FIRS saleId of the sale that > > matches some conditions. I will > > always receive the Client Id, but not always the other arguments (sent > > as NULLs). >=20 > Well, keep in mind that your multi-column index will only be useful if al= l=20 > columns are queried starting from the left. That is, the index will be= =20 > ignored if you have a "where productId =3D x" without a "where branchid = =3D y". >=20 > > CREATE OR REPLACE FUNCTION findSale(INTEGER, INTEGER, INTEGER, INTEGER) > > RETURNS INTEGER AS ' > > DECLARE > > a_clientId ALIAS FOR $1; > > a_branchId ALIAS FOR $1; > > a_productId ALIAS FOR $1; > > a_employeeId ALIAS FOR $1; >=20 > Your aliases are wrong here. >=20 > > branchId=3Dcoalesce(a_branchId, branchId) AND /*branchId is null? > > anything will be ok*/ > > productId=3Dcoalesce(a_productId, productId) AND /*productId is > > null? anything will be ok*/ >=20 > On a very large table this will be very inefficient. you'll be comparin= g the=20 > productid, for example, even if no productid is passed ... and the index= =20 > won't do you any good because the planner should figure out that 100% of = rows=20 > match the condition.=20=20 >=20 > Instead, I recommend that you build up a dynamic query as a string and th= en=20 > pass only the conditions sent by the user. You can then EXECUTE the quer= y=20 > and loop through it for a result. >=20 > Of course, YMMV. My approach will require you to create more indexes wh= ich=20 > could be a problem if you have limited disk space. --=-VDkwkZh9iPNnZ25QZjzB Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable what you say is that the index is not effective because of its size, but it= would still be used *if* the conditions are right... In this case, I care = about performance, not space.

But what you say about the index not being good because 100% of rows match = the condition confirms what I suspected.

Thanks for your help.


On Fri, 2003-07-25 at 14:28, Josh Berkus wrote:
Franco,

> CREATE INDEX sales_k1 ON sales(clientId, branchId, productId,
> employeeId, saleDate, price, qty);

A 7-column index is unlikely to be effective -- the index will be almost as=
=20
large as the table.   Try indexing only the first 3-4 columns instead.=20=
=20

> I want to make a function that returns the FIRS saleId of the sale that
> matches some conditions. I will
> always receive the Client Id, but not always the other arguments (sent
> as NULLs).

Well, keep in mind that your multi-column index will only be useful if all=
=20
columns are queried starting from the left.  That is, the index will be=20
ignored if you have a "where productId =3D x" without a "whe=
re branchid =3D y".

> CREATE OR REPLACE FUNCTION findSale(INTEGER, INTEGER, INTEGER, INTEGER)
> RETURNS INTEGER AS '
> DECLARE
>    a_clientId ALIAS FOR $1;
>    a_branchId ALIAS FOR $1;
>    a_productId ALIAS FOR $1;
>    a_employeeId ALIAS FOR $1;

Your aliases are wrong here.

>       branchId=3Dcoalesce(a_branchId, branchId) AND /*branchId is null?
> anything will be ok*/
>       productId=3Dcoalesce(a_productId, productId) AND /*productId is
> null? anything will be ok*/

On a very large table this will be very inefficient.   you'll be comparing =
the=20
productid, for example, even if no productid is passed ... and the index=20
won't do you any good because the planner should figure out that 100% of ro=
ws=20
match the condition.=20=20

Instead, I recommend that you build up a dynamic query as a string and then=
=20
pass only the conditions sent by the user.  You can then EXECUTE the query=
=20
and loop through it for a result.

Of course, YMMV.   My approach will require you to create more indexes whic=
h=20
could be a problem if you have limited disk space.
--=-VDkwkZh9iPNnZ25QZjzB-- --=-Cs5rownaEIGVqUgz1wmU Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/IXgR21dVnhLsBV0RAh9iAJ9f6869W0UsR4gRjo7MERpdqOqCigCeIeMk ZnnnUO88Ea8jw30pA704Vk0= =mOkO -----END PGP SIGNATURE----- --=-Cs5rownaEIGVqUgz1wmU-- From pgsql-performance-owner@postgresql.org Fri Jul 25 12:27:52 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 11AEED1C927 for ; Fri, 25 Jul 2003 15:27:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 49574-03 for ; Fri, 25 Jul 2003 12:27:03 -0300 (ADT) Received: from sandal.saglik.gov.tr (unknown [212.175.175.10]) by svr1.postgresql.org (Postfix) with ESMTP id 62D2DD1C922 for ; Fri, 25 Jul 2003 12:27:49 -0300 (ADT) Received: from 212.174.57.164 (sandal.saglik.gov.tr [212.175.175.10]) by sandal.saglik.gov.tr (8.11.6/8.11.6) with SMTP id h6PFfti15125; Fri, 25 Jul 2003 18:42:00 +0300 Message-ID: X-Mailer: BasiliX 1.1.0 -- http://basilix.org X-SenderIP: 212.174.57.164 Date: Fri, 25 Jul 2003 18:41:55 EEST From: Kasim Oztoprak Reply-To: "Kasim Oztoprak" Subject: Re: hardware performance and some more To: shridhar_daithankar@persistent.co.in To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/415 X-Sequence-Number: 2708 On 25 Jul 2003 17:13 EEST you wrote: > On 25 Jul 2003 at 16:38, Kasim Oztoprak wrote: > > this is kind of directory assistance application. actually the select statements are not > > very complex. the database contain 25 million subscriber records and the operators searches > > for the subscriber numbers or addresses. there are not much update operations actually the > > update ratio is approximately %0.1 . > > > > i will use at least 4 machines each having 4 cpu with the speed of 2.8 ghz xeon processors. > > and suitable memory capacity with it. > > Are you going to duplicate the data? > > If you are going to have 3000 sql statements per second, I would suggest, > > 1. Get quad CPU. You probably need that horsepower > 2. Use prepared statements and stored procedures to avoid parsing overhead. > > I doubt you would need cluster of machines though. If you run it thr. a pilot > program, that would give you an idea whether or not you need a cluster.. > > Bye > Shridhar > i will try to cluster them. i can duplicate the data if i need. in the case of update, then, i will fix them through. what exactly do you mean from a pilot program? -kas�m > -- > Default, n.: The hardware's, of course. > > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Fri Jul 25 21:45:05 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7BF4AD1C4C1 for ; Sat, 26 Jul 2003 00:45:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 87424-06 for ; Fri, 25 Jul 2003 21:44:16 -0300 (ADT) Received: from smtp.noos.fr (nan-smtp-12.noos.net [212.198.2.83]) by svr1.postgresql.org (Postfix) with ESMTP id 389C2D1C4CD for ; Fri, 25 Jul 2003 21:45:00 -0300 (ADT) Received: (qmail 35062626 invoked by uid 0); 26 Jul 2003 00:45:02 -0000 Received: from unknown (HELO gmendola) ([212.198.37.110]) (envelope-sender ) by 212.198.2.83 (qmail-ldap-1.03) with SMTP for ; 26 Jul 2003 00:45:02 -0000 Message-ID: <012401c3530f$096eb150$10d4a8c0@mm.eutelsat.org> From: "Mendola Gaetano" To: Subject: Wrong rows number expected Date: Sat, 26 Jul 2003 02:44:13 +0200 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.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/423 X-Sequence-Number: 2716 Hi all, last week Josh Berkus point my attenction ( see post Wrong plan or what ) to the fact that in this select: select * from user_logs ul, user_data ud, class_default cd where ul.id_user = ud.id_user and ud.id_class = cd.id_class and cd.id_provider = 39; The planner say: QUERY PLAN Hash Join (cost=265.64..32000.76 rows=40612 width=263) (actual time=11074.21..11134.28 rows=10 loops=1) Hash Cond: ("outer".id_user = "inner".id_user) -> Seq Scan on user_logs ul (cost=0.00..24932.65 rows=1258965 width=48) (actual time=0.02..8530.21 rows=1258966 loops=1) -> Hash (cost=264.81..264.81 rows=331 width=215) (actual time=30.22..30.22 rows=0 loops=1) -> Nested Loop (cost=0.00..264.81 rows=331 width=215) (actual time=29.95..30.20 rows=6 loops=1) -> Seq Scan on class_default cd (cost=0.00..1.39 rows=1 width=55) (actual time=0.08..0.10 rows=1 loops=1) Filter: (id_provider = 39) -> Index Scan using idx_user_data_class on user_data ud (cost=0.00..258.49 rows=395 width=160) (actual time=29.82..29.96 rows=6 loops=1) Index Cond: (ud.id_class = "outer".id_class) Total runtime: 11135.65 msec (10 rows) and the quantity reported in: Hash Join (cost=265.64..32000.76 rows=40612 width=263) (actual time=11074.21..11134.28 rows=10 loops=1) is wrong about the rows returned, I did what Josh Berkus suggeted me: 1) Make sure you've VACUUM ANALYZED 2) Adjust the following postgresql.conf statistics: a) effective_cache_size: increase to 70% of available (not used by other processes) RAM. b) random_page_cost: decrease, maybe to 2. c) default_statistics_target: try increasing to 100 (warning: this will significantly increase the time required to do ANALYZE) I pushed also default_statistics_target to 1000 but the plan remain the same with an execution of 11 secs but If I do the followin 3 equivalent query I obatin the same result in olny fews ms: SELECT id_class from class_default where id_provider = 39; id_class ---------- 48 (1 row) SELECT id_user from user_data where id_class in ( 48 ); id_user --------- 10943 10942 10934 10927 10910 10909 (6 rows) SELECT * from user_logs where id_user in ( 10943, 10942, 10934, 10927, 10910, 10909 ); May I do something else ? Thank you in advance Gaetano Mendola From pgsql-performance-owner@postgresql.org Sat Jul 26 06:52:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E7451D1C913 for ; Sat, 26 Jul 2003 09:52:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 31474-03 for ; Sat, 26 Jul 2003 06:51:58 -0300 (ADT) Received: from mail.aznetmail.com (unknown [212.47.140.5]) by svr1.postgresql.org (Postfix) with SMTP id 40674D1C910 for ; Sat, 26 Jul 2003 06:52:42 -0300 (ADT) Received: (qmail 39929 invoked from network); 26 Jul 2003 09:50:32 -0000 Received: from unknown (HELO kuliyev.com) (212.47.128.13) by main.aznetcard.com with SMTP; 26 Jul 2003 09:50:32 -0000 Message-ID: <3F224F65.1050601@kuliyev.com> Date: Sat, 26 Jul 2003 14:52:37 +0500 From: Rauf Kuliyev User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030513 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: SUBSCRIBE Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/425 X-Sequence-Number: 2718 SUBSCRIBE From pgsql-performance-owner@postgresql.org Sat Jul 26 07:18:36 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 90681D1C90E for ; Sat, 26 Jul 2003 10:18:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 31468-05 for ; Sat, 26 Jul 2003 07:17:45 -0300 (ADT) Received: from mailhost2.tudelft.nl (mailhost2.tudelft.nl [130.161.180.2]) by svr1.postgresql.org (Postfix) with ESMTP id 67FE6D1C4DC for ; Sat, 26 Jul 2003 07:18:31 -0300 (ADT) Received: from 127.0.0.1 (localhost [127.0.0.1]) by rav.antivirus (Postfix) with SMTP id 084501067; Sat, 26 Jul 2003 12:18:32 +0200 (MEST) Received: from listserv.tudelft.nl (listserv.tudelft.nl [130.161.180.33]) by mailhost2.tudelft.nl (Postfix) with ESMTP id E4EBE1027; Sat, 26 Jul 2003 12:18:31 +0200 (MEST) Received: from acm (x193056-2.shuis-s.tudelft.nl [145.94.193.58]) by listserv.tudelft.nl (8.12.8p1/8.12.8) with ESMTP id h6QAINkm012996; Sat, 26 Jul 2003 12:18:32 +0200 (MEST) From: "Arjen van der Meijden" To: "'Andrew McMillan'" , "'Alexander Priem'" Cc: "'PgSQL Performance ML'" Subject: Re: Tuning PostgreSQL Date: Sat, 26 Jul 2003 12:18:37 +0200 Message-ID: <000001c3535f$4af7acd0$3ac15e91@acm> 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.2627 In-Reply-To: <1059129938.6896.1109.camel@kant.mcmillan.net.nz> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/426 X-Sequence-Number: 2719 > Andrew McMillan wrote: > > The general heuristic is that RAID-5 is not the way to deal > with databases. Now surely someone will disagree with me, > but as I understand it RAID-5 has a bottleneck on a single > disk for the > (checksum) information. Bottleneck is not the word you want > to hear in the context of "database server". That's indeed incorrect. There is no single disk "special" in a Raid-5, you might be mistaking it for Raid-3/4 (where a single disk holds the checksum). In raid-5 the checksums are scattered around on all the harddisks. Raid-5's problem is the write-performance, but with a decent raid-controller it outperforms a less-decent raid-controller (with the same harddisks) on both read- and writeperformance which is running a raid-10. With a decent raid-controller you end up with "about the same" write performance as with raid-1, but slightly lower read performance. At least, that's what I was able to gather from some tests of a colleague of mine with different raid-setups. > RAID-1 (mirroring) or RAID-10 (sort-of-mirrored-RAID-5) is > the best choice. Raid-10 is _not_ similar to raid-5, it is raid1+0 i.e. a mirroring set of stripes (raid-0 is more-or-less a stripe). For databases, raid-10 is supposed to be the fastest, since you have the advantage of the striping for both reading and writing. While you also have the advantage of the mirroring for reading. The main disadvantage of raid-1 (and also of raid-10) is the heavy waste of harddisk space. Another advantage of raid-5 over raid-10 is that when you don't care about space, raid-5 is more save with four harddrives than raid-10 (i.e. set it up with a 3-disk+1spare). > As far as FS performance goes, a year or two ago I remember > someone doing an evaluation of FS performance for PostgreSQL > and they found that the best performance was... > > FAT > > Yep: FAT FAT has a few disadvantages afaik, I wouldn't use it for my database at least. > Personally I don't plan to reboot my DB server more than once > a year (if that (even my_laptop currently has 37 days uptime, > not including suspend). On our DB servers I use ext2 (rather > than ext3) mounted with noatime, and I bite the 15 minutes to > fsck (once a year) rather than screw general performance with > journalling database on top of journalling FS. I split > pg_xlog onto a separate physical disk, if performance > requirements are extreme. Well, reboting is not a problem with ext2, but crashing might be... And normally you don't plan a systemcrash ;) Ext3 and xfs handle that much better. Regards, Arjen From pgsql-admin-owner@postgresql.org Thu Jul 31 21:02:38 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 08B71D1C90E for ; Sat, 26 Jul 2003 10:54:27 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 31557-05 for ; Sat, 26 Jul 2003 07:53:40 -0300 (ADT) Received: from ncc1701.cistron.net (uucp.cistron.nl [62.216.30.38]) by svr1.postgresql.org (Postfix) with ESMTP id B9A85D1C4DC for ; Sat, 26 Jul 2003 07:54:25 -0300 (ADT) Received: from news by ncc1701.cistron.net with local (Exim 3.35 #1 (Debian)) id 19gMh2-0008U6-00 for ; Sat, 26 Jul 2003 12:54:28 +0200 From: "HansH" Subject: Re: Wrong plan or what ? Date: Sat, 26 Jul 2003 12:53:23 +0200 Organization: Cistron Lines: 35 Message-ID: References: <00c101c35074$1e5f5b20$152aa8c0@GMENDOLA2> X-Trace: ncc1701.cistron.net 1059216867 32474 195.64.95.109 (26 Jul 2003 10:54:27 GMT) X-Complaints-To: abuse@cistron.nl X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/371 X-Sequence-Number: 9711 In response to "Mendola Gaetano": > I'm running Postgres7.3.3 and I'm performing this simple select: Looking at your fast three step plan > SELECT id_class from class_default where id_provider = 39; > SELECT id_user from user_data where id_class in ( 48 ); > SELECT * from user_logs where id_user in ( > 10943, 10942, 10934, 10927, 10910, 10909 ); I'ld stem for reordering the from and where clauses alike: select * from class_default cd, user_data ud, user_logs ul where cd.id_provider = 39 and ud.id_class = cd.id_class and ul.id_user = ud.id_user; Personally I dislike implied joins and rather go for _about_ this: select * from ( class_default cd LEFT JOIN user_data ud ON ud.id_class = cd.id_class ) LEFT JOIN user_logs ul ON ul.id_user = ud.id_user, where cd.id_provider = 39; Good luck, HansH From pgsql-performance-owner@postgresql.org Sat Jul 26 11:12:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 100D7D1C92B for ; Sat, 26 Jul 2003 14:12:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 39707-04 for ; Sat, 26 Jul 2003 11:11:55 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 017A9D1C4EB for ; Sat, 26 Jul 2003 11:12:40 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6QECZQ3009305; Sat, 26 Jul 2003 10:12:36 -0400 (EDT) To: "Arjen van der Meijden" Cc: "'Andrew McMillan'" , "'Alexander Priem'" , "'PgSQL Performance ML'" Subject: Re: Tuning PostgreSQL In-reply-to: <000001c3535f$4af7acd0$3ac15e91@acm> References: <000001c3535f$4af7acd0$3ac15e91@acm> Comments: In-reply-to "Arjen van der Meijden" message dated "Sat, 26 Jul 2003 12:18:37 +0200" Date: Sat, 26 Jul 2003 10:12:35 -0400 Message-ID: <9304.1059228755@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/427 X-Sequence-Number: 2720 "Arjen van der Meijden" writes: > Well, reboting is not a problem with ext2, but crashing might be... And > normally you don't plan a systemcrash ;) > Ext3 and xfs handle that much better. A journaling filesystem is good to use if you can set it to journal metadata but not file contents. PG's WAL logic can recover lost file contents, but we have no way to help out the filesystem if it's lost metadata. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jul 26 18:08:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 28AF8D1C91C for ; Sat, 26 Jul 2003 21:08:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 64780-01 for ; Sat, 26 Jul 2003 18:08:00 -0300 (ADT) Received: from v2.intertune.com (unknown [209.75.26.20]) by svr1.postgresql.org (Postfix) with ESMTP id 85C53D1C4BC for ; Sat, 26 Jul 2003 18:08:47 -0300 (ADT) Received: from home01 (66-75-1-38.san.rr.com [66.75.1.38]) (authenticated) by v2.intertune.com (8.11.6/8.11.6) with ESMTP id h6QLUwi30692 for ; Sat, 26 Jul 2003 14:30:58 -0700 From: "Balazs Wellisch" Cc: "'PgSQL Performance ML'" Subject: Re: Tuning PostgreSQL Date: Sat, 26 Jul 2003 14:08:34 -0700 Message-ID: <000401c353ba$16cb98d0$0600a8c0@home01> 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.2616 In-Reply-To: <000001c3535f$4af7acd0$3ac15e91@acm> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/428 X-Sequence-Number: 2721 Since there seem to be a lot of different opinions regarding the various different RAID configurations I thought I'd post this link to the list: http://www.storagereview.com/guide2000/ref/hdd/perf/raid/index.html This is the best resource for information on RAID and hard drive performance I found online. I hope this helps. Balazs From pgsql-performance-owner@postgresql.org Sun Jul 27 05:39:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DE4C9D1C50E for ; Sun, 27 Jul 2003 08:39:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 96438-08 for ; Sun, 27 Jul 2003 05:38:10 -0300 (ADT) Received: from spv.Informatik.Uni-Oldenburg.DE (spv.Informatik.uni-oldenburg.de [134.106.1.10]) by svr1.postgresql.org (Postfix) with ESMTP id 7033DD1C507 for ; Sun, 27 Jul 2003 05:38:59 -0300 (ADT) Received: from sibelius.artis.uni-oldenburg.de ([134.106.121.2]) by spv.Informatik.Uni-Oldenburg.DE (Exim 3.16) id 19gh3U-0002Ik-00; Sun, 27 Jul 2003 10:39:00 +0200 Received: from 127.0.0.1 (really [134.106.121.91]) by sibelius.artis.uni-oldenburg.de via smail with esmtp id (Debian Smail3.2.0.102) for ; Sun, 27 Jul 2003 10:38:53 +0200 (CEST) Date: Sun, 27 Jul 2003 10:40:09 +0200 From: Daniel Migowski X-Mailer: The Bat! (v1.62r) Educational Reply-To: Daniel Migowski X-Priority: 3 (Normal) Message-ID: <1662072945.20030727104009@artis.uni-oldenburg.de> To: pgsql-performance@postgresql.org Subject: Mapping Database completly into memory 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-Archive-Number: 200307/429 X-Sequence-Number: 2722 Hallo pgsql-performance, I just wondered if there is a possibility to map my database running on a linux system completly into memory and to only use disk accesses for writes. I got a nice machine around with 2 gigs of ram, and my database at the moment uses about 30MB on the disks. Or does Postgresql do this automtatically, with some cache adjusting parameters, and after doing a select * from on my database? Thank you and ciao, Mig-O From pgsql-performance-owner@postgresql.org Sun Jul 27 05:47:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 95325D1C507 for ; Sun, 27 Jul 2003 08:47:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 99678-03 for ; Sun, 27 Jul 2003 05:47:02 -0300 (ADT) Received: from spv.Informatik.Uni-Oldenburg.DE (spv.Informatik.uni-oldenburg.de [134.106.1.10]) by svr1.postgresql.org (Postfix) with ESMTP id 7CFFDD1C4D6 for ; Sun, 27 Jul 2003 05:47:51 -0300 (ADT) Received: from sibelius.artis.uni-oldenburg.de ([134.106.121.2]) by spv.Informatik.Uni-Oldenburg.DE (Exim 3.16) id 19ghC4-0002JE-00; Sun, 27 Jul 2003 10:47:52 +0200 Received: from 127.0.0.1 (really [134.106.121.91]) by sibelius.artis.uni-oldenburg.de via smail with esmtp id (Debian Smail3.2.0.102) for ; Sun, 27 Jul 2003 10:47:45 +0200 (CEST) Date: Sun, 27 Jul 2003 10:49:01 +0200 From: Daniel Migowski X-Mailer: The Bat! (v1.62r) Educational Reply-To: Daniel Migowski X-Priority: 3 (Normal) Message-ID: <97842368.20030727104901@artis.uni-oldenburg.de> To: pgsql-performance@postgresql.org Subject: Mapping a database completly into Memory 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-Archive-Number: 200307/430 X-Sequence-Number: 2723 Hallo pgsql-performance, I just wondered if there is a possibility to map my database running on a linux system completly into memory and to only use disk accesses for writes. I got a nice machine around with 2 gigs of ram, and my database at the moment uses about 30MB on the disks. Or does Postgresql do this automtatically, with some cache adjusting parameters, and after doing a select * from on my database? Thank you and ciao, Mig-O From pgsql-performance-owner@postgresql.org Sun Jul 27 09:59:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 76687D1C4C1 for ; Sun, 27 Jul 2003 12:59:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 11709-03 for ; Sun, 27 Jul 2003 09:58:18 -0300 (ADT) Received: from unimm.unisoftbg.com (unknown [194.12.229.207]) by svr1.postgresql.org (Postfix) with ESMTP id D7F71D1C4D7 for ; Sun, 27 Jul 2003 09:56:20 -0300 (ADT) Received: (qmail 1805 invoked by uid 507); 27 Jul 2003 12:57:20 -0000 Received: from unknown (HELO t1.unisoftbg.com) (pginfo%t1.unisoftbg.com@194.12.229.193) by 0 with SMTP; 27 Jul 2003 12:57:20 -0000 Message-ID: <3F23BC59.B96BBBFE@t1.unisoftbg.com> Date: Sun, 27 Jul 2003 13:49:45 +0200 From: pginfo X-Mailer: Mozilla 4.03 [en] (Win95; I) MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Subject: Query problem Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/431 X-Sequence-Number: 2724 Hi , I am working to migrate a oracle application to pg. I am using pg 7.3.3 on Dual PIII, 2 GB RAM,linux RedHat 7.3. One of my selects is working much slower as in oracle. In this example I am using not many rows in tables. For all the joins I have indexes. All IDS or IDS_xxx are name. Pls if it is possible poit me how to fix this problem. I send the query and the explai analyze. I have ran vacuum analyze full on db. Many thanks, ivan. explain analyze select O.IDS as oids,O.IDS_MDL_MDF_VOL as ids_mmv,M.MNAME AS MODDELNAME,M.KOD AS MODELKOD,O.IDS_COLOR,COL.MNAME AS COLORNAME,COL.KOD AS COLORKOD, TT.IDS AS LOCIDS,TT.MNAME AS LOCNAME, TT.KOD AS LOC_KOD ,O.IDS_DOSTAV,DST.MNAME AS DOSTAVNAME, O.IDS_PROIZV,PRZ.MNAME as PROIZVNAME,O.CHASSI,O.CHASSI_ACC,O.DVIGATEL,O.ORDER_NUM,O.ORDER_DATE,O.DOG_OR_FREE, O.NALICHEN,O.DATE_PROIZV, O.DATE_IN,O.ALI,O.DATE_ALI, O.PRICE_PAY,O.PRICE_PAY_VAL, O.START_DATE,O.DAYS,O.END_DATE,O.COMENTAR,O.IDS_AUTOVOZ,AWT.MNAME AS AUTOVNAME, O.SVERKA,O.NEW_OLD,O.KM,O.START_DATE_REZ,O.END_DATE_REZ,O.IDS_SLUJITEL,SLU.KOD,NULL AS CT_IDS, NULL AS C_NUM, O.DATE_ALI2, NULL AS C_STATE, 0 AS DAMAGE, O.REG_NUMBER AS CARREGNUMBER,O.DATE_REG AS CARREGDATE,O.GARTYPE,2002 AS GODINA,O.COMENTAR1, O.IDS_COMBOPT,CB.KOD AS IDS_COMBOPT_KOD,O.REF_BG,O.DAM,O.OBEM, O.IDS_TAPICERII,TAP.KOD AS IDS_TAPICERII_KOD,TAP.MNAME AS IDS_TAPICERII_NAME,O.PAPKA_N,O.CEDMICAPR, O.RADIO_KOD AS RADIO_KOD,O.KEY_KOD AS KEY_KOD,O.ALARM_KOD AS ALARM_KOD,O.BOLT_KOD AS BOLT_KOD,M.MOST_PS, NULL AS IDS_KLIENT , NULL AS KlientName ,O.TALON_N AS talonN,O.STATEMODIFY AS STATEMOD,O.MESTA AS MESTA,O.CENA_COLOR AS CENA_COL,O.CENA_TAP AS CENA_TAP,M.CENA_PROD AS MCENA_PROD,M.CENA_PROD_VAL AS MCENA_PROD_VAL,O.CENA_MDL,O.MESTA_MDL,O.CENA_COLOR_VAL,O.CENA_TAP_VAL,O.CENA_MDL_VAL,O.VIRTUALEN,M.IDS_GRUPA,COL.MNAME_1 AS COLMNAME1,O.DATE_PLAN_P,O.KM_PLAN_P from A_COLORS COL, A_MDL_MDF_VOL M ,A_LOCATIONS TT, A_CARS O left outer join A_SLUJITELI SLU ON(O.IDS_SLUJITEL=SLU.IDS) left outer join A_AUTOVOZ AWT ON(O.IDS_AUTOVOZ=AWT.IDS) left outer join A_COMBOPT CB ON(O.IDS_COMBOPT=CB.IDS) left outer join A_TAPICERII TAP ON(O.IDS_TAPICERII=TAP.IDS) left outer join A_KLIENTI DST ON( O.IDS_DOSTAV=DST.IDS) left outer join A_KLIENTI PRZ ON( O.IDS_PROIZV = PRZ.IDS) ,A_CH_CAR CHT WHERE O.IDS_LOCATION=TT.IDS AND O.IDS_MDL_MDF_VOL=M.IDS AND O.IDS_COLOR=COL.IDS AND CHT.IDS=O.IDS AND CHT.INSTIME=1059300812726 AND CHT.SES=1059300377005 and O.DOG_OR_FREE IN(0,2,3) ; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=138.54..142.57 rows=2 width=2051) (actual time=286.17..286.29 rows=2 loops=1) Hash Cond: ("outer".ids_location = "inner".ids) -> Hash Join (cost=137.42..141.40 rows=2 width=1971) (actual time=285.95..286.02 rows=2 loops=1) Hash Cond: ("outer".ids = "inner".ids_color) -> Seq Scan on a_colors col (cost=0.00..3.12 rows=112 width=101) (actual time=0.01..0.30 rows=112 loops=1) -> Hash (cost=137.41..137.41 rows=2 width=1870) (actual time=285.43..285.43 rows=0 loops=1) -> Hash Join (cost=134.88..137.41 rows=2 width=1870) (actual time=285.12..285.42 rows=2 loops=1) Hash Cond: ("outer".ids = "inner".ids_mdl_mdf_vol) -> Seq Scan on a_mdl_mdf_vol m (cost=0.00..2.34 rows=34 width=189) (actual time=0.03..0.21 rows=34 loops=1) -> Hash (cost=134.88..134.88 rows=2 width=1681) (actual time=284.98..284.98 rows=0 loops=1) -> Hash Join (cost=10.76..134.88 rows=2 width=1681) (actual time=189.62..284.97 rows=2 loops=1) Hash Cond: ("outer".ids = "inner".ids) -> Hash Join (cost=9.73..128.72 rows=1019 width=1617) (actual time=1.58..283.39 rows=1023 loops=1) Hash Cond: ("outer".ids_proizv = "inner".ids) -> Hash Join (cost=7.50..108.66 rows=1019 width=1545) (actual time=1.34..234.05 rows=1023 loops=1) Hash Cond: ("outer".ids_dostav = "inner".ids) -> Hash Join (cost=5.28..88.60 rows=1019 width=1473) (actual time=1.12..188.41 rows=1023 loops=1) Hash Cond: ("outer".ids_tapicerii = "inner".ids) -> Hash Join (cost=2.40..67.89 rows=1019 width=1372) (actual time=0.68..145.58 rows=1023 loops=1) Hash Cond: ("outer".ids_combopt = "inner".ids) -> Hash Join (cost=1.09..46.19 rows=1019 width=1301) (actual time=0.45..106.88 rows=1023 loops=1) Hash Cond: ("outer".ids_autovoz = "inner".ids) -> Hash Join (cost=1.09..41.03 rows=1019 width=1189) (actual time=0.31..72.28 rows=1023 loops=1) Hash Cond: ("outer".ids_slujitel = "inner".ids) -> Index Scan using i_cars_dog_or_free on a_cars o (cost=0.00..22.11 rows=1019 width=1119) (actual time=0.12..37.41 rows=1023 loops=1) Filter: ((dog_or_free = 0) OR (dog_or_free = 2) OR (dog_or_free = 3)) -> Hash (cost=1.07..1.07 rows=7 width=70) (actual time=0.04..0.04 rows=0 loops=1) -> Seq Scan on a_slujiteli slu (cost=0.00..1.07 rows=7 width=70) (actual time=0.01..0.03 rows=7 loops=1) -> Hash (cost=0.00..0.00 rows=1 width=112) (actual time=0.00..0.00 rows=0 loops=1) -> Seq Scan on a_autovoz awt (cost=0.00..0.00 rows=1 width=112) (actual time=0.00..0.00 rows=0 loops=1) -> Hash (cost=1.25..1.25 rows=25 width=71) (actual time=0.09..0.09 rows=0 loops=1) -> Seq Scan on a_combopt cb (cost=0.00..1.25 rows=25 width=71) (actual time=0.01..0.06 rows=25 loops=1) -> Hash (cost=2.70..2.70 rows=70 width=101) (actual time=0.29..0.29 rows=0 loops=1) -> Seq Scan on a_tapicerii tap (cost=0.00..2.70 rows=70 width=101) (actual time=0.01..0.17 rows=70 loops=1) -> Hash (cost=2.18..2.18 rows=18 width=72) (actual time=0.06..0.06 rows=0 loops=1) -> Seq Scan on a_klienti dst (cost=0.00..2.18 rows=18 width=72) (actual time=0.01..0.03 rows=18 loops=1) -> Hash (cost=2.18..2.18 rows=18 width=72) (actual time=0.07..0.07 rows=0 loops=1) -> Seq Scan on a_klienti prz (cost=0.00..2.18 rows=18 width=72) (actual time=0.01..0.05 rows=18 loops=1) -> Hash (cost=1.03..1.03 rows=2 width=64) (actual time=0.03..0.03 rows=0 loops=1) -> Seq Scan on a_ch_car cht (cost=0.00..1.03 rows=2 width=64) (actual time=0.02..0.03 rows=2 loops=1) Filter: ((instime = 1059300812726::bigint) AND (ses = 1059300377005::bigint)) -> Hash (cost=1.10..1.10 rows=10 width=80) (actual time=0.07..0.07 rows=0 loops=1) -> Seq Scan on a_locations tt (cost=0.00..1.10 rows=10 width=80) (actual time=0.03..0.05 rows=10 loops=1) Total runtime: 287.61 msec (44 rows) Time: 301.36 ms From pgsql-performance-owner@postgresql.org Sun Jul 27 10:32:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 41C13D1C4B9 for ; Sun, 27 Jul 2003 13:32:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 11118-07 for ; Sun, 27 Jul 2003 10:31:21 -0300 (ADT) Received: from unimm.unisoftbg.com (unknown [194.12.229.207]) by svr1.postgresql.org (Postfix) with ESMTP id 57DEED1C4B7 for ; Sun, 27 Jul 2003 10:29:24 -0300 (ADT) Received: (qmail 2154 invoked by uid 507); 27 Jul 2003 13:30:24 -0000 Received: from unknown (HELO t1.unisoftbg.com) (pginfo%t1.unisoftbg.com@194.12.229.193) by 0 with SMTP; 27 Jul 2003 13:30:24 -0000 Message-ID: <3F23C418.5CC6D754@t1.unisoftbg.com> Date: Sun, 27 Jul 2003 14:22:48 +0200 From: pginfo X-Mailer: Mozilla 4.03 [en] (Win95; I) MIME-Version: 1.0 To: Bruno BAGUETTE Cc: pgsql-performance@postgresql.org Subject: Re: RE : Query problem References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/433 X-Sequence-Number: 2726 Hi Bruno, I think I have tunet it. Pg is working for most of my selects, but I have problem with this one. regards, ivan Bruno BAGUETTE wrote: > Hello, > > > One of my selects is working much slower as in oracle. > > In this example I am using not many rows in tables. > > For all the joins I have indexes. > > All IDS or IDS_xxx are name. > > > > Pls if it is possible poit me how to fix this problem. > > > > I send the query and the explai analyze. > > I have ran vacuum analyze full on db. > > Have you tuned your postgresql.conf settings ? > > The PostgreSQL default settings are very low in order to allow > PostgreSQL to RUN on old machines and new machines. If you need > PERFORMANCE (which is quite logic), you must setup the postgresql.conf > file. > > Here's a nice article about the postgresql.conf file tuning : > http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html > > Hope this help ! :-) > > Cheers, > > --------------------------------------- > Bruno BAGUETTE - pgsql-ml@baguette.net From pgsql-performance-owner@postgresql.org Sun Jul 27 10:25:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D56D9D1C4B9 for ; Sun, 27 Jul 2003 13:24:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 10475-04 for ; Sun, 27 Jul 2003 10:24:09 -0300 (ADT) Received: from juliette2.openweb.be (juliette2.openweb.be [217.145.32.36]) by svr1.postgresql.org (Postfix) with SMTP id BB782D1C4B7 for ; Sun, 27 Jul 2003 10:24:56 -0300 (ADT) Received: (qmail 32159 invoked by uid 585); 27 Jul 2003 13:16:25 -0000 Received: from pgsql-ml@baguette.net by juliette2.openweb.be by uid 582 with qmail-scanner-1.10 (avp. Clear:0. Processed in 1.862134 secs); 27 Jul 2003 13:16:25 -0000 Received: from levure.baguette.net (HELO Morpheus) (217.145.35.101) by juliette2.openweb.be with SMTP; 27 Jul 2003 13:16:23 -0000 From: "Bruno BAGUETTE" To: "'pginfo'" , Subject: RE : Query problem Date: Sun, 27 Jul 2003 15:26:03 +0200 Message-ID: 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: <3F23BC59.B96BBBFE@t1.unisoftbg.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/432 X-Sequence-Number: 2725 Hello, > One of my selects is working much slower as in oracle. > In this example I am using not many rows in tables. > For all the joins I have indexes. > All IDS or IDS_xxx are name. > > Pls if it is possible poit me how to fix this problem. > > I send the query and the explai analyze. > I have ran vacuum analyze full on db. Have you tuned your postgresql.conf settings ? The PostgreSQL default settings are very low in order to allow PostgreSQL to RUN on old machines and new machines. If you need PERFORMANCE (which is quite logic), you must setup the postgresql.conf file. Here's a nice article about the postgresql.conf file tuning : http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html Hope this help ! :-) Cheers, --------------------------------------- Bruno BAGUETTE - pgsql-ml@baguette.net From pgsql-performance-owner@postgresql.org Sun Jul 27 11:25:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CDB5FD1C4CD for ; Sun, 27 Jul 2003 14:25:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 15855-02 for ; Sun, 27 Jul 2003 11:24:23 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 759B6D1C4BB for ; Sun, 27 Jul 2003 11:25:10 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 78CC61024D; Sun, 27 Jul 2003 10:17:49 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 8343310248; Sun, 27 Jul 2003 10:17:46 -0400 (EDT) Subject: Re: Query problem From: Rod Taylor To: pginfo Cc: "pgsql-performance@postgresql.org" In-Reply-To: <3F23BC59.B96BBBFE@t1.unisoftbg.com> References: <3F23BC59.B96BBBFE@t1.unisoftbg.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-R5uW4lhIhASnKOzxHWZy" Message-Id: <1059315939.32716.17.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 27 Jul 2003 10:25:40 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/434 X-Sequence-Number: 2727 --=-R5uW4lhIhASnKOzxHWZy Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Try re-arranging your join structure: , A_CARS O JOIN A_CH_CAR CHT ON (CHT.IDS=3DO.IDS) left outer join A_SLUJITELI SLU ON(O.IDS_SLUJITEL=3DSLU.IDS) left outer join A_AUTOVOZ AWT ON(O.IDS_AUTOVOZ=3DAWT.IDS) left outer join A_COMBOPT CB ON(O.IDS_COMBOPT=3DCB.IDS) left outer join A_TAPICERII TAP ON(O.IDS_TAPICERII=3DTAP.IDS) left outer join A_KLIENTI DST ON(O.IDS_DOSTAV=3DDST.IDS) left outer join A_KLIENTI PRZ ON(O.IDS_PROIZV =3D PRZ.IDS) WHERE O.IDS_LOCATION=3DTT.IDS AND O.IDS_MDL_MDF_VOL=3DM.IDS AND CHT.INSTIME=3D1059300812726 AND CHT.SES=3D1059300377005 and O.DOG_OR_FREE IN(0,2,3); I believe this will cause fewer rows to be used when hashing for the left outer joins. On Sun, 2003-07-27 at 07:49, pginfo wrote: > Hi , >=20 > I am working to migrate a oracle application to pg. > I am using pg 7.3.3 on Dual PIII, 2 GB RAM,linux RedHat 7.3. >=20 > One of my selects is working much slower as in oracle. > In this example I am using not many rows in tables. > For all the joins I have indexes. > All IDS or IDS_xxx are name. >=20 > Pls if it is possible poit me how to fix this problem. >=20 > I send the query and the explai analyze. > I have ran vacuum analyze full on db. >=20 > Many thanks, > ivan. >=20 > explain analyze select O.IDS as oids,O.IDS_MDL_MDF_VOL as > ids_mmv,M.MNAME AS MODDELNAME,M.KOD AS MODELKOD,O.IDS_COLOR,COL.MNAME > AS COLORNAME,COL.KOD AS COLORKOD, TT.IDS AS LOCIDS,TT.MNAME AS LOCNAME, > TT.KOD AS LOC_KOD ,O.IDS_DOSTAV,DST.MNAME AS DOSTAVNAME, > O.IDS_PROIZV,PRZ.MNAME as > PROIZVNAME,O.CHASSI,O.CHASSI_ACC,O.DVIGATEL,O.ORDER_NUM,O.ORDER_DATE,O.DO= G_OR_FREE, > O.NALICHEN,O.DATE_PROIZV, O.DATE_IN,O.ALI,O.DATE_ALI, > O.PRICE_PAY,O.PRICE_PAY_VAL, > O.START_DATE,O.DAYS,O.END_DATE,O.COMENTAR,O.IDS_AUTOVOZ,AWT.MNAME AS > AUTOVNAME, > O.SVERKA,O.NEW_OLD,O.KM,O.START_DATE_REZ,O.END_DATE_REZ,O.IDS_SLUJITEL,SL= U.KOD,NULL > AS CT_IDS, NULL AS C_NUM, O.DATE_ALI2, NULL AS C_STATE, 0 AS DAMAGE, > O.REG_NUMBER AS CARREGNUMBER,O.DATE_REG AS CARREGDATE,O.GARTYPE,2002 AS > GODINA,O.COMENTAR1, O.IDS_COMBOPT,CB.KOD AS > IDS_COMBOPT_KOD,O.REF_BG,O.DAM,O.OBEM, O.IDS_TAPICERII,TAP.KOD AS > IDS_TAPICERII_KOD,TAP.MNAME AS > IDS_TAPICERII_NAME,O.PAPKA_N,O.CEDMICAPR, O.RADIO_KOD AS > RADIO_KOD,O.KEY_KOD AS KEY_KOD,O.ALARM_KOD AS ALARM_KOD,O.BOLT_KOD AS > BOLT_KOD,M.MOST_PS, NULL AS IDS_KLIENT , NULL AS KlientName ,O.TALON_N > AS talonN,O.STATEMODIFY AS STATEMOD,O.MESTA AS MESTA,O.CENA_COLOR AS > CENA_COL,O.CENA_TAP AS CENA_TAP,M.CENA_PROD AS > MCENA_PROD,M.CENA_PROD_VAL AS > MCENA_PROD_VAL,O.CENA_MDL,O.MESTA_MDL,O.CENA_COLOR_VAL,O.CENA_TAP_VAL,O.C= ENA_MDL_VAL,O.VIRTUALEN,M.IDS_GRUPA,COL.MNAME_1 > AS COLMNAME1,O.DATE_PLAN_P,O.KM_PLAN_P from A_COLORS COL, A_MDL_MDF_VOL > M ,A_LOCATIONS TT, A_CARS O left outer join A_SLUJITELI SLU > ON(O.IDS_SLUJITEL=3DSLU.IDS) left outer join A_AUTOVOZ AWT > ON(O.IDS_AUTOVOZ=3DAWT.IDS) left outer join A_COMBOPT CB > ON(O.IDS_COMBOPT=3DCB.IDS) left outer join A_TAPICERII TAP > ON(O.IDS_TAPICERII=3DTAP.IDS) left outer join A_KLIENTI DST ON( > O.IDS_DOSTAV=3DDST.IDS) left outer join A_KLIENTI PRZ ON( O.IDS_PROIZV = =3D > PRZ.IDS) ,A_CH_CAR CHT WHERE O.IDS_LOCATION=3DTT.IDS AND > O.IDS_MDL_MDF_VOL=3DM.IDS AND O.IDS_COLOR=3DCOL.IDS AND CHT.IDS=3DO.IDS= AND > CHT.INSTIME=3D1059300812726 AND CHT.SES=3D1059300377005 and O.DOG_OR_FREE > IN(0,2,3) ; >=20 > QUERY PLAN > -------------------------------------------------------------------------= ---------------------------------------------------------------------------= ---------------------------------------------------------- >=20 > Hash Join (cost=3D138.54..142.57 rows=3D2 width=3D2051) (actual > time=3D286.17..286.29 rows=3D2 loops=3D1) > Hash Cond: ("outer".ids_location =3D "inner".ids) > -> Hash Join (cost=3D137.42..141.40 rows=3D2 width=3D1971) (actual > time=3D285.95..286.02 rows=3D2 loops=3D1) > Hash Cond: ("outer".ids =3D "inner".ids_color) > -> Seq Scan on a_colors col (cost=3D0.00..3.12 rows=3D112 > width=3D101) (actual time=3D0.01..0.30 rows=3D112 loops=3D1) > -> Hash (cost=3D137.41..137.41 rows=3D2 width=3D1870) (actual > time=3D285.43..285.43 rows=3D0 loops=3D1) > -> Hash Join (cost=3D134.88..137.41 rows=3D2 width=3D187= 0) > (actual time=3D285.12..285.42 rows=3D2 loops=3D1) > Hash Cond: ("outer".ids =3D "inner".ids_mdl_mdf_vol) > -> Seq Scan on a_mdl_mdf_vol m (cost=3D0.00..2.34 > rows=3D34 width=3D189) (actual time=3D0.03..0.21 rows=3D34 loops=3D1) > -> Hash (cost=3D134.88..134.88 rows=3D2 width=3D16= 81) > (actual time=3D284.98..284.98 rows=3D0 loops=3D1) > -> Hash Join (cost=3D10.76..134.88 rows=3D2 > width=3D1681) (actual time=3D189.62..284.97 rows=3D2 loops=3D1) > Hash Cond: ("outer".ids =3D "inner".ids) > -> Hash Join (cost=3D9.73..128.72 > rows=3D1019 width=3D1617) (actual time=3D1.58..283.39 rows=3D1023 loops= =3D1) > Hash Cond: ("outer".ids_proizv =3D > "inner".ids) > -> Hash Join (cost=3D7.50..108.66 > rows=3D1019 width=3D1545) (actual time=3D1.34..234.05 rows=3D1023 loops= =3D1) > Hash Cond: > ("outer".ids_dostav =3D "inner".ids) > -> Hash Join > (cost=3D5.28..88.60 rows=3D1019 width=3D1473) (actual time=3D1.12..188.41 > rows=3D1023 loops=3D1) > Hash Cond: > ("outer".ids_tapicerii =3D "inner".ids) > -> Hash Join > (cost=3D2.40..67.89 rows=3D1019 width=3D1372) (actual time=3D0.68..145.58 > rows=3D1023 loops=3D1) > Hash Cond: > ("outer".ids_combopt =3D "inner".ids) > -> Hash Join > (cost=3D1.09..46.19 rows=3D1019 width=3D1301) (actual time=3D0.45..106.88 > rows=3D1023 loops=3D1) > Hash > Cond: ("outer".ids_autovoz =3D "inner".ids) > -> Hash > Join (cost=3D1.09..41.03 rows=3D1019 width=3D1189) (actual time=3D0.31..= 72.28 > rows=3D1023 loops=3D1) >=20 > Hash Cond: ("outer".ids_slujitel =3D "inner".ids) > -> > Index Scan using i_cars_dog_or_free on a_cars o (cost=3D0.00..22.11 > rows=3D1019 width=3D1119) (actual time=3D0.12..37.41 rows=3D1023 loops=3D= 1) >=20 > Filter: ((dog_or_free =3D 0) OR (dog_or_free =3D 2) OR (dog_or_free =3D 3= )) > -> > Hash (cost=3D1.07..1.07 rows=3D7 width=3D70) (actual time=3D0.04..0.04 r= ows=3D0 > loops=3D1) >=20 > -> Seq Scan on a_slujiteli slu (cost=3D0.00..1.07 rows=3D7 width=3D70) > (actual time=3D0.01..0.03 rows=3D7 loops=3D1) > -> Hash > (cost=3D0.00..0.00 rows=3D1 width=3D112) (actual time=3D0.00..0.00 rows= =3D0 > loops=3D1) > -> > Seq Scan on a_autovoz awt (cost=3D0.00..0.00 rows=3D1 width=3D112) (actu= al > time=3D0.00..0.00 rows=3D0 loops=3D1) > -> Hash > (cost=3D1.25..1.25 rows=3D25 width=3D71) (actual time=3D0.09..0.09 rows= =3D0 > loops=3D1) > -> Seq > Scan on a_combopt cb (cost=3D0.00..1.25 rows=3D25 width=3D71) (actual > time=3D0.01..0.06 rows=3D25 loops=3D1) > -> Hash > (cost=3D2.70..2.70 rows=3D70 width=3D101) (actual time=3D0.29..0.29 rows= =3D0 > loops=3D1) > -> Seq Scan on > a_tapicerii tap (cost=3D0.00..2.70 rows=3D70 width=3D101) (actual > time=3D0.01..0.17 rows=3D70 loops=3D1) > -> Hash (cost=3D2.18..2.18 > rows=3D18 width=3D72) (actual time=3D0.06..0.06 rows=3D0 loops=3D1) > -> Seq Scan on > a_klienti dst (cost=3D0.00..2.18 rows=3D18 width=3D72) (actual > time=3D0.01..0.03 rows=3D18 loops=3D1) > -> Hash (cost=3D2.18..2.18 > rows=3D18 width=3D72) (actual time=3D0.07..0.07 rows=3D0 loops=3D1) > -> Seq Scan on a_klienti > prz (cost=3D0.00..2.18 rows=3D18 width=3D72) (actual time=3D0.01..0.05 r= ows=3D18 > loops=3D1) > -> Hash (cost=3D1.03..1.03 rows=3D2 > width=3D64) (actual time=3D0.03..0.03 rows=3D0 loops=3D1) > -> Seq Scan on a_ch_car cht > (cost=3D0.00..1.03 rows=3D2 width=3D64) (actual time=3D0.02..0.03 rows=3D2 > loops=3D1) > Filter: ((instime =3D > 1059300812726::bigint) AND (ses =3D 1059300377005::bigint)) > -> Hash (cost=3D1.10..1.10 rows=3D10 width=3D80) (actual time=3D0.07= ..0.07 > rows=3D0 loops=3D1) > -> Seq Scan on a_locations tt (cost=3D0.00..1.10 rows=3D10 > width=3D80) (actual time=3D0.03..0.05 rows=3D10 loops=3D1) > Total runtime: 287.61 msec > (44 rows) >=20 > Time: 301.36 ms >=20 >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend >=20 --=-R5uW4lhIhASnKOzxHWZy Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/I+Di6DETLow6vwwRAsorAJ40TFg+2zg+mc6NAbboKL7IF3ao1QCeIHLu tT4w11Y4Tj7j/M10DBDCc7U= =PTyj -----END PGP SIGNATURE----- --=-R5uW4lhIhASnKOzxHWZy-- From pgsql-performance-owner@postgresql.org Sun Jul 27 13:20:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 601DBD1C91F for ; Sun, 27 Jul 2003 16:20:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 11817-10 for ; Sun, 27 Jul 2003 13:19:16 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 262AED1C4BA for ; Sun, 27 Jul 2003 13:20:08 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6RGIqQ3009003; Sun, 27 Jul 2003 12:18:53 -0400 (EDT) To: Daniel Migowski Cc: pgsql-performance@postgresql.org Subject: Re: Mapping a database completly into Memory In-reply-to: <97842368.20030727104901@artis.uni-oldenburg.de> References: <97842368.20030727104901@artis.uni-oldenburg.de> Comments: In-reply-to Daniel Migowski message dated "Sun, 27 Jul 2003 10:49:01 +0200" Date: Sun, 27 Jul 2003 12:18:52 -0400 Message-ID: <9002.1059322732@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/435 X-Sequence-Number: 2728 Daniel Migowski writes: > I just wondered if there is a possibility to map my database running > on a linux system completly into memory and to only use disk > accesses for writes. That happens for free, if you have enough RAM. The kernel will use spare RAM to hold copies of every disk block it's ever read. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 28 01:15:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 44B63D1C4E6 for ; Mon, 28 Jul 2003 04:15:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 64092-04 for ; Mon, 28 Jul 2003 01:14:10 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 1A764D1C4C8 for ; Mon, 28 Jul 2003 01:15:04 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3352743; Sun, 27 Jul 2003 21:15:22 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Daniel Migowski Subject: Re: Mapping a database completly into Memory Date: Sun, 27 Jul 2003 21:14:11 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-performance@postgresql.org References: <97842368.20030727104901@artis.uni-oldenburg.de> <9002.1059322732@sss.pgh.pa.us> In-Reply-To: <9002.1059322732@sss.pgh.pa.us> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307272114.11579.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/436 X-Sequence-Number: 2729 Daniel, > > I just wondered if there is a possibility to map my database running > > on a linux system completly into memory and to only use disk > > accesses for writes. > > That happens for free, if you have enough RAM. The kernel will use > spare RAM to hold copies of every disk block it's ever read. Also, don't forget to raise your effective_cache_size so that PostgreSQL *knows* that you have lots of RAM. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 28 12:56:53 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DD151D1C7F2 for ; Mon, 28 Jul 2003 14:14:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 92696-09 for ; Mon, 28 Jul 2003 11:13:28 -0300 (ADT) Received: from lucifer.akyasociados.com.ar (unknown [200.69.203.237]) by svr1.postgresql.org (Postfix) with ESMTP id CECA2D1C7F8 for ; Mon, 28 Jul 2003 11:14:17 -0300 (ADT) Received: from taz.oficina (taz.oficina [192.168.1.174]) (authenticated bits=0) by lucifer.akyasociados.com.ar (8.12.9/8.12.9) with ESMTP id h6SEH6so072554; Mon, 28 Jul 2003 11:17:06 -0300 (ART) (envelope-from franco@akyasociados.com.ar) Subject: Re: Mapping a database completly into Memory From: Franco Bruno Borghesi To: Josh Berkus Cc: Daniel Migowski , pgsql-performance@postgresql.org In-Reply-To: <200307272114.11579.josh@agliodbs.com> References: <97842368.20030727104901@artis.uni-oldenburg.de> <9002.1059322732@sss.pgh.pa.us> <200307272114.11579.josh@agliodbs.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-VTGh5l54Wmx+UnmEEkZB" Organization: AK y Asociados S.R.L. Message-Id: <1059401815.749.7.camel@taz.oficina> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 28 Jul 2003 11:16:55 -0300 X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/437 X-Sequence-Number: 2730 --=-VTGh5l54Wmx+UnmEEkZB Content-Type: multipart/alternative; boundary="=-eoPw81zciwjNmxSan3/f" --=-eoPw81zciwjNmxSan3/f Content-Type: text/plain Content-Transfer-Encoding: quoted-printable wouldn't also increasing shared_buffers to 64 or 128 MB be a good performance improvement? This way, pages belonging to heavily used indexes would be already cached by the database itself. Please, correct me if I'm wrong. On Mon, 2003-07-28 at 01:14, Josh Berkus wrote: > Daniel, >=20 > > > I just wondered if there is a possibility to map my database running > > > on a linux system completly into memory and to only use disk > > > accesses for writes. > > > > That happens for free, if you have enough RAM. The kernel will use > > spare RAM to hold copies of every disk block it's ever read. >=20 > Also, don't forget to raise your effective_cache_size so that PostgreSQL= =20 > *knows* that you have lots of RAM. --=-eoPw81zciwjNmxSan3/f Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable wouldn't also increasing shared_buffers to 64 or 128 MB be a good performan= ce improvement? This way, pages belonging to heavily used indexes would be = already cached by the database itself.

Please, correct me if I'm wrong.

On Mon, 2003-07-28 at 01:14, Josh Berkus wrote:
Daniel,

> > I just wondered if there is a possibility to map my database runn=
ing
> > on a linux system completly into memory and to only use disk
> > accesses for writes.
>
> That happens for free, if you have enough RAM.  The kernel will use
> spare RAM to hold copies of every disk block it's ever read.

Also, don't forget to raise your effective_cache_size so that PostgreSQL=20
*knows* that you have lots of RAM.
--=-eoPw81zciwjNmxSan3/f-- --=-VTGh5l54Wmx+UnmEEkZB Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/JTBX21dVnhLsBV0RAnenAJ9B95hov69+OqrhIN2cxy6ncl/b8wCdGwX0 puFd21I4zVEunwszQFtTvOc= =DiiU -----END PGP SIGNATURE----- --=-VTGh5l54Wmx+UnmEEkZB-- From pgsql-performance-owner@postgresql.org Mon Jul 28 14:57:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D12A3D1C988 for ; Mon, 28 Jul 2003 16:17:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 03074-01 for ; Mon, 28 Jul 2003 13:16:19 -0300 (ADT) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by svr1.postgresql.org (Postfix) with ESMTP id 4EE36D1C9B2 for ; Mon, 28 Jul 2003 13:17:14 -0300 (ADT) Received: from tarzan ([68.96.211.236]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030728161714.ITPY23518.lakemtao03.cox.net@tarzan> for ; Mon, 28 Jul 2003 12:17:14 -0400 Message-ID: <000f01c35523$f13dee90$ecd36044@tarzan> From: "Justin Long" To: Subject: Optimization Date: Mon, 28 Jul 2003 12:18:55 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000C_01C35502.69E97930" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 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.6 tagged_above=0.0 required=5.0 tests=BAYES_30, HTML_20_30 X-Spam-Level: X-Archive-Number: 200307/440 X-Sequence-Number: 2733 This is a multi-part message in MIME format. ------=_NextPart_000_000C_01C35502.69E97930 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Greetings, I am trying to understand the various factors used by Postgres to optimize.= I presently have a dual-866 Dell server with 1GB of memory. I've done the = following: set /proc/sys/kernel/shmmax to 512000000 shared_buffers =3D 32000 sort_mem =3D 32000 max_connections=3D64 fsync=3Dfalse Can someone tell me what effective_cache_size should be set to? what kind o= f formula to use for this? (I got the other figures from phpbuilder.com, an= d modified for 512k memory).=20 The databases I'm using have about 200,000+ news headlines with full-text i= ndexes (which range upwards of a few million records). They are updated abo= ut every 5 to 10 minutes, which means I also have to run a vacuum about onc= e every 2 to 3 hours at least. As I get more updates obviously the efficien= cy goes down. I'm trying to make the most of this system but don't fully un= derstand PG's optimization stuff. Thanks in advance, Justin Long ------=_NextPart_000_000C_01C35502.69E97930 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Greetings,
 
I am trying to understand the various fact= ors used=20 by Postgres to optimize. I presently have a dual-866 Dell server with 1GB o= f=20 memory. I've done the following:
 
set /proc/sys/kernel/shmmax to=20 512000000
shared_buffers =3D 32000
sort_mem =3D=20 32000
max_connections=3D64
fsync=3Dfalse
Can someone tell me what effective_cache_s= ize=20 should be set to? what kind of formula to use for this? (I got the other fi= gures=20 from phpbuilder.com, and modified for 512k memory).
 
The databases I'm using have about 200,000= + news=20 headlines with full-text indexes (which range upwards of a few million reco= rds).=20 They are updated about every 5 to 10 minutes, which means I also have to ru= n a=20 vacuum about once every 2 to 3 hours at least. As I get more updates obviou= sly=20 the efficiency goes down. I'm trying to make the most of this system but do= n't=20 fully understand PG's optimization stuff.
 
Thanks in advance,
Justin Long
 
------=_NextPart_000_000C_01C35502.69E97930-- From pgsql-performance-owner@postgresql.org Mon Jul 28 14:42:05 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DD77ED1C4E3 for ; Mon, 28 Jul 2003 16:26:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 00247-10 for ; Mon, 28 Jul 2003 13:25:22 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D7DE9D1C4C9 for ; Mon, 28 Jul 2003 13:26:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6SGPvQ3010186; Mon, 28 Jul 2003 12:25:58 -0400 (EDT) To: Franco Bruno Borghesi Cc: Josh Berkus , Daniel Migowski , pgsql-performance@postgresql.org Subject: Re: Mapping a database completly into Memory In-reply-to: <1059401815.749.7.camel@taz.oficina> References: <97842368.20030727104901@artis.uni-oldenburg.de> <9002.1059322732@sss.pgh.pa.us> <200307272114.11579.josh@agliodbs.com> <1059401815.749.7.camel@taz.oficina> Comments: In-reply-to Franco Bruno Borghesi message dated "28 Jul 2003 11:16:55 -0300" Date: Mon, 28 Jul 2003 12:25:57 -0400 Message-ID: <10185.1059409557@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/439 X-Sequence-Number: 2732 Franco Bruno Borghesi writes: > wouldn't also increasing shared_buffers to 64 or 128 MB be a good > performance improvement? This way, pages belonging to heavily used > indexes would be already cached by the database itself. Not necessarily. The trouble with large shared_buffers settings is you end up with lots of pages being doubly cached (both in PG's buffers and in the kernel's disk cache), thus wasting RAM. If we had a portable way of preventing the kernel from caching the same page, it would make more sense to run with large shared_buffers. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 28 14:31:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 15E3ED1C509 for ; Mon, 28 Jul 2003 16:51:35 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 01464-08 for ; Mon, 28 Jul 2003 13:50:38 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 1CB6AD1C511 for ; Mon, 28 Jul 2003 13:51:33 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3354115; Mon, 28 Jul 2003 09:51:51 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Tom Lane Subject: Re: Mapping a database completly into Memory Date: Mon, 28 Jul 2003 09:50:36 -0700 User-Agent: KMail/1.4.3 References: <97842368.20030727104901@artis.uni-oldenburg.de> <1059401815.749.7.camel@taz.oficina> <10185.1059409557@sss.pgh.pa.us> In-Reply-To: <10185.1059409557@sss.pgh.pa.us> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307280950.36076.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/438 X-Sequence-Number: 2731 Tom, > If we had a portable way > of preventing the kernel from caching the same page, it would make more > sense to run with large shared_buffers. Really? I thought we wanted to move the other way ... that is, if we could get over the portability issues, eliminate shared_buffers entirely and rely completely on the OS cache. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 28 17:05:12 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BC14FD1C4B9 for ; Mon, 28 Jul 2003 16:58:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 03074-05 for ; Mon, 28 Jul 2003 13:57:26 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id C447FD1C4EE for ; Mon, 28 Jul 2003 13:58:20 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6SGwJQ3015251; Mon, 28 Jul 2003 12:58:19 -0400 (EDT) To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Mapping a database completly into Memory In-reply-to: <200307280950.36076.josh@agliodbs.com> References: <97842368.20030727104901@artis.uni-oldenburg.de> <1059401815.749.7.camel@taz.oficina> <10185.1059409557@sss.pgh.pa.us> <200307280950.36076.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Mon, 28 Jul 2003 09:50:36 -0700" Date: Mon, 28 Jul 2003 12:58:19 -0400 Message-ID: <15250.1059411499@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/449 X-Sequence-Number: 2742 Josh Berkus writes: >> If we had a portable way >> of preventing the kernel from caching the same page, it would make more >> sense to run with large shared_buffers. > Really? I thought we wanted to move the other way ... that is, if we could > get over the portability issues, eliminate shared_buffers entirely and rely > completely on the OS cache. That seems unlikely to happen: there are cache-coherency problems if you don't do your page-level access through shared buffers. Some have suggested using mmap access to the data files in place of shared memory, but that introduces a slew of issues of its own. It might happen but I'm not holding my breath. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jul 28 17:03:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C7823D1C4C8 for ; Mon, 28 Jul 2003 17:11:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 03586-05 for ; Mon, 28 Jul 2003 14:10:05 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 705CBD1C4B9 for ; Mon, 28 Jul 2003 14:10:59 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3354170; Mon, 28 Jul 2003 10:11:18 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Balazs Wellisch" Subject: Re: Tuning PostgreSQL Date: Mon, 28 Jul 2003 10:10:02 -0700 User-Agent: KMail/1.4.3 Cc: "'PgSQL Performance ML'" References: <000401c353ba$16cb98d0$0600a8c0@home01> In-Reply-To: <000401c353ba$16cb98d0$0600a8c0@home01> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307281010.02770.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/448 X-Sequence-Number: 2741 Balasz, > Since there seem to be a lot of different opinions regarding the various > different RAID configurations I thought I'd post this link to the list: > http://www.storagereview.com/guide2000/ref/hdd/perf/raid/index.html Yeah ... this is a really good article. Made me realize why "stripey" RAID sucks for OLTP databases, unless you throw a lot of platters at them. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 28 16:46:04 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 298E0D1C511 for ; Mon, 28 Jul 2003 17:44:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 07123-03 for ; Mon, 28 Jul 2003 14:43:43 -0300 (ADT) Received: from lucifer.akyasociados.com.ar (unknown [200.69.203.237]) by svr1.postgresql.org (Postfix) with ESMTP id 256CBD1C4E3 for ; Mon, 28 Jul 2003 14:44:37 -0300 (ADT) Received: from taz.oficina (taz.oficina [192.168.1.174]) (authenticated bits=0) by lucifer.akyasociados.com.ar (8.12.9/8.12.9) with ESMTP id h6SHmp2J000756; Mon, 28 Jul 2003 14:48:51 -0300 (ART) (envelope-from franco@akyasociados.com.ar) Subject: Re: Mapping a database completly into Memory From: Franco Bruno Borghesi To: Josh Berkus Cc: Tom Lane , pgsql-performance@postgresql.org In-Reply-To: <200307280950.36076.josh@agliodbs.com> References: <97842368.20030727104901@artis.uni-oldenburg.de> <1059401815.749.7.camel@taz.oficina> <10185.1059409557@sss.pgh.pa.us> <200307280950.36076.josh@agliodbs.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-6xp8HrO23Z50AhoMANm1" Organization: AK y Asociados S.R.L. Message-Id: <1059414481.1957.1.camel@taz.oficina> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.0 Date: 28 Jul 2003 14:48:02 -0300 X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/447 X-Sequence-Number: 2740 --=-6xp8HrO23Z50AhoMANm1 Content-Type: multipart/alternative; boundary="=-UrP0EGn2eV4SfGs9VKAw" --=-UrP0EGn2eV4SfGs9VKAw Content-Type: text/plain Content-Transfer-Encoding: quoted-printable But I think it's still a good option.=20 For example, in servers where there are other applications running (a web server, for example) that are constantly accesing the disk and replacing cached postgresql pages in the kernel, having shared buffers could reduce this efect and assure the precense of our pages in memory... I gues :) On Mon, 2003-07-28 at 13:50, Josh Berkus wrote: > Tom, >=20 > > If we had a portable way > > of preventing the kernel from caching the same page, it would make more > > sense to run with large shared_buffers. >=20 > Really? I thought we wanted to move the other way ... that is, if we cou= ld=20 > get over the portability issues, eliminate shared_buffers entirely and re= ly=20 > completely on the OS cache. --=-UrP0EGn2eV4SfGs9VKAw Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable But I think it's still a good option.

For example, in servers where there are other applications running (a web s= erver, for example) that are constantly accesing the disk and replacing cac= hed postgresql pages in the kernel, having shared buffers could reduce this= efect and assure the precense of our pages in memory... I gues :)

On Mon, 2003-07-28 at 13:50, Josh Berkus wrote:
Tom,

> If we had a portable way
> of preventing the kernel from caching the same page, it would make more
> sense to run with large shared_buffers.

Really?  I thought we wanted to move the other way ... that is, if we could=
=20
get over the portability issues, eliminate shared_buffers entirely and rely=
=20
completely on the OS cache.
--=-UrP0EGn2eV4SfGs9VKAw-- --=-6xp8HrO23Z50AhoMANm1 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/JWHR21dVnhLsBV0RAogxAJ9veZe97qtA2bhSMQWrEeRnFK3KbwCffLMy QJch389SPV72kivv8frmQqw= =VkEW -----END PGP SIGNATURE----- --=-6xp8HrO23Z50AhoMANm1-- From pgsql-performance-owner@postgresql.org Mon Jul 28 16:33:30 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 63F39D1C4EA for ; Mon, 28 Jul 2003 18:10:43 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08058-05 for ; Mon, 28 Jul 2003 15:09:47 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 3993DD1C4E3 for ; Mon, 28 Jul 2003 15:10:41 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6SI9ULV029327; Mon, 28 Jul 2003 12:09:31 -0600 (MDT) Date: Mon, 28 Jul 2003 11:58:11 -0600 (MDT) From: "scott.marlowe" To: Daniel Migowski Cc: Subject: Re: Mapping Database completly into memory In-Reply-To: <1662072945.20030727104009@artis.uni-oldenburg.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/445 X-Sequence-Number: 2738 On Sun, 27 Jul 2003, Daniel Migowski wrote: > Hallo pgsql-performance, > > I just wondered if there is a possibility to map my database running > on a linux system completly into memory and to only use disk > accesses for writes. > > I got a nice machine around with 2 gigs of ram, and my database at > the moment uses about 30MB on the disks. > > Or does Postgresql do this automtatically, with some cache adjusting > parameters, and after doing a select * from on my > database? Are you looking at a read only type database thing here? It's generally considered bad practice to run databases from memory only, since a loss of power results in a loss of all data. Postgresql and whatever OS it runs on can usually cache an entire 30 meg data set in memory easily. You'll need to crank up shared buffers a bit (1000 shared buffers is 8 megs, so 5000 should be enough to cache the whole thing (~40 megs). Also, be sure and crank up your effective_cache_size so the planner knows the kernel has lots of space for caching data and favors index scans. From pgsql-performance-owner@postgresql.org Mon Jul 28 16:34:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4E5C1D1C91F for ; Mon, 28 Jul 2003 18:01:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 06925-04 for ; Mon, 28 Jul 2003 15:00:24 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 4BB1DD1C507 for ; Mon, 28 Jul 2003 15:01:19 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3354339; Mon, 28 Jul 2003 11:01:39 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Justin Long" , Subject: Re: Optimization Date: Mon, 28 Jul 2003 11:00:19 -0700 User-Agent: KMail/1.4.3 References: <000f01c35523$f13dee90$ecd36044@tarzan> In-Reply-To: <000f01c35523$f13dee90$ecd36044@tarzan> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307281100.19084.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/446 X-Sequence-Number: 2739 Justin, > I am trying to understand the various factors used by Postgres to optimiz= e.=20 I presently have a dual-866 Dell server with 1GB of memory. I've done the= =20 following: Please set the performance articles at:=20 http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jul 28 16:31:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CAC53D1C4E3 for ; Mon, 28 Jul 2003 18:19:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 05659-09 for ; Mon, 28 Jul 2003 15:18:17 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id A7283D1C4B9 for ; Mon, 28 Jul 2003 15:19:11 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19hCaV-0000bx-00 for ; Mon, 28 Jul 2003 14:19:11 -0400 Received: by dba2 (Postfix, from userid 1019) id 4511BCEC9; Mon, 28 Jul 2003 14:20:33 -0400 (EDT) Date: Mon, 28 Jul 2003 14:20:33 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Mapping a database completly into Memory Message-ID: <20030728182033.GH6279@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <97842368.20030727104901@artis.uni-oldenburg.de> <9002.1059322732@sss.pgh.pa.us> <200307272114.11579.josh@agliodbs.com> <1059401815.749.7.camel@taz.oficina> <10185.1059409557@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10185.1059409557@sss.pgh.pa.us> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/444 X-Sequence-Number: 2737 On Mon, Jul 28, 2003 at 12:25:57PM -0400, Tom Lane wrote: > in the kernel's disk cache), thus wasting RAM. If we had a portable way > of preventing the kernel from caching the same page, it would make more > sense to run with large shared_buffers. Plus, Postgres seems not to be very good at managing very large buffer sets. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Mon Jul 28 15:44:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 18CE4D1C4E3 for ; Mon, 28 Jul 2003 18:27:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 11180-02 for ; Mon, 28 Jul 2003 15:26:24 -0300 (ADT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id 21F97D1C4CB for ; Mon, 28 Jul 2003 15:27:19 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6SIRJ0P005164; Mon, 28 Jul 2003 13:27:19 -0500 Reply-To: From: "Nick Fankhauser - Doxpop" To: "Justin Long" , Subject: Re: Optimization Date: Mon, 28 Jul 2003 13:25:55 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <000f01c35523$f13dee90$ecd36044@tarzan> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/442 X-Sequence-Number: 2735 Justin- It sounds like you're on a system similar to ours, so I'll pass along the changes that I made, which seem to have increased performance, and most importantly, haven't hurt anything. The main difference in our environment is that we are less Update/Insert intensive than you are- in our application, 90% of our information (court cases) is static (Closed) and 10% are frequently being updated (Pending/Active). This means I only vacuum once a week. I haven't had chance to churn out objective tests yet, but my subjective judgment is that this set of params works well: Set SHMMAX and SHMALL in the kernel to 134217728 (128MB) Set shared_buffers to 8192 (64MB) Set sort_mem to 16384 (16MB) Set effective_cache_size to 65536 (1/2 GB) The Hardware is a dual-processor Athlon 1.2 Ghz box with 1 GB of RAM and the DB on SCSI RAID drives. The database size is about 8GB, with the largest table 2.5 GB, and the two most commonly queried tables at 1 GB each. The OS is Debian Linux kernel 2.4.x (recompiled custom kernel for dual processor support) The PostgreSQL version is 7.3.2 My reasoning was to increase shared_buffers based on anecdotal recommendations I've seen on this list to 64MB and boost the OS SHMMAX to twice that value to allow adequate room for other shared memory needs, thus reserving 128MB. Of the remaining memory, 256MB goes to 16MB sort space times a guesstimate of 16 simultaneous sorts at any given time. If I leave about 128 MB for headroom, then 1/2 GB should be left available for the effective cache size. I've never been tempted to turn fsync off. That seems like a risky move. Regards, -Nick --------------------------------------------------------------------- Nick Fankhauser nickf@doxpop.com Phone 1.765.965.7363 Fax 1.765.962.9788 doxpop - Court records at your fingertips - http://www.doxpop.com/ From pgsql-performance-owner@postgresql.org Mon Jul 28 15:32:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D9FE5D1C4EC for ; Mon, 28 Jul 2003 18:29:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 08134-10 for ; Mon, 28 Jul 2003 15:29:02 -0300 (ADT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id D7618D1C4CB for ; Mon, 28 Jul 2003 15:29:56 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6SITv0P005192; Mon, 28 Jul 2003 13:29:58 -0500 Reply-To: From: "Nick Fankhauser" To: "Justin Long" , Subject: Re: Optimization Date: Mon, 28 Jul 2003 13:28:34 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <000f01c35523$f13dee90$ecd36044@tarzan> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/441 X-Sequence-Number: 2734 Justin- It sounds like you're on a system similar to ours, so I'll pass along the changes that I made, which seem to have increased performance, and most importantly, haven't hurt anything. The main difference in our environment is that we are less Update/Insert intensive than you are- in our application, 90% of our information (court cases) is static (Closed) and 10% are frequently being updated (Pending/Active). This means I only vacuum once a week. I haven't had chance to churn out objective tests yet, but my subjective judgment is that this set of params works well: Set SHMMAX and SHMALL in the kernel to 134217728 (128MB) Set shared_buffers to 8192 (64MB) Set sort_mem to 16384 (16MB) Set effective_cache_size to 65536 (1/2 GB) The Hardware is a dual-processor Athlon 1.2 Ghz box with 1 GB of RAM and the DB on SCSI RAID drives. The database size is about 8GB, with the largest table 2.5 GB, and the two most commonly queried tables at 1 GB each. The OS is Debian Linux kernel 2.4.x (recompiled custom kernel for dual processor support) The PostgreSQL version is 7.3.2 My reasoning was to increase shared_buffers based on anecdotal recommendations I've seen on this list to 64MB and boost the OS SHMMAX to twice that value to allow adequate room for other shared memory needs, thus reserving 128MB off the top. Of the remaining memory, 256MB goes to 16MB sort space times a guesstimate of 16 simultaneous sorts at any given time. If I leave about 128 MB for headroom, then 1/2 GB should be left available for the effective cache size. I've never been tempted to turn fsync off. That seems like a risky move. Regards, -Nick --------------------------------------------------------------------- Nick Fankhauser nickf@doxpop.com Phone 1.765.965.7363 Fax 1.765.962.9788 doxpop - Court records at your fingertips - http://www.doxpop.com/ From pgsql-performance-owner@postgresql.org Mon Jul 28 16:27:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2DD32D1C4EC for ; Mon, 28 Jul 2003 18:40:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 09708-06 for ; Mon, 28 Jul 2003 15:39:38 -0300 (ADT) Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by svr1.postgresql.org (Postfix) with ESMTP id 313F8D1C4E3 for ; Mon, 28 Jul 2003 15:40:32 -0300 (ADT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.12.3/8.12.3/Debian-6.4) with SMTP id h6SIeX0P005320; Mon, 28 Jul 2003 13:40:33 -0500 Reply-To: From: "Nick Fankhauser" To: "Justin Long" , Subject: Re: Optimization Date: Mon, 28 Jul 2003 13:39:09 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <000f01c35523$f13dee90$ecd36044@tarzan> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/443 X-Sequence-Number: 2736 >Can someone tell me what effective_cache_size should be set to? You may be able to intuit this from my last post, but if I understand correctly, what you should be doing is estimating how much memory is likely to be "left over" for the OS to do disk caching with after all of the basic needs of the OS, PostgreSQL & any other applications are taken care of. You then tell postgresql what to expect in terms of caching resources by putting this number into effective_cache_size, and this allows the query planner come up with a strategy that is optimized for the expected cache size. So the "formula" would be: Figure out how much memory is normally in use allowing adequate margins, subtract this from your total RAM, and make the remainder your effective_cache size. -Nick From pgsql-performance-owner@postgresql.org Mon Jul 28 17:47:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6B45FD1C95D for ; Mon, 28 Jul 2003 19:28:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 11181-08 for ; Mon, 28 Jul 2003 16:27:50 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 57D69D1C50D for ; Mon, 28 Jul 2003 16:28:44 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3354608; Mon, 28 Jul 2003 12:29:04 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Justin Long" , Subject: Re: Optimization Date: Mon, 28 Jul 2003 12:27:44 -0700 User-Agent: KMail/1.4.3 References: <000f01c35523$f13dee90$ecd36044@tarzan> In-Reply-To: <000f01c35523$f13dee90$ecd36044@tarzan> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307281227.44072.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/450 X-Sequence-Number: 2743 Justin, > I am trying to understand the various factors used by Postgres to optimiz= e.=20 I presently have a dual-866 Dell server with 1GB of memory. I've done the= =20 following: see: http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php which has articles on .conf files. (feel free to link these articles at PHPbuilder.com and elsewhere!) > The databases I'm using have about 200,000+ news headlines with full-text= =20 indexes (which range upwards of a few million records). They are updated=20 about every 5 to 10 minutes, which means I also have to run a vacuum about= =20 once every 2 to 3 hours at least. As I get more updates obviously the=20 efficiency goes down. I'm trying to make the most of this system but don't= =20 fully understand PG's optimization stuff. Unless you're running PostgreSQL 7.1 or earlier, you should be VACUUMing ev= ery=20 10-15 minutes, not every 2-3 hours. Regular VACUUM does not lock your=20 database. You will also want to increase your FSM_relations so that VACUUM= =20 is more effective/efficient; again, see the articles. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-admin-owner@postgresql.org Mon Jul 28 18:29:07 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DB4FFD1C90F for ; Mon, 28 Jul 2003 21:29:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 21458-04 for ; Mon, 28 Jul 2003 18:28:10 -0300 (ADT) Received: from web21102.mail.yahoo.com (web21102.mail.yahoo.com [216.136.227.104]) by svr1.postgresql.org (Postfix) with SMTP id 5C0F0D1C508 for ; Mon, 28 Jul 2003 18:29:03 -0300 (ADT) Message-ID: <20030728212905.79549.qmail@web21102.mail.yahoo.com> Received: from [65.206.239.222] by web21102.mail.yahoo.com via HTTP; Mon, 28 Jul 2003 14:29:05 PDT Date: Mon, 28 Jul 2003 14:29:05 -0700 (PDT) From: Shankar K Subject: Rebuild indexes To: pgsql-performance@postgresql.org Cc: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/278 X-Sequence-Number: 9618 Hi Everyone, I've a kind of less inserts/mostly updates table, which we vacuum every half-hour. here is the output of vacuum analyze INFO: --Relation public.accounts-- INFO: Index accounts_u1: Pages 1498; Tuples 515: Deleted 179. CPU 0.00s/0.00u sec elapsed 0.00 sec. INFO: Index accounts_u2: Pages 2227; Tuples 515: Deleted 179. CPU 0.00s/0.00u sec elapsed 0.01 sec. INFO: Index accounts_u3: Pages 246; Tuples 515: Deleted 179. CPU 0.00s/0.00u sec elapsed 0.00 sec. however its indexes keeps growing on and on. After surfing the manuals for a while, i came to know that vacuum doesn't clears up dead tuples caused by updates. so i then decided to do reindex online, but that makes exclusive lock on table which would prevent writing on to tables. finally i'm at a point where i decided to do index swapping. for e.g. 1. create index accounts_u1_swap,accounts_u2_swap and accounts_u3_swap in addition to the original indexes 2. analyze table to update stats, so that the table knows about new indexes. 3. drop original indexes 4. i wish i had a rename index command to rename _swap to its original index name. now create indexes with original name 5. follow #2 and #3 (now drop _swap indexes) Is there a better way to do this. comments are appreciated. thanks -Shankar __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com From pgsql-admin-owner@postgresql.org Thu Jul 31 20:58:13 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1C854D1C4C9; Tue, 29 Jul 2003 00:19:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 28848-06; Mon, 28 Jul 2003 21:19:04 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id F0FBBD1C4B7; Mon, 28 Jul 2003 21:19:56 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3355595; Mon, 28 Jul 2003 17:20:19 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Shankar K , pgsql-performance@postgresql.org Subject: Re: [PERFORM] Rebuild indexes Date: Mon, 28 Jul 2003 17:18:59 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-admin@postgresql.org References: <20030728212905.79549.qmail@web21102.mail.yahoo.com> In-Reply-To: <20030728212905.79549.qmail@web21102.mail.yahoo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307281718.59127.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/367 X-Sequence-Number: 9707 Shankar, > Is there a better way to do this. comments are > appreciated. No. This is one of the major features in 7.4; FSM and VACUUM will manage= =20 indexes as well. Until then, we all suffer .... BTW, the REINDEX command is transaction-safe. So if your database has "lu= ll"=20 periods, you can run it without worrying that any updates will get turned= =20 back. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-admin-owner@postgresql.org Mon Jul 28 23:29:03 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 75AC5D1C4EC; Tue, 29 Jul 2003 02:21:35 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 36266-04; Mon, 28 Jul 2003 23:20:41 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 76B80D1C4EB; Mon, 28 Jul 2003 23:21:33 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6T2LbQ3017555; Mon, 28 Jul 2003 22:21:37 -0400 (EDT) To: Shankar K Cc: pgsql-performance@postgresql.org, pgsql-admin@postgresql.org Subject: Re: Rebuild indexes In-reply-to: <20030728212905.79549.qmail@web21102.mail.yahoo.com> References: <20030728212905.79549.qmail@web21102.mail.yahoo.com> Comments: In-reply-to Shankar K message dated "Mon, 28 Jul 2003 14:29:05 -0700" Date: Mon, 28 Jul 2003 22:21:37 -0400 Message-ID: <17554.1059445297@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/281 X-Sequence-Number: 9621 Shankar K writes: > ... so i then decided to do reindex online, but > that makes exclusive lock on table which would prevent > writing on to tables. So does CREATE INDEX, so it's not clear what you're buying with all these pushups. > 2. analyze table to update stats, so that the table > knows about new indexes. You do not need to ANALYZE to get the system to notice new indexes. > 4. i wish i had a rename index command to rename _swap > to its original index name. You can rename indexes as if they were tables. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jul 29 00:03:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7D806D1CA05 for ; Tue, 29 Jul 2003 03:00:46 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 38297-02 for ; Mon, 28 Jul 2003 23:59:47 -0300 (ADT) Received: from web21106.mail.yahoo.com (web21106.mail.yahoo.com [216.136.227.108]) by svr1.postgresql.org (Postfix) with SMTP id 518F2D1C936 for ; Tue, 29 Jul 2003 00:00:44 -0300 (ADT) Message-ID: <20030729030039.15806.qmail@web21106.mail.yahoo.com> Received: from [12.234.204.72] by web21106.mail.yahoo.com via HTTP; Mon, 28 Jul 2003 20:00:39 PDT Date: Mon, 28 Jul 2003 20:00:39 -0700 (PDT) From: Shankar K Subject: Re: [ADMIN] Rebuild indexes To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <17554.1059445297@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-Archive-Number: 200307/454 X-Sequence-Number: 2747 thanks tom. i wasn't sure about create index taking exclusive locks on tables too. so i could as well reindex than doing the whole _swap mess during off-peak hrs. --- Tom Lane wrote: > Shankar K writes: > > ... so i then decided to do reindex online, but > > that makes exclusive lock on table which would > prevent > > writing on to tables. > > So does CREATE INDEX, so it's not clear what you're > buying with > all these pushups. > > > 2. analyze table to update stats, so that the > table > > knows about new indexes. > > You do not need to ANALYZE to get the system to > notice new indexes. > > > 4. i wish i had a rename index command to rename > _swap > > to its original index name. > > You can rename indexes as if they were tables. > > regards, tom lane > > ---------------------------(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 __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com From pgsql-performance-owner@postgresql.org Tue Jul 29 02:44:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A5F42D1C90E for ; Tue, 29 Jul 2003 05:44:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 48845-04 for ; Tue, 29 Jul 2003 02:43:17 -0300 (ADT) Received: from rtlocal.trade-india.com (mail-relay.trade-india.com [203.196.129.235]) by svr1.postgresql.org (Postfix) with SMTP id 5BC94D1C510 for ; Tue, 29 Jul 2003 02:44:11 -0300 (ADT) Received: (qmail 8688 invoked from network); 29 Jul 2003 05:53:12 -0000 Received: from unknown (HELO system67.trade-india-local.com) (unknown) by unknown with SMTP; 29 Jul 2003 05:53:12 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: pgsql-performance@postgresql.org Subject: Why performance improvement on converting subselect to a function ? Date: Tue, 29 Jul 2003 11:14:29 +0530 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307291114.29567.mallah@trade-india.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/455 X-Sequence-Number: 2748 Hi, For each company_id in certain table i have to search the same table get certain rows sort them and pick up the top one , i tried using this subselect: explain analyze SELECT company_id , (SELECT edition FROM ONLY public.branding_master b WHERE old_company_id = a.company_id OR company_id = a.company_id ORDER BY b.company_id DESC LIMIT 1) from public.branding_master a limit 50; QUERY PLAN Limit (cost=0.00..3.52 rows=50 width=4) (actual time=463.97..19429.54 rows=50 loops=1) -> Seq Scan on branding_master a (cost=0.00..6530.79 rows=92679 width=4) (actual time=463.97..19429.28 rows=51 loops=1) SubPlan -> Limit (cost=0.00..168.36 rows=1 width=6) (actual time=66.96..380.94 rows=1 loops=51) -> Index Scan Backward using branding_master_pkey on branding_master b (cost=0.00..23990.26 rows=142 width=6) (actual time=66.95..380.93 rows=1 loops=51) Filter: ((old_company_id = $0) OR (company_id = $0)) Total runtime: 19429.76 msec (7 rows) Very Slow 20 secs. CREATE FUNCTION most_recent_edition (integer) returns integer AS 'SELECT edition::integer FROM ONLY public.branding_master b WHERE old_company_id = $1 OR company_id = $1 ORDER BY b.company_id DESC LIMIT 1 ' language 'sql'; tradein_clients=# explain analyze SELECT company_id , most_recent_edition(company_id) from public.branding_master limit 50; QUERY PLAN Limit (cost=0.00..3.52 rows=50 width=4) (actual time=208.23..3969.39 rows=50 loops=1) -> Seq Scan on branding_master (cost=0.00..6530.79 rows=92679 width=4) (actual time=208.22..3969.15 rows=51 loops=1) Total runtime: 3969.52 msec (3 rows) Time: 4568.33 ms 4 times faster. But i feel it can be lot more faster , can anyone suggest me something to try. Indexes exists on company_id(pkey) and old_company_id Most of the chores are already done [ vacuum full analyze , reindex ] Regds mallah. From pgsql-performance-owner@postgresql.org Tue Jul 29 03:50:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 35244D1C4B8 for ; Tue, 29 Jul 2003 06:50:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 52965-01 for ; Tue, 29 Jul 2003 03:49:18 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 95C6BD1C4B7 for ; Tue, 29 Jul 2003 03:50:12 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6T6mMIO026724 for ; Tue, 29 Jul 2003 12:18:22 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6T6mLRb026696 for ; Tue, 29 Jul 2003 12:18:22 +0530 From: "Shridhar Daithankar" To: Date: Tue, 29 Jul 2003 12:21:59 +0530 MIME-Version: 1.0 Subject: Re: Optimization Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F2666E7.7231.44FA68B@localhost> In-reply-to: <200307281227.44072.josh@agliodbs.com> References: <000f01c35523$f13dee90$ecd36044@tarzan> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/456 X-Sequence-Number: 2749 On 28 Jul 2003 at 12:27, Josh Berkus wrote: > Unless you're running PostgreSQL 7.1 or earlier, you should be VACUUMing every > 10-15 minutes, not every 2-3 hours. Regular VACUUM does not lock your > database. You will also want to increase your FSM_relations so that VACUUM > is more effective/efficient; again, see the articles. There is an auto-vacuum daemon in contrib and if I understand it correctly, it is not getting much of a field testing. How about you guys installing it and trying it? Bye Shridhar -- O'Reilly's Law of the Kitchen: Cleanliness is next to impossible From pgsql-performance-owner@postgresql.org Tue Jul 29 04:14:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5F20CD1C4CD for ; Tue, 29 Jul 2003 07:14:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 49986-06 for ; Tue, 29 Jul 2003 04:13:20 -0300 (ADT) Received: from smtp.blueyonder.co.uk (pc-62-31-245-46-gl.blueyonder.co.uk [62.31.245.46]) by svr1.postgresql.org (Postfix) with ESMTP id 29B19D1C4C8 for ; Tue, 29 Jul 2003 04:14:16 -0300 (ADT) Received: from reddragon.localdomain ([127.0.0.1] helo=localhost) by smtp.blueyonder.co.uk with esmtp (Exim 4.10) id 19hOhH-00008q-00 for pgsql-performance@postgresql.org; Tue, 29 Jul 2003 08:14:59 +0100 Date: Tue, 29 Jul 2003 08:14:59 +0100 (BST) From: Peter Childs X-X-Sender: peter@RedDragon.Childs Cc: pgsql-performance@postgresql.org Subject: Re: Optimization In-Reply-To: <3F2666E7.7231.44FA68B@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/457 X-Sequence-Number: 2750 On Tue, 29 Jul 2003, Shridhar Daithankar wrote: > On 28 Jul 2003 at 12:27, Josh Berkus wrote: > > Unless you're running PostgreSQL 7.1 or earlier, you should be VACUUMing every > > 10-15 minutes, not every 2-3 hours. Regular VACUUM does not lock your > > database. You will also want to increase your FSM_relations so that VACUUM > > is more effective/efficient; again, see the articles. > > There is an auto-vacuum daemon in contrib and if I understand it correctly, it > is not getting much of a field testing. How about you guys installing it and > trying it? If there is such a daemon, what is it called? As I can't see it. Is it part of gborg? Peter Childs From pgsql-performance-owner@postgresql.org Tue Jul 29 04:19:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 46B3DD1C4C8 for ; Tue, 29 Jul 2003 07:19:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 52980-02 for ; Tue, 29 Jul 2003 04:18:47 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 3DCB4D1C4D0 for ; Tue, 29 Jul 2003 04:19:42 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6T7HrpW003006 for ; Tue, 29 Jul 2003 12:47:53 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6T7HqRZ002993 for ; Tue, 29 Jul 2003 12:47:52 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org Date: Tue, 29 Jul 2003 12:51:30 +0530 MIME-Version: 1.0 Subject: Re: Optimization Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F266DD2.30197.46AAB7A@localhost> In-reply-to: References: <3F2666E7.7231.44FA68B@localhost> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/458 X-Sequence-Number: 2751 On 29 Jul 2003 at 8:14, Peter Childs wrote: > On Tue, 29 Jul 2003, Shridhar Daithankar wrote: > > > On 28 Jul 2003 at 12:27, Josh Berkus wrote: > > > Unless you're running PostgreSQL 7.1 or earlier, you should be VACUUMing every > > > 10-15 minutes, not every 2-3 hours. Regular VACUUM does not lock your > > > database. You will also want to increase your FSM_relations so that VACUUM > > > is more effective/efficient; again, see the articles. > > > > There is an auto-vacuum daemon in contrib and if I understand it correctly, it > > is not getting much of a field testing. How about you guys installing it and > > trying it? > > If there is such a daemon, what is it called? As I can't see it. > Is it part of gborg? It is in sources. See contrib module in postgresql CVS, 7.4 beta if you prefer to wait till announement. It is called as pgavd.. Bye Shridhar -- squatcho, n.: The button at the top of a baseball cap. -- "Sniglets", Rich Hall & Friends From pgsql-performance-owner@postgresql.org Tue Jul 29 08:57:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 57817D1C508 for ; Tue, 29 Jul 2003 11:56:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 66248-03 for ; Tue, 29 Jul 2003 08:55:57 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 669D3D1C4E6 for ; Tue, 29 Jul 2003 08:56:51 -0300 (ADT) Received: from acdc.int.libertyrms.com ([10.1.2.254] helo=libertyrms.info) by mail.libertyrms.com with smtp (Exim 3.22 #3 (Debian)) id 19hT65-0006aK-00 for ; Tue, 29 Jul 2003 07:56:53 -0400 Received: from 64.229.210.126 (SquirrelMail authenticated user cbbrowne) by look.libertyrms.com with HTTP; Tue, 29 Jul 2003 07:56:56 -0400 (EDT) Message-ID: <62321.64.229.210.126.1059479816.squirrel@look.libertyrms.com> Date: Tue, 29 Jul 2003 07:56:56 -0400 (EDT) Subject: autovacuum From: "Christopher Browne" To: X-Priority: 3 Importance: Normal Reply-To: cbbrowne@libertyrms.info X-Mailer: SquirrelMail (version 1.2.11) 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-Archive-Number: 200307/459 X-Sequence-Number: 2752 Shridhar wrote: >There is an auto-vacuum daemon in contrib and if I understand it correctly, >it is not getting much of a field testing. How about you guys installing it >and trying it. I'm one of those that has been running it; there are numerous test systems around where it has been running off and on over the last few months. The thing I keep reconstructing is the script to automatically start it up. It should get started shortly after the postmaster starts up; based on variations on the systems I work with, there's a lot of variation on how that gets handled, which hasn't let me see anything stabilize as the Right Way to start it up :-(. -- (reverse (concatenate 'string "ofni.smrytrebil@" "enworbbc")) Christopher Browne (416) 646 3304 x124 (land) From pgsql-performance-owner@postgresql.org Tue Jul 29 09:03:53 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 816ADD1C4CD for ; Tue, 29 Jul 2003 12:03:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67003-02 for ; Tue, 29 Jul 2003 09:02:45 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 8E488D1C4C1 for ; Tue, 29 Jul 2003 09:03:39 -0300 (ADT) Received: from acdc.int.libertyrms.com ([10.1.2.254] helo=libertyrms.info) by mail.libertyrms.com with smtp (Exim 3.22 #3 (Debian)) id 19hTCf-0006i5-00 for ; Tue, 29 Jul 2003 08:03:41 -0400 Received: from 64.229.210.126 (SquirrelMail authenticated user cbbrowne) by look.libertyrms.com with HTTP; Tue, 29 Jul 2003 08:03:44 -0400 (EDT) Message-ID: <62334.64.229.210.126.1059480224.squirrel@look.libertyrms.com> Date: Tue, 29 Jul 2003 08:03:44 -0400 (EDT) Subject: Autovacuum From: "Christopher Browne" To: X-Priority: 3 Importance: Normal Reply-To: cbbrowne@libertyrms.info X-Mailer: SquirrelMail (version 1.2.11) 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-Archive-Number: 200307/460 X-Sequence-Number: 2753 "Shridhar Daithankar" wrote: >It is called as pgavd.. No, it is called pg_autovacuum "pgavd" was a previous attempt at this that was being distributed on gborg. Its parser ussage (I don't recall if it was just lex or whether it also included yacc) made it troublesome to get to run on all platforms. The code for pg_autovacuum is in 7.4, in contrib; it also works perfectly well in 7.3, so you should be able to grab the directory and drop the code into the 7.3 contrib area. -- (reverse (concatenate 'string "ofni.smrytrebil@" "enworbbc")) Christopher Browne (416) 646 3304 x124 (land) From pgsql-performance-owner@postgresql.org Tue Jul 29 09:29:54 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E473AD1C4B9 for ; Tue, 29 Jul 2003 12:29:49 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67331-05 for ; Tue, 29 Jul 2003 09:28:54 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id EB43FD1C4CD for ; Tue, 29 Jul 2003 09:29:46 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6TCS4g1014737 for ; Tue, 29 Jul 2003 17:58:04 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6TCS3K7014724 for ; Tue, 29 Jul 2003 17:58:03 +0530 From: "Shridhar Daithankar" To: Date: Tue, 29 Jul 2003 18:01:36 +0530 MIME-Version: 1.0 Subject: Re: Autovacuum Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F26B680.17444.58696F2@localhost> In-reply-to: <62334.64.229.210.126.1059480224.squirrel@look.libertyrms.com> 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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/461 X-Sequence-Number: 2754 On 29 Jul 2003 at 8:03, Christopher Browne wrote: > "Shridhar Daithankar" wrote: > >It is called as pgavd.. > > No, it is called pg_autovacuum > > "pgavd" was a previous attempt at this that was being distributed on > gborg. Its parser ussage (I don't recall if it was just lex or whether it > also included yacc) made it troublesome to get to run on all platforms. Yeah.. I wrote that and didn't quite maintain that after. Mathew finished pg_autovacuum shortly after that. I recall reading some bug reports and I fixed couple of problems in CVS but didn't bother to make a release after there was a contrib module.. > The code for pg_autovacuum is in 7.4, in contrib; it also works perfectly > well in 7.3, so you should be able to grab the directory and drop the code > into the 7.3 contrib area. Good to know that.. Bye Shridhar -- Flon's Law: There is not now, and never will be, a language in which it is the least bit difficult to write bad programs. From pgsql-performance-owner@postgresql.org Tue Jul 29 11:09:15 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BFC42D1C4B9 for ; Tue, 29 Jul 2003 14:09:13 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 70204-07 for ; Tue, 29 Jul 2003 11:08:18 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 74ABBD1C4B7 for ; Tue, 29 Jul 2003 11:09:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6TE9FQ3021658; Tue, 29 Jul 2003 10:09:15 -0400 (EDT) To: Rajesh Kumar Mallah Cc: pgsql-performance@postgresql.org Subject: Re: Why performance improvement on converting subselect to a function ? In-reply-to: <200307291114.29567.mallah@trade-india.com> References: <200307291114.29567.mallah@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Tue, 29 Jul 2003 11:14:29 +0530" Date: Tue, 29 Jul 2003 10:09:15 -0400 Message-ID: <21657.1059487755@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/462 X-Sequence-Number: 2755 Rajesh Kumar Mallah writes: > explain analyze SELECT company_id , (SELECT edition FROM ONLY > public.branding_master b WHERE old_company_id = a.company_id OR company_id = > a.company_id ORDER BY b.company_id DESC LIMIT 1) from public.branding_master > a limit 50; > Total runtime: 19429.76 msec > CREATE FUNCTION most_recent_edition (integer) returns integer AS 'SELECT > edition::integer FROM ONLY public.branding_master b WHERE old_company_id = $1 > OR company_id = $1 ORDER BY b.company_id DESC LIMIT 1 ' language 'sql'; > tradein_clients=# explain analyze SELECT company_id , > most_recent_edition(company_id) from public.branding_master limit 50; > Total runtime: 3969.52 msec Odd. Apparently the planner is picking a better plan in the function context than in the subselect context --- which is strange since it ought to have less information. AFAIK the only way to see the plan generated for a SQL function's query is like this: regression=# create function foo(int) returns int as regression-# 'select unique1 from tenk1 where unique1 = $1' language sql; CREATE FUNCTION regression=# set debug_print_plan TO 1; SET regression=# set client_min_messages TO debug; SET regression=# select foo(55); DEBUG: plan: DETAIL: {RESULT :startup_cost 0.00 :total_cost 0.01 :plan_rows 1 :plan_width 0 :targetlist ({TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 :resname foo :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false} :expr {FUNCEXPR :funcid 706101 :funcresulttype 23 :funcretset false ... (etc etc) Would you do that and send it along? I'm curious ... > But i feel it can be lot more faster , can anyone suggest me something > to try. Create an index on old_company_id, perhaps. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jul 29 12:28:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E7981D1C4EE for ; Tue, 29 Jul 2003 15:15:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77814-01 for ; Tue, 29 Jul 2003 12:14:07 -0300 (ADT) Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id 3E6B3D1C4CD for ; Tue, 29 Jul 2003 12:15:06 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kciLink.com (Postfix) with ESMTP id 6B5CD3E86 for ; Tue, 29 Jul 2003 11:15:05 -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 SMTP id 37520-02 for ; Tue, 29 Jul 2003 11:14:55 -0400 (EDT) Received: by lorax.kciLink.com (Postfix, from userid 8) id 1AF6D3E23; Tue, 29 Jul 2003 11:14:55 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Tuning PostgreSQL Date: Tue, 29 Jul 2003 11:14:54 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 25 Message-ID: References: <873cgvpylu.fsf@stark.dyndns.tv> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kciLink.com 1059491695 92135 216.194.193.105 (29 Jul 2003 15:14:55 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Tue, 29 Jul 2003 15:14:55 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, berkeley-unix) Cancel-Lock: sha1:btXw58ZCAcntR4NMiOSnOO5FxBo= X-Virus-Scanned: by amavisd-new at kciLink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/464 X-Sequence-Number: 2757 >>>>> "GS" == Greg Stark writes: GS> "scott.marlowe" writes: GS> But you have to actually test your setup in practice to see if it GS> hurts. A big data warehousing system will be faster under RAID5 GS> than under RAID1+0 because of the extra disks in the GS> stripeset. The more disks in the stripeset the more bandwidth you GS> get. Anyone have ideas on 14 spindles? I just ordered a disk subsystem with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell PERC3/DC controller (only 128MB cache, though). My plan was to do RAID10, but I think I'll play with RAID5 again and see which gives me the best performance. Unfortunatly, it is difficult to recreate the highly fragmented tables I have now (vacuum full takes over 14 hours on one of the tables) so I'm not sure how to best compare them. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Tue Jul 29 12:23:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C90DBD1C934 for ; Tue, 29 Jul 2003 15:22:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77941-03 for ; Tue, 29 Jul 2003 12:21:52 -0300 (ADT) Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id 16CE0D1C4B9 for ; Tue, 29 Jul 2003 12:22:51 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kciLink.com (Postfix) with ESMTP id A71D33E3B for ; Tue, 29 Jul 2003 11:22:50 -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 SMTP id 37520-03 for ; Tue, 29 Jul 2003 11:22:40 -0400 (EDT) Received: by lorax.kciLink.com (Postfix, from userid 8) id 43D913E30; Tue, 29 Jul 2003 11:22:40 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Mapping a database completly into Memory Date: Tue, 29 Jul 2003 11:22:40 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 21 Message-ID: References: <97842368.20030727104901@artis.uni-oldenburg.de> <9002.1059322732@sss.pgh.pa.us> <200307272114.11579.josh@agliodbs.com> <1059401815.749.7.camel@taz.oficina> <10185.1059409557@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 1059492160 92135 216.194.193.105 (29 Jul 2003 15:22:40 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Tue, 29 Jul 2003 15:22:40 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, berkeley-unix) Cancel-Lock: sha1:08ptNhern9nM9vHhwXaK2wuEqZo= X-Virus-Scanned: by amavisd-new at kciLink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/463 X-Sequence-Number: 2756 >>>>> "TL" == Tom Lane writes: TL> Franco Bruno Borghesi writes: >> wouldn't also increasing shared_buffers to 64 or 128 MB be a good >> performance improvement? This way, pages belonging to heavily used >> indexes would be already cached by the database itself. TL> Not necessarily. The trouble with large shared_buffers settings is you TL> end up with lots of pages being doubly cached (both in PG's buffers and I think if you do a lot of inserting/updating to your table, then more SHM is better (and very high fsm settings), since you defer pushing out the dirty pages to the disk. For read-mostly, I agree that letting the OS do the caching is a better way. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Tue Jul 29 12:46:20 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C9D10D1C4B8 for ; Tue, 29 Jul 2003 15:46:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 76219-07 for ; Tue, 29 Jul 2003 12:45:18 -0300 (ADT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by svr1.postgresql.org (Postfix) with ESMTP id CD902D1C4B7 for ; Tue, 29 Jul 2003 12:46:16 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030729154616.SXAG24359.lakemtao02.cox.net@[192.168.1.1]> for ; Tue, 29 Jul 2003 11:46:16 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: <873cgvpylu.fsf@stark.dyndns.tv> Content-Type: text/plain Message-Id: <1059493575.7505.129.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 29 Jul 2003 10:46:15 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/465 X-Sequence-Number: 2758 On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > >>>>> "GS" == Greg Stark writes: > > GS> "scott.marlowe" writes: > > GS> But you have to actually test your setup in practice to see if it > GS> hurts. A big data warehousing system will be faster under RAID5 > GS> than under RAID1+0 because of the extra disks in the > GS> stripeset. The more disks in the stripeset the more bandwidth you > GS> get. > > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > PERC3/DC controller (only 128MB cache, though). 14 drives on one SCSI card, eh? I'd be worried about saturating the bus. Maybe it's an old rule of thumb, but I would fill a SCSI chain more than half full. > My plan was to do RAID10, but I think I'll play with RAID5 again and > see which gives me the best performance. Unfortunatly, it is > difficult to recreate the highly fragmented tables I have now (vacuum > full takes over 14 hours on one of the tables) so I'm not sure how to > best compare them. Also IMO: if I needed something *really* high performance, I'd start with a mobo that has dual PCI buses (133MB/s can get swamped quickly by U320 devices) or PCI-X (but they're so new...). Then: - get dual U320 SCSI cards (one for each PCI bus) - plug them into dual redundant fast path external storage controllers that have, oh, 512MB RAM cache *each*) - dual port the drives, so they plug into both storage controllers Since I wouldn't put 14 drives on one SCSI chain, double what I just said, and only plug 7 drives in each controller. If your app needs One Big Honkin' Device, use the Linux Volume Manager (LVM) to merge the 2 RAID logical devices into one "super- logical" device. Yes, that's lot's of money, but is the data, and speed, important enough? -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 29 13:31:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C5DDCD1C93C for ; Tue, 29 Jul 2003 16:16:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 81404-02 for ; Tue, 29 Jul 2003 13:15:47 -0300 (ADT) Received: from isis.pcis.net (isis.pcis.net [207.18.226.3]) by svr1.postgresql.org (Postfix) with ESMTP id 8BA11D1C938 for ; Tue, 29 Jul 2003 13:16:45 -0300 (ADT) Received: from lyric.ofsloans.com (unverified [209.180.142.225]) by isis.pcis.net (Rockliffe SMTPRA 4.5.6) with ESMTP id ; Tue, 29 Jul 2003 11:16:44 -0500 Subject: Re: Tuning PostgreSQL From: Will LaShell To: Vivek Khera Cc: pgsql-performance@postgresql.org In-Reply-To: References: <873cgvpylu.fsf@stark.dyndns.tv> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-mI1xHXoPtwuwAT01kzv1" X-Mailer: Ximian Evolution 1.0.8 (1.0.8-11) Date: 29 Jul 2003 09:16:36 -0700 Message-Id: <1059495404.24884.69.camel@lyric.ofsloans.com> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/466 X-Sequence-Number: 2759 --=-mI1xHXoPtwuwAT01kzv1 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, 2003-07-29 at 08:14, Vivek Khera wrote: > >>>>> "GS" =3D=3D Greg Stark writes: >=20 > GS> "scott.marlowe" writes: >=20 > GS> But you have to actually test your setup in practice to see if it > GS> hurts. A big data warehousing system will be faster under RAID5 > GS> than under RAID1+0 because of the extra disks in the > GS> stripeset. The more disks in the stripeset the more bandwidth you > GS> get. >=20 > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > PERC3/DC controller (only 128MB cache, though). Hey one comment on this. With dell Perc3/DC you should check the megaraid-devel list to find the best BIOS settings for maximum performance. There have been many comments on it and trials to get it going really well. All told though I totally love the LSI Megaraid ( which is what the perc3/dc is ) controllers. We use the Elite 1650 with seagate cheetah drives for a nice little array. --Will --=-mI1xHXoPtwuwAT01kzv1 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQA/Jp3kZr3R5kgOZd0RAtT2AKCU52fTszZcAhAOKaB283ttetK9RACfQ3GF 0tg9nHoPcu5K/h1JmsJpJx4= =SrWT -----END PGP SIGNATURE----- --=-mI1xHXoPtwuwAT01kzv1-- From pgsql-performance-owner@postgresql.org Tue Jul 29 13:35:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6FB65D1C4D5 for ; Tue, 29 Jul 2003 16:30:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77824-10 for ; Tue, 29 Jul 2003 13:29:42 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 5F554D1C4B8 for ; Tue, 29 Jul 2003 13:30:40 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6TGTdpe011941; Tue, 29 Jul 2003 10:29:39 -0600 (MDT) Date: Tue, 29 Jul 2003 10:18:13 -0600 (MDT) From: "scott.marlowe" To: Ron Johnson Cc: PgSQL Performance ML Subject: Re: Tuning PostgreSQL In-Reply-To: <1059493575.7505.129.camel@haggis> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/467 X-Sequence-Number: 2760 On 29 Jul 2003, Ron Johnson wrote: > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > >>>>> "GS" == Greg Stark writes: > > > > GS> "scott.marlowe" writes: > > > > GS> But you have to actually test your setup in practice to see if it > > GS> hurts. A big data warehousing system will be faster under RAID5 > > GS> than under RAID1+0 because of the extra disks in the > > GS> stripeset. The more disks in the stripeset the more bandwidth you > > GS> get. > > > > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > > PERC3/DC controller (only 128MB cache, though). > > 14 drives on one SCSI card, eh? I'd be worried about saturating > the bus. I'm pretty sure those PERCs are based on the megaraid cards, which can handle 3 or 4 channels each... > Maybe it's an old rule of thumb, but I would fill a SCSI chain > more than half full. It's an old rule of thumb, but it still applies, it just takes more drives to saturate the channel. Figure ~ 30 to 50 MBytes a second per drive, on a U320 port it would take 10 drives to saturate it, and considering random accesses will be much slower than the max ~30 megs a second off the platter rate, it might take more than the max 14 drives to saturate U320. From pgsql-performance-owner@postgresql.org Tue Jul 29 13:47:10 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C4346D1C4EC for ; Tue, 29 Jul 2003 16:47:03 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 81378-07 for ; Tue, 29 Jul 2003 13:46:00 -0300 (ADT) Received: from trade-india.com (ns5.trade-india.com [66.234.10.13]) by svr1.postgresql.org (Postfix) with SMTP id A926BD1C4CB for ; Tue, 29 Jul 2003 13:46:57 -0300 (ADT) Received: (qmail 27063 invoked by uid 0); 29 Jul 2003 16:46:23 -0000 Received: from mallah@trade-india.com by ns5.trade-india.com by uid 502 with qmail-scanner-1.15 (uvscan: v4.1.60/v4171. Clear:. Processed in 2.144034 secs); 29 Jul 2003 16:46:23 -0000 Received: from unknown (HELO trade-india.com) (203.145.130.142) by ns5.trade-india.com with SMTP; 29 Jul 2003 16:46:20 -0000 Message-ID: <3F26A503.3050104@trade-india.com> Date: Tue, 29 Jul 2003 22:16:59 +0530 From: Rajesh Kumar Mallah User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Why performance improvement on converting subselect References: <200307291114.29567.mallah@trade-india.com> <21657.1059487755@sss.pgh.pa.us> In-Reply-To: <21657.1059487755@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------080809040000060809080803" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/468 X-Sequence-Number: 2761 This is a multi-part message in MIME format. --------------080809040000060809080803 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Tom Lane wrote: >Rajesh Kumar Mallah writes: > > >>explain analyze SELECT company_id , (SELECT edition FROM ONLY >>public.branding_master b WHERE old_company_id = a.company_id OR company_id = >>a.company_id ORDER BY b.company_id DESC LIMIT 1) from public.branding_master >>a limit 50; >>Total runtime: 19429.76 msec >> >> > > > >>CREATE FUNCTION most_recent_edition (integer) returns integer AS 'SELECT >>edition::integer FROM ONLY public.branding_master b WHERE old_company_id = $1 >>OR company_id = $1 ORDER BY b.company_id DESC LIMIT 1 ' language 'sql'; >> >> > > > >>tradein_clients=# explain analyze SELECT company_id , >>most_recent_edition(company_id) from public.branding_master limit 50; >>Total runtime: 3969.52 msec >> >> > >Odd. Apparently the planner is picking a better plan in the function >context than in the subselect context --- which is strange since it >ought to have less information. > >AFAIK the only way to see the plan generated for a SQL function's query >is like this: > >regression=# create function foo(int) returns int as >regression-# 'select unique1 from tenk1 where unique1 = $1' language sql; >CREATE FUNCTION >regression=# set debug_print_plan TO 1; >SET >regression=# set client_min_messages TO debug; >SET >regression=# select foo(55); >DEBUG: plan: >DETAIL: {RESULT :startup_cost 0.00 :total_cost 0.01 :plan_rows 1 :plan_width 0 >:targetlist ({TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1 >:resname foo :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false} >:expr {FUNCEXPR :funcid 706101 :funcresulttype 23 :funcretset false > ... (etc etc) > >Would you do that and send it along? I'm curious ... > Sorry for the delayed response. tradein_clients=# explain analyze SELECT company_id , data_bank.most_recent_edition(company_id) from public.branding_master limit 50; -------------------------------------------------------------------------------------------------------------------------- Limit (cost=0.00..3.57 rows=50 width=4) (actual time=149.52..2179.49 rows=50 loops=1) -> Seq Scan on branding_master (cost=0.00..6626.52 rows=92752 width=4) (actual time=149.51..2179.30 rows=51 loops=1) tradein_clients=# tradein_clients=# tradein_clients=# explain analyze SELECT company_id , data_bank.most_recent_edition(company_id) from public.branding_master limit 50; DEBUG: StartTransactionCommand LOG: plan: { LIMIT :startup_cost 0.00 :total_cost 185.65 :rows 1 :width 6 :qptargetlist ({ TARGETENTRY :resdom { RESDOM :resno 1 :restype 23 :restypmod -1 :resname edition :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { EXPR :typeOid 23 :opType func :oper { FUNC :funcid 313 :funcresulttype 23 :funcretset false :funcformat 1 } :args ({ VAR :varno 1 :varattno 31 :vartype 21 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 31})}} { TARGETENTRY :resdom { RESDOM :resno 2 :restype 23 :restypmod -1 :resname company_id :reskey 0 :reskeyop 0 :ressortgroupref 1 :resjunk true } :expr { VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1}}) :qpqual <> :lefttree { INDEXSCAN :startup_cost 0.00 :total_cost 24302.69 :rows 131 :width 6 :qptargetlist ({ TARGETENTRY :resdom { RESDOM :resno 1 :restype 23 :restypmod -1 :resname edition :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { EXPR :typeOid 23 :opType func :oper { FUNC :funcid 313 :funcresulttype 23 :funcretset false :funcformat 1 } :args ({ VAR :varno 1 :varattno 31 :vartype 21 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 31})}} { TARGETENTRY :resdom { RESDOM :resno 2 :restype 23 :restypmod -1 :resname company_id :reskey 0 :reskeyop 0 :ressortgroupref 1 :resjunk true } :expr { VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1}}) :qpqual ({ EXPR :typeOid 16 :opType or :oper <> :args ({ EXPR :typeOid 16 :opType op :oper { OPER :opno 96 :opid 65 :opresulttype 16 :opretset false } :args ({ VAR :varno 1 :varattno 19 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 19} { PARAM :paramkind 12 :paramid 1 :paramname \ :paramtype 23 })} { EXPR :typeOid 16 :opType op :oper { OPER :opno 96 :opid 65 :opresulttype 16 :opretset false } :args ({ VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1 :varlevelsup 0 :varnoold 1 :varoattno 1} { PARAM :paramkind 12 :paramid 1 :paramname \ :paramtype 23 })})}) :lefttree <> :righttree <> :extprm () :locprm () :initplan <> :nprm 0 :scanrelid 1 :indxid ( 310742439) :indxqual (<>) :indxqualorig (<>) :indxorderdir -1 } :righttree <> :extprm () :locprm () :initplan <> :nprm 0 :limitOffset <> :limitCount { CONST :consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue 4 [ 1 0 0 0 ] }} DEBUG: CommitTransactionCommand > > > >>But i feel it can be lot more faster , can anyone suggest me something >>to try. >> >> >Create an index on old_company_id, perhaps. > Its there already.. branding_master_old_comapany_id btree (old_company_id), regds , mallah. > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > --------------080809040000060809080803 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Lane wrote:
Rajesh Kumar Mallah <mallah@trade-india.com> writes:
  
explain analyze SELECT company_id , (SELECT edition FROM ONLY 
public.branding_master b WHERE old_company_id = a.company_id OR company_id = 
a.company_id  ORDER BY b.company_id DESC LIMIT 1) from public.branding_master
a   limit 50;
Total runtime: 19429.76 msec
    

  
CREATE FUNCTION most_recent_edition (integer) returns integer AS 'SELECT 
edition::integer FROM ONLY public.branding_master b WHERE old_company_id = $1
OR company_id = $1  ORDER BY b.company_id DESC LIMIT 1 ' language 'sql';
    

  
tradein_clients=# explain analyze SELECT company_id , 
most_recent_edition(company_id) from public.branding_master limit 50;
Total runtime: 3969.52 msec
    

Odd.  Apparently the planner is picking a better plan in the function
context than in the subselect context --- which is strange since it
ought to have less information.

AFAIK the only way to see the plan generated for a SQL function's query
is like this:

regression=# create function foo(int) returns int as
regression-# 'select unique1 from tenk1 where unique1 = $1' language sql;
CREATE FUNCTION
regression=# set debug_print_plan TO 1;
SET
regression=# set client_min_messages TO debug;
SET
regression=# select foo(55);
DEBUG:  plan:
DETAIL:  {RESULT :startup_cost 0.00 :total_cost 0.01 :plan_rows 1 :plan_width 0
:targetlist ({TARGETENTRY :resdom {RESDOM :resno 1 :restype 23 :restypmod -1
:resname foo :ressortgroupref 0 :resorigtbl 0 :resorigcol 0 :resjunk false}
:expr {FUNCEXPR :funcid 706101 :funcresulttype 23 :funcretset false
 ... (etc etc)

Would you do that and send it along?  I'm curious ...

Sorry for the delayed response.
tradein_clients=# explain analyze SELECT company_id ,  data_bank.most_recent_edition(company_id) from public.branding_master limit 50;

--------------------------------------------------------------------------------------------------------------------------
 Limit  (cost=0.00..3.57 rows=50 width=4) (actual time=149.52..2179.49 rows=50 loops=1)
   ->  Seq Scan on branding_master  (cost=0.00..6626.52 rows=92752 width=4) (actual time=149.51..2179.30 rows=51 loops=1)
tradein_clients=#
tradein_clients=#
tradein_clients=# explain analyze SELECT company_id ,  data_bank.most_recent_edition(company_id) from public.branding_master limit 50;
DEBUG:  StartTransactionCommand
LOG:  plan:
{ LIMIT :startup_cost 0.00 :total_cost 185.65 :rows 1 :width 6 :qptargetlist
({ TARGETENTRY :resdom { RESDOM :resno 1 :restype 23 :restypmod -1 :resname
edition :reskey 0 :reskeyop 0 :ressortgroupref 0 :resjunk false } :expr { EXPR
:typeOid 23  :opType func :oper { FUNC :funcid 313 :funcresulttype 23
:funcretset false :funcformat 1 } :args ({ VAR :varno 1 :varattno 31 :vartype
21 :vartypmod -1  :varlevelsup 0 :varnoold 1 :varoattno 31})}} { TARGETENTRY
:resdom { RESDOM :resno 2 :restype 23 :restypmod -1 :resname company_id
:reskey 0 :reskeyop 0 :ressortgroupref 1 :resjunk true } :expr { VAR :varno 1
:varattno 1 :vartype 23 :vartypmod -1  :varlevelsup 0 :varnoold 1 :varoattno
1}}) :qpqual <> :lefttree { INDEXSCAN :startup_cost 0.00 :total_cost 24302.69
:rows 131 :width 6 :qptargetlist ({ TARGETENTRY :resdom { RESDOM :resno 1
:restype 23 :restypmod -1 :resname edition :reskey 0 :reskeyop 0
:ressortgroupref 0 :resjunk false } :expr { EXPR :typeOid 23  :opType func
:oper { FUNC :funcid 313 :funcresulttype 23 :funcretset false :funcformat 1 }
:args ({ VAR :varno 1 :varattno 31 :vartype 21 :vartypmod -1  :varlevelsup 0
:varnoold 1 :varoattno 31})}} { TARGETENTRY :resdom { RESDOM :resno 2 :restype
23 :restypmod -1 :resname company_id :reskey 0 :reskeyop 0 :ressortgroupref 1
:resjunk true } :expr { VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1
:varlevelsup 0 :varnoold 1 :varoattno 1}}) :qpqual ({ EXPR :typeOid 16
:opType or :oper <> :args ({ EXPR :typeOid 16  :opType op :oper { OPER :opno
96 :opid 65 :opresulttype 16 :opretset false } :args ({ VAR :varno 1 :varattno
19 :vartype 23 :vartypmod -1  :varlevelsup 0 :varnoold 1 :varoattno 19} {
PARAM :paramkind 12 :paramid 1 :paramname \<unnamed> :paramtype 23 })} { EXPR
:typeOid 16  :opType op :oper { OPER :opno 96 :opid 65 :opresulttype 16
:opretset false } :args ({ VAR :varno 1 :varattno 1 :vartype 23 :vartypmod -1
:varlevelsup 0 :varnoold 1 :varoattno 1} { PARAM :paramkind 12 :paramid 1
:paramname \<unnamed> :paramtype 23 })})}) :lefttree <> :righttree <> :extprm
() :locprm () :initplan <> :nprm 0  :scanrelid 1 :indxid ( 310742439)
:indxqual (<>) :indxqualorig (<>) :indxorderdir -1 } :righttree <> :extprm ()
:locprm () :initplan <> :nprm 0  :limitOffset <> :limitCount { CONST
:consttype 23 :constlen 4 :constbyval true :constisnull false :constvalue  4 [
1 0 0 0 ] }}

DEBUG:  CommitTransactionCommand



  
But i feel it can be lot more faster , can anyone suggest me something
to try.
    
Create an index on old_company_id, perhaps.
Its there already..
  branding_master_old_comapany_id btree (old_company_id),

regds , mallah.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
  

--------------080809040000060809080803-- From pgsql-performance-owner@postgresql.org Tue Jul 29 15:08:49 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 04BF0D1C911 for ; Tue, 29 Jul 2003 18:08:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 87139-02 for ; Tue, 29 Jul 2003 15:07:24 -0300 (ADT) Received: from lakemtao02.cox.net (lakemtao02.cox.net [68.1.17.243]) by svr1.postgresql.org (Postfix) with ESMTP id DC949D1C7F8 for ; Tue, 29 Jul 2003 15:08:21 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao02.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030729180822.ULZZ24359.lakemtao02.cox.net@[192.168.1.1]> for ; Tue, 29 Jul 2003 14:08:22 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1059502102.7505.176.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 29 Jul 2003 13:08:22 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/469 X-Sequence-Number: 2762 On Tue, 2003-07-29 at 11:18, scott.marlowe wrote: > On 29 Jul 2003, Ron Johnson wrote: > > > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > > >>>>> "GS" == Greg Stark writes: > > > > > > GS> "scott.marlowe" writes: > > > > > > GS> But you have to actually test your setup in practice to see if it > > > GS> hurts. A big data warehousing system will be faster under RAID5 > > > GS> than under RAID1+0 because of the extra disks in the > > > GS> stripeset. The more disks in the stripeset the more bandwidth you > > > GS> get. > > > > > > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > > > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > > > PERC3/DC controller (only 128MB cache, though). > > > > 14 drives on one SCSI card, eh? I'd be worried about saturating > > the bus. > > I'm pretty sure those PERCs are based on the megaraid cards, which can > handle 3 or 4 channels each... Each with 14 devices? If so, isn't that a concentrated point of failure, even if the channels are 1/2 full? > > Maybe it's an old rule of thumb, but I would fill a SCSI chain > > more than half full. > > It's an old rule of thumb, but it still applies, it just takes more drives > to saturate the channel. Figure ~ 30 to 50 MBytes a second per drive, on > a U320 port it would take 10 drives to saturate it, and considering random > accesses will be much slower than the max ~30 megs a second off the > platter rate, it might take more than the max 14 drives to saturate U320. Ok. You'd still saturate the 133MB/s PCI bus at 133/30 = 4.4 drives. -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 29 16:35:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id EDBB5D1C934 for ; Tue, 29 Jul 2003 19:12:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 91118-04 for ; Tue, 29 Jul 2003 16:11:43 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 9B963D1C91C for ; Tue, 29 Jul 2003 16:12:40 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6TJBvpe024909; Tue, 29 Jul 2003 13:11:57 -0600 (MDT) Date: Tue, 29 Jul 2003 13:00:30 -0600 (MDT) From: "scott.marlowe" To: Ron Johnson Cc: PgSQL Performance ML Subject: Re: Tuning PostgreSQL In-Reply-To: <1059502102.7505.176.camel@haggis> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/470 X-Sequence-Number: 2763 On 29 Jul 2003, Ron Johnson wrote: > On Tue, 2003-07-29 at 11:18, scott.marlowe wrote: > > On 29 Jul 2003, Ron Johnson wrote: > > > > > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > > > >>>>> "GS" == Greg Stark writes: > > > > > > > > GS> "scott.marlowe" writes: > > > > > > > > GS> But you have to actually test your setup in practice to see if it > > > > GS> hurts. A big data warehousing system will be faster under RAID5 > > > > GS> than under RAID1+0 because of the extra disks in the > > > > GS> stripeset. The more disks in the stripeset the more bandwidth you > > > > GS> get. > > > > > > > > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > > > > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > > > > PERC3/DC controller (only 128MB cache, though). > > > > > > 14 drives on one SCSI card, eh? I'd be worried about saturating > > > the bus. > > > > I'm pretty sure those PERCs are based on the megaraid cards, which can > > handle 3 or 4 channels each... > > Each with 14 devices? If so, isn't that a concentrated point of > failure, even if the channels are 1/2 full? Yep. I've built one once before when BIG hard drives were 9 gigs. :-) And it is a point of concentrated failure, which brings me to my favorite part about the LSI megaraid cards (which most / all perc3s are apparently.) If you build a RAID1+0 or 0+1, you can seperate it out so each sub part is on it's own card, and the other cards keep acting like one big card. Assuming the bad card isn't killing your PCI bus or draining the 12V rail or something. > > > Maybe it's an old rule of thumb, but I would fill a SCSI chain > > > more than half full. > > > > It's an old rule of thumb, but it still applies, it just takes more drives > > to saturate the channel. Figure ~ 30 to 50 MBytes a second per drive, on > > a U320 port it would take 10 drives to saturate it, and considering random > > accesses will be much slower than the max ~30 megs a second off the > > platter rate, it might take more than the max 14 drives to saturate U320. > > Ok. You'd still saturate the 133MB/s PCI bus at 133/30 = 4.4 drives. But that's seq scan. For many database applications, random access performance is much more important. Imagine 200 people entering reservations of 8k or less each into a transaction processing engine. Each transactions chance to hit an unoccupied spindle is what really counts. If there's 30 spindles, each doing a stripe's worth of access all the time, it's likely to never flood the channel. If random access is 1/4th the speed of seq scan, then you need to multiply it by 4 to get the number of drives that'd saturate the PCI bus. From pgsql-performance-owner@postgresql.org Tue Jul 29 16:52:16 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8BE97D1C4E6 for ; Tue, 29 Jul 2003 19:50:37 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 93549-09 for ; Tue, 29 Jul 2003 16:49:39 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 6A4BAD1C4CB for ; Tue, 29 Jul 2003 16:50:36 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030729195037.SAER7142.lakemtao01.cox.net@[192.168.1.1]> for ; Tue, 29 Jul 2003 15:50:37 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1059508232.7508.191.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 29 Jul 2003 14:50:32 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/471 X-Sequence-Number: 2764 On Tue, 2003-07-29 at 14:00, scott.marlowe wrote: > On 29 Jul 2003, Ron Johnson wrote: > > > On Tue, 2003-07-29 at 11:18, scott.marlowe wrote: > > > On 29 Jul 2003, Ron Johnson wrote: > > > > > > > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > > > > >>>>> "GS" == Greg Stark writes: > > > > > > > > > > GS> "scott.marlowe" writes: > > > > > > > > > > GS> But you have to actually test your setup in practice to see if it > > > > > GS> hurts. A big data warehousing system will be faster under RAID5 > > > > > GS> than under RAID1+0 because of the extra disks in the > > > > > GS> stripeset. The more disks in the stripeset the more bandwidth you > > > > > GS> get. > > > > > > > > > > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > > > > > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > > > > > PERC3/DC controller (only 128MB cache, though). > > > > > > > > 14 drives on one SCSI card, eh? I'd be worried about saturating > > > > the bus. > > > > > > I'm pretty sure those PERCs are based on the megaraid cards, which can > > > handle 3 or 4 channels each... > > > > Each with 14 devices? If so, isn't that a concentrated point of > > failure, even if the channels are 1/2 full? > > Yep. I've built one once before when BIG hard drives were 9 gigs. :-) > > And it is a point of concentrated failure, which brings me to my favorite > part about the LSI megaraid cards (which most / all perc3s are > apparently.) > > If you build a RAID1+0 or 0+1, you can seperate it out so each sub part is > on it's own card, and the other cards keep acting like one big card. > Assuming the bad card isn't killing your PCI bus or draining the 12V rail > or something. Sounds like my kinda card! Is the cache battery-backed up? How much cache can you stuff in them? > > > > Maybe it's an old rule of thumb, but I would fill a SCSI chain > > > > more than half full. > > > > > > It's an old rule of thumb, but it still applies, it just takes more drives > > > to saturate the channel. Figure ~ 30 to 50 MBytes a second per drive, on > > > a U320 port it would take 10 drives to saturate it, and considering random > > > accesses will be much slower than the max ~30 megs a second off the > > > platter rate, it might take more than the max 14 drives to saturate U320. > > > > Ok. You'd still saturate the 133MB/s PCI bus at 133/30 = 4.4 drives. > > But that's seq scan. For many database applications, random access > performance is much more important. Imagine 200 people entering > reservations of 8k or less each into a transaction processing engine. > Each transactions chance to hit an unoccupied spindle is what really > counts. If there's 30 spindles, each doing a stripe's worth of access all > the time, it's likely to never flood the channel. > > If random access is 1/4th the speed of seq scan, then you need to multiply > it by 4 to get the number of drives that'd saturate the PCI bus. Maybe it's just me, but I've never seen a purely TP system. Even if roll off the daily updates to a "reporting database" each night, some yahoo manager with enough juice to have his way still wants up-to-the-minute reports... Better yet, the Access Jockey, who thinks s/he's an SQL whiz but couldn't JOIN himself out of a paper bag... -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 29 17:24:28 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AA9CDD1C9C0 for ; Tue, 29 Jul 2003 20:24:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 94859-06 for ; Tue, 29 Jul 2003 17:23:07 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 587BFD1C9C8 for ; Tue, 29 Jul 2003 17:24:03 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6TKLNpe001562; Tue, 29 Jul 2003 14:21:23 -0600 (MDT) Date: Tue, 29 Jul 2003 14:09:56 -0600 (MDT) From: "scott.marlowe" To: Ron Johnson Cc: PgSQL Performance ML Subject: Re: Tuning PostgreSQL In-Reply-To: <1059508232.7508.191.camel@haggis> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/472 X-Sequence-Number: 2765 On 29 Jul 2003, Ron Johnson wrote: > On Tue, 2003-07-29 at 14:00, scott.marlowe wrote: > > On 29 Jul 2003, Ron Johnson wrote: > > > > > On Tue, 2003-07-29 at 11:18, scott.marlowe wrote: > > > > On 29 Jul 2003, Ron Johnson wrote: > > > > > > > > > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > > > > > >>>>> "GS" == Greg Stark writes: > > > > > > > > > > > > GS> "scott.marlowe" writes: > > > > > > > > > > > > GS> But you have to actually test your setup in practice to see if it > > > > > > GS> hurts. A big data warehousing system will be faster under RAID5 > > > > > > GS> than under RAID1+0 because of the extra disks in the > > > > > > GS> stripeset. The more disks in the stripeset the more bandwidth you > > > > > > GS> get. > > > > > > > > > > > > Anyone have ideas on 14 spindles? I just ordered a disk subsystem > > > > > > with 14 high speed (U320 15kRPM) SCSI disks to hook up with a dell > > > > > > PERC3/DC controller (only 128MB cache, though). > > > > > > > > > > 14 drives on one SCSI card, eh? I'd be worried about saturating > > > > > the bus. > > > > > > > > I'm pretty sure those PERCs are based on the megaraid cards, which can > > > > handle 3 or 4 channels each... > > > > > > Each with 14 devices? If so, isn't that a concentrated point of > > > failure, even if the channels are 1/2 full? > > > > Yep. I've built one once before when BIG hard drives were 9 gigs. :-) > > > > And it is a point of concentrated failure, which brings me to my favorite > > part about the LSI megaraid cards (which most / all perc3s are > > apparently.) > > > > If you build a RAID1+0 or 0+1, you can seperate it out so each sub part is > > on it's own card, and the other cards keep acting like one big card. > > Assuming the bad card isn't killing your PCI bus or draining the 12V rail > > or something. > > Sounds like my kinda card! > > Is the cache battery-backed up? Yep > How much cache can you stuff in them? the old old old school MegaRAID428 could hold up to 128 Meg. I'm sure the new ones can handle 512Meg or more. > > > > > Maybe it's an old rule of thumb, but I would fill a SCSI chain > > > > > more than half full. > > > > > > > > It's an old rule of thumb, but it still applies, it just takes more drives > > > > to saturate the channel. Figure ~ 30 to 50 MBytes a second per drive, on > > > > a U320 port it would take 10 drives to saturate it, and considering random > > > > accesses will be much slower than the max ~30 megs a second off the > > > > platter rate, it might take more than the max 14 drives to saturate U320. > > > > > > Ok. You'd still saturate the 133MB/s PCI bus at 133/30 = 4.4 drives. > > > > But that's seq scan. For many database applications, random access > > performance is much more important. Imagine 200 people entering > > reservations of 8k or less each into a transaction processing engine. > > Each transactions chance to hit an unoccupied spindle is what really > > counts. If there's 30 spindles, each doing a stripe's worth of access all > > the time, it's likely to never flood the channel. > > > > If random access is 1/4th the speed of seq scan, then you need to multiply > > it by 4 to get the number of drives that'd saturate the PCI bus. > > Maybe it's just me, but I've never seen a purely TP system. I think most of them are running under TPF on a mainframe in a basement somewhere, like for airline reservations. I've never worked on one, but met one of the guys who runs one, and they use 12 mainframes for 6 live machines and each live machine has a failover machine behind it in sysplex mode. I kept thinking of the giant dinosaurs in Jurassic park... > Even if roll off the daily updates to a "reporting database" each > night, some yahoo manager with enough juice to have his way still > wants up-to-the-minute reports... Just because it's TP doesn't mean it doesn't have real time reporting. But expensive reports probably do get run at night. > Better yet, the Access Jockey, who thinks s/he's an SQL whiz but > couldn't JOIN himself out of a paper bag... I've seen a few who got joins and unions and what not, but explaining fks or transactions got me a glazed look... :-) From pgsql-performance-owner@postgresql.org Tue Jul 29 17:38:39 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 87F88D1C4B8 for ; Tue, 29 Jul 2003 20:38:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 97315-02 for ; Tue, 29 Jul 2003 17:37:38 -0300 (ADT) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by svr1.postgresql.org (Postfix) with ESMTP id 82BDFD1C4D5 for ; Tue, 29 Jul 2003 17:38:34 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030729203835.XRQW23518.lakemtao03.cox.net@[192.168.1.1]>; Tue, 29 Jul 2003 16:38:35 -0400 Subject: Re: Tuning PostgreSQL From: Ron Johnson To: "scott.marlowe" Cc: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1059511115.7508.197.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 29 Jul 2003 15:38:35 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/473 X-Sequence-Number: 2766 On Tue, 2003-07-29 at 15:09, scott.marlowe wrote: > On 29 Jul 2003, Ron Johnson wrote: > > > On Tue, 2003-07-29 at 14:00, scott.marlowe wrote: > > > On 29 Jul 2003, Ron Johnson wrote: > > > > > > > On Tue, 2003-07-29 at 11:18, scott.marlowe wrote: > > > > > On 29 Jul 2003, Ron Johnson wrote: > > > > > > > > > > > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > > > > > > >>>>> "GS" == Greg Stark writes: > > > > > > > > > > > > > > GS> "scott.marlowe" writes: [snip] > > > But that's seq scan. For many database applications, random access > > > performance is much more important. Imagine 200 people entering > > > reservations of 8k or less each into a transaction processing engine. > > > Each transactions chance to hit an unoccupied spindle is what really > > > counts. If there's 30 spindles, each doing a stripe's worth of access all > > > the time, it's likely to never flood the channel. > > > > > > If random access is 1/4th the speed of seq scan, then you need to multiply > > > it by 4 to get the number of drives that'd saturate the PCI bus. > > > > Maybe it's just me, but I've never seen a purely TP system. > > I think most of them are running under TPF on a mainframe in a basement > somewhere, like for airline reservations. I've never worked on one, but > met one of the guys who runs one, and they use 12 mainframes for 6 live > machines and each live machine has a failover machine behind it in sysplex > mode. I kept thinking of the giant dinosaurs in Jurassic park... We have something similar running on Alphas and VMS; does about 8M Txn/day. Anyone who uses E-ZPass in the northeast eventually gets stuck in our systems. (Made me fear Big Brother...) > > Even if roll off the daily updates to a "reporting database" each > > night, some yahoo manager with enough juice to have his way still > > wants up-to-the-minute reports... > > Just because it's TP doesn't mean it doesn't have real time reporting. > But expensive reports probably do get run at night. Yes, but... There's always the exception. > > Better yet, the Access Jockey, who thinks s/he's an SQL whiz but > > couldn't JOIN himself out of a paper bag... > > I've seen a few who got joins and unions and what not, but explaining fks > or transactions got me a glazed look... :-) Wow! They understood joins? You lucky dog!!! -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Tue Jul 29 18:32:43 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id ED0B7D1C938 for ; Tue, 29 Jul 2003 21:32:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 99014-07 for ; Tue, 29 Jul 2003 18:31:16 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id EE9A3D1C949 for ; Tue, 29 Jul 2003 18:32:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6TLWFQ3004579; Tue, 29 Jul 2003 17:32:15 -0400 (EDT) To: Rajesh Kumar Mallah Cc: pgsql-performance@postgresql.org Subject: Re: Why performance improvement on converting subselect to a function ? In-reply-to: <3F26A503.3050104@trade-india.com> References: <200307291114.29567.mallah@trade-india.com> <21657.1059487755@sss.pgh.pa.us> <3F26A503.3050104@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Tue, 29 Jul 2003 22:16:59 +0530" Date: Tue, 29 Jul 2003 17:32:14 -0400 Message-ID: <4578.1059514334@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/474 X-Sequence-Number: 2767 Rajesh Kumar Mallah writes: > Tom Lane wrote: >> Odd. Apparently the planner is picking a better plan in the function >> context than in the subselect context --- which is strange since it >> ought to have less information. > [ verbose plan snipped ] Well, that sure seems to be the same plan. Curious that the runtime wasn't about the same. Perhaps the slow execution of the first query was a caching effect? If you alternate trying the query both ways, does the speed difference persist? regards, tom lane From pgsql-sql-owner@postgresql.org Tue Jul 29 23:09:09 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9E112D1C9EF for ; Wed, 30 Jul 2003 02:08:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 19040-02 for ; Tue, 29 Jul 2003 23:08:01 -0300 (ADT) Received: from spiff.astoria.bogus (dsl027-144-149.nyc1.dsl.speakeasy.net [216.27.144.149]) by svr1.postgresql.org (Postfix) with ESMTP id 88FB4D1C9ED for ; Tue, 29 Jul 2003 23:08:55 -0300 (ADT) Received: from spiff.astoria.bogus (localhost.localdomain [127.0.0.1]) by spiff.astoria.bogus (8.12.8/8.12.8) with ESMTP id h6U290TC001878 for ; Tue, 29 Jul 2003 22:09:00 -0400 Received: (from meb@localhost) by spiff.astoria.bogus (8.12.8/8.12.8/Submit) id h6U28xwR001876 for pgsql-sql@postgresql.org; Tue, 29 Jul 2003 22:08:59 -0400 Date: Tue, 29 Jul 2003 22:08:59 -0400 From: Mark Bronnimann To: pgsql-sql@postgresql.org Subject: function returning setof performance question Message-ID: <20030730020859.GA1795@spiff.astoria.bogus> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/439 X-Sequence-Number: 14553 I have a question regarding the performance of a function returning a set of a view as opposed to just selecting the view with the same where clause. Please, if this should go to the performance list instead, let me know. I'm just wondering about this from the sql end of things. Here's the environment: I'm working from PHP, calling on the query. I have a view that joins 12 tables and orders the results. From PHP, I do a select on that view with a where clause. I created a function that queries the view with the where clause included in the function. The function is returning a setof that view taking one variable for the where clause (there are several other static wheres in there). I have found that querying the view with the where clause is giving me quicker results than if I call the function. The performance hit is tiny, we're talking less than 1/2 a second, but when I've done this sort of thing in Oracle I've seen a performance increase, not a decrease. Any ideas? Thanks folks... I'm new to the list. -- Mark Bronnimann meb@speakeasy.net -- Let's organize this thing and take all the fun out of it. -- From pgsql-sql-owner@postgresql.org Tue Jul 29 23:28:03 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 78422D1C90E for ; Wed, 30 Jul 2003 02:27:31 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14338-09 for ; Tue, 29 Jul 2003 23:26:34 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id A9C67D1C4CB for ; Tue, 29 Jul 2003 23:27:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id BC6B91024D; Tue, 29 Jul 2003 22:20:20 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 1449710248; Tue, 29 Jul 2003 22:20:18 -0400 (EDT) Subject: Re: function returning setof performance question From: Rod Taylor To: Mark Bronnimann Cc: pgsql-sql@postgresql.org In-Reply-To: <20030730020859.GA1795@spiff.astoria.bogus> References: <20030730020859.GA1795@spiff.astoria.bogus> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-wXIudNigNvDGi5HPPEaG" Message-Id: <1059532098.54325.23.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 29 Jul 2003 22:28:19 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/441 X-Sequence-Number: 14555 --=-wXIudNigNvDGi5HPPEaG Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > The performance hit is tiny, we're talking less than 1/2 a second,=20 > but when I've done this sort of thing in Oracle I've seen a performance= =20 > increase, not a decrease.=20 Thats just plain strange (never tried on Oracle). Why in the world would adding the overhead of a function call (with no other changes) increase performance? The function has additional overhead in the form of the plpgsql interpreter. You may find a c function will give close to identical performance as with the standard view so long as the query is the same. One thing to keep in mind is that the view can be rearranged to give a better query overall. The exact work completed for the view may be different when called from within a different SQL statement. Most functions -- some SQL language based functions are strange this way -- cannot do this --=-wXIudNigNvDGi5HPPEaG Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/Jy1C6DETLow6vwwRAjEJAJ446f+fjBCyFkVZtobtqqMx3Dai+ACfVjbo 9tdR9XTAfLtilquPPr9tok0= =nfdL -----END PGP SIGNATURE----- --=-wXIudNigNvDGi5HPPEaG-- From pgsql-sql-owner@postgresql.org Tue Jul 29 23:57:40 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 45863D1C7F8 for ; Wed, 30 Jul 2003 02:57:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 14351-10 for ; Tue, 29 Jul 2003 23:56:29 -0300 (ADT) Received: from spiff.astoria.bogus (dsl027-144-149.nyc1.dsl.speakeasy.net [216.27.144.149]) by svr1.postgresql.org (Postfix) with ESMTP id 5515BD1C934 for ; Tue, 29 Jul 2003 23:57:23 -0300 (ADT) Received: from spiff.astoria.bogus (localhost.localdomain [127.0.0.1]) by spiff.astoria.bogus (8.12.8/8.12.8) with ESMTP id h6U2vRTC002281; Tue, 29 Jul 2003 22:57:27 -0400 Received: (from meb@localhost) by spiff.astoria.bogus (8.12.8/8.12.8/Submit) id h6U2vRLo002279; Tue, 29 Jul 2003 22:57:27 -0400 Date: Tue, 29 Jul 2003 22:57:27 -0400 From: Mark Bronnimann To: Rod Taylor Cc: pgsql-sql@postgresql.org Subject: Re: function returning setof performance question Message-ID: <20030730025727.GA2094@spiff.astoria.bogus> References: <20030730020859.GA1795@spiff.astoria.bogus> <1059532098.54325.23.camel@jester> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1059532098.54325.23.camel@jester> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/442 X-Sequence-Number: 14556 Thanks for the reply. I was hoping to eliminate the parse call on the view because I was doing the where clause on the view instead of putting the where in the view. In all, I was hoping to keep a single view called from multiple functions with different where clauses. Yep... I shoulda known better... Thanks again! And Rod Taylor (rbt@rbt.ca) said...: > > The performance hit is tiny, we're talking less than 1/2 a second, > > but when I've done this sort of thing in Oracle I've seen a performance > > increase, not a decrease. > > Thats just plain strange (never tried on Oracle). Why in the world > would adding the overhead of a function call (with no other changes) > increase performance? > > The function has additional overhead in the form of the plpgsql > interpreter. You may find a c function will give close to identical > performance as with the standard view so long as the query is the same. > > > One thing to keep in mind is that the view can be rearranged to give a > better query overall. The exact work completed for the view may be > different when called from within a different SQL statement. Most > functions -- some SQL language based functions are strange this way -- > cannot do this > -- Mark Bronnimann meb@speakeasy.net -- Let's organize this thing and take all the fun out of it. -- From pgsql-sql-owner@postgresql.org Wed Jul 30 00:54:16 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1E75BD1C4C9 for ; Wed, 30 Jul 2003 03:54:10 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 26783-04 for ; Wed, 30 Jul 2003 00:53:08 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 115BBD1C4B7 for ; Wed, 30 Jul 2003 00:54:08 -0300 (ADT) Received: from [192.168.5.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 17469; Tue, 29 Jul 2003 20:16:59 -0700 Message-ID: <3F2740A8.7020900@joeconway.com> Date: Tue, 29 Jul 2003 20:51:04 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mark Bronnimann Cc: Rod Taylor , pgsql-sql@postgresql.org Subject: Re: function returning setof performance question References: <20030730020859.GA1795@spiff.astoria.bogus> <1059532098.54325.23.camel@jester> <20030730025727.GA2094@spiff.astoria.bogus> In-Reply-To: <20030730025727.GA2094@spiff.astoria.bogus> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/443 X-Sequence-Number: 14557 Mark Bronnimann wrote: > I was hoping to eliminate the parse call on the view because I was doing > the where clause on the view instead of putting the where in the view. > In all, I was hoping to keep a single view called from multiple functions > with different where clauses. Yep... I shoulda known better... > It sounds like you're using a sql function, not a plpgsql function (although I don't think you said either way). If you write the function in plpgsql it will get parsed and cached on the first call in a particular backend session, which *might* give you improved performance on subsequent calls, if there are any; are you using persistent connections? Alternatively, it might work to use a prepared query. Joe From pgsql-performance-owner@postgresql.org Wed Jul 30 04:25:03 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CB5A4D1C4D0 for ; Wed, 30 Jul 2003 07:25:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 37955-06 for ; Wed, 30 Jul 2003 04:24:01 -0300 (ADT) Received: from rtlocal.trade-india.com (unknown [203.196.129.235]) by svr1.postgresql.org (Postfix) with SMTP id 0E759D1C4C9 for ; Wed, 30 Jul 2003 04:24:52 -0300 (ADT) Received: (qmail 2380 invoked from network); 30 Jul 2003 07:33:58 -0000 Received: from unknown (HELO system67.trade-india-local.com) (unknown) by unknown with SMTP; 30 Jul 2003 07:33:58 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: Tom Lane , Josh Berkus Subject: Re: Why performance improvement on converting subselect to a function ? Date: Wed, 30 Jul 2003 12:54:49 +0530 User-Agent: KMail/1.5.1 Cc: pgsql-performance@postgresql.org, "Shridhar Daithankar" References: <200307291114.29567.mallah@trade-india.com> <3F26A503.3050104@trade-india.com> <4578.1059514334@sss.pgh.pa.us> In-Reply-To: <4578.1059514334@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307301254.49159.mallah@trade-india.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/475 X-Sequence-Number: 2768 Dear Tom, the problem was repeatble in the sense repeated execution of queries made no difference on performance. What lead to degradation was the bumping off of effective_cache_size parameter from 1000 to 64K Can any one point me the recent guide done by Sridhar and Josh i want to see what i mis(read|understood) from there ;-) [ it was on GeneralBits' Home Page ] Anyway the performance gain was from 32 secs to less than a sec what i restored cache size from 64K to 1000. I will post again with more details but at the moment i got to load my data_bank :) Regds Mallah. On Wednesday 30 Jul 2003 3:02 am, Tom Lane wrote: > Rajesh Kumar Mallah writes: > > Tom Lane wrote: > >> Odd. Apparently the planner is picking a better plan in the function > >> context than in the subselect context --- which is strange since it > >> ought to have less information. > > > > [ verbose plan snipped ] > > Well, that sure seems to be the same plan. Curious that the runtime > wasn't about the same. Perhaps the slow execution of the first query > was a caching effect? If you alternate trying the query both ways, > does the speed difference persist? > > regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jul 30 10:53:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 95743D1C9C8 for ; Wed, 30 Jul 2003 13:51:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 59415-07 for ; Wed, 30 Jul 2003 10:50:39 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id A9563D1C995 for ; Wed, 30 Jul 2003 10:51:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6UDpNQ3009199; Wed, 30 Jul 2003 09:51:23 -0400 (EDT) To: Rajesh Kumar Mallah Cc: Josh Berkus , pgsql-performance@postgresql.org, "Shridhar Daithankar" Subject: Re: Why performance improvement on converting subselect to a function ? In-reply-to: <200307301254.49159.mallah@trade-india.com> References: <200307291114.29567.mallah@trade-india.com> <3F26A503.3050104@trade-india.com> <4578.1059514334@sss.pgh.pa.us> <200307301254.49159.mallah@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Wed, 30 Jul 2003 12:54:49 +0530" Date: Wed, 30 Jul 2003 09:51:23 -0400 Message-ID: <9198.1059573083@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/476 X-Sequence-Number: 2769 Rajesh Kumar Mallah writes: > What lead to degradation was the bumping off of > effective_cache_size parameter from 1000 to 64K Check the plan then; AFAIR the only possible effect of changing effective_cache_size is to influence which plan the planner picks. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jul 30 10:57:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 87FE4D1C4CB for ; Wed, 30 Jul 2003 13:55:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 61521-04 for ; Wed, 30 Jul 2003 10:54:07 -0300 (ADT) Received: from smtp.pspl.co.in (unknown [202.54.11.65]) by svr1.postgresql.org (Postfix) with ESMTP id 0C449D1C4D5 for ; Wed, 30 Jul 2003 10:54:58 -0300 (ADT) Received: (from root@localhost) by smtp.pspl.co.in (8.12.9/8.12.9) id h6UDrW0M032384 for ; Wed, 30 Jul 2003 19:23:32 +0530 Received: from daithan (daithan.intranet.pspl.co.in [192.168.7.161]) (authenticated bits=0) by persistent.co.in (8.12.9/8.12.9) with ESMTP id h6UDrWK7032371; Wed, 30 Jul 2003 19:23:32 +0530 From: "Shridhar Daithankar" To: pgsql-performance@postgresql.org, "Shridhar Daithankar" Date: Wed, 30 Jul 2003 19:26:48 +0530 MIME-Version: 1.0 Subject: Re: Why performance improvement on converting subselect to a function ? Reply-To: shridhar_daithankar@persistent.co.in Message-ID: <3F281BF8.5372.AFAF180@localhost> In-reply-to: <200307301254.49159.mallah@trade-india.com> References: <4578.1059514334@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-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/477 X-Sequence-Number: 2770 On 30 Jul 2003 at 12:54, Rajesh Kumar Mallah wrote: > Can any one point me the recent guide done by > Sridhar and Josh i want to see what i mis(read|understood) > from there ;-) [ it was on GeneralBits' Home Page ] http://www.varlena.com/GeneralBits/Tidbits/perf.html HTH Bye Shridhar -- program, n.: A magic spell cast over a computer allowing it to turn one's input into error messages. tr.v. To engage in a pastime similar to banging one's head against a wall, but with fewer opportunities for reward. From pgsql-performance-owner@postgresql.org Wed Jul 30 11:45:58 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D403DD1C514 for ; Wed, 30 Jul 2003 14:41:57 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 63280-06 for ; Wed, 30 Jul 2003 11:40:57 -0300 (ADT) Received: from lakemtao03.cox.net (lakemtao03.cox.net [68.1.17.242]) by svr1.postgresql.org (Postfix) with ESMTP id D4047D1C509 for ; Wed, 30 Jul 2003 11:41:52 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao03.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030730144158.GNGZ23518.lakemtao03.cox.net@[192.168.1.1]> for ; Wed, 30 Jul 2003 10:41:58 -0400 Subject: Re: Tuning PostgreSQL, pt 2 From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <1059511115.7508.197.camel@haggis> References: <1059511115.7508.197.camel@haggis> Content-Type: text/plain Message-Id: <1059576111.7505.264.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 30 Jul 2003 09:41:52 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/478 X-Sequence-Number: 2771 On Tue, 2003-07-29 at 15:38, Ron Johnson wrote: > On Tue, 2003-07-29 at 15:09, scott.marlowe wrote: > > On 29 Jul 2003, Ron Johnson wrote: > > > > > On Tue, 2003-07-29 at 14:00, scott.marlowe wrote: > > > > On 29 Jul 2003, Ron Johnson wrote: > > > > > > > > > On Tue, 2003-07-29 at 11:18, scott.marlowe wrote: > > > > > > On 29 Jul 2003, Ron Johnson wrote: > > > > > > > > > > > > > On Tue, 2003-07-29 at 10:14, Vivek Khera wrote: > > > > > > > > >>>>> "GS" == Greg Stark writes: > > > > > > > > > > > > > > > > GS> "scott.marlowe" writes: > [snip] [snip] > > I think most of them are running under TPF on a mainframe in a basement > > somewhere, like for airline reservations. I've never worked on one, but > > met one of the guys who runs one, and they use 12 mainframes for 6 live > > machines and each live machine has a failover machine behind it in sysplex > > mode. I kept thinking of the giant dinosaurs in Jurassic park... > > We have something similar running on Alphas and VMS; does about > 8M Txn/day. Anyone who uses E-ZPass in the northeast eventually > gets stuck in our systems. Oh, forget to mention: yes, they are in a 2-deep basement. -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-advocacy-owner@postgresql.org Wed Jul 30 13:01:56 2003 X-Original-To: pgsql-advocacy-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 894F9D1C4D5; Wed, 30 Jul 2003 16:01:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 67568-06; Wed, 30 Jul 2003 13:00:49 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 46072D1C4D0; Wed, 30 Jul 2003 13:01:50 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3360622; Wed, 30 Jul 2003 09:02:10 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-advocacy@postgresql.org, sfpug@postgresql.org, pgsql-performance@postgresql.org Subject: Getting Started Guide? Date: Wed, 30 Jul 2003 09:00:37 -0700 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307300900.37546.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/325 X-Sequence-Number: 1849 Folks, Sorry for the cross-posting! Somebody approached me with the skeleton of a "Gettting started with PostgreSQL" page, and now I can't find the e-mail. Who was it? Please send again! -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jul 30 14:12:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A4548D1C4D0 for ; Wed, 30 Jul 2003 17:12:22 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 73798-03 for ; Wed, 30 Jul 2003 14:11:20 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 88D5AD1C4B7 for ; Wed, 30 Jul 2003 14:12:20 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6UHBSpe010064 for ; Wed, 30 Jul 2003 11:11:28 -0600 (MDT) Date: Wed, 30 Jul 2003 10:59:23 -0600 (MDT) From: "scott.marlowe" To: Subject: postgresql.conf Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/480 X-Sequence-Number: 2773 I'm looking at doing the example postgresql.conf files for the 7.4 release. So far, the catagories we have would be a matrix of: -------------- Large Machine -- Small Machine Webserver OLAP OLTP Workstation But likely only one entry for workstation. anyone have any advice on what they use in which situations and what we should include in the examples? I'm guessing OLTP needs things like FSM cranked up, OLAP (a for analytical) needs more shared buffers and sort memory Webserver might be better served just slightly higher values than default but well under those of either OLTP or OLAP... From pgsql-performance-owner@postgresql.org Wed Jul 30 14:37:56 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E9A1ED1C4D0 for ; Wed, 30 Jul 2003 17:20:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 71813-10 for ; Wed, 30 Jul 2003 14:19:23 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id E3499D1C4B7 for ; Wed, 30 Jul 2003 14:20:23 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3360937; Wed, 30 Jul 2003 10:20:43 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "scott.marlowe" , Subject: Re: postgresql.conf Date: Wed, 30 Jul 2003 10:19:21 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307301019.21870.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/482 X-Sequence-Number: 2775 Scott, > I'm guessing OLTP needs things like FSM cranked up,=20 > OLAP (a for analytical) needs more shared buffers and sort memory > Webserver might be better served just slightly higher values than default= =20 > but well under those of either OLTP or OLAP... Yes. Take sort_mem for example: OLTP_SM 1024 OLTP_LM 2048 OLAP_SM 4096 OLAP_LM 16384 WWW_SM 512 WWW_LM 1024 Workstation 1024 The basic idea is: More RAM =3D> more sort_mem More concurrent queries =3D> less sort_mem Larger data sets =3D> more sort_mem Lots of grouped aggregates =3D> more sort_mem --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jul 30 14:34:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9FF5ED1C509; Wed, 30 Jul 2003 17:29:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 75384-03; Wed, 30 Jul 2003 14:28:52 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 6A38FD1C515; Wed, 30 Jul 2003 14:29:52 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3360969; Wed, 30 Jul 2003 10:30:12 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Mark Bronnimann , pgsql-sql@postgresql.org Subject: Re: [SQL] function returning setof performance question Date: Wed, 30 Jul 2003 10:28:50 -0700 User-Agent: KMail/1.4.3 References: <20030730020859.GA1795@spiff.astoria.bogus> In-Reply-To: <20030730020859.GA1795@spiff.astoria.bogus> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307301028.50759.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/481 X-Sequence-Number: 2774 Mark, I'm crossing this over to the performance list; it's really appropriate on= =20 both lists. So I'm quoting you in full as well. > I have a question regarding the performance of a function returning a= =20 > set of a view as opposed to just selecting the view with the same=20 > where clause. Please, if this should go to the performance list instead,= =20 > let me know. I'm just wondering about this from the sql end of things.=20 >=20 > Here's the environment: >=20 > I'm working from PHP, calling on the query.=20 >=20 > I have a view that joins 12 tables and orders the results.=20 >=20 > From PHP, I do a select on that view with a where clause.=20 >=20 > I created a function that queries the view with the where clause=20 > included in the function. The function is returning a setof that=20 > view taking one variable for the where clause (there are several=20 > other static wheres in there). >=20 > I have found that querying the view with the where clause is=20 > giving me quicker results than if I call the function.=20 >=20 > The performance hit is tiny, we're talking less than 1/2 a second,=20 > but when I've done this sort of thing in Oracle I've seen a performance= =20 > increase, not a decrease.=20 >=20 > Any ideas?=20 Actually, this is exactly what I'd expect in your situation. The SRF retu= rns=20 the records in a very inefficient fashion: by materializing the result set= =20 and looping through it to return it to the calling cursor, whereas the View= =20 does set-based operations to grab blocks of data. Also PL/pgSQL as a=20 language is not nearly as optimized as Oracle's PL/SQL. It's also possible that PostgreSQL handles criteria-filtered views better t= han=20 Oracle does. I wouldn't be surprised. The only times I can imagine an SRF being faster than a view with a where= =20 clause are: 1) When you're only returning a small part of a complex result set, e.g. 10= =20 rows out of 32,718. 2) When the view is too complex (e.g. UNION with subselects) for the Postgr= es=20 planner to "push down" the WHERE criteria into the view execution. I've been planning on testing the performance of SRFs vs. views myself for= =20 paginated result sets in a web application, but haven't gotten around to it= =20 since I can't get my www clients to upgrade to 7.3 ... --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jul 30 15:33:46 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DFAB9D1C4D6 for ; Wed, 30 Jul 2003 18:32:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77943-07 for ; Wed, 30 Jul 2003 15:31:42 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id CD906D1C4EB for ; Wed, 30 Jul 2003 15:32:42 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030730183244.DPER7142.lakemtao01.cox.net@[192.168.1.1]> for ; Wed, 30 Jul 2003 14:32:44 -0400 Subject: Re: postgresql.conf From: Ron Johnson To: PgSQL Performance ML In-Reply-To: References: Content-Type: text/plain Message-Id: <1059589963.7505.325.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 30 Jul 2003 13:32:43 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/483 X-Sequence-Number: 2776 On Wed, 2003-07-30 at 11:59, scott.marlowe wrote: > I'm looking at doing the example postgresql.conf files for the 7.4 > release. So far, the catagories we have would be a matrix of: > > -------------- Large Machine -- Small Machine > Webserver > OLAP > OLTP > Workstation > > But likely only one entry for workstation. How about "General Purpose", for DBs that don't fit into any one category? > anyone have any advice on what they use in which situations and what we > should include in the examples? > > I'm guessing OLTP needs things like FSM cranked up, > OLAP (a for analytical) needs more shared buffers and sort memory > Webserver might be better served just slightly higher values than default > but well under those of either OLTP or OLAP... -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Wed Jul 30 15:34:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 346D5D1C4D5 for ; Wed, 30 Jul 2003 18:34:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80348-02 for ; Wed, 30 Jul 2003 15:33:14 -0300 (ADT) Received: from c000.snv.cp.net (h007.c000.snv.cp.net [209.228.32.71]) by svr1.postgresql.org (Postfix) with SMTP id 9E25DD1C4D7 for ; Wed, 30 Jul 2003 15:34:13 -0300 (ADT) Received: (cpmta 13160 invoked from network); 30 Jul 2003 11:34:13 -0700 Received: from 209.228.32.82 (HELO mail.treat.com.criticalpath.net) by smtp.treat.com (209.228.32.71) with SMTP; 30 Jul 2003 11:34:13 -0700 X-Sent: 30 Jul 2003 18:34:13 GMT Received: from [208.255.226.178] by mail.treat.com with HTTP; Wed, 30 Jul 2003 14:34:13 -0400 (EDT) Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 7bit MIME-Version: 1.0 To: scott.marlowe@ihs.com Cc: pgsql-performance@postgresql.org From: "Robert Treat" Subject: Re: postgresql.conf X-Sent-From: rob@treat.com Date: Wed, 30 Jul 2003 14:34:13 -0400 (EDT) X-Mailer: Web Mail 5.4.0-4_sol28 Message-Id: <20030730113413.6872.h018.c000.wm@mail.treat.com.criticalpath.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/484 X-Sequence-Number: 2777 On Wed, 30 Jul 2003 10:59:23 -0600 (MDT), "scott.marlowe" wrote: > > I'm looking at doing the example postgresql.conf files for the 7.4 > release. So far, the catagories we have would be a matrix of: > > -------------- Large Machine -- Small Machine > Webserver > OLAP > OLTP > Workstation > > But likely only one entry for workstation. > > anyone have any advice on what they use in which situations and what we > should include in the examples? > > I'm guessing OLTP needs things like FSM cranked up, > OLAP (a for analytical) needs more shared buffers and sort memory > Webserver might be better served just slightly higher values than default > but well under those of either OLTP or OLAP... > Are you planning on differentiating between dedicated machines and multi-server machines? For example, a dedicated database for a webserver would be tuned differently from a server that was running both the webserver and the database on the same machine. Robert Treat -- Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Wed Jul 30 15:44:19 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 00D45D1C4EB for ; Wed, 30 Jul 2003 18:44:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80570-04 for ; Wed, 30 Jul 2003 15:43:13 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 071BFD1C4D7 for ; Wed, 30 Jul 2003 15:44:13 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3361272; Wed, 30 Jul 2003 11:44:33 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Robert Treat" , scott.marlowe@ihs.com Subject: Re: postgresql.conf Date: Wed, 30 Jul 2003 11:43:11 -0700 User-Agent: KMail/1.4.3 Cc: pgsql-performance@postgresql.org References: <20030730113413.6872.h018.c000.wm@mail.treat.com.criticalpath.net> In-Reply-To: <20030730113413.6872.h018.c000.wm@mail.treat.com.criticalpath.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307301143.11609.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/485 X-Sequence-Number: 2778 Robert, > Are you planning on differentiating between dedicated machines and=20 multi-server > machines? For example, a dedicated database for a webserver would be tuned > differently from a server that was running both the webserver and the=20 database on > the same machine.=20 My thought is when we define "Small Machine" in at the top of the file we= =20 define it as "Small Machine or Multi-Purpose machine". The settings should= =20 be nearly the same for a machine that has only 64MB of *available* RAM as o= ne=20 that has only 96MB of RAM at all. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jul 30 16:00:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 08E79D1C90E for ; Wed, 30 Jul 2003 18:59:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78640-10 for ; Wed, 30 Jul 2003 15:58:40 -0300 (ADT) Received: from silmaril.syscor.priv (h24-77-52-251.sbm.shawcable.net [24.77.52.251]) by svr1.postgresql.org (Postfix) with ESMTP id 6962CD1C4EB for ; Wed, 30 Jul 2003 15:59:39 -0300 (ADT) Received: from syscor.com (strider.syscor.priv [192.168.1.3]) by silmaril.syscor.priv (8.12.8/8.12.8) with ESMTP id h6UIxhUe024572 for ; Wed, 30 Jul 2003 11:59:43 -0700 Message-ID: <3F28159E.6090606@syscor.com> Date: Wed, 30 Jul 2003 11:59:42 -0700 From: Ron User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: postgresql.conf References: <20030730113413.6872.h018.c000.wm@mail.treat.com.criticalpath.net> <200307301143.11609.josh@agliodbs.com> In-Reply-To: <200307301143.11609.josh@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/486 X-Sequence-Number: 2779 Josh Berkus wrote: >Robert, > > > >>Are you planning on differentiating between dedicated machines and >> >> >multi-server > > >>machines? For example, a dedicated database for a webserver would be tuned >>differently from a server that was running both the webserver and the >> >> >database on > > >>the same machine. >> >> > >My thought is when we define "Small Machine" in at the top of the file we >define it as "Small Machine or Multi-Purpose machine". The settings should >be nearly the same for a machine that has only 64MB of *available* RAM as one >that has only 96MB of RAM at all. > > > We are using postgres 7.3.2 for one of our clients with a smallish db, on a p4 with 4G ram box which also servers as a web server and a web-based file repository (~ 80G). We are starting another project for another customer, on a p4 with 2G ram, and the db will be larger, approx 7-15G when finished. This box will also be used as a web server, and as it won't go 'live' until the fall, will run 7.4. I don't know if this is representative of other postgresql installs, but I would also put in my vote for the differentiation added, as these are not small machines but are multi-server boxes. my 2 cents worth Ron PS the new postgresql.conf performance tuning docs are extremely helpful, thanks From pgsql-performance-owner@postgresql.org Wed Jul 30 16:13:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 50EB2D1C4D5 for ; Wed, 30 Jul 2003 19:11:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80294-06 for ; Wed, 30 Jul 2003 16:10:50 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 50FCAD1C4D7 for ; Wed, 30 Jul 2003 16:11:50 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3361423; Wed, 30 Jul 2003 12:12:11 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Ron , pgsql-performance@postgresql.org Subject: Re: postgresql.conf Date: Wed, 30 Jul 2003 12:10:49 -0700 User-Agent: KMail/1.4.3 References: <20030730113413.6872.h018.c000.wm@mail.treat.com.criticalpath.net> <200307301143.11609.josh@agliodbs.com> <3F28159E.6090606@syscor.com> In-Reply-To: <3F28159E.6090606@syscor.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307301210.49034.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/487 X-Sequence-Number: 2780 Ron, > I don't know if this is representative of other postgresql installs, but= =20 > I would also put in my vote for the differentiation added, as these are= =20 > not small machines but are multi-server boxes. But how is the Multi-purpose configuration different from the Small Machine= =20 configuration? If the actual settings are the same, we just need to=20 explain somewhere what it means. I'll argue pretty strongly against including a seperate MP configuration=20 because it would raise our number of suggested sets to 10 from 7. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jul 30 16:39:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 04313D1C4D5 for ; Wed, 30 Jul 2003 19:38:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 81257-08 for ; Wed, 30 Jul 2003 16:37:31 -0300 (ADT) Received: from trade-india.com (ns5.trade-india.com [66.234.10.13]) by svr1.postgresql.org (Postfix) with SMTP id 0485CD1C951 for ; Wed, 30 Jul 2003 16:38:26 -0300 (ADT) Received: (qmail 12634 invoked by uid 0); 30 Jul 2003 19:37:52 -0000 Received: from mallah@trade-india.com by ns5.trade-india.com by uid 502 with qmail-scanner-1.15 (uvscan: v4.1.60/v4171. Clear:. Processed in 1.950342 secs); 30 Jul 2003 19:37:52 -0000 Received: from unknown (HELO trade-india.com) (203.145.130.142) by ns5.trade-india.com with SMTP; 30 Jul 2003 19:37:50 -0000 Message-ID: <3F281EB7.7010308@trade-india.com> Date: Thu, 31 Jul 2003 01:08:31 +0530 From: Rajesh Kumar Mallah User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Why performance improvement on converting subselect References: <200307291114.29567.mallah@trade-india.com> <3F26A503.3050104@trade-india.com> <4578.1059514334@sss.pgh.pa.us> <200307301254.49159.mallah@trade-india.com> <9198.1059573083@sss.pgh.pa.us> In-Reply-To: <9198.1059573083@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/488 X-Sequence-Number: 2781 Tom Lane wrote: >Rajesh Kumar Mallah writes: > > >>What lead to degradation was the bumping off of >>effective_cache_size parameter from 1000 to 64K >> >> > >Check the plan then; AFAIR the only possible effect of changing >effective_cache_size is to influence which plan the planner picks. > Dear Tom, Below are the plans for two cases. I dont know how to read them accurately can u please explain them. Also can anyone point to some documentation oriented towards understanding explain analyze output? Regds Mallah. tradein_clients=# SET effective_cache_size = 1000; SET tradein_clients=# explain analyze SELECT pri_key,most_recent_edition(pri_key) from profiles where source='BRANDING' limit 100; QUERY PLAN -------------------------------------------------------------------------------------------------------------------- Limit (cost=0.00..25.67 rows=100 width=4) (actual time=141.11..154.71 rows=100 loops=1) -> Seq Scan on profiles (cost=0.00..15754.83 rows=61385 width=4) (actual time=141.11..154.51 rows=101 loops=1) Filter: (source = 'BRANDING'::character varying) Total runtime: 154.84 msec (4 rows) tradein_clients=# SET effective_cache_size = 64000; SET tradein_clients=# explain analyze SELECT pri_key,most_recent_edition(pri_key) from profiles where source='BRANDING' limit 100; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------- Limit (cost=0.00..25.67 rows=100 width=4) (actual time=587.61..22884.75 rows=100 loops=1) -> Seq Scan on profiles (cost=0.00..15754.83 rows=61385 width=4) (actual time=587.60..22884.25 rows=101 loops=1) Filter: (source = 'BRANDING'::character varying) Total runtime: 22884.97 msec (4 rows) tradein_clients=# > > regards, tom lane > >---------------------------(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 Wed Jul 30 17:22:38 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 21ED9D1C977 for ; Wed, 30 Jul 2003 20:22:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85438-08 for ; Wed, 30 Jul 2003 17:21:28 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id EDA54D1C7F1 for ; Wed, 30 Jul 2003 17:22:27 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6UKLcpe026235; Wed, 30 Jul 2003 14:21:38 -0600 (MDT) Date: Wed, 30 Jul 2003 14:09:32 -0600 (MDT) From: "scott.marlowe" To: Josh Berkus Cc: Ron , Subject: Re: postgresql.conf In-Reply-To: <200307301210.49034.josh@agliodbs.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/489 X-Sequence-Number: 2782 On Wed, 30 Jul 2003, Josh Berkus wrote: > Ron, > > > I don't know if this is representative of other postgresql installs, but > > I would also put in my vote for the differentiation added, as these are > > not small machines but are multi-server boxes. > > But how is the Multi-purpose configuration different from the Small Machine > configuration? If the actual settings are the same, we just need to > explain somewhere what it means. > > I'll argue pretty strongly against including a seperate MP configuration > because it would raise our number of suggested sets to 10 from 7. Maybe we should look at it more from the point of view of how much horsepower (I/O bandwidth, memory, memory bandwidth, cpu bandwidth) is left over for postgresql. After all, a Dual 2.8GHz Opteron with 32 gigs of ram is gonna be faster, even if it has apache/LDAP/etc on it than a dedicated P100 with 64 meg of ram. I think the default postgresql.conf should be the one for the 64 Meg free PII-300 and below class, and our first step up should assume say, 256 Meg ram and simple RAID1, approximately 1GHz CPU or less. The high end should assume Dual CPUs of 1Ghz or better, 1Gig of ram (or more). Once someone is getting into the 8 way Itanium II with 32 Gigs of RAM, the fact that they are doing something that big means that by looking at the default, the workgroup, and the large server configs, they can extrapolate and experiment to determine the best settings, and are going to need to anyway to get it right. So, maybe just a note on which parameters to increase if you have more RAM/CPU/I/O bandwidth in the big server example? From pgsql-performance-owner@postgresql.org Wed Jul 30 17:44:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 24CECD1C7F1 for ; Wed, 30 Jul 2003 20:43:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85912-09 for ; Wed, 30 Jul 2003 17:42:25 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 09384D1C4EB for ; Wed, 30 Jul 2003 17:43:25 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3361918; Wed, 30 Jul 2003 13:43:46 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "scott.marlowe" Subject: Re: postgresql.conf Date: Wed, 30 Jul 2003 13:42:24 -0700 User-Agent: KMail/1.4.3 Cc: Ron , References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200307301342.24321.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/490 X-Sequence-Number: 2783 Scott, > Once someone is getting into the 8 way Itanium II with 32 Gigs of RAM,=20 > the fact that they are doing something that big means that by looking at= =20 > the default, the workgroup, and the large server configs, they can=20 > extrapolate and experiment to determine the best settings, and are going= =20 > to need to anyway to get it right. >=20 > So, maybe just a note on which parameters to increase if you have more=20 > RAM/CPU/I/O bandwidth in the big server example? Also, lets not get away from our goal here, which is NOT to provide=20 comprehensive documenation (which is available elsewhere) but to give new= =20 DBAs a *sample* config that will perform better than the default. Plus, I would assume that anybody who spent $50,000 on hardware would be sm= art=20 enough to pay a consultant $1000 to tune their database correctly. --=20 -Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jul 30 19:10:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 105CCD1C4D0 for ; Wed, 30 Jul 2003 22:10:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 93668-04 for ; Wed, 30 Jul 2003 19:09:24 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 58789D1C4D5 for ; Wed, 30 Jul 2003 19:10:22 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6UMAOp15472; Wed, 30 Jul 2003 18:10:24 -0400 (EDT) From: Bruce Momjian Message-Id: <200307302210.h6UMAOp15472@candle.pha.pa.us> Subject: Re: Mapping a database completly into Memory In-Reply-To: To: Vivek Khera Date: Wed, 30 Jul 2003 18:10:24 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/491 X-Sequence-Number: 2784 I think it all depends on your working set. Having shared memory be smaller than you working set causes pages to have to be copied in from the kernel buffers (not a huge problem, but a small penalty), while having shared memory larger than the working set causes overhead of searching through all those buffers. --------------------------------------------------------------------------- Vivek Khera wrote: > >>>>> "TL" == Tom Lane writes: > > TL> Franco Bruno Borghesi writes: > >> wouldn't also increasing shared_buffers to 64 or 128 MB be a good > >> performance improvement? This way, pages belonging to heavily used > >> indexes would be already cached by the database itself. > > TL> Not necessarily. The trouble with large shared_buffers settings is you > TL> end up with lots of pages being doubly cached (both in PG's buffers and > > I think if you do a lot of inserting/updating to your table, then more > SHM is better (and very high fsm settings), since you defer pushing > out the dirty pages to the disk. For read-mostly, I agree that > letting the OS do the caching is a better way. > > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Vivek Khera, Ph.D. Khera Communications, Inc. > Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 > AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ > > ---------------------------(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 > -- 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 Jul 30 19:12:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E50FED1C4D0 for ; Wed, 30 Jul 2003 22:12:53 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 92903-09 for ; Wed, 30 Jul 2003 19:11:53 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 1755BD1C921 for ; Wed, 30 Jul 2003 19:12:51 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h6UMCrc15739; Wed, 30 Jul 2003 18:12:53 -0400 (EDT) From: Bruce Momjian Message-Id: <200307302212.h6UMCrc15739@candle.pha.pa.us> Subject: Re: Mapping a database completly into Memory In-Reply-To: To: Vivek Khera Date: Wed, 30 Jul 2003 18:12:53 -0400 (EDT) Cc: pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (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-Archive-Number: 200307/492 X-Sequence-Number: 2785 You make an interesting distinction that read/write needs more shared memory. I think this is because if you want to reused a read-only shared buffer, you can just throw away the contents, while a dirty buffer requires you to write it into the kernel before you can use it. --------------------------------------------------------------------------- Vivek Khera wrote: > >>>>> "TL" == Tom Lane writes: > > TL> Franco Bruno Borghesi writes: > >> wouldn't also increasing shared_buffers to 64 or 128 MB be a good > >> performance improvement? This way, pages belonging to heavily used > >> indexes would be already cached by the database itself. > > TL> Not necessarily. The trouble with large shared_buffers settings is you > TL> end up with lots of pages being doubly cached (both in PG's buffers and > > I think if you do a lot of inserting/updating to your table, then more > SHM is better (and very high fsm settings), since you defer pushing > out the dirty pages to the disk. For read-mostly, I agree that > letting the OS do the caching is a better way. > > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Vivek Khera, Ph.D. Khera Communications, Inc. > Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 > AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ > > ---------------------------(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 > -- 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 Jul 31 00:21:42 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 154C2D1C4EB for ; Thu, 31 Jul 2003 03:21:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 13589-03 for ; Thu, 31 Jul 2003 00:20:36 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id E3E89D1C4D6 for ; Thu, 31 Jul 2003 00:21:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6V3LcQ3027222; Wed, 30 Jul 2003 23:21:38 -0400 (EDT) To: Rajesh Kumar Mallah Cc: pgsql-performance@postgresql.org Subject: Re: Why performance improvement on converting subselect In-reply-to: <3F281EB7.7010308@trade-india.com> References: <200307291114.29567.mallah@trade-india.com> <3F26A503.3050104@trade-india.com> <4578.1059514334@sss.pgh.pa.us> <200307301254.49159.mallah@trade-india.com> <9198.1059573083@sss.pgh.pa.us> <3F281EB7.7010308@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Thu, 31 Jul 2003 01:08:31 +0530" Date: Wed, 30 Jul 2003 23:21:38 -0400 Message-ID: <27221.1059621698@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/493 X-Sequence-Number: 2786 Rajesh Kumar Mallah writes: > Below are the plans for two cases. I dont know how to read them accurately > can u please explain them. Well, they're the same plan, as far as they go. I suppose that the runtime difference must come from choosing a different plan inside the most_recent_edition() function, which we cannot see in the explain output. As before, turning on logging of verbose query plans is the only way to look at what the function is doing. > Also can anyone point to some documentation > oriented towards understanding explain analyze output? http://www.postgresql.org/docs/view.php?version=7.3&idoc=0&file=performance-tips.html regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 31 02:39:48 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 19D21D1C4D0 for ; Thu, 31 Jul 2003 05:39:45 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 25061-04 for ; Thu, 31 Jul 2003 02:38:41 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id D589BD1C4D5 for ; Thu, 31 Jul 2003 02:39:42 -0300 (ADT) Received: from acdc.int.libertyrms.com ([10.1.2.254] helo=libertyrms.info) by mail.libertyrms.com with smtp (Exim 3.22 #3 (Debian)) id 19i6AA-0003VC-00 for ; Thu, 31 Jul 2003 01:39:42 -0400 Received: from 64.229.210.126 (SquirrelMail authenticated user cbbrowne) by look.libertyrms.com with HTTP; Thu, 31 Jul 2003 01:39:44 -0400 (EDT) Message-ID: <63416.64.229.210.126.1059629984.squirrel@look.libertyrms.com> Date: Thu, 31 Jul 2003 01:39:44 -0400 (EDT) Subject: Possible problem with DOMAIN evaluation? From: "Christopher Browne" To: X-Priority: 3 Importance: Normal Reply-To: cbbrowne@libertyrms.info X-Mailer: SquirrelMail (version 1.2.11) 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-Archive-Number: 200307/494 X-Sequence-Number: 2787 I have the following schema which I have set up, and I have inserted a bunch of entries into it: create domain contact_id as integer; create sequence contact_seq; create domain street_address as character varying(64); create domain name as character varying(64); create domain country as character(2); create domain telno as character varying(17); create domain extension as character varying(12); create domain public_key as character varying(64); create table contact ( id contact_id unique not null default nextval('contact_seq'), public_key public_key unique not null, name character varying (64), org character varying (64), street1 street_address, street2 street_address, city character varying(30), region character(2), country country, postcode character varying(15), voice telno, voice_ext extension, fax telno, fax_ext extension, cell telno, email character varying(64), created_on timestamp with time zone default now(), updated_on timestamp with time zone default now() ); performance=# explain analyze select * from contact where country::country = 'AD'::character(2); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Index Scan using contact_country_idx on contact (cost=0.00..1405.24 rows=360 width=302) (actual time=0.07..5.30 rows=344 loops=1) Index Cond: ((country)::bpchar = 'AD'::bpchar) Total runtime: 5.72 msec (3 rows) I do the same query using the actual name of the domain, and get the following: performance=# explain analyze select * from contact where country::country = 'AD'::country; QUERY PLAN ---------------------------------------------------------------------------------------------------------- Seq Scan on contact (cost=0.00..8181.81 rows=360 width=302) (actual time=0.04..825.48 rows=344 loops=1) Filter: ((country)::text = 'AD'::text) Total runtime: 825.85 msec (3 rows) Apparently the filter transforms ::country into ::text, essentially losing the domain information, and destroying the ability to detect the index. I was a little disappointed that explain analyze select * from contact where country = 'AD'; didn't do well; the value of DOMAINS is seriously injured if their metadata gets lost, for optimization purposes. Version 7.3.3, FYI... It's not inconceivable that this might have changed in 7.4, which would strengthen the argument that DOMAINs didn't become useful 'til 7.4... [Rummaging around for 7.4 instance...] performance=# explain analyze select * from contact where country = 'AD'::country; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------ Index Scan using contact_country_idx on contact (cost=0.00..547.57 rows=291 width=516) (actual time=0.24..33.88 rows=143 loops=1) Index Cond: ((country)::bpchar = (('AD'::bpchar)::country)::bpchar) Total runtime: 34.43 msec (3 rows) Looks like that IS the case; in fact, it gets that same plan even if I don't specify ::country on the country string... This is obviously something that has changed _big time_ betwixt 7.3 and 7.4... -- (reverse (concatenate 'string "ofni.smrytrebil@" "enworbbc")) Christopher Browne (416) 646 3304 x124 (land) From pgsql-performance-owner@postgresql.org Thu Jul 31 02:45:32 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0013DD1C4D5 for ; Thu, 31 Jul 2003 05:45:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 25954-01 for ; Thu, 31 Jul 2003 02:44:20 -0300 (ADT) Received: from lakemtao04.cox.net (lakemtao04.cox.net [68.1.17.241]) by svr1.postgresql.org (Postfix) with ESMTP id AC2E5D1C4D0 for ; Thu, 31 Jul 2003 02:45:21 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao04.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030731054524.NYJI13930.lakemtao04.cox.net@[192.168.1.1]> for ; Thu, 31 Jul 2003 01:45:24 -0400 Subject: Targeted CPU compilations From: Ron Johnson To: PgSQL Performance ML Content-Type: text/plain Message-Id: <1059630316.7508.368.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 00:45:17 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/495 X-Sequence-Number: 2788 Hi, Has anyone done any benchmarks to see if PG compiled for the target CPU (Athlon XP, P4 Xeon, Pentium III, etc) is significantly more efficient than when compiled for the i386? This should also apply to Sparc, Alpha, etc. Yes, more RAM and faster disks are extremely important, but when the fast disks have sucked the commonly shared data into all that RAM, the RAM cache will be exercise heavily, and that means lots of CPU. Business logic embedded in SQL and stored procedures, and CRC (or MD5) calculations would also be sped up. -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 31 09:12:34 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2517DD1C923 for ; Thu, 31 Jul 2003 12:11:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 44853-05 for ; Thu, 31 Jul 2003 09:10:15 -0300 (ADT) Received: from mailav.tor1.inquent.com (mail.inquent.com [216.208.117.106]) by svr1.postgresql.org (Postfix) with ESMTP id 5C46FD1C7F5 for ; Thu, 31 Jul 2003 09:11:15 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mailav.tor1.inquent.com (Postfix) with ESMTP id BA2FD1024D; Thu, 31 Jul 2003 08:04:03 -0400 (EDT) Received: from [192.168.1.200] (dyn-133-81.tor.dsl.tht.net [134.22.133.81]) by mailav.tor1.inquent.com (Postfix) with ESMTP id 3F1DC10248; Thu, 31 Jul 2003 08:04:01 -0400 (EDT) Subject: Re: Possible problem with DOMAIN evaluation? From: Rod Taylor To: cbbrowne@libertyrms.info Cc: Postgresql Performance In-Reply-To: <63416.64.229.210.126.1059629984.squirrel@look.libertyrms.com> References: <63416.64.229.210.126.1059629984.squirrel@look.libertyrms.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-nAfOVy5dQVV/ilyUMRKk" Message-Id: <1059653517.29474.26.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 08:11:58 -0400 X-Virus-Scanned: by AMaViS perl-11 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/496 X-Sequence-Number: 2789 --=-nAfOVy5dQVV/ilyUMRKk Content-Type: text/plain Content-Transfer-Encoding: quoted-printable > Looks like that IS the case; in fact, it gets that same plan even if I > don't specify ::country on the country string... >=20 > This is obviously something that has changed _big time_ betwixt 7.3 and > 7.4... Several issues of this type have been fixed during 7.4, though there are a few left with the pl languages. --=-nAfOVy5dQVV/ilyUMRKk Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA/KQeN6DETLow6vwwRAgSlAJ0Xwkgu3BAyz02C/hpLo9j/fafxjwCfcGqp Ao/69cg6NrC94E2d99qc64o= =uMDi -----END PGP SIGNATURE----- --=-nAfOVy5dQVV/ilyUMRKk-- From pgsql-performance-owner@postgresql.org Thu Jul 31 11:30:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 12789D1C7F4 for ; Thu, 31 Jul 2003 14:15:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50907-10 for ; Thu, 31 Jul 2003 11:14:21 -0300 (ADT) Received: from yertle.kcilink.com (yertle.kcilink.com [216.194.193.105]) by svr1.postgresql.org (Postfix) with ESMTP id D4D33D1C7F1 for ; Thu, 31 Jul 2003 11:15:20 -0300 (ADT) Received: by yertle.kcilink.com (Postfix, from userid 100) id 918A22178C; Thu, 31 Jul 2003 10:15:04 -0400 (EDT) From: Vivek Khera MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16169.9320.444739.336507@yertle.int.kciLink.com> Date: Thu, 31 Jul 2003 10:15:04 -0400 To: pgsql-performance@postgresql.org Subject: Re: Mapping a database completly into Memory In-Reply-To: <200307302210.h6UMAOp15472@candle.pha.pa.us> References: <200307302210.h6UMAOp15472@candle.pha.pa.us> X-Mailer: VM 7.14 under 21.4 (patch 12) "Portable Code" XEmacs Lucid X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/497 X-Sequence-Number: 2790 >>>>> "BM" == Bruce Momjian writes: BM> I think it all depends on your working set. Having shared memory be BM> smaller than you working set causes pages to have to be copied in from BM> the kernel buffers (not a huge problem, but a small penalty), while BM> having shared memory larger than the working set causes overhead of BM> searching through all those buffers. i.e., It is a black art, and no single piece of advice can be taken in isolation ;-( From pgsql-performance-owner@postgresql.org Thu Jul 31 15:44:22 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3DA4AD1C4D0 for ; Thu, 31 Jul 2003 14:43:24 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 54792-01 for ; Thu, 31 Jul 2003 11:42:23 -0300 (ADT) Received: from snowwhite.lulu.com (unknown [66.193.5.50]) by svr1.postgresql.org (Postfix) with ESMTP id 0E83ED1C9D8 for ; Thu, 31 Jul 2003 11:43:21 -0300 (ADT) Received: from lulu.com (foo.rdu.lulu.com [10.0.0.123]) by snowwhite.lulu.com (8.11.6/8.11.6) with ESMTP id h6VEh0V15082 for ; Thu, 31 Jul 2003 10:43:15 -0400 Message-ID: <3F292AF4.1000104@lulu.com> Date: Thu, 31 Jul 2003 10:43:00 -0400 From: cafweb User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: postgresql.conf References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------000409090906070601000706" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/499 X-Sequence-Number: 2792 This is a multi-part message in MIME format. --------------000409090906070601000706 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit >So, maybe just a note on which parameters to increase if you have more >RAM/CPU/I/O bandwidth in the big server example? > > Yes, that would be great. Actually I prefer rules of thumb and examples for each extreme. If possible a little note WHY the parameter should be tweaked, and what effects it will have. For example, more note's like Josh's below would be a big help... >Yes. Take sort_mem for example: >OLTP_SM 1024 >OLTP_LM 2048 >OLAP_SM 4096 >OLAP_LM 16384 >WWW_SM 512 >WWW_LM 1024 >Workstation 1024 > >The basic idea is: >More RAM => more sort_mem >More concurrent queries => less sort_mem >Larger data sets => more sort_mem >Lots of grouped aggregates => more sort_mem > > > -- [ Christian Fowler [ cafweb@lulu.com [ http://www.lulu.com --------------000409090906070601000706 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
So, maybe just a note on which parameters to increase if you have more 
RAM/CPU/I/O bandwidth in the big server example?
  
Yes, that would be great. Actually I prefer rules of thumb and examples for each extreme. If possible a little note WHY the parameter should be tweaked, and what effects it will have. For example, more note's like Josh's below would be a big help...

Yes. Take sort_mem for example:
OLTP_SM	1024
OLTP_LM	2048
OLAP_SM	4096
OLAP_LM	16384
WWW_SM	512
WWW_LM	1024
Workstation	1024

The basic idea is:
More RAM => more sort_mem
More concurrent queries => less sort_mem
Larger data sets => more sort_mem
Lots of grouped aggregates => more sort_mem

  

-- 
[ Christian Fowler
[ cafweb@lulu.com
[ http://www.lulu.com
--------------000409090906070601000706-- From pgsql-performance-owner@postgresql.org Thu Jul 31 15:11:50 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 20F49D1C994 for ; Thu, 31 Jul 2003 15:42:02 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 60090-09 for ; Thu, 31 Jul 2003 12:40:26 -0300 (ADT) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by svr1.postgresql.org (Postfix) with ESMTP id 9DEA3D1C91E for ; Thu, 31 Jul 2003 12:41:29 -0300 (ADT) Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19iFXQ-000796-00 for ; Thu, 31 Jul 2003 17:40:20 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19iF11-0003CD-00 for ; Thu, 31 Jul 2003 17:06:51 +0200 From: "Jianshuo Niu" Subject: Help on my database performance Date: Thu, 31 Jul 2003 11:06:09 -0400 Lines: 28 Message-ID: X-Complaints-To: usenet@main.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/498 X-Sequence-Number: 2791 Hi! There: I ran the same explain analyze on two similar tables. However, the table with less data took much more time than the one with more data. Could anyone tell me what happened? Here is the explain analyze: explain analyze select productid from tfd_catalog; NOTICE: QUERY PLAN: Seq Scan on tfd_catalog (cost=0.00..43769.82 rows=161282 width=10) (actual time =3928.64..12905.76 rows=161282 loops=1) Total runtime: 13240.21 msec explain analyze select productid from hm_catalog; NOTICE: QUERY PLAN: Seq Scan on hm_catalog (cost=0.00..22181.18 rows=277518 width=9) (actual time=2 1.32..6420.76 rows=277518 loops=1) Total runtime: 6772.95 msec Thank you for your help Josh From pgsql-performance-owner@postgresql.org Thu Jul 31 17:15:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 41C72D1C9C5 for ; Thu, 31 Jul 2003 17:37:47 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 68720-02 for ; Thu, 31 Jul 2003 14:36:42 -0300 (ADT) Received: from email06.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.75]) by svr1.postgresql.org (Postfix) with SMTP id 16A44D1C9C7 for ; Thu, 31 Jul 2003 14:37:44 -0300 (ADT) Received: (qmail 421212 invoked from network); 31 Jul 2003 17:37:41 -0000 Received: from m168p012.dipool.highway.telekom.at (HELO cantor) ([62.46.10.236]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 17:37:41 -0000 From: Manfred Koizar To: Sean Chittenden Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Moving postgresql.conf tunables into 2003... Date: Thu, 31 Jul 2003 19:37:40 +0200 Message-ID: <4nfiiv850cu7vkp39tv7mk2b3pniim8ccu@4ax.com> References: <20030703190502.GR72567@perrin.int.nxad.com> <2422.1057264735@sss.pgh.pa.us> <20030704000646.GV72567@perrin.int.nxad.com> In-Reply-To: <20030704000646.GV72567@perrin.int.nxad.com> X-Mailer: Forte Agent 1.93/32.576 English (American) 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-Archive-Number: 200307/503 X-Sequence-Number: 2796 [jumping in late due to vacation] On Thu, 3 Jul 2003 17:06:46 -0700, Sean Chittenden wrote: >> is some other problem that needs to be solved. (I'd wonder about >> index correlation myself; we know that that equation is pretty >> bogus.) > >Could be. I had him create a multi-column index on the date and a >non-unique highly redundant id. Tom has already suspected index correlation to be a possible source of the problem and recommended to CLUSTER on the index. A weakness of the current planner implementation is that a multi column index is always thought to have low correlation. In your case even after CLUSTER the 2-column index on (date, sensorid) is treated like a single column index with correlation 0.5. I have an experimental patch lying around somewhere that tries to work around these problems by offering different estimation methods for index scans. If you are interested, I'll dig it out. In the meantime have him try with a single column index on date. On 04 Jul 2003 08:29:04 -0400, Rod Taylor wrote: |That's one heck of a poor estimate for the number of rows returned. | |> -> Seq Scan on mss_fwevent (cost=0.00..223312.60 rows=168478 width=12) | (actual time=24253.66..24319.87 rows=320 loops=1) > -> Index Scan using mss_fwevent_evtime_sensorid_idx on mss_fwevent > (cost=0.00..2442524.70 rows=168478 width=12) > (actual time=68.36..132.84 rows=320 loops=1) > Index Cond: ((evtime > (now() - '06:00'::interval)) AND (sensorid = 7)) > Filter: (NOT "action") Estimated number of rows being wrong by a factor 500 seems to be the main problem hiding everything else. With statistics already set to 1000, does this mean that sensorid, evtime, and action are not independent? It'd be interesting to know whether the estimation error comes from "Index Cond" or from "Filter". Servus Manfred From pgsql-performance-owner@postgresql.org Thu Jul 31 16:57:57 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id B260CD1C9C5 for ; Thu, 31 Jul 2003 18:57:25 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 70041-10 for ; Thu, 31 Jul 2003 15:56:21 -0300 (ADT) Received: from lorax.kciLink.com (lorax.kciLink.com [206.112.95.1]) by svr1.postgresql.org (Postfix) with ESMTP id DD816D1C9C8 for ; Thu, 31 Jul 2003 15:57:23 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by lorax.kciLink.com (Postfix) with ESMTP id CA24F3EDF for ; Thu, 31 Jul 2003 14:57:24 -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 SMTP id 01559-02 for ; Thu, 31 Jul 2003 14:57:14 -0400 (EDT) Received: by lorax.kciLink.com (Postfix, from userid 8) id 83A5C3ED2; Thu, 31 Jul 2003 14:57:14 -0400 (EDT) To: pgsql-performance@postgresql.org Path: not-for-mail From: Vivek Khera Newsgroups: ml.postgres.performance Subject: Re: Tuning PostgreSQL Date: Thu, 31 Jul 2003 14:57:14 -0400 Organization: Khera Communications, Inc., Rockville, MD Lines: 21 Message-ID: References: <1059508232.7508.191.camel@haggis> NNTP-Posting-Host: yertle.kcilink.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: lorax.kciLink.com 1059677834 1626 216.194.193.105 (31 Jul 2003 18:57:14 GMT) X-Complaints-To: daemon@kciLink.com NNTP-Posting-Date: Thu, 31 Jul 2003 18:57:14 +0000 (UTC) User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, berkeley-unix) Cancel-Lock: sha1:l7u0Gsc28jxxpz3B8LjsYF3dLNg= X-Virus-Scanned: by amavisd-new at kciLink.com X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/502 X-Sequence-Number: 2795 >>>>> "RJ" == Ron Johnson writes: RJ> On Tue, 2003-07-29 at 14:00, scott.marlowe wrote: RJ> Sounds like my kinda card! RJ> Is the cache battery-backed up? yep RJ> How much cache can you stuff in them? as per dell, the max is 128Mb, which was a bummer. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D. Khera Communications, Inc. Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ From pgsql-performance-owner@postgresql.org Thu Jul 31 16:35:26 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3F124D1C9C8 for ; Thu, 31 Jul 2003 19:33:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 76254-03 for ; Thu, 31 Jul 2003 16:32:49 -0300 (ADT) Received: from email06.aon.at (WARSL402PIP3.highway.telekom.at [195.3.96.75]) by svr1.postgresql.org (Postfix) with SMTP id B471BD1C9DD for ; Thu, 31 Jul 2003 16:33:50 -0300 (ADT) Received: (qmail 101802 invoked from network); 31 Jul 2003 19:13:08 -0000 Received: from m168p012.dipool.highway.telekom.at (HELO cantor) ([62.46.10.236]) (envelope-sender ) by qmail6rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 19:13:08 -0000 From: Manfred Koizar To: "Jianshuo Niu" Cc: pgsql-performance@postgresql.org Subject: Re: Help on my database performance Date: Thu, 31 Jul 2003 21:13:07 +0200 Message-ID: <97qiivonvj5brg9q7ale1033fp53rupi54@4ax.com> References: In-Reply-To: X-Mailer: Forte Agent 1.93/32.576 English (American) 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-Archive-Number: 200307/501 X-Sequence-Number: 2794 On Thu, 31 Jul 2003 11:06:09 -0400, "Jianshuo Niu" wrote: >I ran the same explain analyze on two similar tables. However, the table >with less data took much more time than the one with more data. Could anyone >tell me what happened? >Seq Scan on tfd_catalog (cost=0.00..43769.82 rows=161282 width=10) (actual >time=3928.64..12905.76 rows=161282 loops=1) >Total runtime: 13240.21 msec > >Seq Scan on hm_catalog (cost=0.00..22181.18 rows=277518 width=9) (actual >time=21.32..6420.76 rows=277518 loops=1) >Total runtime: 6772.95 msec The first SELECT takes almost twice the time because tfd_catalog has almost twice as many pages than hm_catalog. This may be due to having wider tuples or more dead tuples in tfd_catalog. In the former case theres not much you can do. But the high startup cost of the first SELECT is a hint for lots of dead tuples. So VACUUM FULL ANALYSE might help. Servus Manfred From pgsql-performance-owner@postgresql.org Thu Jul 31 16:29:06 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0A3F5D1C9D9 for ; Thu, 31 Jul 2003 19:26:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 75390-03 for ; Thu, 31 Jul 2003 16:25:37 -0300 (ADT) Received: from mail-2.zoominternet.net (mail-2.zoominternet.net [63.67.120.22]) by svr1.postgresql.org (Postfix) with SMTP id D07BDD1C9D8 for ; Thu, 31 Jul 2003 16:26:39 -0300 (ADT) Received: (qmail 9554 invoked from network); 31 Jul 2003 19:26:40 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-2.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 19:26:40 -0000 Subject: EXTERNAL storage and substring on long strings From: Scott Cain To: pgsql-performance@postgresql.org Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1059679600.1429.41.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 15:26:40 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/500 X-Sequence-Number: 2793 Hello, A few days ago, I asked for advice on speeding up substring queries on the GENERAL mailing list. Joe Conway helpfully pointed out the ALTER TABLE STORAGE EXTERNAL documentation. After doing the alter, the queries got slower! Here is the background: A freshly loaded database is VACUUM ANALYZEd and I run this query: explain analyze select substring(residues from 1000000 for 20000) from feature where feature_id=1; where feature is a table with ~3 million rows, and residues is a text column, where for the majority of the rows of feature, it is null, for a large minority, it is shortish strings (a few thousand characters), and for 6 rows, residues contains very long strings (~20 million characters (it's chromosome DNA sequence from fruit flies)). Here's the result from the ANALYZE: Index Scan using feature_pkey on feature (cost=0.00..3.01 rows=1 width=152) (actual time=388.88..388.89 rows=1 loops=1) Index Cond: (feature_id = 1) Total runtime: 389.00 msec (3 rows) Now, I'll change the storage: alter table feature alter column residues set storage external; To make sure that really happens, I run an update on feature: update feature set residues = residues where feature_id<8; and then VACUUM ANALYZE again. I run the same EXPLAIN ANALYZE query as above and get this output: Index Scan using feature_pkey on feature (cost=0.00..3.01 rows=1 width=153) (actual time=954.13..954.14 rows=1 loops=1) Index Cond: (feature_id = 1) Total runtime: 954.26 msec (3 rows) Whoa! That's not what I expected, the time to do the query got more that twice as long. So I think, maybe it was just an unlucky section, and overall performance will be much better. So I write a perl script to do substring queries over all of my chromosomes at various positions and lengths (20,000 queries total). For comparison, I also ran the same script, extracting the chromosomes via sql and doing the substring in perl. Here's what happened: substr in perl 0.014sec/query EXTENDED storage 0.0052sec/query default storage 0.0040sec/query So, what am I missing? Why doesn't EXTENDED storage improve substring performance as it says it should in http://www.postgresql.org/docs/7.3/interactive/sql-altertable.html ? I am using an IDE drive on a laptop, running Postgresql 7.3.2 on RedHat Linux 7.3 with 512M RAM. Thanks, Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Thu Jul 31 17:54:01 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id ED693D1C9E1 for ; Thu, 31 Jul 2003 19:45:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 73129-08 for ; Thu, 31 Jul 2003 16:44:13 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id E48A5D1C9DE for ; Thu, 31 Jul 2003 16:45:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6VJivQ3018306; Thu, 31 Jul 2003 15:44:57 -0400 (EDT) To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: EXTERNAL storage and substring on long strings In-reply-to: <1059679600.1429.41.camel@localhost.localdomain> References: <1059679600.1429.41.camel@localhost.localdomain> Comments: In-reply-to Scott Cain message dated "31 Jul 2003 15:26:40 -0400" Date: Thu, 31 Jul 2003 15:44:57 -0400 Message-ID: <18305.1059680697@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/511 X-Sequence-Number: 2804 Scott Cain writes: > explain analyze select substring(residues from 1000000 for 20000) > from feature where feature_id=1; > where feature is a table with ~3 million rows, and residues is a text > column, where for the majority of the rows of feature, it is null, for a > large minority, it is shortish strings (a few thousand characters), and > for 6 rows, residues contains very long strings (~20 million characters > (it's chromosome DNA sequence from fruit flies)). I think the reason uncompressed storage loses here is that the runtime is dominated by the shortish strings, and you have to do more I/O to get at those if they're uncompressed, negating any advantage from not having to fetch all of the longish strings. Or it could be that there's a bug preventing John Gray's substring-slice optimization from getting used. The only good way to tell that I can think of is to rebuild PG with profiling enabled and try to profile the execution both ways. Are you up for that? (BTW, if you are using a multibyte database encoding, then that's your problem right there --- the optimization is practically useless unless character and byte indexes are the same.) regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 31 17:53:51 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4AE95D1C9D9 for ; Thu, 31 Jul 2003 19:51:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77506-04 for ; Thu, 31 Jul 2003 16:50:42 -0300 (ADT) Received: from flake.decibel.org (unknown [66.143.173.58]) by svr1.postgresql.org (Postfix) with SMTP id 65BA2D1C4D0 for ; Thu, 31 Jul 2003 16:51:44 -0300 (ADT) Received: (qmail 91747 invoked by uid 1001); 31 Jul 2003 19:51:45 -0000 Date: Thu, 31 Jul 2003 14:51:45 -0500 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Odd explain estimate Message-ID: <20030731195145.GD55392@nasby.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/510 X-Sequence-Number: 2803 Why is pgsql estimating a cost of 100000000 for retire_today in this query? I analyzed it, and there's nothing very odd about it, other than it's a temp table. BTW, I had to set enable_seqscan=false to get this, otherwise it wants to seqscan ogr_results, which is rather painful since it occupies 350k pages. ogr=# explain analyze select distinct stub_id, nodecount, id from (select distinct stub_id, nodecount, o.id, r.stats_id from retire_today r, ogr_results o where o.id=r.id) o where exists (select * from ogr_results o2 where o2.stub_id=o.stub_id and o2.nodecount=o.nodecount and o2.id=o.stats_id); QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Unique (cost=101349702.99..101350940.01 rows=12370 width=24) (actual time=422568.80..422568.82 rows=1 loops=1) -> Sort (cost=101349702.99..101350012.25 rows=123702 width=24) (actual time=422568.79..422568.80 rows=1 loops=1) Sort Key: stub_id, nodecount, id -> Subquery Scan o (cost=101323777.30..101339240.00 rows=123702 width=24) (actual time=388142.51..422568.59 rows=1 loops=1) Filter: (subplan) -> Unique (cost=101323777.30..101339240.00 rows=123702 width=24) (actual time=12456.49..13570.23 rows=56546 loops=1) -> Sort (cost=101323777.30..101326869.84 rows=1237016 width=24) (actual time=12456.47..12758.86 rows=56546 loops=1) Sort Key: o.stub_id, o.nodecount, o.id, r.stats_id -> Nested Loop (cost=100000000.00..101198600.98 rows=1237016 width=24) (actual time=93.57..11747.10 rows=56546 loops=1) -> Seq Scan on retire_today r (cost=100000000.00..100000001.93 rows=93 width=8) (actual time=0.03..1.78 rows=93 loops=1) -> Index Scan using ogr_results__id on ogr_results o (cost=0.00..12721.90 rows=13301 width=16) (actual time=18.03..118.43 rows=608 loops=93) Index Cond: (o.id = "outer".id) SubPlan -> Index Scan using results_id_count on ogr_results o2 (cost=0.00..3.03 rows=1 width=24) (actual time=7.21..7.21 rows=0 loops=56546) Index Cond: ((stub_id = $0) AND (nodecount = $1)) Filter: (id = $2) Total runtime: 422591.48 msec (17 rows) Table "pg_temp_2.retire_today" Column | Type | Modifiers ----------+-----------------------+----------- email | character varying(64) | not null id | integer | not null stats_id | integer | not null ogr=# select * from pg_stats where tablename='retire_today'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+--------------+----------+-----------+-----------+------------+--------------------------------------+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------- pg_temp_1 | retire_today | email | 0 | 23 | -1 | | | {75521.3541@compuserve.com,arlehma@01019freenet.de,dallas.morlock@worldnet.att.net,hugo@mcs.net,jmk_yoko@yahoo.com.au,lenchik@severodvinsk.ru,nilrem@o2.pl,rc55@pochta.ru,seph429@earthlink.net,vitte@frontbone.de,zotxxx@xs4all.nl} | 0.894781 pg_temp_1 | retire_today | id | 0 | 4 | -1 | | | {17193,153860,220570,315863,351077,382582,405976,413303,418589,423335,424575} | 0.17536 pg_temp_1 | retire_today | stats_id | 0 | 4 | -0.946237 | {142167,391154,402835,422577,423809} | {0.0215054,0.0215054,0.0215054,0.0215054,0.0215054} | {136669,373730,415341,421924,423416,423553,423959,424089,424354,424609,424976} | -0.132419 pg_temp_2 | retire_today | email | 0 | 23 | -1 | | | {75521.3541@compuserve.com,arlehma@01019freenet.de,dallas.morlock@worldnet.att.net,hugo@mcs.net,jmk_yoko@yahoo.com.au,lenchik@severodvinsk.ru,nilrem@o2.pl,rc55@pochta.ru,seph429@earthlink.net,vitte@frontbone.de,zotxxx@xs4all.nl} | 0.894781 pg_temp_2 | retire_today | id | 0 | 4 | -1 | | | {17193,153860,220570,315863,351077,382582,405976,413303,418589,423335,424575} | 0.17536 pg_temp_2 | retire_today | stats_id | 0 | 4 | -0.946237 | {142167,391154,402835,422577,423809} | {0.0215054,0.0215054,0.0215054,0.0215054,0.0215054} | {136669,373730,415341,421924,423416,423553,423959,424089,424354,424609,424976} | -0.132419 (6 rows) ogr=# select * from pg_class where relname='retire_today'; relname | relnamespace | reltype | relowner | relam | relfilenode | relpages | reltuples | reltoastrelid | reltoastidxid | relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | relhassubclass | relacl --------------+--------------+-----------+----------+-------+-------------+----------+-----------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+-------- retire_today | 16765 | 636609103 | 101 | 0 | 636609102 | 1 | 93 | 0 | 0 | f | f | r | 3 | 0 | 0 | 0 | 0 | 0 | f | f | f | f | retire_today | 411964549 | 636609142 | 110 | 0 | 636609141 | 1 | 93 | 0 | 0 | f | f | r | 3 | 0 | 0 | 0 | 0 | 0 | f | f | f | f | retire_today | 478929703 | 632973603 | 101 | 0 | 632973602 | 0 | 0 | 0 | 0 | f | f | r | 3 | 0 | 0 | 0 | 0 | 0 | f | f | f | f | (3 rows) -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?" From pgsql-performance-owner@postgresql.org Thu Jul 31 17:34:07 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CC22FD1C9E1 for ; Thu, 31 Jul 2003 20:14:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 75816-08 for ; Thu, 31 Jul 2003 17:13:25 -0300 (ADT) Received: from main.gmane.org (main.gmane.org [80.91.224.249]) by svr1.postgresql.org (Postfix) with ESMTP id DEAB7D1C9DA for ; Thu, 31 Jul 2003 17:14:27 -0300 (ADT) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19iJlx-00050T-00 for ; Thu, 31 Jul 2003 22:11:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19iJjM-0004nL-00 for ; Thu, 31 Jul 2003 22:08:56 +0200 From: "Jianshuo Niu" Subject: Re: Help on my database performance Date: Thu, 31 Jul 2003 16:08:11 -0400 Lines: 32 Message-ID: References: <97qiivonvj5brg9q7ale1033fp53rupi54@4ax.com> X-Complaints-To: usenet@main.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/505 X-Sequence-Number: 2798 Dear Manfred: Thank you so much for your response. vacuum full anaylze works! explain analyze select count(*) from tfd_catalog ; NOTICE: QUERY PLAN: explain analyze select count(*) from tfd_catalog ; NOTICE: QUERY PLAN: Aggregate (cost=15986.02..15986.02 rows=1 width=0) (actual time=1089.99..1089.9 9 rows=1 loops=1) -> Seq Scan on tfd_catalog (cost=0.00..15582.82 rows=161282 width=0) (actual time=0.11..833.41 rows=161282 loops=1) Total runtime: 1090.51 msec EXPLAIN -> Seq Scan on tfd_catalog (cost=0.00..15582.82 rows=161282 width=0) (actual time=0.11..833.41 rows=161282 loops=1) Total runtime: 1090.51 msec Could you tell me what does "Aggregate (cost=15986.02..15986.02 rows=1 width=0) (actual time=1089.99..1089.99 rows=1 loops=1)" mean? It does not show in my previous report. I appreicate it. Josh From pgsql-performance-owner@postgresql.org Thu Jul 31 17:28:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DEF9DD1C9C8 for ; Thu, 31 Jul 2003 20:20:39 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78478-06 for ; Thu, 31 Jul 2003 17:19:35 -0300 (ADT) Received: from mail-1.zoominternet.net (mail-1.zoominternet.net [63.67.120.5]) by svr1.postgresql.org (Postfix) with SMTP id 88C4BD1C994 for ; Thu, 31 Jul 2003 17:20:37 -0300 (ADT) Received: (qmail 31326 invoked from network); 31 Jul 2003 20:20:39 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-1.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 20:20:39 -0000 Subject: Re: EXTERNAL storage and substring on long strings From: Scott Cain To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <18305.1059680697@sss.pgh.pa.us> References: <1059679600.1429.41.camel@localhost.localdomain> <18305.1059680697@sss.pgh.pa.us> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1059682839.5415.53.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 16:20:39 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/504 X-Sequence-Number: 2797 On Thu, 2003-07-31 at 15:44, Tom Lane wrote: > Scott Cain writes: > > explain analyze select substring(residues from 1000000 for 20000) > > from feature where feature_id=1; > > > where feature is a table with ~3 million rows, and residues is a text > > column, where for the majority of the rows of feature, it is null, for a > > large minority, it is shortish strings (a few thousand characters), and > > for 6 rows, residues contains very long strings (~20 million characters > > (it's chromosome DNA sequence from fruit flies)). > > I think the reason uncompressed storage loses here is that the runtime > is dominated by the shortish strings, and you have to do more I/O to get > at those if they're uncompressed, negating any advantage from not having > to fetch all of the longish strings. I'm not sure I understand what that paragraph means, but it sounds like, if PG is working the way it is supposed to, tough for me, right? > > Or it could be that there's a bug preventing John Gray's substring-slice > optimization from getting used. The only good way to tell that I can > think of is to rebuild PG with profiling enabled and try to profile the > execution both ways. Are you up for that? I am not against recompiling. I am currently using an RPM version, but I could probably recompile; the compilation is probably straight forward (adding something like `--with_profiling` to ./configure), but how straight forward is actually doing the profiling? Is there a document somewhere that lays it out? > > (BTW, if you are using a multibyte database encoding, then that's your > problem right there --- the optimization is practically useless unless > character and byte indexes are the same.) I shouldn't be, but since it is an RPM, I can't be sure. It sure would be silly since the strings consist only of [ATGCN]. Thanks, Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Thu Jul 31 17:53:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 75E99D1C4D0 for ; Thu, 31 Jul 2003 20:29:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 81239-02 for ; Thu, 31 Jul 2003 17:28:10 -0300 (ADT) Received: from ns.fairind.com (unknown [65.161.19.65]) by svr1.postgresql.org (Postfix) with ESMTP id 5EBB9D1C9C9 for ; Thu, 31 Jul 2003 17:29:12 -0300 (ADT) Received: from encounter.fairfield.com by ns.fairind.com via smtpd (for developer.postgresql.org [64.117.224.193]) with ESMTP; Thu, 31 Jul 2003 15:29:14 -0500 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: Odd performance results Date: Thu, 31 Jul 2003 15:29:14 -0500 Message-ID: <906E2C446A276048A1BE283F17BCB12CB13185@encounter.fairind.fairfield.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Odd performance results Thread-Index: AcNXol0hz5JN/sDjEdeZ6ABQBHwzDQ== From: "Medora Schauer" To: "postgresql" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/509 X-Sequence-Number: 2802 I have a table with a 3 column key. I noticed that when I update a non-key= field in a record of the table that the update was taking longer than I thought i= t=20 should. After much experimenting I discovered that if I changed the data types of two of the key columns to FLOAT8 that I got vastly improved performance. Orignally the data types of the 3 columns were FLOAT4, FLOAT4 and INT4. My plaform is a PowerPC running Linux. I speculated that the performance improvement might be because the PowePC is a 64 bit processor but when I changed the column data types to INT8, INT8 and INT4 I din't see any improvement. I also ran my test code on a Pentium 4 machine with the same results in all cases. This doesn't make any sense to me. Why would FLOAT8 keys ever result in improved performance? I verified with EXPLAIN that the index is used in every case for the update. My postmaster version is 7.1.3. Any help will be greatly appreciated. *********************************************************************** Medora Schauer Sr. Software Engineer Fairfield Industries 14100 Southwest Freeway Suite 600 Sugar Land, Tx 77478-3469 USA mschauer@fairfield.com *********************************************************************** From pgsql-performance-owner@postgresql.org Thu Jul 31 17:46:55 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 215DDD1C9C8 for ; Thu, 31 Jul 2003 20:35:15 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80396-03 for ; Thu, 31 Jul 2003 17:34:10 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id E62F9D1C942 for ; Thu, 31 Jul 2003 17:35:12 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 19214; Thu, 31 Jul 2003 12:57:40 -0700 Message-ID: <3F297CBA.1080703@joeconway.com> Date: Thu, 31 Jul 2003 13:31:54 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: EXTERNAL storage and substring on long strings References: <1059679600.1429.41.camel@localhost.localdomain> In-Reply-To: <1059679600.1429.41.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-Archive-Number: 200307/507 X-Sequence-Number: 2800 Scott Cain wrote: > Index Scan using feature_pkey on feature (cost=0.00..3.01 rows=1 > width=153) (actual time=954.13..954.14 rows=1 loops=1) > Index Cond: (feature_id = 1) > Total runtime: 954.26 msec > (3 rows) > > Whoa! That's not what I expected, the time to do the query got more > that twice as long. So I think, maybe it was just an unlucky section, > and overall performance will be much better. So I write a perl script > to do substring queries over all of my chromosomes at various positions > and lengths (20,000 queries total). For comparison, I also ran the same > script, extracting the chromosomes via sql and doing the substring in > perl. Here's what happened: Hmmm, what happens if you compare with a shorter substring, e.g.: explain analyze select substring(residues from 1000000 for 2000) from feature where feature_id=1; I'm just guessing, but it might be that the extra I/O time to read 20K of uncompressed text versus the smaller compressed text is enough to swamp the time saved from not needing to uncompress. Any other ideas out there? Joe From pgsql-performance-owner@postgresql.org Thu Jul 31 17:53:00 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id D0381D1C9C8 for ; Thu, 31 Jul 2003 20:32:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78852-07 for ; Thu, 31 Jul 2003 17:31:13 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id D6F1AD1C9DA for ; Thu, 31 Jul 2003 17:32:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6VKW0Q3018764; Thu, 31 Jul 2003 16:32:00 -0400 (EDT) To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: EXTERNAL storage and substring on long strings In-reply-to: <1059682839.5415.53.camel@localhost.localdomain> References: <1059679600.1429.41.camel@localhost.localdomain> <18305.1059680697@sss.pgh.pa.us> <1059682839.5415.53.camel@localhost.localdomain> Comments: In-reply-to Scott Cain message dated "31 Jul 2003 16:20:39 -0400" Date: Thu, 31 Jul 2003 16:32:00 -0400 Message-ID: <18763.1059683520@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/508 X-Sequence-Number: 2801 Scott Cain writes: >> (BTW, if you are using a multibyte database encoding, then that's your >> problem right there --- the optimization is practically useless unless >> character and byte indexes are the same.) > I shouldn't be, but since it is an RPM, I can't be sure. Look at "psql -l" to see what encoding it reports for your database. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 31 17:46:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A22E2D1C994 for ; Thu, 31 Jul 2003 20:46:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 78478-08 for ; Thu, 31 Jul 2003 17:44:59 -0300 (ADT) Received: from mail-2.zoominternet.net (mail-2.zoominternet.net [63.67.120.22]) by svr1.postgresql.org (Postfix) with SMTP id 4A58FD1C9C8 for ; Thu, 31 Jul 2003 17:39:45 -0300 (ADT) Received: (qmail 7829 invoked from network); 31 Jul 2003 20:39:46 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-2.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 20:39:46 -0000 Subject: Re: EXTERNAL storage and substring on long strings From: Scott Cain To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <18763.1059683520@sss.pgh.pa.us> References: <1059679600.1429.41.camel@localhost.localdomain> <18305.1059680697@sss.pgh.pa.us> <1059682839.5415.53.camel@localhost.localdomain> <18763.1059683520@sss.pgh.pa.us> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1059683986.1428.59.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 16:39:47 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/506 X-Sequence-Number: 2799 On Thu, 2003-07-31 at 16:32, Tom Lane wrote: > Scott Cain writes: > >> (BTW, if you are using a multibyte database encoding, then that's your > >> problem right there --- the optimization is practically useless unless > >> character and byte indexes are the same.) > > > I shouldn't be, but since it is an RPM, I can't be sure. > > Look at "psql -l" to see what encoding it reports for your database. > I see, encoding is a per database option. Since I've never set it, all my databases use sql_ascii. -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Thu Jul 31 20:52:09 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2CC82D1C942 for ; Thu, 31 Jul 2003 23:52:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 92621-06 for ; Thu, 31 Jul 2003 20:51:00 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 0BFAFD1C921 for ; Thu, 31 Jul 2003 20:52:04 -0300 (ADT) Received: from mail-1.zoominternet.net (mail-1.zoominternet.net [63.67.120.5]) by www.postgresql.com (Postfix) with SMTP id 1218CCF50F9 for ; Thu, 31 Jul 2003 17:42:16 -0300 (ADT) Received: (qmail 662 invoked from network); 31 Jul 2003 20:41:37 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-1.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 20:41:37 -0000 Subject: Re: EXTERNAL storage and substring on long strings From: Scott Cain To: Joe Conway Cc: pgsql-performance@postgresql.org In-Reply-To: <3F297CBA.1080703@joeconway.com> References: <1059679600.1429.41.camel@localhost.localdomain> <3F297CBA.1080703@joeconway.com> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1059684097.1429.62.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 16:41:37 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/524 X-Sequence-Number: 2817 So it is possible that if I had a fast scsi drive, the performance might be better? On Thu, 2003-07-31 at 16:31, Joe Conway wrote: > Scott Cain wrote: > > Index Scan using feature_pkey on feature (cost=0.00..3.01 rows=1 > > width=153) (actual time=954.13..954.14 rows=1 loops=1) > > Index Cond: (feature_id = 1) > > Total runtime: 954.26 msec > > (3 rows) > > > > Whoa! That's not what I expected, the time to do the query got more > > that twice as long. So I think, maybe it was just an unlucky section, > > and overall performance will be much better. So I write a perl script > > to do substring queries over all of my chromosomes at various positions > > and lengths (20,000 queries total). For comparison, I also ran the same > > script, extracting the chromosomes via sql and doing the substring in > > perl. Here's what happened: > > Hmmm, what happens if you compare with a shorter substring, e.g.: > > explain analyze select substring(residues from 1000000 for 2000) > from feature where feature_id=1; > > I'm just guessing, but it might be that the extra I/O time to read 20K > of uncompressed text versus the smaller compressed text is enough to > swamp the time saved from not needing to uncompress. > > Any other ideas out there? > > Joe -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Thu Jul 31 17:56:45 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 28E3DD1C50B for ; Thu, 31 Jul 2003 20:52:58 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 82831-01 for ; Thu, 31 Jul 2003 17:51:52 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id E5ECED1C518 for ; Thu, 31 Jul 2003 17:52:56 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 19244; Thu, 31 Jul 2003 13:15:20 -0700 Message-ID: <3F2980DD.5010608@joeconway.com> Date: Thu, 31 Jul 2003 13:49:33 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: EXTERNAL storage and substring on long strings References: <1059679600.1429.41.camel@localhost.localdomain> <3F297CBA.1080703@joeconway.com> <1059684097.1429.62.camel@localhost.localdomain> In-Reply-To: <1059684097.1429.62.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-Archive-Number: 200307/512 X-Sequence-Number: 2805 Scott Cain wrote: > So it is possible that if I had a fast scsi drive, the performance might > be better? Faster drives are always better ;-) Did you try the comparison with shorter substrings? Also, maybe not related to your specific question, but have you tuned any other postgresql.conf settings? Joe From pgsql-performance-owner@postgresql.org Thu Jul 31 17:58:31 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 7B064D1C95A for ; Thu, 31 Jul 2003 20:58:30 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80397-06 for ; Thu, 31 Jul 2003 17:57:24 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 8F745D1C956 for ; Thu, 31 Jul 2003 17:58:29 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6VKwBQ3019023; Thu, 31 Jul 2003 16:58:11 -0400 (EDT) To: Scott Cain Cc: pgsql-performance@postgresql.org Subject: Re: EXTERNAL storage and substring on long strings In-reply-to: <1059683986.1428.59.camel@localhost.localdomain> References: <1059679600.1429.41.camel@localhost.localdomain> <18305.1059680697@sss.pgh.pa.us> <1059682839.5415.53.camel@localhost.localdomain> <18763.1059683520@sss.pgh.pa.us> <1059683986.1428.59.camel@localhost.localdomain> Comments: In-reply-to Scott Cain message dated "31 Jul 2003 16:39:47 -0400" Date: Thu, 31 Jul 2003 16:58:11 -0400 Message-ID: <19022.1059685091@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/513 X-Sequence-Number: 2806 Scott Cain writes: > I see, encoding is a per database option. Since I've never set it, all > my databases use sql_ascii. Okay, then you've dodged the obvious bullet; time to try profiling I guess. The way I usually do it is (given a clean, configured source tree): cd src/backend gmake PROFILE="-pg -DLINUX_PROFILE" all install resulting postgres executable (The -DLINUX_PROFILE is unnecessary on non-Linux machines, but AFAIK it won't hurt anything either.) Once you have this installed, each session will end by dumping a gmon.out profile file into the $PGDATA/base/nnn directory for its database. After you've done a test run, you do gprof path/to/postgres/executable path/to/gmon.out >outputfile and voila, you have a profile. It's a good idea to make sure that you accumulate a fair amount of CPU time in a test session, since the profile depends on statistical sampling. I like to have about a minute of accumulated runtime before trusting the results. Repeat the same query multiple times if needed. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 31 17:59:24 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id E4A10D1C4DB for ; Thu, 31 Jul 2003 20:59:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80446-05 for ; Thu, 31 Jul 2003 17:58:17 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id E47F1D1C4BD for ; Thu, 31 Jul 2003 17:59:21 -0300 (ADT) Received: from [10.1.2.130] (helo=dba2) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19iKW9-00014Z-00 for ; Thu, 31 Jul 2003 16:59:21 -0400 Received: by dba2 (Postfix, from userid 1019) id 4B40ECEC9; Thu, 31 Jul 2003 16:59:21 -0400 (EDT) Date: Thu, 31 Jul 2003 16:59:21 -0400 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Odd explain estimate Message-ID: <20030731205921.GF16230@libertyrms.info> Mail-Followup-To: Andrew Sullivan , pgsql-performance@postgresql.org References: <20030731195145.GD55392@nasby.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030731195145.GD55392@nasby.net> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/514 X-Sequence-Number: 2807 On Thu, Jul 31, 2003 at 02:51:45PM -0500, Jim C. Nasby wrote: > Why is pgsql estimating a cost of 100000000 for retire_today in this > query? I analyzed it, and there's nothing very odd about it, other than > it's a temp table. > > BTW, I had to set enable_seqscan=false to get this, otherwise it wants That's why. When you do that, it just automatically adds 100000000 to the cost of a seqscan. It can't really disable it, because there might be no other way to pull the result. If you really needed to set enable_seqscan=false (did you really? Are you sure that's not the cheapest way?), you might want to investigate expainding the statistics on the indexed column, increasing the correlation through clustering, and other such tricks. A -- ---- Andrew Sullivan 204-4141 Yonge Street Liberty RMS Toronto, Ontario Canada M2P 2A8 +1 416 646 3304 x110 From pgsql-performance-owner@postgresql.org Thu Jul 31 18:06:33 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 990E0D1C50B for ; Thu, 31 Jul 2003 21:06:32 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80766-05 for ; Thu, 31 Jul 2003 18:05:25 -0300 (ADT) Received: from joeconway.com (66-146-172-86.skyriver.net [66.146.172.86]) by svr1.postgresql.org (Postfix) with ESMTP id 4C8F9D1C512 for ; Thu, 31 Jul 2003 18:06:30 -0300 (ADT) Received: from [206.19.64.3] (account jconway HELO joeconway.com) by joeconway.com (CommuniGate Pro SMTP 4.0.6) with ESMTP-TLS id 19267; Thu, 31 Jul 2003 13:28:54 -0700 Message-ID: <3F298409.4030309@joeconway.com> Date: Thu, 31 Jul 2003 14:03:05 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Scott Cain Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: EXTERNAL storage and substring on long strings References: <1059679600.1429.41.camel@localhost.localdomain> <18305.1059680697@sss.pgh.pa.us> <1059682839.5415.53.camel@localhost.localdomain> In-Reply-To: <1059682839.5415.53.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-Archive-Number: 200307/515 X-Sequence-Number: 2808 Scott Cain wrote: > I am not against recompiling. I am currently using an RPM version, but > I could probably recompile; the compilation is probably straight forward > (adding something like `--with_profiling` to ./configure), but how > straight forward is actually doing the profiling? Is there a document > somewhere that lays it out? > Try: rpm --rebuild --define 'beta 1' postgresql-7.3.4-1PGDG.src.rpm This will get you Postgres with --enable-cassert and --enable-debug, and it will leave the binaries unstripped. Install the new RPMs. Then start up psql in one terminal, followed by gdb in another. Attach to the postgres backend pid and set a breakpoint at toast_fetch_datum_slice. Then continue the gdb session, and run your sql statement in the psql session. Something like: session 1: psql mydatabase session 2: ps -ef | grep postgres (note the pid on the postgres backend, *not* the psql session) gdb /usr/bin/postgres attach break toast_fetch_datum_slice continue session 1: select substring(residues from 1000000 for 20000) from feature where feature_id=1; session 2: did we hit the breakpoint in toast_fetch_datum_slice? HTH, Joe From pgsql-performance-owner@postgresql.org Thu Jul 31 18:10:27 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 45A20D1C4BF for ; Thu, 31 Jul 2003 21:10:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 80396-09 for ; Thu, 31 Jul 2003 18:09:19 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 5610AD1C4BD for ; Thu, 31 Jul 2003 18:10:24 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6VLANQ3019175; Thu, 31 Jul 2003 17:10:23 -0400 (EDT) To: "Medora Schauer" Cc: "postgresql" Subject: Re: Odd performance results In-reply-to: <906E2C446A276048A1BE283F17BCB12CB13185@encounter.fairind.fairfield.com> References: <906E2C446A276048A1BE283F17BCB12CB13185@encounter.fairind.fairfield.com> Comments: In-reply-to "Medora Schauer" message dated "Thu, 31 Jul 2003 15:29:14 -0500" Date: Thu, 31 Jul 2003 17:10:22 -0400 Message-ID: <19174.1059685822@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/516 X-Sequence-Number: 2809 "Medora Schauer" writes: > I have a table with a 3 column key. I noticed that when I update a non-key field > in a record of the table that the update was taking longer than I thought it > should. After much experimenting I discovered that if I changed the data > types of two of the key columns to FLOAT8 that I got vastly improved > performance. Are there any foreign key linkages to or from this table? Maybe the other end of the foreign key is float8? regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jul 31 18:11:18 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 49613D1C7EF for ; Thu, 31 Jul 2003 21:11:18 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 82845-05 for ; Thu, 31 Jul 2003 18:10:11 -0300 (ADT) Received: from mail-3.zoominternet.net (mail-3.zoominternet.net [63.67.120.3]) by svr1.postgresql.org (Postfix) with SMTP id 49BB3D1C4DB for ; Thu, 31 Jul 2003 18:11:16 -0300 (ADT) Received: (qmail 21132 invoked from network); 31 Jul 2003 21:11:15 -0000 Received: from acs-24-154-209-142.zoominternet.net (HELO gmod.lajolla) ([24.154.209.142]) (envelope-sender ) by mail-3.zoominternet.net (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 21:11:15 -0000 Subject: Re: EXTERNAL storage and substring on long strings From: Scott Cain To: Joe Conway Cc: pgsql-performance@postgresql.org In-Reply-To: <3F2980DD.5010608@joeconway.com> References: <1059679600.1429.41.camel@localhost.localdomain> <3F297CBA.1080703@joeconway.com> <1059684097.1429.62.camel@localhost.localdomain> <3F2980DD.5010608@joeconway.com> Content-Type: text/plain Organization: Cold Spring Harbor Lab Message-Id: <1059685870.1429.73.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 17:11:15 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/517 X-Sequence-Number: 2810 Joe, I'm working on the comparison--I think the best way to do it is to reload the original data into a new database and compare them, so it will take a while. I have tuned postgresql.conf according to the page that everybody around here seems to cite. I'll probably post back tomorrow with another set of results. Also, the perl script that did several queries used lengths of 5000, 10,000 and 40,000 because those are the typical lengths I would use (occasionally shorter). Thanks, Scott On Thu, 2003-07-31 at 16:49, Joe Conway wrote: > Scott Cain wrote: > > So it is possible that if I had a fast scsi drive, the performance might > > be better? > > Faster drives are always better ;-) > > Did you try the comparison with shorter substrings? Also, maybe not > related to your specific question, but have you tuned any other > postgresql.conf settings? > > Joe > > -- ------------------------------------------------------------------------ Scott Cain, Ph. D. cain@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory From pgsql-performance-owner@postgresql.org Thu Jul 31 18:21:41 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F12E8D1C4BF for ; Thu, 31 Jul 2003 21:21:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 81693-05 for ; Thu, 31 Jul 2003 18:20:34 -0300 (ADT) Received: from lakemtao01.cox.net (lakemtao01.cox.net [68.1.17.244]) by svr1.postgresql.org (Postfix) with ESMTP id 19D84D1C4BD for ; Thu, 31 Jul 2003 18:21:39 -0300 (ADT) Received: from [192.168.1.1] ([68.11.66.83]) by lakemtao01.cox.net (InterMail vM.5.01.04.05 201-253-122-122-105-20011231) with ESMTP id <20030731212137.RSQY7142.lakemtao01.cox.net@[192.168.1.1]> for ; Thu, 31 Jul 2003 17:21:37 -0400 Subject: Re: EXTERNAL storage and substring on long strings From: Ron Johnson To: PgSQL Performance ML In-Reply-To: <3F297CBA.1080703@joeconway.com> References: <1059679600.1429.41.camel@localhost.localdomain> <3F297CBA.1080703@joeconway.com> Content-Type: text/plain Message-Id: <1059686498.7505.558.camel@haggis> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 31 Jul 2003 16:21:38 -0500 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/518 X-Sequence-Number: 2811 On Thu, 2003-07-31 at 15:31, Joe Conway wrote: > Scott Cain wrote: > > Index Scan using feature_pkey on feature (cost=0.00..3.01 rows=1 > > width=153) (actual time=954.13..954.14 rows=1 loops=1) > > Index Cond: (feature_id = 1) > > Total runtime: 954.26 msec > > (3 rows) > > > > Whoa! That's not what I expected, the time to do the query got more > > that twice as long. So I think, maybe it was just an unlucky section, > > and overall performance will be much better. So I write a perl script > > to do substring queries over all of my chromosomes at various positions > > and lengths (20,000 queries total). For comparison, I also ran the same > > script, extracting the chromosomes via sql and doing the substring in > > perl. Here's what happened: > > Hmmm, what happens if you compare with a shorter substring, e.g.: > > explain analyze select substring(residues from 1000000 for 2000) > from feature where feature_id=1; > > I'm just guessing, but it might be that the extra I/O time to read 20K > of uncompressed text versus the smaller compressed text is enough to > swamp the time saved from not needing to uncompress. Are you asking, "Can his CPU decompress faster than his disks can read?" -- +-----------------------------------------------------------------+ | Ron Johnson, Jr. Home: ron.l.johnson@cox.net | | Jefferson, LA USA | | | | "I'm not a vegetarian because I love animals, I'm a vegetarian | | because I hate vegetables!" | | unknown | +-----------------------------------------------------------------+ From pgsql-performance-owner@postgresql.org Thu Jul 31 18:32:11 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1EE00D1C4BF for ; Thu, 31 Jul 2003 21:32:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85202-01 for ; Thu, 31 Jul 2003 18:31:04 -0300 (ADT) Received: from email01.aon.at (WARSL402PIP2.highway.telekom.at [195.3.96.74]) by svr1.postgresql.org (Postfix) with SMTP id 9FFC7D1C4BD for ; Thu, 31 Jul 2003 18:32:08 -0300 (ADT) Received: (qmail 441956 invoked from network); 31 Jul 2003 21:32:06 -0000 Received: from m168p012.dipool.highway.telekom.at (HELO cantor) ([62.46.10.236]) (envelope-sender ) by qmail7rs.highway.telekom.at (qmail-ldap-1.03) with SMTP for ; 31 Jul 2003 21:32:06 -0000 From: Manfred Koizar To: "Jianshuo Niu" Cc: pgsql-performance@postgresql.org Subject: Re: Help on my database performance Date: Thu, 31 Jul 2003 23:32:04 +0200 Message-ID: References: <97qiivonvj5brg9q7ale1033fp53rupi54@4ax.com> In-Reply-To: X-Mailer: Forte Agent 1.93/32.576 English (American) 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-Archive-Number: 200307/519 X-Sequence-Number: 2812 On Thu, 31 Jul 2003 16:08:11 -0400, "Jianshuo Niu" wrote: >explain analyze select count(*) from tfd_catalog ; >NOTICE: QUERY PLAN: > >Aggregate (cost=15986.02..15986.02 rows=1 width=0) > (actual time=1089.99..1089.99 rows=1 loops=1) > -> Seq Scan on tfd_catalog (cost=0.00..15582.82 rows=161282 width=0) > (actual time=0.11..833.41 rows=161282 loops=1) >Total runtime: 1090.51 msec >Could you tell me what does "Aggregate (cost=15986.02..15986.02 rows=1 >width=0) (actual time=1089.99..1089.99 rows=1 loops=1)" mean? It does not >show in my previous report. In your first post you did SELECT productid FROM tfd_catalog; now you did SELECT count(*) FROM tfd_catalog; count() is an aggregate function which in your case takes 161282 rows as input and produces a single row as output. The "actual" part of the "Aggregate" line tells you that the first resulting row is generated 1089.99 milliseconds after query start and the last row (not surprisingly) at the same time. The "cost" part contains the planner's estimations for these values. Servus Manfred From pgsql-performance-owner@postgresql.org Thu Jul 31 18:32:22 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 4F42CD1C518 for ; Thu, 31 Jul 2003 21:32:21 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 84747-03 for ; Thu, 31 Jul 2003 18:31:14 -0300 (ADT) Received: from ns.fairind.com (unknown [65.161.19.65]) by svr1.postgresql.org (Postfix) with ESMTP id 6114ED1C512 for ; Thu, 31 Jul 2003 18:32:19 -0300 (ADT) Received: from encounter.fairfield.com by ns.fairind.com via smtpd (for developer.postgresql.org [64.117.224.193]) with ESMTP; Thu, 31 Jul 2003 16:32:19 -0500 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: Odd performance results X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Thu, 31 Jul 2003 16:32:16 -0500 Message-ID: <906E2C446A276048A1BE283F17BCB12CB131EA@encounter.fairind.fairfield.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Odd performance results Thread-Index: AcNXqCkcnv7wGSMWT7mz9hgz2X6qbAAAvhxQ From: "Medora Schauer" To: "Tom Lane" Cc: "postgresql" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/520 X-Sequence-Number: 2813 Orignally there were but in the process of trying to figure out what is going on I stripped everything out of the database except the table being queried. >=20 > "Medora Schauer" writes: > > I have a table with a 3 column key. I noticed that when I=20 > update a non-key field > > in a record of the table that the update was taking longer=20 > than I thought it=20 > > should. After much experimenting I discovered that if I=20 > changed the data > > types of two of the key columns to FLOAT8 that I got vastly improved > > performance. >=20 > Are there any foreign key linkages to or from this table? Maybe the > other end of the foreign key is float8? >=20 > regards, tom lane >=20 From pgsql-performance-owner@postgresql.org Thu Jul 31 19:24:13 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id C97FED1C92C for ; Thu, 31 Jul 2003 22:24:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85212-06 for ; Thu, 31 Jul 2003 19:23:07 -0300 (ADT) Received: from mail.libertyrms.com (unknown [209.167.124.227]) by svr1.postgresql.org (Postfix) with ESMTP id 9F71DD1C92A for ; Thu, 31 Jul 2003 19:24:11 -0300 (ADT) Received: from dev6.int.libertyrms.com ([10.1.2.212] helo=libertyrms.info) by mail.libertyrms.com with esmtp (Exim 3.22 #3 (Debian)) id 19iLqF-0002Me-00 for ; Thu, 31 Jul 2003 18:24:11 -0400 Received: by libertyrms.info (Postfix, from userid 1079) id 939E3BBAC5; Thu, 31 Jul 2003 18:24:11 -0400 (EDT) To: pgsql-performance@postgresql.org Subject: Views With Unions From: Christopher Browne Date: Thu, 31 Jul 2003 18:24:11 -0400 Message-ID: <60adaunxmc.fsf@dev6.int.libertyrms.info> User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/521 X-Sequence-Number: 2814 This is stepping back quite a while; let me point people to the thread of 2003-02 where Mariusz Czu\x{0142}ada was looking for a way of optimizing a VIEW that was a UNION. The subject has come up a few times through PostgreSQL history, and I'd imagine to think I may have a little something new to offer to it. Let's consider a table used to store log information: create table log_table ( request_time timestamp with time zone, object character varying, -- What they asked for request_type character(8), -- What they did to it request_size integer, requestor inet, request_status integer, result_size integer, request_detail character varying ); create index log_times on log_table(request_time); create index log_object on log_table(object); Every time "something happens," an entry goes into this table. Unfortunately, the table is likely to grow to tremendous size, over time, and there are all sorts of troublesome things about purging it: -> Fragmentation may waste space and destroy the usefulness of indices; -> Deleting data row by row will cause replication logic to go mad, as triggers get invoked for every single row modified; -> The action of deletion will draw the data we just decided was _useless_ into memory, injuring cache utilization badly as we fill the cache with trash. The obvious thought: Create several tables, and join them together into a view. So instead of log_table being a table, we have log_table_1 thru log_table_3, each with the schema describe above, and define the view: create view log_table as select * from log_table_1 union all select * from log_table_2 union all select * from log_table_3; It's easy enough (modulo a little debugging and pl/pgsql work :-)) to turn this into an updatable view so that inserts into log_table use a different log table every (day|week|month). And we can TRUNCATE the eldest one, which is a cheap operation. This approach also resembles the way the "O guys" handle partitioned tables, so it's not merely about "logs." Unfortunately, selects on the VIEW are, at present, unable to make use of the indices. So if we want all log entries for June 11th, the query: select * from log_table where request_time between 'june 11 2003' and 'june 12 2003'; returns a plan: Subquery Scan log_table (cost=0.00..10950.26 rows=177126 width=314) -> Append (cost=0.00..10950.26 rows=177126 width=314) -> Subquery Scan *SELECT* 1 (cost=0.00..3089.07 rows=50307 width=71) -> Seq Scan on log_table_1 (cost=0.00..3089.07 rows=50307 width=71) -> Subquery Scan *SELECT* 2 (cost=0.00..602.92 rows=9892 width=314) -> Seq Scan on log_table_2 (cost=0.00..602.92 rows=9892 width=314) -> Subquery Scan *SELECT* 3 (cost=0.00..2390.09 rows=39209 width=314) -> Seq Scan on log_table_3 (cost=0.00..2390.09 rows=39209 width=314) In effect, the query is materialized into: select * from (select * from log_table_1 union all select * from log_table_2 union all select * from log_table_3) as merger where [request_time between 'june 11 2003' and 'june 12 2003']; What would perform better would be to attach the WHERE clause to each of the union members. (Everyone stop and sing "Solidarity Forever" :-)) E.g.: select * from ( select * from log_table_1 where request_time between 'june 11 2003' and 'june 12 2003' union all select * from log_table_2 where request_time between 'june 11 2003' and 'june 12 2003' union all select * from log_table_3 where request_time between 'june 11 2003' and 'june 12 2003' union all ) as merged_version; Subquery Scan merged_version (cost=0.00..947.04 rows=247 width=314) (actual time=55.86..1776.42 rows=20124 loops=1) -> Append (cost=0.00..947.04 rows=247 width=314) (actual time=55.84..1483.60 rows=20124 loops=1) -> Subquery Scan *SELECT* 1 (cost=0.00..3.02 rows=1 width=71) (actual time=55.83..289.81 rows=3422 loops=1) -> Index Scan using log_table_1_trans_on_idx on log_table_1 (cost=0.00..3.02 rows=1 width=71) (actual time=55.80..239.84 rows=3422 loops=1) -> Subquery Scan *SELECT* 2 (cost=0.00..191.38 rows=49 width=314) (actual time=62.32..1115.15 rows=16702 loops=1) -> Index Scan using log_table_2_trans_on_idx on log_table_2 (cost=0.00..191.38 rows=49 width=314) (actual time=62.29..873.63 rows=16702 loops=1) -> Subquery Scan *SELECT* 3 (cost=0.00..752.64 rows=196 width=314) (actual time=26.69..26.69 rows=0 loops=1) -> Index Scan using log_table_3_trans_on_idx on log_table_3 (cost=0.00..752.64 rows=196 width=314) (actual time=26.69..26.69 rows=0 loops=1) Total runtime: 1806.39 msec Which is nice and quick, as it cuts each set down to size _before_ merging them. Mariusz had been looking, back in February, for an optimization that would, in effect, throw away the UNION ALL clauses that were unnecessary. Tom Lane and Stephan Szabo, in discussing this, observed, quite rightly, that this is liable to be an obscure sort of optimization: Tom Lane writes: > Stephan Szabo writes: > > Yeah, but I think what he's hoping is that it'll notice that > > "key=1 and key=3" would be noticed as a false condition so that it doesn't > > scan those tables since a row presumably can't satisify both. The question > > would be, is the expense of checking the condition for all queries > > greater than the potential gain for these sorts of queries. > Yes, this is the key point: we won't put in an optimization that > wins on a small class of queries unless there is no material cost > added for planning cases where it doesn't apply. In contrast, I would argue that adding the WHERE clause in as an extra condition on each of the UNION subqueries is an optimization that is likely to win in _most_ cases. It helps with the example I illustrated; it would help with Mariusz' scenario, not by outright eliminating UNION subqueries, but rather by making their result sets empty. select key, value from view123 where key = 2 transforms into... select key, value from tab1 where key=1 [and key = 2] union all select key, value from tab2 where key=2 [and key = 2] union all select key, value from tab3 where key=3 [and key = 2]; The generalization is that: select * from (select [fields1] from t1 where [cond1] (UNION|UNION ALL|INTERSECT) select [fields2] from t2 where [cond2] (UNION|UNION ALL|INTERSECT) ... select [fieldsn] from tn where [condn]) as COMBINATION WHERE [globalcond]; is equivalent to: select * from (select [fields1] from t1 where ([cond1]) and [globalcond] (UNION|UNION ALL|INTERSECT) select [fields2] from t2 where ([cond2]) and [globalcond] (UNION|UNION ALL|INTERSECT) ... select [fieldsn] from tn where ([condn]) and [globalcond] ) as COMBINATION; [globalcond] has to be expressed in terms of the fields available for each subquery, but that already needs to be true, because the global condition at present is being applied to the fields that are given by the UNION/INTERSECT/UNION ALL. -- let name="cbbrowne" and tld="libertyrms.info" in String.concat "@" [name;tld];; Christopher Browne (416) 646 3304 x124 (land) From pgsql-performance-owner@postgresql.org Thu Jul 31 19:34:35 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8C7C3D1C921 for ; Thu, 31 Jul 2003 22:34:34 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85202-07 for ; Thu, 31 Jul 2003 19:33:28 -0300 (ADT) Received: from megazone.bigpanda.com (45.mufb.snfc.sffca01r18.dsl.att.net [12.103.249.45]) by svr1.postgresql.org (Postfix) with ESMTP id 8C24AD1C92D for ; Thu, 31 Jul 2003 19:34:27 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 7B4D0D617; Thu, 31 Jul 2003 15:34:27 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 710015C10; Thu, 31 Jul 2003 15:34:27 -0700 (PDT) Date: Thu, 31 Jul 2003 15:34:27 -0700 (PDT) From: Stephan Szabo To: Christopher Browne Cc: Subject: Re: Views With Unions In-Reply-To: <60adaunxmc.fsf@dev6.int.libertyrms.info> Message-ID: <20030731152719.V26943-100000@megazone.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/522 X-Sequence-Number: 2815 On Thu, 31 Jul 2003, Christopher Browne wrote: > select * from log_table where request_time between 'june 11 2003' and > 'june 12 2003'; > > returns a plan: > Subquery Scan log_table (cost=0.00..10950.26 rows=177126 width=314) > -> Append (cost=0.00..10950.26 rows=177126 width=314) > -> Subquery Scan *SELECT* 1 (cost=0.00..3089.07 rows=50307 width=71) > -> Seq Scan on log_table_1 (cost=0.00..3089.07 rows=50307 width=71) > -> Subquery Scan *SELECT* 2 (cost=0.00..602.92 rows=9892 width=314) > -> Seq Scan on log_table_2 (cost=0.00..602.92 rows=9892 width=314) > -> Subquery Scan *SELECT* 3 (cost=0.00..2390.09 rows=39209 width=314) > -> Seq Scan on log_table_3 (cost=0.00..2390.09 rows=39209 width=314) What version are you using? In 7.3 and up it should be willing to consider moving the clause down, unless there's something like a type mismatch (because in that case it may not be equivalent without a bunch more work on the clause). From pgsql-performance-owner@postgresql.org Thu Jul 31 20:00:08 2003 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0C489D1C94C for ; Thu, 31 Jul 2003 23:00:07 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 89044-01 for ; Thu, 31 Jul 2003 19:58:57 -0300 (ADT) Received: from flake.decibel.org (unknown [66.143.173.58]) by svr1.postgresql.org (Postfix) with SMTP id EEC3FD1C92B for ; Thu, 31 Jul 2003 20:00:00 -0300 (ADT) Received: (qmail 98915 invoked by uid 1001); 31 Jul 2003 22:59:59 -0000 Date: Thu, 31 Jul 2003 17:59:59 -0500 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Re: Odd explain estimate Message-ID: <20030731225959.GH55392@nasby.net> References: <20030731195145.GD55392@nasby.net> <20030731205921.GF16230@libertyrms.info> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030731205921.GF16230@libertyrms.info> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.8-RELEASE i386 X-Distributed: Join the Effort! http://www.distributed.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/523 X-Sequence-Number: 2816 On Thu, Jul 31, 2003 at 04:59:21PM -0400, Andrew Sullivan wrote: > On Thu, Jul 31, 2003 at 02:51:45PM -0500, Jim C. Nasby wrote: > If you really needed to set enable_seqscan=false (did you really? > Are you sure that's not the cheapest way?), you might want to > investigate expainding the statistics on the indexed column, > increasing the correlation through clustering, and other such tricks. Well, if I don't do this it wants to seqscan a table that occupies 350k pages, instead of pulling a couple thousand rows. I started running it with the seqscan and it's already taken way longer than it does if I disable seqscan. I guess I'll try expanding the statistics. -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or what?"