diff --git "a/pgsql-performance.200412" "b/pgsql-performance.200412" new file mode 100644--- /dev/null +++ "b/pgsql-performance.200412" @@ -0,0 +1,31648 @@ +From pgsql-performance-owner@postgresql.org Wed Dec 1 00:28:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A3A703A5284 + for ; + Wed, 1 Dec 2004 00:28:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 89518-03 + for ; + Wed, 1 Dec 2004 00:28:09 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id A3A553A5286 + for ; + Wed, 1 Dec 2004 00:28:11 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6727804; Tue, 30 Nov 2004 16:25:13 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Hardware purchase question +Date: Tue, 30 Nov 2004 16:26:42 -0800 +User-Agent: KMail/1.6.2 +Cc: Bo Stewart +References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> +In-Reply-To: + <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200411301626.42189.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/1 +X-Sequence-Number: 9376 + +Bo, + +> 2 - 2.4 Ghz Xeon processors +> 4GB ram +> 4 36gb 10000rpm scsi drives configured for raid 10 + +Hopefully you've turned OFF hyperthreading? + +> gains can I expect on average from swapping from 4 disk raid 10 to 14 disk +> raid 10? Could I expect to see 40 - 50% better throughput. + +This is so dependant on application design that I can't possibly estimate. +One big gain area for you will be moving the database log (pg_xlog) to its +own private disk resource (such as a raid-1 pair). In high-write +enviroments, this can gain you 15% without changing anything else. + +> The servers listed above are the dell 2650's which have perc 3 +> controllers. I have seen on this list where they are know for not +> performing well. So any suggestions for an attached scsi device would be +> greatly appreciated. Also, any thoughts on fibre channel storage devices? + +The 2650s don't perform well in a whole assortment of ways. This is why they +are cheap. + +NetApps seem to be the current best in NAS/SAN storage, although many people +like EMC. Stay away from Apple's XRaid, which is not designed for +databases. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Dec 1 01:49:54 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 510983A53D5 + for ; + Wed, 1 Dec 2004 01:49:52 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10723-01 + for ; + Wed, 1 Dec 2004 01:49:43 +0000 (GMT) +Received: from bluebamboo.ph (unknown [202.175.252.53]) + by svr1.postgresql.org (Postfix) with ESMTP id 468B53A53D3 + for ; + Wed, 1 Dec 2004 01:49:43 +0000 (GMT) +Received: from irridescens ([192.168.0.180]) + by bluebamboo.ph (8.11.6/8.11.6) with ESMTP id iB11oQi18788; + Wed, 1 Dec 2004 09:50:27 +0800 +From: "BBI Edwin Punzalan" +To: "'gnari'" , +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 09:50:30 +0800 +Message-ID: <004b01c4d748$23ccad90$b400a8c0@bluebamboo.ph> +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 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +In-reply-to: <002701c4d259$91b7a330$0100000a@wp2000> +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/2 +X-Sequence-Number: 9377 + + +Hi, what do you mean by increasing the statistics on the date column? + +We never had any upgrade on it. + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of gnari +Sent: Thursday, November 25, 2004 3:13 AM +To: BBI Edwin Punzalan; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] FW: Index usage + + +From: "BBI Edwin Punzalan" +> +> Yes, the database is being vacuum-ed and analyzed on a daily basis. +> + +then you should consider increating the statistics on the date column, as +the estimates were a bit off in the plan + +> Our version is 7.2.1 + +upgrade time ? + +gnari + + + +---------------------------(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 Wed Dec 1 02:05:26 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AF8633A53BB + for ; + Wed, 1 Dec 2004 02:05:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11551-10 + for ; + Wed, 1 Dec 2004 02:05:16 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 4CA793A52D0 + for ; + Wed, 1 Dec 2004 02:05:18 +0000 (GMT) +Received: from wp2000 ([157.157.176.239] [157.157.176.239]) by + quasar.skima.is; + Wed, 1 Dec 2004 02:05:18 Z +Message-Id: <017c01c4d74a$90805de0$0100000a@wp2000> +From: "gnari" +To: "BBI Edwin Punzalan" , + +References: <004b01c4d748$23ccad90$b400a8c0@bluebamboo.ph> +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 02:07:52 -0000 +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 5.00.2919.6700 +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/3 +X-Sequence-Number: 9378 + +From: "BBI Edwin Punzalan" + + +> +> Hi, what do you mean by increasing the statistics on the date column? + +alter table chatlogs alter column date set statistics 300; +analyze chatlogs; + +> > > Our version is 7.2.1 +> > +> > upgrade time ? +> +> We never had any upgrade on it. + +7.2 is a bit dated now that 8.0 is in beta + +if you want to stay with 7.2, you should at least upgrade +to the latest point release (7.2.6 ?), as several serious bugs +have been fixed + +gnari + + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 02:32:44 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C2543A525B + for ; + Wed, 1 Dec 2004 02:32:40 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27890-01 + for ; + Wed, 1 Dec 2004 02:32:30 +0000 (GMT) +Received: from bluebamboo.ph (unknown [202.175.252.53]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BC543A53B8 + for ; + Wed, 1 Dec 2004 02:32:32 +0000 (GMT) +Received: from irridescens ([192.168.0.180]) + by bluebamboo.ph (8.11.6/8.11.6) with ESMTP id iB12XBi19542; + Wed, 1 Dec 2004 10:33:11 +0800 +From: "BBI Edwin Punzalan" +To: "'gnari'" , +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 10:33:15 +0800 +Message-ID: <004c01c4d74e$1c61d110$b400a8c0@bluebamboo.ph> +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 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +In-reply-to: <017c01c4d74a$90805de0$0100000a@wp2000> +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/4 +X-Sequence-Number: 9379 + + +Thanks but whatever it does, it didn't work. :D + +Do you think upgrading will fix this problem? + +=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= + +db=3D# alter table chatlogs alter column date set statistics 300; +ALTER +db=3D# analyze chatlogs; +ANALYZE +db=3D# explain analyze select * from chatlogs where date >=3D '12/1/04'; +NOTICE: QUERY PLAN: + +Index Scan using chatlogs_type_idx on chatlogs (cost=3D0.00..6053.61 +rows=3D3357 width=3D212) (actual time=3D22.14..138.53 rows=3D1312 +loops=3D1) +Total runtime: 139.42 msec + +EXPLAIN +morphTv=3D# explain analyze select * from chatlogs where date >=3D = +'11/03/04'; +NOTICE: QUERY PLAN: + +Seq Scan on chatlogs (cost=3D0.00..27252.86 rows=3D271882 width=3D212) = +(actual +time=3D12.24..13419.36 rows=3D257137 loops=3D1) +Total runtime: 13573.70 msec + +EXPLAIN +=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= + + + + +-----Original Message----- +From: gnari [mailto:gnari@simnet.is]=20 +Sent: Wednesday, December 01, 2004 10:08 AM +To: BBI Edwin Punzalan; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] FW: Index usage + + +From: "BBI Edwin Punzalan" + + +>=20 +> Hi, what do you mean by increasing the statistics on the date column? + +alter table chatlogs alter column date set statistics 300; analyze = +chatlogs; + +> > > Our version is 7.2.1 +> >=20 +> > upgrade time ? +>=20 +> We never had any upgrade on it. + +7.2 is a bit dated now that 8.0 is in beta + +if you want to stay with 7.2, you should at least upgrade +to the latest point release (7.2.6 ?), as several serious bugs have been +fixed + +gnari + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 03:59:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AF7B63A540A + for ; + Wed, 1 Dec 2004 03:59:23 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49627-10 + for ; + Wed, 1 Dec 2004 03:59:17 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 80A1B3A5441 + for ; + Wed, 1 Dec 2004 03:59:15 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iB13wxZ20934; + Wed, 1 Dec 2004 12:58:59 +0900 +Message-ID: <00d101c4d75a$4bdc1700$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "BBI Edwin Punzalan" , + "'gnari'" , +References: <004c01c4d74e$1c61d110$b400a8c0@bluebamboo.ph> +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 13:00:24 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="iso-8859-1"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/5 +X-Sequence-Number: 9380 + +If it's any help, i just ran this test on 7.4.6, my table has about 7000000 +rows and the index is an integer. + +The item id ranges from 1 to 20000. + +As you can see from the following plans, the optimizer changed it's plan +depending on the value of the item id condition, and will use an index when +it determines that the number of values that will be returned is a low % of +the total table size. + +The item_id is an integer, but It looked like you are using a character +field to store date information. Also, the dates you entered in your test +case seem to be in the format DD/MM/YY which won't be amenable to useful +comparative searching (I didn't read any of the earlier posts so if that +isn't the case, just ignore this). If this is the case, try storing the data +in a date column and see what happens then. + +regards +Iain + +test=# explain analyse select * from bigtable where item_id <= 1000; + QUERY +PLAN + +------------------------------------------------------------------------------------------------------------------- +-------------------------------------------- + Index Scan using d_bigtable_idx2 on bigtable (cost=0.00..118753.57 +rows=59553 width=80) (actual +time=0.069..704.401 rows=58102 loops=1) + Index Cond: ((item_id)::integer <= 1000) + Total runtime: 740.786 ms +(3 rows) + + +test=# explain analyse select * from bigtable where item_id <= 100000000; + QUERY PLAN + +------------------------------------------------------------------------------------------------------------------- +--------------- + Seq Scan on d_hi_mise_item_uri (cost=0.00..194285.15 rows=7140589 +width=80) (actual time=0.027..18599.032 rows=71 +14844 loops=1) + Filter: ((item_id)::integer <= 100000000) + Total runtime: 23024.986 ms + +----- Original Message ----- +From: "BBI Edwin Punzalan" +To: "'gnari'" ; +Sent: Wednesday, December 01, 2004 11:33 AM +Subject: Re: [PERFORM] FW: Index usage + + +> +> Thanks but whatever it does, it didn't work. :D +> +> Do you think upgrading will fix this problem? +> +> ========================= +> db=# alter table chatlogs alter column date set statistics 300; +> ALTER +> db=# analyze chatlogs; +> ANALYZE +> db=# explain analyze select * from chatlogs where date >= '12/1/04'; +> NOTICE: QUERY PLAN: +> +> Index Scan using chatlogs_type_idx on chatlogs (cost=0.00..6053.61 +> rows=3357 width=212) (actual time=22.14..138.53 rows=1312 +> loops=1) +> Total runtime: 139.42 msec +> +> EXPLAIN +> morphTv=# explain analyze select * from chatlogs where date >= '11/03/04'; +> NOTICE: QUERY PLAN: +> +> Seq Scan on chatlogs (cost=0.00..27252.86 rows=271882 width=212) (actual +> time=12.24..13419.36 rows=257137 loops=1) +> Total runtime: 13573.70 msec +> +> EXPLAIN +> ========================= +> +> +> +> -----Original Message----- +> From: gnari [mailto:gnari@simnet.is] +> Sent: Wednesday, December 01, 2004 10:08 AM +> To: BBI Edwin Punzalan; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] FW: Index usage +> +> +> From: "BBI Edwin Punzalan" +> +> +>> +>> Hi, what do you mean by increasing the statistics on the date column? +> +> alter table chatlogs alter column date set statistics 300; analyze +> chatlogs; +> +>> > > Our version is 7.2.1 +>> > +>> > upgrade time ? +>> +>> We never had any upgrade on it. +> +> 7.2 is a bit dated now that 8.0 is in beta +> +> if you want to stay with 7.2, you should at least upgrade +> to the latest point release (7.2.6 ?), as several serious bugs have been +> fixed +> +> gnari +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 04:05:19 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FBE03A5431 + for ; + Wed, 1 Dec 2004 04:05:17 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54001-02 + for ; + Wed, 1 Dec 2004 04:05:11 +0000 (GMT) +Received: from bluebamboo.ph (unknown [202.175.252.53]) + by svr1.postgresql.org (Postfix) with ESMTP id 4184F3A5445 + for ; + Wed, 1 Dec 2004 04:05:09 +0000 (GMT) +Received: from irridescens ([192.168.0.180]) + by bluebamboo.ph (8.11.6/8.11.6) with ESMTP id iB145Ei21391; + Wed, 1 Dec 2004 12:05:14 +0800 +From: "BBI Edwin Punzalan" +To: "'Iain'" , "'gnari'" , + +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 12:05:18 +0800 +Message-ID: <006101c4d75a$f87a0030$b400a8c0@bluebamboo.ph> +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 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +In-reply-to: <00d101c4d75a$4bdc1700$7201a8c0@mst1x5r347kymb> +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/6 +X-Sequence-Number: 9381 + + +Hi. Thanks for your reply. The date column data type is date already. = +:D + +-----Original Message----- +From: Iain [mailto:iain@mst.co.jp]=20 +Sent: Wednesday, December 01, 2004 12:00 PM +To: BBI Edwin Punzalan; 'gnari'; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] FW: Index usage + + +If it's any help, i just ran this test on 7.4.6, my table has about = +7000000=20 +rows and the index is an integer. + +The item id ranges from 1 to 20000. + +As you can see from the following plans, the optimizer changed it's plan = + +depending on the value of the item id condition, and will use an index = +when=20 +it determines that the number of values that will be returned is a low % = +of=20 +the total table size. + +The item_id is an integer, but It looked like you are using a character=20 +field to store date information. Also, the dates you entered in your = +test=20 +case seem to be in the format DD/MM/YY which won't be amenable to useful = + +comparative searching (I didn't read any of the earlier posts so if that = + +isn't the case, just ignore this). If this is the case, try storing the = +data + +in a date column and see what happens then. + +regards +Iain + +test=3D# explain analyse select * from bigtable where item_id <=3D 1000; +=20 +QUERY=20 +PLAN + +-------------------------------------------------------------------------= +--- +--------------------------------------- +-------------------------------------------- + Index Scan using d_bigtable_idx2 on bigtable (cost=3D0.00..118753.57=20 +rows=3D59553 width=3D80) (actual +time=3D0.069..704.401 rows=3D58102 loops=3D1) + Index Cond: ((item_id)::integer <=3D 1000) + Total runtime: 740.786 ms +(3 rows) + + +test=3D# explain analyse select * from bigtable where item_id <=3D = +100000000; + QUERY PLAN + +-------------------------------------------------------------------------= +--- +--------------------------------------- +--------------- + Seq Scan on d_hi_mise_item_uri (cost=3D0.00..194285.15 rows=3D7140589=20 +width=3D80) (actual time=3D0.027..18599.032 rows=3D71 +14844 loops=3D1) + Filter: ((item_id)::integer <=3D 100000000) + Total runtime: 23024.986 ms + +----- Original Message -----=20 +From: "BBI Edwin Punzalan" +To: "'gnari'" ; +Sent: Wednesday, December 01, 2004 11:33 AM +Subject: Re: [PERFORM] FW: Index usage + + +> +> Thanks but whatever it does, it didn't work. :D +> +> Do you think upgrading will fix this problem? +> +> = +=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= + +> db=3D# alter table chatlogs alter column date set statistics 300; = +ALTER +> db=3D# analyze chatlogs; +> ANALYZE +> db=3D# explain analyze select * from chatlogs where date >=3D = +'12/1/04'; +> NOTICE: QUERY PLAN: +> +> Index Scan using chatlogs_type_idx on chatlogs (cost=3D0.00..6053.61=20 +> rows=3D3357 width=3D212) (actual time=3D22.14..138.53 rows=3D1312 +> loops=3D1) +> Total runtime: 139.42 msec +> +> EXPLAIN +> morphTv=3D# explain analyze select * from chatlogs where date >=3D=20 +> '11/03/04'; +> NOTICE: QUERY PLAN: +> +> Seq Scan on chatlogs (cost=3D0.00..27252.86 rows=3D271882 = +width=3D212)=20 +> (actual time=3D12.24..13419.36 rows=3D257137 loops=3D1) Total runtime: = + +> 13573.70 msec +> +> EXPLAIN +> = +=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= + +> +> +> +> -----Original Message----- +> From: gnari [mailto:gnari@simnet.is] +> Sent: Wednesday, December 01, 2004 10:08 AM +> To: BBI Edwin Punzalan; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] FW: Index usage +> +> +> From: "BBI Edwin Punzalan" +> +> +>> +>> Hi, what do you mean by increasing the statistics on the date column? +> +> alter table chatlogs alter column date set statistics 300; analyze +> chatlogs; +> +>> > > Our version is 7.2.1 +>> > +>> > upgrade time ? +>> +>> We never had any upgrade on it. +> +> 7.2 is a bit dated now that 8.0 is in beta +> +> if you want to stay with 7.2, you should at least upgrade +> to the latest point release (7.2.6 ?), as several serious bugs have=20 +> been fixed +> +> gnari +> +> +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 1: subscribe and unsubscribe commands go to = +majordomo@postgresql.org=20 + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 04:10:44 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 91B883A541D + for ; + Wed, 1 Dec 2004 04:10:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53749-10 + for ; + Wed, 1 Dec 2004 04:10:36 +0000 (GMT) +Received: from fine4.fine.co.kr (unknown [211.238.40.4]) + by svr1.postgresql.org (Postfix) with ESMTP id C066B3A543E + for ; + Wed, 1 Dec 2004 04:10:33 +0000 (GMT) +Received: from [192.168.0.240] ([192.168.0.240]) (authenticated bits=0) + by fine4.fine.co.kr (8.13.1/8.13.1) with ESMTP id iB14AOW7029197 + for ; Wed, 1 Dec 2004 13:10:27 +0900 +Message-ID: <41AD4433.1030909@siche.net> +Date: Wed, 01 Dec 2004 13:10:27 +0900 +From: =?UTF-8?B?7J6l7ZiE7ISx?= +User-Agent: ��| e� 0.9 (Windows/20041103) +X-Accept-Language: ko-kr, ko, en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Using "LIMIT" is much faster even though, searching with PK. +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char A8 hex) in message + header 'User-Agent': User-Agent: \250\310| e\310 0.9 (Wind... +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/7 +X-Sequence-Number: 9382 + +hello~ +i'm curious about this situation. + +here is my test. +my zipcode table has 47705 rows, +and schema looks like this. + +pgsql=# \d zipcode + +Table "public.zipcode" Column | Type | Modifiers +---------+-----------------------+----------- zipcode | character(7) | +not null sido | character varying(4) | not null gugun | character +varying(13) | not null dong | character varying(43) | not null bunji | +character varying(17) | not null seq | integer | not null Indexes: +"zipcode_pkey" PRIMARY KEY, btree (seq) + +and I need seq scan so, + +pgsql=# SET enable_indexscan TO OFF; +SET +Time: 0.534 ms + + +now test start! +the first row. + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq = '1'; + +QUERY PLAN +------------------------------------------------------------------------------------------------------- + Seq Scan on zipcode (cost=0.00..1168.31 rows=1 width=207) (actual +time=0.029..88.099 rows=1 loops=1) + Filter: (seq = 1) + Total runtime: 88.187 ms +(3 rows) + +Time: 89.392 ms pgsql=# + +the first row with LIMIT + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq = '1' LIMIT 1; +QUERY PLAN +------------------------------------------------------------------------------------------------------------ +Limit (cost=0.00..1168.31 rows=1 width=207) (actual time=0.033..0.034 +rows=1 loops=1) -> Seq Scan on zipcode (cost=0.00..1168.31 rows=1 +width=207) (actual time=0.028..0.028 rows=1 loops=1) Filter: (seq = 1) +Total runtime: 0.111 ms (4 rows) + +Time: 1.302 ms pgsql=# + +the last row, + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq = '47705'; QUERY +PLAN +------------------------------------------------------------------------------------------------------- +Seq Scan on zipcode (cost=0.00..1168.31 rows=1 width=207) (actual +time=3.248..88.232 rows=1 loops=1) Filter: (seq = 47705) Total runtime: +88.317 ms (3 rows) + +Time: 89.521 ms pgsql=# + +the last row with LIMIT, + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq = '47705' LIMIT +1; QUERY PLAN +------------------------------------------------------------------------------------------------------------ +Limit (cost=0.00..1168.31 rows=1 width=207) (actual time=3.254..3.254 +rows=1 loops=1) -> Seq Scan on zipcode (cost=0.00..1168.31 rows=1 +width=207) (actual time=3.248..3.248 rows=1 loops=1) Filter: (seq = +47705) Total runtime: 3.343 ms (4 rows) + +Time: 4.583 ms pgsql=# + +When I using index scan, the result was almost same, that means, there +was no time difference, so i'll not mention about index scan. + +but, sequence scan, as you see above result, there is big time +difference between using LIMIT and without using it. my question is, +when we're searching with PK like SELECT * FROM table WHERE PK = 'xxx', +we already know there is only 1 row or not. so, pgsql should stop +searching when maching row was found, isn't it? + +i don't know exactly about mechanism how pgsql searching row its inside, +so might be i'm thinking wrong way, any comments, advices, notes, +anything will be appreciate to me! + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 04:17:49 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B7213A540F + for ; + Wed, 1 Dec 2004 04:17:44 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58066-02 + for ; + Wed, 1 Dec 2004 04:17:38 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 61F9E3A546D + for ; + Wed, 1 Dec 2004 04:17:36 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iB14HPZ21081; + Wed, 1 Dec 2004 13:17:25 +0900 +Message-ID: <00e001c4d75c$defe7e40$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "BBI Edwin Punzalan" , + "'gnari'" , +References: <006101c4d75a$f87a0030$b400a8c0@bluebamboo.ph> +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 13:18:50 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="iso-8859-1"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/8 +X-Sequence-Number: 9383 + +Sorry, i can't check this easily as I don't have any date fields in my data +(they all held has character strings - do as i say, not as i do) but maybe +you should cast or convert the string representation of the date to a date +in the where clause. Postgres might be doing some implicit conversion but if +it is, I'd expect it to use a YYYY-MM-DD format which is what I see here. + +Something like ... WHERE date>= to_date('11/03/04','DD/MM/YY') + +regards +Iain +----- Original Message ----- +From: "BBI Edwin Punzalan" +To: "'Iain'" ; "'gnari'" ; + +Sent: Wednesday, December 01, 2004 1:05 PM +Subject: RE: [PERFORM] FW: Index usage + + +> +> Hi. Thanks for your reply. The date column data type is date already. :D +> +> -----Original Message----- +> From: Iain [mailto:iain@mst.co.jp] +> Sent: Wednesday, December 01, 2004 12:00 PM +> To: BBI Edwin Punzalan; 'gnari'; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] FW: Index usage +> +> +> If it's any help, i just ran this test on 7.4.6, my table has about +> 7000000 +> rows and the index is an integer. +> +> The item id ranges from 1 to 20000. +> +> As you can see from the following plans, the optimizer changed it's plan +> depending on the value of the item id condition, and will use an index +> when +> it determines that the number of values that will be returned is a low % +> of +> the total table size. +> +> The item_id is an integer, but It looked like you are using a character +> field to store date information. Also, the dates you entered in your test +> case seem to be in the format DD/MM/YY which won't be amenable to useful +> comparative searching (I didn't read any of the earlier posts so if that +> isn't the case, just ignore this). If this is the case, try storing the +> data +> +> in a date column and see what happens then. +> +> regards +> Iain +> +> test=# explain analyse select * from bigtable where item_id <= 1000; +> +> QUERY +> PLAN +> +> ---------------------------------------------------------------------------- +> --------------------------------------- +> -------------------------------------------- +> Index Scan using d_bigtable_idx2 on bigtable (cost=0.00..118753.57 +> rows=59553 width=80) (actual +> time=0.069..704.401 rows=58102 loops=1) +> Index Cond: ((item_id)::integer <= 1000) +> Total runtime: 740.786 ms +> (3 rows) +> +> +> test=# explain analyse select * from bigtable where item_id <= 100000000; +> QUERY PLAN +> +> ---------------------------------------------------------------------------- +> --------------------------------------- +> --------------- +> Seq Scan on d_hi_mise_item_uri (cost=0.00..194285.15 rows=7140589 +> width=80) (actual time=0.027..18599.032 rows=71 +> 14844 loops=1) +> Filter: ((item_id)::integer <= 100000000) +> Total runtime: 23024.986 ms +> +> ----- Original Message ----- +> From: "BBI Edwin Punzalan" +> To: "'gnari'" ; +> Sent: Wednesday, December 01, 2004 11:33 AM +> Subject: Re: [PERFORM] FW: Index usage +> +> +>> +>> Thanks but whatever it does, it didn't work. :D +>> +>> Do you think upgrading will fix this problem? +>> +>> ========================= +>> db=# alter table chatlogs alter column date set statistics 300; ALTER +>> db=# analyze chatlogs; +>> ANALYZE +>> db=# explain analyze select * from chatlogs where date >= '12/1/04'; +>> NOTICE: QUERY PLAN: +>> +>> Index Scan using chatlogs_type_idx on chatlogs (cost=0.00..6053.61 +>> rows=3357 width=212) (actual time=22.14..138.53 rows=1312 +>> loops=1) +>> Total runtime: 139.42 msec +>> +>> EXPLAIN +>> morphTv=# explain analyze select * from chatlogs where date >= +>> '11/03/04'; +>> NOTICE: QUERY PLAN: +>> +>> Seq Scan on chatlogs (cost=0.00..27252.86 rows=271882 width=212) +>> (actual time=12.24..13419.36 rows=257137 loops=1) Total runtime: +>> 13573.70 msec +>> +>> EXPLAIN +>> ========================= +>> +>> +>> +>> -----Original Message----- +>> From: gnari [mailto:gnari@simnet.is] +>> Sent: Wednesday, December 01, 2004 10:08 AM +>> To: BBI Edwin Punzalan; pgsql-performance@postgresql.org +>> Subject: Re: [PERFORM] FW: Index usage +>> +>> +>> From: "BBI Edwin Punzalan" +>> +>> +>>> +>>> Hi, what do you mean by increasing the statistics on the date column? +>> +>> alter table chatlogs alter column date set statistics 300; analyze +>> chatlogs; +>> +>>> > > Our version is 7.2.1 +>>> > +>>> > upgrade time ? +>>> +>>> We never had any upgrade on it. +>> +>> 7.2 is a bit dated now that 8.0 is in beta +>> +>> if you want to stay with 7.2, you should at least upgrade +>> to the latest point release (7.2.6 ?), as several serious bugs have +>> been fixed +>> +>> gnari +>> +>> +>> ---------------------------(end of +>> broadcast)--------------------------- +>> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 04:26:43 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E8BCA3A540F + for ; + Wed, 1 Dec 2004 04:26:19 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59355-05 + for ; + Wed, 1 Dec 2004 04:26:13 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 918A63A51B2 + for ; + Wed, 1 Dec 2004 04:26:12 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB14QBfJ001391; + Tue, 30 Nov 2004 23:26:11 -0500 (EST) +To: =?UTF-8?B?7J6l7ZiE7ISx?= +Cc: pgsql-performance@postgresql.org +Subject: Re: Using "LIMIT" is much faster even though, searching with PK. +In-reply-to: <41AD4433.1030909@siche.net> +References: <41AD4433.1030909@siche.net> +Comments: In-reply-to =?UTF-8?B?7J6l7ZiE7ISx?= + message dated "Wed, 01 Dec 2004 13:10:27 +0900" +Date: Tue, 30 Nov 2004 23:26:11 -0500 +Message-ID: <1390.1101875171@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/9 +X-Sequence-Number: 9384 + +=?UTF-8?B?7J6l7ZiE7ISx?= writes: +> but, sequence scan, as you see above result, there is big time +> difference between using LIMIT and without using it. + +You've got a table full of dead rows. Try VACUUM FULL ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Dec 1 04:42:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D6E413A548D + for ; + Wed, 1 Dec 2004 04:38:52 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63601-04 + for ; + Wed, 1 Dec 2004 04:38:47 +0000 (GMT) +Received: from fine4.fine.co.kr (unknown [211.238.40.4]) + by svr1.postgresql.org (Postfix) with ESMTP id C19003A5484 + for ; + Wed, 1 Dec 2004 04:38:44 +0000 (GMT) +Received: from [192.168.0.240] ([192.168.0.240]) (authenticated bits=0) + by fine4.fine.co.kr (8.13.1/8.13.1) with ESMTP id iB14ca0n029785; + Wed, 1 Dec 2004 13:38:37 +0900 +Message-ID: <41AD4AD0.908@siche.net> +Date: Wed, 01 Dec 2004 13:38:40 +0900 +From: "Hyun-Sung, Jang" +User-Agent: ��| e� 0.9 (Windows/20041103) +X-Accept-Language: ko-kr, ko, en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Using "LIMIT" is much faster even though, searching +References: <41AD4433.1030909@siche.net> <1390.1101875171@sss.pgh.pa.us> +In-Reply-To: <1390.1101875171@sss.pgh.pa.us> +Content-Type: multipart/alternative; + boundary="------------080103070908010700070206" +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char A8 hex) in message + header 'User-Agent': User-Agent: \250\310| e\310 0.9 (Wind... +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, HTML_50_60, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/10 +X-Sequence-Number: 9385 + +This is a multi-part message in MIME format. +--------------080103070908010700070206 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 8bit + +before test, I already executed VACUUM FULL. +this result show up after vacuum full. + + +Tom Lane 쓴 글: + +>=?UTF-8?B?7J6l7ZiE7ISx?= writes: +> +> +>>but, sequence scan, as you see above result, there is big time +>>difference between using LIMIT and without using it. +>> +>> +> +>You've got a table full of dead rows. Try VACUUM FULL ... +> +> regards, tom lane +> +> +> + + +--------------080103070908010700070206 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + + + + + + +before test, I already executed VACUUM FULL.
+this result show up after vacuum full.
+
+
+Tom Lane 쓴 글: +
+
=?UTF-8?B?7J6l7ZiE7ISx?= <siche@siche.net> writes:
+  
+
+
but, sequence scan, as you see above result, there is big time 
+difference between using LIMIT and without using it.
+    
+
+

+You've got a table full of dead rows.  Try VACUUM FULL ...
+
+			regards, tom lane
+
+  
+
+
+ + + +--------------080103070908010700070206-- + +From pgsql-performance-owner@postgresql.org Wed Dec 1 05:06:52 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D30403A546B + for ; + Wed, 1 Dec 2004 05:06:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69786-10 + for ; + Wed, 1 Dec 2004 05:06:32 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D5013A5451 + for ; + Wed, 1 Dec 2004 05:06:31 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6728689; Tue, 30 Nov 2004 21:08:02 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Using "LIMIT" is much faster even though, searching +Date: Tue, 30 Nov 2004 21:03:51 -0800 +User-Agent: KMail/1.6.2 +Cc: "Hyun-Sung, Jang" , Tom Lane +References: <41AD4433.1030909@siche.net> <1390.1101875171@sss.pgh.pa.us> + <41AD4AD0.908@siche.net> +In-Reply-To: <41AD4AD0.908@siche.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Message-Id: <200411302103.51643.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/11 +X-Sequence-Number: 9386 + +Hyun-Sang, + +> before test, I already executed VACUUM FULL. +> this result show up after vacuum full. + +Really? Your results really look like a bloated table. Can you run VACUUM +FULL ANALYZE VERBOSE on the table and post the output? + +> When I using index scan, the result was almost same, that means, there +> was no time difference, so i'll not mention about index scan. + +Can we see an index scan plan anyway? EXPLAIN ANALYZE? + +Oh, and if this is a zip codes table, why are you using a sequence as the +primary key instead of just using the zip code? + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Dec 1 06:03:47 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 555573A54B2 + for ; + Wed, 1 Dec 2004 06:03:45 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85154-04 + for ; + Wed, 1 Dec 2004 06:03:42 +0000 (GMT) +Received: from fine4.fine.co.kr (unknown [211.238.40.4]) + by svr1.postgresql.org (Postfix) with ESMTP id DAAF43A5492 + for ; + Wed, 1 Dec 2004 06:03:40 +0000 (GMT) +Received: from [192.168.0.240] ([192.168.0.240]) (authenticated bits=0) + by fine4.fine.co.kr (8.13.1/8.13.1) with ESMTP id iB163RCg032253; + Wed, 1 Dec 2004 15:03:27 +0900 +Message-ID: <41AD5EB3.80201@siche.net> +Date: Wed, 01 Dec 2004 15:03:31 +0900 +From: "Hyun-Sung, Jang" +User-Agent: ��| e� 0.9 (Windows/20041103) +X-Accept-Language: ko-kr, ko, en-us, en +MIME-Version: 1.0 +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, Tom Lane +Subject: Re: Using "LIMIT" is much faster even though, searching +References: <41AD4433.1030909@siche.net> <1390.1101875171@sss.pgh.pa.us> + <41AD4AD0.908@siche.net> <200411302103.51643.josh@agliodbs.com> +In-Reply-To: <200411302103.51643.josh@agliodbs.com> +Content-Type: multipart/alternative; + boundary="------------000201030000080003040402" +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char A8 hex) in message + header 'User-Agent': User-Agent: \250\310| e\310 0.9 (Wind... +X-Spam-Status: No, hits=0.172 tagged_above=0 required=5 tests=AWL, HTML_10_20, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/12 +X-Sequence-Number: 9387 + +This is a multi-part message in MIME format. +--------------000201030000080003040402 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 8bit + +do you need all of verbose information?? +VACUUM FULL ANALYZE VERBOSE give me a lot of infomation, +so i just cut zipcode parts. + +==start=============================================================================== +INFO: vacuuming "public.zipcode" +INFO: "zipcode": found 0 removable, 47705 nonremovable row versions in +572 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 76 to 136 bytes long. +There were 0 unused item pointers. +Total free space (including removable row versions) is 27944 bytes. +0 pages are or will become empty, including 0 at the end of the table. +91 pages containing 8924 free bytes are potential move destinations. +CPU 0.03s/0.00u sec elapsed 0.03 sec. +INFO: index "zipcode_pkey" now contains 47705 row versions in 147 pages +DETAIL: 0 index pages have been deleted, 0 are currently reusable. +CPU 0.01s/0.00u sec elapsed 0.00 sec. +INFO: "zipcode": moved 0 row versions, truncated 572 to 572 pages +DETAIL: CPU 0.00s/0.00u sec elapsed 0.00 sec. +INFO: analyzing "public.zipcode" +INFO: "zipcode": scanned 572 of 572 pages, containing 47705 live rows +and 0 dead rows; 3000 rows in sample, 47705 estimated total rows +INFO: free space map: 108 relations, 128 pages stored; 1760 total pages +needed +DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB +shared memory. +VACUUM +pgsql=# +==end=============================================================================== + + +USING INDEX SCAN + +==start=============================================================================== +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1'; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- + Index Scan using zipcode_pkey on zipcode (cost=0.00..3.02 rows=1 +width=55) (actual time=0.054..0.058 rows=1 loops=1) + Index Cond: (seq = 1) + Total runtime: 0.152 ms +(3 rows) + +pgsql=# + + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1' LIMIT 1; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..3.02 rows=1 width=55) (actual time=0.059..0.060 +rows=1 loops=1) + -> Index Scan using zipcode_pkey on zipcode (cost=0.00..3.02 rows=1 +width=55) (actual time=0.054..0.054 rows=1 loops=1) + Index Cond: (seq = 1) + Total runtime: 0.158 ms +(4 rows) + +pgsql=# + + +WHEN SELECT LAST ROW ----- + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705'; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------- + Index Scan using zipcode_pkey on zipcode (cost=0.00..3.02 rows=1 +width=55) (actual time=0.054..0.059 rows=1 loops=1) + Index Cond: (seq = 47705) + Total runtime: 0.150 ms +(3 rows) + +pgsql=# + + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705' LIMIT 1; + QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..3.02 rows=1 width=55) (actual time=0.057..0.057 +rows=1 loops=1) + -> Index Scan using zipcode_pkey on zipcode (cost=0.00..3.02 rows=1 +width=55) (actual time=0.052..0.052 rows=1 loops=1) + Index Cond: (seq = 47705) + Total runtime: 0.156 ms +(4 rows) + +pgsql=# +==end=============================================================================== + + + +USING SEQUENCE SCAN + +==start=============================================================================== +pgsql=# set enable_indexscan to off; +SET +pgsql=# + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1'; + QUERY PLAN +------------------------------------------------------------------------------------------------------- + Seq Scan on zipcode (cost=0.00..1168.31 rows=1 width=55) (actual +time=0.032..109.934 rows=1 loops=1) + Filter: (seq = 1) + Total runtime: 110.021 ms +(3 rows) + +pgsql=# + + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1' LIMIT 1; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..1168.31 rows=1 width=55) (actual time=0.035..0.035 +rows=1 loops=1) + -> Seq Scan on zipcode (cost=0.00..1168.31 rows=1 width=55) (actual +time=0.030..0.030 rows=1 loops=1) + Filter: (seq = 1) + Total runtime: 0.113 ms +(4 rows) + +pgsql=# + + +WHEN SELECT LAST ROW ----- + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705'; + QUERY PLAN +------------------------------------------------------------------------------------------------------- + Seq Scan on zipcode (cost=0.00..1168.31 rows=1 width=55) (actual +time=4.048..110.232 rows=1 loops=1) + Filter: (seq = 47705) + Total runtime: 110.322 ms +(3 rows) + +pgsql=# + + +pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705' LIMIT 1; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..1168.31 rows=1 width=55) (actual time=4.038..4.038 +rows=1 loops=1) + -> Seq Scan on zipcode (cost=0.00..1168.31 rows=1 width=55) (actual +time=4.033..4.033 rows=1 loops=1) + Filter: (seq = 47705) + Total runtime: 4.125 ms +(4 rows) + +pgsql=# + +==end=============================================================================== + + +I just choose zipcode table for this test. +not only zipcode table but other table also give me same result. + +SELECT * FROM table_name WHERE PK = 'xxx' + +was always slower than + +SELECT * FROM table_name WHERE PK = 'xxx' LIMIT 1 + +when sequence scan . + +i think pgsql tring to find more than 1 row when query executed even if +searching condition is primary key. + + +ah, why i'm using sequence as PK instead of zip code is +in korea, the small towns doesn't have it's own zipcode +so they share other big city's. +that's why zip code can't be a primary key. +actually, i'm not using sequence to find zipcode. +i made it temporary for this test. + +i think there is nobody want to using sequence number to find zipcode, +instead of city name. :-) + + +Josh Berkus 쓴 글: + +>Hyun-Sang, +> +> +> +>>before test, I already executed VACUUM FULL. +>>this result show up after vacuum full. +>> +>> +> +>Really? Your results really look like a bloated table. Can you run VACUUM +>FULL ANALYZE VERBOSE on the table and post the output? +> +> +> +>>When I using index scan, the result was almost same, that means, there +>>was no time difference, so i'll not mention about index scan. +>> +>> +> +>Can we see an index scan plan anyway? EXPLAIN ANALYZE? +> +>Oh, and if this is a zip codes table, why are you using a sequence as the +>primary key instead of just using the zip code? +> +> +> + + +--------------000201030000080003040402 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + + + + + + +do you need all of verbose information??
+VACUUM FULL ANALYZE VERBOSE give me a lot of infomation,
+so i just cut zipcode parts.
+
+==start===============================================================================
+INFO:  vacuuming "public.zipcode"
+INFO:  "zipcode": found 0 removable, 47705 nonremovable row versions in +572 pages
+DETAIL:  0 dead row versions cannot be removed yet.
+Nonremovable row versions range from 76 to 136 bytes long.
+There were 0 unused item pointers.
+Total free space (including removable row versions) is 27944 bytes.
+0 pages are or will become empty, including 0 at the end of the table.
+91 pages containing 8924 free bytes are potential move destinations.
+CPU 0.03s/0.00u sec elapsed 0.03 sec.
+INFO:  index "zipcode_pkey" now contains 47705 row versions in 147 pages
+DETAIL:  0 index pages have been deleted, 0 are currently reusable.
+CPU 0.01s/0.00u sec elapsed 0.00 sec.
+INFO:  "zipcode": moved 0 row versions, truncated 572 to 572 pages
+DETAIL:  CPU 0.00s/0.00u sec elapsed 0.00 sec.
+INFO:  analyzing "public.zipcode"
+INFO:  "zipcode": scanned 572 of 572 pages, containing 47705 live rows +and 0 dead rows; 3000 rows in sample, 47705 estimated total rows
+INFO:  free space map: 108 relations, 128 pages stored; 1760 total +pages needed
+DETAIL:  Allocated FSM size: 1000 relations + 20000 pages = 182 kB +shared memory.
+VACUUM
+pgsql=#
+==end===============================================================================
+
+
+USING INDEX SCAN
+
+==start===============================================================================
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1';
+                                                      QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------
+ Index Scan using zipcode_pkey on zipcode  (cost=0.00..3.02 rows=1 +width=55) (actual time=0.054..0.058 rows=1 loops=1)
+   Index Cond: (seq = 1)
+ Total runtime: 0.152 ms
+(3 rows)
+
+pgsql=#
+
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1' LIMIT 1;
+                                                         QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------
+ Limit  (cost=0.00..3.02 rows=1 width=55) (actual time=0.059..0.060 +rows=1 loops=1)
+   ->  Index Scan using zipcode_pkey on zipcode  (cost=0.00..3.02 +rows=1 width=55) (actual time=0.054..0.054 rows=1 loops=1)
+         Index Cond: (seq = 1)
+ Total runtime: 0.158 ms
+(4 rows)
+
+pgsql=#
+
+
+WHEN SELECT LAST ROW -----
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705';
+                                                      QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------
+ Index Scan using zipcode_pkey on zipcode  (cost=0.00..3.02 rows=1 +width=55) (actual time=0.054..0.059 rows=1 loops=1)
+   Index Cond: (seq = 47705)
+ Total runtime: 0.150 ms
+(3 rows)
+
+pgsql=#
+
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705' LIMIT 1;
+                                                         QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------
+ Limit  (cost=0.00..3.02 rows=1 width=55) (actual time=0.057..0.057 +rows=1 loops=1)
+   ->  Index Scan using zipcode_pkey on zipcode  (cost=0.00..3.02 +rows=1 width=55) (actual time=0.052..0.052 rows=1 loops=1)
+         Index Cond: (seq = 47705)
+ Total runtime: 0.156 ms
+(4 rows)
+
+pgsql=#
+==end===============================================================================
+
+
+
+USING SEQUENCE SCAN
+
+==start===============================================================================
+pgsql=# set enable_indexscan to off;
+SET
+pgsql=#
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1';
+                                              QUERY PLAN
+-------------------------------------------------------------------------------------------------------
+ Seq Scan on zipcode  (cost=0.00..1168.31 rows=1 width=55) (actual +time=0.032..109.934 rows=1 loops=1)
+   Filter: (seq = 1)
+ Total runtime: 110.021 ms
+(3 rows)
+
+pgsql=#
+
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='1' LIMIT 1;
+                                                QUERY PLAN
+-----------------------------------------------------------------------------------------------------------
+ Limit  (cost=0.00..1168.31 rows=1 width=55) (actual time=0.035..0.035 +rows=1 loops=1)
+   ->  Seq Scan on zipcode  (cost=0.00..1168.31 rows=1 width=55) +(actual time=0.030..0.030 rows=1 loops=1)
+         Filter: (seq = 1)
+ Total runtime: 0.113 ms
+(4 rows)
+
+pgsql=#
+
+
+WHEN SELECT LAST ROW -----
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705';
+                                              QUERY PLAN
+-------------------------------------------------------------------------------------------------------
+ Seq Scan on zipcode  (cost=0.00..1168.31 rows=1 width=55) (actual +time=4.048..110.232 rows=1 loops=1)
+   Filter: (seq = 47705)
+ Total runtime: 110.322 ms
+(3 rows)
+
+pgsql=#
+
+
+pgsql=# EXPLAIN ANALYZE select * from zipcode where seq='47705' LIMIT 1;
+                                                QUERY PLAN
+-----------------------------------------------------------------------------------------------------------
+ Limit  (cost=0.00..1168.31 rows=1 width=55) (actual time=4.038..4.038 +rows=1 loops=1)
+   ->  Seq Scan on zipcode  (cost=0.00..1168.31 rows=1 width=55) +(actual time=4.033..4.033 rows=1 loops=1)
+         Filter: (seq = 47705)
+ Total runtime: 4.125 ms
+(4 rows)
+
+pgsql=#
+
+==end===============================================================================
+
+
+I just choose zipcode table for this test.
+not only zipcode table but other table also give me same result.
+
+SELECT * FROM table_name WHERE PK = 'xxx'
+
+was always slower than
+
+SELECT * FROM table_name WHERE PK = 'xxx' LIMIT 1
+
+when sequence scan .
+
+i think pgsql tring to find more than 1 row when query executed even if
+searching condition is primary key.
+
+
+ah, why i'm using sequence as PK instead of zip code is
+in korea, the small towns doesn't have it's own zipcode
+so they share other big city's.
+that's why zip code can't be a primary key.
+actually, i'm not using sequence to find zipcode.
+i made it temporary for this test.
+
+i think there is nobody want to using sequence number to find zipcode,
+instead of city name. :-)
+
+
+Josh Berkus 쓴 글: +
+
Hyun-Sang,
+
+  
+
+
before test, I already executed VACUUM FULL.
+this result show up after vacuum full.
+    
+
+

+Really?   Your results really look like a bloated table.   Can you run VACUUM 
+FULL ANALYZE VERBOSE on the table and post the output?
+
+  
+
+
When I using index scan, the result was almost same, that means, there
+was no time difference, so i'll not mention about index scan.
+    
+
+

+Can we see an index scan plan anyway?   EXPLAIN ANALYZE?
+
+Oh, and if this is a zip codes table, why are you using a sequence as the 
+primary key instead of just using the zip code? 
+
+  
+
+
+ + + +--------------000201030000080003040402-- + +From pgsql-performance-owner@postgresql.org Wed Dec 1 08:23:46 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C2583A5512 + for ; + Wed, 1 Dec 2004 08:23:44 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18954-03 + for ; + Wed, 1 Dec 2004 08:23:39 +0000 (GMT) +Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) + by svr1.postgresql.org (Postfix) with ESMTP id 964B43A54C9 + for ; + Wed, 1 Dec 2004 08:23:39 +0000 (GMT) +Received: from 222-152-89-172.jetstream.xtra.co.nz ([222.152.89.172] + helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with asmtp + (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) + id 1CZPlu-0001bs-Dt; Wed, 01 Dec 2004 21:23:34 +1300 +Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) + by lamb.mcmillan.net.nz (Postfix) with ESMTP id 84593AD98588; + Wed, 1 Dec 2004 21:23:31 +1300 (NZDT) +Subject: Re: Using "LIMIT" is much faster even though, searching +From: Andrew McMillan +To: "Hyun-Sung, Jang" +Cc: pgsql-performance@postgresql.org +In-Reply-To: <41AD5EB3.80201@siche.net> +References: <41AD4433.1030909@siche.net> <1390.1101875171@sss.pgh.pa.us> + <41AD4AD0.908@siche.net> <200411302103.51643.josh@agliodbs.com> + <41AD5EB3.80201@siche.net> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-HPZpOiA0XfEVgRJcIg88" +Date: Wed, 01 Dec 2004 21:23:30 +1300 +Message-Id: <1101889411.16058.241.camel@lamb.mcmillan.net.nz> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/14 +X-Sequence-Number: 9389 + + +--=-HPZpOiA0XfEVgRJcIg88 +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Wed, 2004-12-01 at 15:03 +0900, Hyun-Sung, Jang wrote: +>=20 +> < lots of information about seq scan vs index scan > +>=20 + +Hi, + +Just because it has an ID that is the largest in the set, does not mean +it will be at the last position in the on-disk tables. And similarly, +the lowest numbered ID does not mean it will be at the beginning in the +on-disk structures. + +So when you 'LIMIT 1' the sequential scan stops as soon as it has found +the first row that matches, but in the no LIMIT case with a sequential +scan it will continue the scan to the end of the on-disk data. + +Given that this column is unique, PostgreSQL could optimise this case +and imply LIMIT 1 for all sequential scans on such criteria, but in the +real world the optimisation is usually going to come from an index - at +least it will for larger tables - since that's a component of how +PostgreSQL is enforcing the unique constraint. + +Regards, + Andrew McMillan. + + +------------------------------------------------------------------------- +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)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 + Chicken Little only has to be right once. +------------------------------------------------------------------------- + + +--=-HPZpOiA0XfEVgRJcIg88 +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) + +iD8DBQBBrX+CjJA0f48GgBIRAgpWAJ9H7N/6xq7BTNE6jHw99aV3Yb28lQCfcYA8 +MeDngcPlpYidkNx7TVQh45A= +=X/+N +-----END PGP SIGNATURE----- + +--=-HPZpOiA0XfEVgRJcIg88-- + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 08:22:42 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 784403A54E9 + for ; + Wed, 1 Dec 2004 08:22:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18954-01 + for ; + Wed, 1 Dec 2004 08:22:27 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 77E1A3A5501 + for ; + Wed, 1 Dec 2004 08:22:27 +0000 (GMT) +Received: from wp2000 ([157.157.176.239] [157.157.176.239]) by + quasar.skima.is; + Wed, 1 Dec 2004 08:22:25 Z +Message-Id: <004901c4d77f$3f31c020$0100000a@wp2000> +From: "gnari" +To: "BBI Edwin Punzalan" , + +References: <004c01c4d74e$1c61d110$b400a8c0@bluebamboo.ph> +Subject: Re: FW: Index usage +Date: Wed, 1 Dec 2004 08:24:59 -0000 +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 5.00.2919.6700 +X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/13 +X-Sequence-Number: 9388 + +From: "BBI Edwin Punzalan" + + +> Thanks but whatever it does, it didn't work. : + +> Do you think upgrading will fix this problem? + +are you sure there is a problem here to solve ? + +> Seq Scan on chatlogs (cost=0.00..27252.86 rows=271882 width=212) (actual +> time=12.24..13419.36 rows=257137 loops=1) + +you see that the actual rowcount matches the estimate, +so the planner is not being misled by wrong statistics. +you realize that an indexscan is not allways faster than +sequential scan unless the number of rows are a small +percentage of the total number of rows + +did you try to add a 'order by date' clause to your query ? + +gnari + + + + +From pgsql-general-owner@postgresql.org Wed Dec 1 12:45:26 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AF48C3A558C; + Wed, 1 Dec 2004 12:45:19 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94358-09; Wed, 1 Dec 2004 12:45:12 +0000 (GMT) +Received: from nitrogenio.carvalhaes.net (oxigenio.carvalhaes.net + [200.102.144.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 871D03A496D; + Wed, 1 Dec 2004 12:45:10 +0000 (GMT) +Received: from [192.168.0.10] ([200.215.220.2]) (authenticated bits=0) + by nitrogenio.carvalhaes.net (8.12.11/8.12.11) with ESMTP id + iB1B9aBQ030154; Wed, 1 Dec 2004 09:09:38 -0200 +Message-ID: <41ADA82A.7070405@carvalhaes.net> +Date: Wed, 01 Dec 2004 09:16:58 -0200 +From: Rodrigo Carvalhaes +Reply-To: grupos@carvalhaes.net +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-general@postgresql.org, pgsql-performance@postgresql.org +Subject: pg_restore taking 4 hours! +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Carvalhaes-MailScanner-Information: Favor contactar o suporte t�cnico para maiores informa��es suporte@triade.com +X-Carvalhaes-MailScanner: Found to be clean +X-MailScanner-From: grupos@carvalhaes.net +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E9 hex) in message + header 'X-Carvalhaes-MailScanner-Information': + X-Carvalhaes-MailScanner-Information: Favor contactar o suporte + t\351cnico para maio... +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/45 +X-Sequence-Number: 69657 + +Hi! + +I am using PostgreSQL with a proprietary ERP software in Brazil. The +database have around 1.600 tables (each one with +/- 50 columns). +My problem now is the time that takes to restore a dump. My customer +database have arount 500mb (on the disk, not the dump file) and I am +making the dump with pg_dump -Fc, my dumped file have 30mb. To make the +dump, it's taking +/- 1,5 hours BUT to restore (using pg_restore ) it it +takes 4 - 5 hours!!! + +Our machine it's a Dell Server Power Edge 1600sc (Xeon 2,4Ghz, with 1GB +memory, 7200 RPM disk). I don't think that there is a machine problem +because it's a server dedicated for the database and the cpu utilization +during the restore is around 30%. + +Looking on the lists arquives I found some messages about this and Tom +Lane was saying that then you have a lot of convertions the dump can +delay too much. 90% of the columns on my database are char columns and I +don't have large objects on the database. The restore is delaying too +much because the conversion of the char columns ? How can I have a +better performance on this restore? + +I need to find a solution for this because I am convincing customers +that are using SQL Server, DB2 and Oracle to change to PostgreSQL but +this customers have databases of 5GB!!! I am thinking that even with a +better server, the restore will take 2 days! + +My data: +Conectiva Linux 10 , Kernel 2.6.8 +PostgreSQL 7.4.6. + +postgresql.conf modified parameters (the other parameters are the default) +tcpip_socket = true +max_connections = 30 +shared_buffers = 30000 +sort_mem = 4096 +vacuum_mem = 8192 +max_fsm_pages = 20000 +max_fsm_relations = 1000 + +Regards, + +Rodrigo Carvalhaes + +From pgsql-performance-owner@postgresql.org Wed Dec 1 13:30:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 834373A55BA + for ; + Wed, 1 Dec 2004 13:30:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09837-04 + for ; + Wed, 1 Dec 2004 13:30:03 +0000 (GMT) +Received: from iglassmail.istructure.com (istructure.com [24.199.154.122]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BDE83A55B0 + for ; + Wed, 1 Dec 2004 13:30:02 +0000 (GMT) +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Query Performance and IOWait +Content-class: urn:content-classes:message +X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 +Date: Wed, 1 Dec 2004 08:29:55 -0500 +Message-ID: <54D4D0185B2D114A84630606A603DC9219A373@iglassmail.istructure.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: RE: [PERFORM] Query Performance and IOWait +Thread-Index: AcTXqdi694cokL8dT0qw6RnirQ/plg== +From: "George Woodring" +To: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/16 +X-Sequence-Number: 9391 + +Just as an update, We installed RHE Update4 beta kernel on a box and it +seems to have solved our issues. + +Woody=20 + +---------------------------------------- +iGLASS Networks +211-A S. Salem St +Apex NC 27502 +(919) 387-3550 x813 +www.iglass.net + +From pgsql-general-owner@postgresql.org Wed Dec 1 14:27:12 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4FB423A55C9; + Wed, 1 Dec 2004 14:25:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 29119-07; Wed, 1 Dec 2004 14:25:02 +0000 (GMT) +Received: from velocity.dnsracks.com (unknown [69.93.167.170]) + by svr1.postgresql.org (Postfix) with ESMTP id C739F3A55F1; + Wed, 1 Dec 2004 14:25:02 +0000 (GMT) +Received: from proxy.pspl.co.in ([203.199.147.2] helo=ps0499.persistent.co.in) + by velocity.dnsracks.com with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.43) + id 1CZVPa-0006jA-Gu; Wed, 01 Dec 2004 19:54:55 +0530 +From: Shridhar Daithankar +To: grupos@carvalhaes.net +Subject: Re: [PERFORM] pg_restore taking 4 hours! +Date: Wed, 1 Dec 2004 19:55:23 +0530 +User-Agent: KMail/1.7 +Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org +References: <41ADA82A.7070405@carvalhaes.net> +In-Reply-To: <41ADA82A.7070405@carvalhaes.net> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200412011955.23543.ghodechhap@ghodechhap.net> +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - velocity.dnsracks.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] +X-AntiAbuse: Sender Address Domain - ghodechhap.net +X-Source: +X-Source-Args: +X-Source-Dir: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/49 +X-Sequence-Number: 69661 + +On Wednesday 01 Dec 2004 4:46 pm, Rodrigo Carvalhaes wrote: +> I need to find a solution for this because I am convincing customers +> that are using SQL Server, DB2 and Oracle to change to PostgreSQL but +> this customers have databases of 5GB!!! I am thinking that even with a +> better server, the restore will take 2 days! +> +> My data: +> Conectiva Linux 10 , Kernel 2.6.8 +> PostgreSQL 7.4.6. +> +> postgresql.conf modified parameters (the other parameters are the default) +> tcpip_socket = true +> max_connections = 30 +> shared_buffers = 30000 +> sort_mem = 4096 +> vacuum_mem = 8192 +> max_fsm_pages = 20000 +> max_fsm_relations = 1000 + +Can you try bumping sort mem lot higher(basically whatever the machine can +afford) so that index creation is faster? + +Just try setting sort mem for the restore session and see if it helps.. + + Shridhar + +From pgsql-general-owner@postgresql.org Wed Dec 1 15:19:33 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2AA353A4835 + for ; + Wed, 1 Dec 2004 15:19:26 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46988-10 + for ; + Wed, 1 Dec 2004 15:19:14 +0000 (GMT) +Received: from web13921.mail.yahoo.com (web13921.mail.yahoo.com + [66.163.176.46]) + by svr1.postgresql.org (Postfix) with SMTP id 26DDA3A461A + for ; + Wed, 1 Dec 2004 15:19:17 +0000 (GMT) +Received: (qmail 17370 invoked by uid 60001); 1 Dec 2004 15:19:17 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=TQHaUDTa8F3P4JUJ/06n0vVPVOvsqwk/00abyclmg7ffGdjYOZfxWk74sE594Er/I5liDnqWNP6HzL5zJlyAbLqK4adK7K4PMvBmLFJS+7Y8uK6Is52wG4Ju4BBcppt3skr3AkvK47e3CLfPmyE0iKTUKqcyMRc5H30BlLa50tg= + ; +Message-ID: <20041201151917.17368.qmail@web13921.mail.yahoo.com> +Received: from [80.67.100.162] by web13921.mail.yahoo.com via HTTP; + Wed, 01 Dec 2004 07:19:17 PST +Date: Wed, 1 Dec 2004 07:19:17 -0800 (PST) +From: "Riccardo G. Facchini" +Reply-To: abief_ag_-postgresql@yahoo.com +Subject: Re: [PERFORM] pg_restore taking 4 hours! +To: Shridhar Daithankar , + grupos@carvalhaes.net +Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org +In-Reply-To: <200412011955.23543.ghodechhap@ghodechhap.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/52 +X-Sequence-Number: 69664 + + +--- Shridhar Daithankar <__> wrote: + +> On Wednesday 01 Dec 2004 4:46 pm, Rodrigo Carvalhaes wrote: +> > I need to find a solution for this because I am convincing +> customers +> > that are using SQL Server, DB2 and Oracle to change to PostgreSQL +> but +> > this customers have databases of 5GB!!! I am thinking that even +> with a +> > better server, the restore will take 2 days! +> > +> > My data: +> > Conectiva Linux 10 , Kernel 2.6.8 +> > PostgreSQL 7.4.6. +> > +> > postgresql.conf modified parameters (the other parameters are the +> default) +> > tcpip_socket = true +> > max_connections = 30 +> > shared_buffers = 30000 +> > sort_mem = 4096 +> > vacuum_mem = 8192 +> > max_fsm_pages = 20000 +> > max_fsm_relations = 1000 +> +> Can you try bumping sort mem lot higher(basically whatever the +> machine can +> afford) so that index creation is faster? +> +> Just try setting sort mem for the restore session and see if it +> helps.. +> +> Shridhar +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + +Yes, indexing is probably the issue. + +You can always ask them to report how long does it take to restore +their M$-SQL, DB2 and Oracle from a scripting dump. + +I've been restoring DB2 for a looong time (on different architectures) +and the main problem comes from indexing. + +As an index is basically a dynamic structure that is created on the +physical data (the data stored on the table), what is normally saved is +the index DEFINITION, not the index itself, so this is recreated at +restore time. + +Some DB2 architectures (and M$-SQL, and Oracle, and Sybase, and others. +others) may have a backup tool that is capable of saving the index +data, but is almost never used, as the index space itself can grow well +over the data size. + +I'll give one example: we have one DB2 on iSeries that runs around the +70Gb of Data and Indexes. We do a full backup that occupies only 45Gb +of Data and we do that in a little more than 1 hour because we only +save the index definitions. + +We know for sure that this full backup takes something between 5 and 7 +hours because of the reindexing. I had this written down in the Restore +Procedure Manual, so the user can't complain (they know that the +procedure will eventually restore the data and the full functionality). + +So, make sure that your client knows of their restore times. + +One small trick that can help you: +FIRST restore the tables. +THEN restore the foreingn keys, the constraints and the triggers and +procedures. +LAST restore the indexes and views. +LATEST restore the security. + +This way, if you have complicated views and indexes with a lot of info, +the procedure <<>> be shorter. + +regards, + +R. + +From pgsql-general-owner@postgresql.org Wed Dec 1 15:39:23 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0992F3A553F; + Wed, 1 Dec 2004 15:39:06 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56515-03; Wed, 1 Dec 2004 15:39:00 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E2B53A5423; + Wed, 1 Dec 2004 15:38:59 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB1Fcbps008362; + Wed, 1 Dec 2004 10:38:37 -0500 (EST) +To: Shridhar Daithankar +Cc: grupos@carvalhaes.net, pgsql-general@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: [PERFORM] pg_restore taking 4 hours! +In-reply-to: <200412011955.23543.ghodechhap@ghodechhap.net> +References: <41ADA82A.7070405@carvalhaes.net> + <200412011955.23543.ghodechhap@ghodechhap.net> +Comments: In-reply-to Shridhar Daithankar + message dated "Wed, 01 Dec 2004 19:55:23 +0530" +Date: Wed, 01 Dec 2004 10:38:37 -0500 +Message-ID: <8361.1101915517@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/54 +X-Sequence-Number: 69666 + +Shridhar Daithankar writes: +> On Wednesday 01 Dec 2004 4:46 pm, Rodrigo Carvalhaes wrote: +>> I need to find a solution for this because I am convincing customers +>> that are using SQL Server, DB2 and Oracle to change to PostgreSQL but +>> this customers have databases of 5GB!!! I am thinking that even with a +>> better server, the restore will take 2 days! + +> Can you try bumping sort mem lot higher(basically whatever the machine can +> afford) so that index creation is faster? + +It would be a good idea to bump up vacuum_mem as well. In current +sources it's vacuum_mem (well actually maintenance_work_mem) that +determines the speed of CREATE INDEX; I forget just how long that +behavior has been around, but 7.4.6 might do it too. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Dec 1 16:46:59 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2A8B63A5607 + for ; + Wed, 1 Dec 2004 16:46:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80619-06 + for ; + Wed, 1 Dec 2004 16:46:47 +0000 (GMT) +Received: from homer.berkhirt.com (homer.berkhirt.com [207.88.49.100]) + by svr1.postgresql.org (Postfix) with ESMTP id C33D63A5616 + for ; + Wed, 1 Dec 2004 16:46:43 +0000 (GMT) +Received: from [10.10.11.117] (homer [127.0.0.1]) (authenticated bits=0) + by homer.berkhirt.com (8.12.10/8.12.10) with ESMTP id iB1GkdF1024391; + Wed, 1 Dec 2004 10:46:40 -0600 +Mime-Version: 1.0 (Apple Message framework v619) +To: "'Postgresql Performance'" +Message-Id: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> +Content-Type: multipart/alternative; boundary=Apple-Mail-7--941647590 +Cc: Brian Hirt +Subject: query with timestamp not using index +From: Brian Hirt +Date: Wed, 1 Dec 2004 09:46:43 -0700 +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/19 +X-Sequence-Number: 9394 + + +--Apple-Mail-7--941647590 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + delsp=yes; + format=flowed + +I have a query that fetches information from a log, based on an indexed =20= + +column. The timestamp in the table is with time zone, and the server =20= + +time zone is not GMT. However, i want all of the timestamps for a =20 +particular day in GMT. If i simply use a date constant, the index is =20= + +used, but the incorrect rows are fetched, since the date is converted =20= + +to a timestamp in the server's time zone. When i cast that date to a =20= + +GMT date, the index is no longer used. Is there some better way to =20 +write the query so that the planner will use the index? I have =20 +simplied the queries below to demonstrate the problem i'm having. =20 +Thanks for any advice. + + +SLOW: +basement=3D# select count(*) from redir_log +basement-# where redir_timestamp >=3D '10/14/2004'::timestamp without =20= + +time zone at time zone 'GMT'; + count +------- + 33696 +(1 row) + +basement=3D# explain analyze +basement-# select count(*) from redir_log +basement-# where redir_timestamp >=3D '10/14/2004'::timestamp = +without =20 +time zone at time zone 'GMT'; + + Aggregate (cost=3D223093.00..223093.00 rows=3D1 width=3D0) (actual =20= + +time=3D5036.975..5036.976 rows=3D1 loops=3D1) + -> Seq Scan on redir_log (cost=3D0.00..219868.95 rows=3D1289621 =20= + +width=3D0) (actual time=3D4941.127..5006.133 rows=3D33696 loops=3D1) + Filter: (redir_timestamp >=3D timezone('GMT'::text, = +'2004-10-14 =20 +00:00:00'::timestamp without time zone)) + Total runtime: 5037.023 ms + + +FAST: +basement=3D# select count(*) from redir_log where redir_timestamp >=3D =20= + +'10/14/2004'; + count +------- + 33072 +(1 row) + +basement=3D# explain analyze select count(*) from redir_log where =20 +redir_timestamp >=3D '10/14/2004'; + =20 +QUERY PLAN +------------------------------------------------------------------------=20= + +------------------------------------------------------------------------=20= + +-- + Aggregate (cost=3D70479.79..70479.79 rows=3D1 width=3D0) (actual =20 +time=3D84.771..84.772 rows=3D1 loops=3D1) + -> Index Scan using redir_log_timestamp on redir_log =20 +(cost=3D0.00..70404.02 rows=3D30308 width=3D0) (actual = +time=3D0.022..55.337 =20 +rows=3D33072 loops=3D1) + Index Cond: (redir_timestamp >=3D '2004-10-14 =20 +00:00:00-06'::timestamp with time zone) + Total runtime: 84.823 ms +(4 rows) + + +-------------------------------------------- +MobyGames +http://www.mobygames.com +The world's largest and most comprehensive=A0 +gaming database project= + +--Apple-Mail-7--941647590 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + +I have a query that fetches information from a log, based on an +indexed column. The timestamp in the table is with time zone, and the +server time zone is not GMT. However, i want all of the timestamps +for a particular day in GMT. If i simply use a date constant, the +index is used, but the incorrect rows are fetched, since the date is +converted to a timestamp in the server's time zone. When i cast that +date to a GMT date, the index is no longer used. Is there some better +way to write the query so that the planner will use the index? I have +simplied the queries below to demonstrate the problem i'm having. =20 +Thanks for any advice. + + + +SLOW: + +basement=3D# select count(*) from redir_log=20 + +basement-# where redir_timestamp >=3D '10/14/2004'::timestamp without +time zone at time zone 'GMT'; + + count=20 + +------- + + 33696 + +(1 row) + + +basement=3D# explain analyze=20 + +basement-# select count(*) from redir_log=20 + +basement-# where redir_timestamp >=3D '10/14/2004'::timestamp = +without +time zone at time zone 'GMT'; + + + Aggregate (cost=3D223093.00..223093.00 rows=3D1 width=3D0) (actual +time=3D5036.975..5036.976 rows=3D1 loops=3D1) + + -> Seq Scan on redir_log (cost=3D0.00..219868.95 rows=3D1289621 +width=3D0) (actual time=3D4941.127..5006.133 rows=3D33696 loops=3D1) + + Filter: (redir_timestamp >=3D timezone('GMT'::text, '2004-10-14 +00:00:00'::timestamp without time zone)) + + Total runtime: 5037.023 ms + + + +FAST: + +basement=3D# select count(*) from redir_log where redir_timestamp >=3D +'10/14/2004'; + + count=20 + +------- + + 33072 + +(1 row) + + +basement=3D# explain analyze select count(*) from redir_log where +redir_timestamp >=3D '10/14/2004'; + + =20 +QUERY PLAN = + =20 + += +--------------------------------------------------------------------------= +------------------------------------------------------------------------ + + Aggregate (cost=3D70479.79..70479.79 rows=3D1 width=3D0) (actual +time=3D84.771..84.772 rows=3D1 loops=3D1) + + -> Index Scan using redir_log_timestamp on redir_log=20 +(cost=3D0.00..70404.02 rows=3D30308 width=3D0) (actual = +time=3D0.022..55.337 +rows=3D33072 loops=3D1) + + Index Cond: (redir_timestamp >=3D '2004-10-14 +00:00:00-06'::timestamp with time zone) + + Total runtime: 84.823 ms + +(4 rows) + + + +-------------------------------------------- + +MobyGames + +http://www.mobygames.com + +The world's largest and most comprehensive=A0=20 + +gaming database project= + +--Apple-Mail-7--941647590-- + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 17:38:43 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E29383A5631 + for ; + Wed, 1 Dec 2004 17:38:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97323-09 + for ; + Wed, 1 Dec 2004 17:38:32 +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 A344A3A5423 + for ; + Wed, 1 Dec 2004 17:38:32 +0000 (GMT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) + id 1CZYQU-0008Sq-GE; Wed, 01 Dec 2004 17:38:02 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 87567167E7; Wed, 1 Dec 2004 17:38:28 +0000 (GMT) +Message-ID: <41AE0194.9050705@archonet.com> +Date: Wed, 01 Dec 2004 17:38:28 +0000 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Brian Hirt +Cc: 'Postgresql Performance' +Subject: Re: query with timestamp not using index +References: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> +In-Reply-To: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/20 +X-Sequence-Number: 9395 + +Brian Hirt wrote: +> I have a query that fetches information from a log, based on an indexed +> column. The timestamp in the table is with time zone, and the server +> time zone is not GMT. However, i want all of the timestamps for a +> particular day in GMT. If i simply use a date constant, the index is +> used, but the incorrect rows are fetched, since the date is converted +> to a timestamp in the server's time zone. When i cast that date to a +> GMT date, the index is no longer used. Is there some better way to +> write the query so that the planner will use the index? I have +> simplied the queries below to demonstrate the problem i'm having. +> Thanks for any advice. +> +> +> SLOW: +> basement=# select count(*) from redir_log +> basement-# where redir_timestamp >= '10/14/2004'::timestamp without +> time zone at time zone 'GMT'; + +Not quite what's wanted. Try keeping things as a timestamp with timezone +(you can add a timestamp to a date): + +SELECT count(*) FROM redir_log +WHERE redir_timestamp BETWEEN '2004-10-14+00'::timestamptz AND +CURRENT_TIMESTAMP; + +Putting two bounds on the range can also help index usage. + +In actual fact, since you're comparing to a timestamp and not a date, +I'd personally supply a valid timestamptz: '2004-10-14 00:00:00+00' +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:15:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D7583A56D8 + for ; + Thu, 2 Dec 2004 02:15:23 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47244-09 + for ; + Thu, 2 Dec 2004 02:15:17 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id C757E3A5624 + for ; + Thu, 2 Dec 2004 02:15:01 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by www.postgresql.com (Postfix) with ESMTP id 55D5E738A49 + for ; + Wed, 1 Dec 2004 20:10:23 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB1K6w0I018428; + Wed, 1 Dec 2004 15:06:58 -0500 (EST) +To: Brian Hirt +Cc: "'Postgresql Performance'" +Subject: Re: query with timestamp not using index +In-reply-to: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> +References: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> +Comments: In-reply-to Brian Hirt + message dated "Wed, 01 Dec 2004 09:46:43 -0700" +Date: Wed, 01 Dec 2004 15:06:58 -0500 +Message-ID: <18427.1101931618@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/31 +X-Sequence-Number: 9406 + +Brian Hirt writes: +> select count(*) from redir_log +> where redir_timestamp >= '10/14/2004'::timestamp without time zone at time zone 'GMT'; + +That seems like the hard way to express a timestamp constant. Why not + +select count(*) from redir_log +where redir_timestamp >= '10/14/2004 00:00 GMT'; + +(FWIW, though, the AT TIME ZONE construct *should* have been collapsed +to a constant; 8.0 fixes this.) + + regards, tom lane + +From pgsql-general-owner@postgresql.org Thu Dec 2 02:49:07 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 69E2E3A56AD; + Thu, 2 Dec 2004 02:49:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59384-08; Thu, 2 Dec 2004 02:48:51 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id EE1BD3A56C7; + Thu, 2 Dec 2004 02:48:22 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by www.postgresql.com (Postfix) with ESMTP id A36287393B4; + Wed, 1 Dec 2004 20:19:51 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6731447; Wed, 01 Dec 2004 12:17:29 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org, grupos@carvalhaes.net +Subject: Re: [PERFORM] pg_restore taking 4 hours! +Date: Wed, 1 Dec 2004 12:19:00 -0800 +User-Agent: KMail/1.6.2 +Cc: pgsql-general@postgresql.org +References: <41ADA82A.7070405@carvalhaes.net> +In-Reply-To: <41ADA82A.7070405@carvalhaes.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412011219.00248.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/77 +X-Sequence-Number: 69689 + +Rodrigo, + +> Our machine it's a Dell Server Power Edge 1600sc (Xeon 2,4Ghz, with 1GB +> memory, 7200 RPM disk). I don't think that there is a machine problem +> because it's a server dedicated for the database and the cpu utilization +> during the restore is around 30%. + +In addition to Tom and Shridhar's advice, a single IDE disk is simply going to +make restores slow. A 500MB data file copy on that disk, straight, would +take up to 15 min. If this is for your ISV application, you need to +seriously re-think your hardware strategy; spending less on processors and +more on disks would be wise. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:31:43 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 628093A567A + for ; + Thu, 2 Dec 2004 02:31:42 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52776-10 + for ; + Thu, 2 Dec 2004 02:31:37 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 9FBC43A563C + for ; + Thu, 2 Dec 2004 02:31:39 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by www.postgresql.com (Postfix) with ESMTP id 07FAD7398E2 + for ; + Wed, 1 Dec 2004 20:26:22 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6731503; Wed, 01 Dec 2004 12:24:11 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Using "LIMIT" is much faster even though, searching +Date: Wed, 1 Dec 2004 12:25:42 -0800 +User-Agent: KMail/1.6.2 +Cc: "Hyun-Sung, Jang" , Tom Lane +References: <41AD4433.1030909@siche.net> + <200411302103.51643.josh@agliodbs.com> + <41AD5EB3.80201@siche.net> +In-Reply-To: <41AD5EB3.80201@siche.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Message-Id: <200412011225.42119.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/36 +X-Sequence-Number: 9411 + +Hyun-Sung, + +> do you need all of verbose information?? +> VACUUM FULL ANALYZE VERBOSE give me a lot of infomation, +> so i just cut zipcode parts. + +Oh, sorry. I meant just "VACUUM FULL ANALYZE VERBOSE zipcode", not the whole +database. Should have been clearer. + +> ==start==================================================================== +>=========== INFO: vacuuming "public.zipcode" +> INFO: "zipcode": found 0 removable, 47705 nonremovable row versions in +> 572 pages +> DETAIL: 0 dead row versions cannot be removed yet. + +OK, looks like you're clean. + +> I just choose zipcode table for this test. +> not only zipcode table but other table also give me same result. +> +> SELECT * FROM table_name WHERE PK = 'xxx' +> +> was always slower than +> +> SELECT * FROM table_name WHERE PK = 'xxx' LIMIT 1 +> +> when sequence scan . + +yeah? So? Stop using sequence scan! You've just demonstrated that, if you +don't force the planner to use sequence scan, things run at the same speed +with or without the LIMIT. So you're causing a problem by forcing the +planner into a bad plan. + +See Andrew's explanation of why it works this way. + +> ah, why i'm using sequence as PK instead of zip code is +> in korea, the small towns doesn't have it's own zipcode +> so they share other big city's. +> that's why zip code can't be a primary key. +> actually, i'm not using sequence to find zipcode. +> i made it temporary for this test. + +That makes sense. + +--Josh + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Dec 1 22:09:15 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 467393A4DC1 + for ; + Wed, 1 Dec 2004 22:09:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81814-08 + for ; + Wed, 1 Dec 2004 22:09:01 +0000 (GMT) +Received: from homer.berkhirt.com (homer.berkhirt.com [207.88.49.100]) + by svr1.postgresql.org (Postfix) with ESMTP id 8A26D3A549A + for ; + Wed, 1 Dec 2004 22:09:00 +0000 (GMT) +Received: from [10.10.11.117] (homer [127.0.0.1]) (authenticated bits=0) + by homer.berkhirt.com (8.12.10/8.12.10) with ESMTP id iB1M90F1012289; + Wed, 1 Dec 2004 16:09:01 -0600 +In-Reply-To: <18427.1101931618@sss.pgh.pa.us> +References: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> + <18427.1101931618@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: multipart/alternative; boundary=Apple-Mail-24--922307065 +Message-Id: <9CFDF39A-43E5-11D9-AD0F-000D93AD2E74@mobygames.com> +Cc: "'Postgresql Performance'" +From: Brian Hirt +Subject: Re: query with timestamp not using index +Date: Wed, 1 Dec 2004 15:09:04 -0700 +To: Tom Lane +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/21 +X-Sequence-Number: 9396 + + +--Apple-Mail-24--922307065 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=ISO-8859-1; + format=flowed + + +On Dec 1, 2004, at 1:06 PM, Tom Lane wrote: +> +> That seems like the hard way to express a timestamp constant. Why not +> + +I realized after i sent this message that i might get this responese. =20= + +I should have mentioned this was from within a stored pl/pgsql=20 +function, and the date wasn't a constant, but a variable. I was just=20 +trying to simplify the example. + +it's more like: + +declare + foo_date date; +begin + select some_date into foo_date from some_table where something =3D= +=20 +something_else; +=09 + select blah from redir_log where redir_timestamp >=3D=20 +foo_date::timestamp without time zone at time zone 'GMT'; + etc / etc / etc +end; + +> select count(*) from redir_log +> where redir_timestamp >=3D '10/14/2004 00:00 GMT'; +> +> (FWIW, though, the AT TIME ZONE construct *should* have been collapsed +> to a constant; 8.0 fixes this.) +> +> regards, tom lane +> +-------------------------------------------- +MobyGames +http://www.mobygames.com +The world's largest and most comprehensive=A0 +gaming database project + +--Apple-Mail-24--922307065 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/enriched; + charset=ISO-8859-1 + + + +On Dec 1, 2004, at 1:06 PM, Tom Lane wrote: + + + +That seems like the hard way to express a timestamp constant. Why not + + + + +I realized after i sent this message that i might get this responese.=20 +I should have mentioned this was from within a stored pl/pgsql +function, and the date wasn't a constant, but a variable. I was just +trying to simplify the example. + + +it's more like: + + +declare + + foo_date date; + +begin + + select some_date into foo_date from some_table where something =3D= + +something_else; + +=09 + + select blah from redir_log where redir_timestamp >=3D +foo_date::timestamp without time zone at time zone 'GMT'; + + etc / etc / etc + +end; + + +select count(*) from redir_log + +where redir_timestamp >=3D '10/14/2004 00:00 GMT'; + + +(FWIW, though, the AT TIME ZONE construct *should* have been collapsed + +to a constant; 8.0 fixes this.) + + + regards, tom lane + + +-------------------------------------------- + +MobyGames + +http://www.mobygames.com + +The world's largest and most comprehensive=A0=20 + +gaming database project + + +--Apple-Mail-24--922307065-- + + +From pgsql-performance-owner@postgresql.org Wed Dec 1 22:17:02 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D2C43A53DE + for ; + Wed, 1 Dec 2004 22:17:02 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84205-09 + for ; + Wed, 1 Dec 2004 22:16:52 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 82EB73A54DB + for ; + Wed, 1 Dec 2004 22:16:52 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB1MGrCh019908; + Wed, 1 Dec 2004 17:16:53 -0500 (EST) +To: Brian Hirt +Cc: "'Postgresql Performance'" +Subject: Re: query with timestamp not using index +In-reply-to: <9CFDF39A-43E5-11D9-AD0F-000D93AD2E74@mobygames.com> +References: <95241C28-43B8-11D9-AD0F-000D93AD2E74@mobygames.com> + <18427.1101931618@sss.pgh.pa.us> + <9CFDF39A-43E5-11D9-AD0F-000D93AD2E74@mobygames.com> +Comments: In-reply-to Brian Hirt + message dated "Wed, 01 Dec 2004 15:09:04 -0700" +Date: Wed, 01 Dec 2004 17:16:53 -0500 +Message-ID: <19907.1101939413@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/22 +X-Sequence-Number: 9397 + +Brian Hirt writes: +> it's more like: + +> declare +> foo_date date; +> begin +> select some_date into foo_date from some_table where something = something_else; +> select blah from redir_log where redir_timestamp >= foo_date::timestamp without time zone at time zone 'GMT'; +> etc / etc / etc + +Ah. In that case you're going to have trouble anyway with the planner +having no clue what the effective value of the comparison expression is, +because it'll certainly not be able to fold the plpgsql variable to a +constant. I agree with the other person who suggested faking it out +by adding a dummy other-side-of-the-range constraint, perhaps + AND redir_timestamp <= now() +(or whatever upper bound is okay for your purposes). This should coax +it into using an indexscan. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Dec 1 22:21:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CFA23A5420 + for ; + Wed, 1 Dec 2004 22:21:19 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86971-03 + for ; + Wed, 1 Dec 2004 22:21:15 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 06FE13A5528 + for ; + Wed, 1 Dec 2004 22:21:14 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6731918 for pgsql-performance@postgresql.org; + Wed, 01 Dec 2004 14:22:46 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Alternatives to Dell? +Date: Wed, 1 Dec 2004 14:24:12 -0800 +User-Agent: KMail/1.6.2 +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Message-Id: <200412011424.12137.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/23 +X-Sequence-Number: 9398 + +Folks, + +A lot of people have been having a devilish time with Dell hardware lately. +It seems like the quality control just isn't there on the Dell servers. + +Thing is, some companies are required to use 1st-tier or at least 2nd-tier +vendors for hardware; they won't home-build. For those people, what vendors +do others on this list recommend? What have been your good/bad experiences? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Dec 2 03:17:59 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 457433A57E6 + for ; + Thu, 2 Dec 2004 03:08:32 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70001-08 + for ; + Thu, 2 Dec 2004 03:08:26 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E0FD3A5881 + for ; + Thu, 2 Dec 2004 03:02:50 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) + by www.postgresql.com (Postfix) with ESMTP id B7CFB73B2EA + for ; + Wed, 1 Dec 2004 22:35:08 +0000 (GMT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id iB1MP3T00619; + Wed, 1 Dec 2004 17:25:03 -0500 (EST) +From: Bruce Momjian +Message-Id: <200412012225.iB1MP3T00619@candle.pha.pa.us> +Subject: Re: Alternatives to Dell? +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +To: josh@agliodbs.com +Date: Wed, 1 Dec 2004 17:25:03 -0500 (EST) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL108 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/42 +X-Sequence-Number: 9417 + +Josh Berkus wrote: +> Folks, +> +> A lot of people have been having a devilish time with Dell hardware lately. +> It seems like the quality control just isn't there on the Dell servers. + +Was the quality ever there with Dell? + +> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> vendors for hardware; they won't home-build. For those people, what vendors +> do others on this list recommend? What have been your good/bad experiences? + +I use Supermicro and have liked them. They make motherboards and systems. + +-- + 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 Dec 2 03:04:07 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B40593A56EF + for ; + Thu, 2 Dec 2004 03:03:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67240-09 + for ; + Thu, 2 Dec 2004 03:03:50 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 62DC63A5720 + for ; + Thu, 2 Dec 2004 03:02:08 +0000 (GMT) +Received: from 3times25.net (duck.3times25.net [66.23.211.34]) + by www.postgresql.com (Postfix) with ESMTP id 3AC6473B302 + for ; + Wed, 1 Dec 2004 22:39:28 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP + id 20C39746B5; Wed, 1 Dec 2004 17:38:49 -0500 (EST) +Message-ID: <41AE47F9.7010802@3times25.net> +Date: Wed, 01 Dec 2004 17:38:49 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <200412011424.12137.josh@agliodbs.com> +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/39 +X-Sequence-Number: 9414 + +Josh Berkus wrote: +> Folks, +> +> A lot of people have been having a devilish time with Dell hardware +> lately. It seems like the quality control just isn't there on the +> Dell servers. +> +> Thing is, some companies are required to use 1st-tier or at least +> 2nd-tier vendors for hardware; they won't home-build. For those +> people, what vendors do others on this list recommend? What have +> been your good/bad experiences? + +My experience with Dell is they are not reliable as well. + +Half way between the big guys and home built. I've had good success +with Monarch Computers. They've had ads in Linux Journal for a while +and a couple of their boxes have been reviewed there. As a matter of +fact, in the December issue, they did a review of a dual operton from +Monarch. + +http://www.monarchcomputer.com/ + +-- +Until later, Geoffrey + +From pgsql-performance-owner@postgresql.org Thu Dec 2 03:12:41 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 63B633A5818 + for ; + Thu, 2 Dec 2004 03:09:43 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70993-03 + for ; + Thu, 2 Dec 2004 03:09:35 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id D01B63A58A1 + for ; + Thu, 2 Dec 2004 03:02:58 +0000 (GMT) +Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) + by www.postgresql.com (Postfix) with ESMTP id DFDD773B324 + for ; + Wed, 1 Dec 2004 22:43:05 +0000 (GMT) +Received: from kungfu (frank.wiles.org [24.124.39.75]) + by frank.wiles.org (8.12.11/8.12.11) with SMTP id iB1NjL4T001845; + Wed, 1 Dec 2004 17:45:22 -0600 +Date: Wed, 1 Dec 2004 16:41:30 -0600 +From: Frank Wiles +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +Message-Id: <20041201164130.4337518a.frank@wiles.org> +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +References: <200412011424.12137.josh@agliodbs.com> +X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i386-redhat-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/41 +X-Sequence-Number: 9416 + +On Wed, 1 Dec 2004 14:24:12 -0800 +Josh Berkus wrote: + +> Folks, +> +> A lot of people have been having a devilish time with Dell hardware +> lately. It seems like the quality control just isn't there on the +> Dell servers. + + I believe I had expressed some problems with Dell in the past, but + it really isn't a quality control issue that I have seen. It is more + of a Linux support issue. Lately I've been running into problems with + getting particular parts of system working under Linux (raid cards, + SATA drives, Ethernet cards) or I can get it working, but it + performs badly ( PERC cards vs say a Mylex card ). + + I think it's more of a system design issue ( wrt Linux use ) rather + than a quality issue. + + --------------------------------- + Frank Wiles + http://www.wiles.org + --------------------------------- + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 03:05:01 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CA51D3A5744 + for ; + Thu, 2 Dec 2004 03:04:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67468-09 + for ; + Thu, 2 Dec 2004 03:04:43 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id E21143A576D + for ; + Thu, 2 Dec 2004 03:02:16 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by www.postgresql.com (Postfix) with ESMTP id 4D81F73B330 + for ; + Wed, 1 Dec 2004 22:44:40 +0000 (GMT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Alternatives to Dell? +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Date: Wed, 1 Dec 2004 17:43:10 -0500 +X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Alternatives to Dell? +thread-index: AcTX9SY3cgbfY+V6THy60X8kEwlctAAAMV8Q +From: "Merlin Moncure" +To: +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/40 +X-Sequence-Number: 9415 + +> Folks, +>=20 +> A lot of people have been having a devilish time with Dell hardware +> lately. +> It seems like the quality control just isn't there on the Dell +servers. +>=20 +> Thing is, some companies are required to use 1st-tier or at least +2nd-tier +> vendors for hardware; they won't home-build. For those people, what +> vendors +> do others on this list recommend? What have been your good/bad +> experiences? + +Well, there is always HP and (if money is no object) IBM or Sun. + +For the budget or performance minded I'd suggest checking out SWT +servers (http://www.swt.com) ...not sure what tier they fit into but +they can get you into a quad Opteron for under 10k$ US, about half what +you would pay for a comparable HP server (and Dell doesn't even offer +Opteron). + +Also, if choice of RAID controller is an option, I'd definitely suggest +3ware. They are cheap, have excellent linux support (including open +source drivers), and have the options you'd expect form a decent raid +controller including a BBU. I just picked up one of their escalade SATA +controllers and am really impressed with it. + +I'd definitely suggest Opteron...cooler, faster, and 64 bit. Another +reason not to go with Dell. + +Merlin + +From pgsql-performance-owner@postgresql.org Thu Dec 2 03:02:26 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E1DBA3A57AF + for ; + Thu, 2 Dec 2004 03:02:25 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66886-07 + for ; + Thu, 2 Dec 2004 03:02:11 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 7BDFA3A5686 + for ; + Thu, 2 Dec 2004 03:02:01 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) + by www.postgresql.com (Postfix) with ESMTP id 0E2CF73B35E + for ; + Wed, 1 Dec 2004 22:49:23 +0000 (GMT) +Received: by rproxy.gmail.com with SMTP id a36so735813rnf + for ; + Wed, 01 Dec 2004 14:48:26 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=F30B9KdKGs3oYJk3ymrQNpOfKJbv2zVB/JJTBchTSw875uQzQ+vp8scu3OjI4tNvk0apR0ELPy326453HAqnFXLFlLb+Y8B10UVw8f3TrZ880OMTREYVJZ7EInCD6YZCSnMkGhHKG+wHMPAK/j7bZI+9FVyKJlfD844yc3TFP2A= +Received: by 10.38.77.6 with SMTP id z6mr468133rna; + Wed, 01 Dec 2004 14:48:26 -0800 (PST) +Received: by 10.38.126.16 with HTTP; Wed, 1 Dec 2004 14:48:26 -0800 (PST) +Message-ID: +Date: Wed, 1 Dec 2004 17:48:26 -0500 +From: Mike Rylander +Reply-To: Mike Rylander +To: josh@agliodbs.com, pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +References: <200412011424.12137.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/38 +X-Sequence-Number: 9413 + +On Wed, 1 Dec 2004 14:24:12 -0800, Josh Berkus wrote: +> Folks, +> +> A lot of people have been having a devilish time with Dell hardware lately. +> It seems like the quality control just isn't there on the Dell servers. + +Which is a shame, because I *still* drool over a rack full of those +front bevels with the bright blue LEDs. :) + +> +> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> vendors for hardware; they won't home-build. For those people, what vendors +> do others on this list recommend? What have been your good/bad experiences? + +I'm using an HP DL585 quad Opteron with 16G RAM as a development box. +It's working great. ;) + +Seriously though, I never really liked HP (or worse, Compaq) hardware +before, but this box seems really well built, and I've yet to see a +'D' in the S column in top with the SA-6404/256 RAID card. + +If all goes as well as it has so far on this testbed I'll be deploying +on a Slony-1 clustered set of 3 of these bad boys with 32G RAM each. +Dollar-for-dollar, we're saving 90% (that's right, an order of +magnitude) going this route, PG with linux-amd64 on HP/Opterons, as +opposed to the E20K monster that was originally spec'd out. + +Mail me direct if you want the full spec list on this beast. And if +there is a ready-made benchmark anyone would like me to run, just drop +me a note. + +-- +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:15:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 527133A568F + for ; + Thu, 2 Dec 2004 02:15:47 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49395-06 + for ; + Thu, 2 Dec 2004 02:15:33 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id D4B8E3A5695 + for ; + Thu, 2 Dec 2004 02:15:02 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by www.postgresql.com (Postfix) with ESMTP id 76FFB73B428 + for ; + Wed, 1 Dec 2004 23:14:20 +0000 (GMT) +Received: from [192.168.1.51] (dsl093-038-087.pdx1.dsl.speakeasy.net + [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB1NDBaW030775; Wed, 1 Dec 2004 15:13:11 -0800 +Message-ID: <41AE5000.5020504@commandprompt.com> +Date: Wed, 01 Dec 2004 15:13:04 -0800 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <200412011424.12137.josh@agliodbs.com> +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +Content-Type: multipart/mixed; boundary="------------020503070605030605000703" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.118 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/32 +X-Sequence-Number: 9407 + +This is a multi-part message in MIME format. +--------------020503070605030605000703 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +> +> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> vendors for hardware; they won't home-build. For those people, what vendors +> do others on this list recommend? What have been your good/bad experiences? + +Well this is almost as bad as vi/emacs ;) but I have had good experience +with Compaq Proliant (now HP) servers. I have also "heard" good things +about IBM. + +IBM actually sells a reasonable costing Opteron server as well. + +Sincerely, + +Joshua D. Drake + + +> + + +-- +Command Prompt, Inc., home of PostgreSQL Replication, and plPHP. +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL + +--------------020503070605030605000703 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua D. Drake +n:Drake;Joshua D. +org:Command Prompt, Inc. +adr:;;PO Box 215;Cascade Locks;Oregon;97014;USA +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +note:Command Prompt, Inc. is the largest and oldest US based commercial PostgreSQL support provider. We provide the only commercially viable integrated PostgreSQL replication solution, but also custom programming, and support. We authored the book Practical PostgreSQL, the procedural language plPHP, and adding trigger capability to plPerl. +x-mozilla-html:FALSE +url:http://www.commandprompt.com/ +version:2.1 +end:vcard + + +--------------020503070605030605000703-- + +From pgsql-performance-owner@postgresql.org Wed Dec 1 23:32:30 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FA903A53DE + for ; + Wed, 1 Dec 2004 23:32:30 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03429-03 + for ; + Wed, 1 Dec 2004 23:32:19 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 528883A4DC1 + for ; + Wed, 1 Dec 2004 23:32:20 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6732216; Wed, 01 Dec 2004 15:33:53 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Off-list Re: Alternatives to Dell? +Date: Wed, 1 Dec 2004 15:35:23 -0800 +User-Agent: KMail/1.6.2 +Cc: Jeff Bohmer +References: <200412011424.12137.josh@agliodbs.com> + +In-Reply-To: +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412011535.24003.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/24 +X-Sequence-Number: 9399 + +Jeff, + +> I'm curious about the problem's you're seeing with Dell servers since +> we're about to buy some 750s, 2850s and 1850s. + +The problems I've been dealing with have been on the *650s. They're the ones +you name. + +> FYI ... the 750s, 1850s and 2850s use Intel chipsets (E7520 on 1850s +> and 2850s, 7210 on 750s), Intel NICs, and come only with LSI Logic +> RAID controllers. It looks like Dell has dropped the +> Broadcom/ServerWorks and Adaptec junk. + +I don't know if Vivek is on this list; I think he just had a critical failure +with one of the new Dells with LSI. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Dec 2 00:17:14 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D16143A55B5 + for ; + Thu, 2 Dec 2004 00:17:13 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19323-02 + for ; + Thu, 2 Dec 2004 00:17:08 +0000 (GMT) +Received: from e2.ny.us.ibm.com (e2.ny.us.ibm.com [32.97.182.142]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B5C73A5582 + for ; + Thu, 2 Dec 2004 00:17:06 +0000 (GMT) +Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) + by e2.ny.us.ibm.com (8.12.10/8.12.10) with ESMTP id iB20H7Ft017359 + for ; Wed, 1 Dec 2004 19:17:07 -0500 +Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) + by d01relay04.pok.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id + iB20H7kb263874 + for ; Wed, 1 Dec 2004 19:17:07 -0500 +Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) + by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id iB20H7YP027273 + for ; Wed, 1 Dec 2004 19:17:07 -0500 +Received: from d01ml255.pok.ibm.com (d01ml255.pok.ibm.com [9.56.227.128]) + by d01av02.pok.ibm.com (8.12.11/8.12.11) with ESMTP id iB20H78v027269; + Wed, 1 Dec 2004 19:17:07 -0500 +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +Subject: Re: Alternatives to Dell? +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +X-Mailer: Lotus Notes Release 6.0.2CF1 June 9, 2003 +Message-ID: + +From: Steven Rosenstein +Date: Wed, 1 Dec 2004 19:17:05 -0500 +X-MIMETrack: Serialize by Router on D01ML255/01/M/IBM(Release 6.53HF103 | + November 15, 2004) at 12/01/2004 19:17:07 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/26 +X-Sequence-Number: 9401 + + + + + +I recommend IBM equipment, but in the spirit of caveat emptor I should let +you know I work for IBM... :-) + +Seriously, I've been using IBM laptops and desktops for about 5 years, even +before I started working for them. They tend to be a little more expensive +than Dell, but I think they use beefier components and don't cut the specs +quite as close as Dell does. IBM gear is designed more for industrial use +than home computing, which is reflected in the quality (and the price). + +IBM just released a new series of PowerPC-based servers that are +specifically designed to run Linux. They're at the higher end, but from +what I understand, they provide much more bang for the buck than +Intel-based servers. + +I hope this helps, +--- Steve +___________________________________________________________________________________ + +Steven Rosenstein +Senior IT Architect/Specialist | IBM Virtual Server Administration +Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 +Text Messaging: 6463456978 @ mobile.mycingular.com +Email: srosenst @ us.ibm.com + +"Learn from the mistakes of others because you can't live long enough to +make them all yourself." -- Eleanor Roosevelt + + + + Josh Berkus + To + Sent by: pgsql-performance@postgresql.org + pgsql-performance cc + -owner@postgresql + .org Subject + [PERFORM] Alternatives to Dell? + + 12/01/2004 05:24 + PM + + + Please respond to + josh + + + + + + +Folks, + +A lot of people have been having a devilish time with Dell hardware lately. + +It seems like the quality control just isn't there on the Dell servers. + +Thing is, some companies are required to use 1st-tier or at least 2nd-tier +vendors for hardware; they won't home-build. For those people, what +vendors +do others on this list recommend? What have been your good/bad +experiences? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +---------------------------(end of broadcast)--------------------------- +TIP 5: Have you checked our extensive FAQ? + + http://www.postgresql.org/docs/faqs/FAQ.html + + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 00:21:07 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CD7A93A555D + for ; + Thu, 2 Dec 2004 00:21:06 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18682-10 + for ; + Thu, 2 Dec 2004 00:20:54 +0000 (GMT) +Received: from ew.mimos.my (unknown [192.228.129.34]) + by svr1.postgresql.org (Postfix) with ESMTP id BFE3E3A556C + for ; + Thu, 2 Dec 2004 00:20:54 +0000 (GMT) +Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) + by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id iB20KIff041693 + for ; + Thu, 2 Dec 2004 08:20:19 +0800 (MYT) + (envelope-from hasnulfadhly.h@mimos.my) +Message-ID: <41AE5FBE.2010104@mimos.my> +Date: Thu, 02 Dec 2004 08:20:14 +0800 +From: Hasnul Fadhly bin Hasan +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: pgsql-performance@postgresql.org +Subject: Recommended Specs +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/27 +X-Sequence-Number: 9402 + +Hi, + +I was reading a lot on the specs that was used by those who runs +postgres. I was wondering is the a more structured method of +determining what is the required hardware specs? The project that i am +doing can populate about few millions records a day (worst case). + +Based on what i read, this is what i guess + +RAM - the more the better +postgresql.conf must be optimized +CPU - not sure if adding more CPU will really help unless i start to +create parrallel insert sessions. +Hard disks - ?? how do i actually check how much space this records take +on the hard drives? +optimized queries is a must +OS? linux? freebsd? solaris? +cpu type? sun sparc? intel? amd? +anything else? + +Hasnul + + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 01:35:42 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 253933A55DB + for ; + Thu, 2 Dec 2004 01:35:42 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37882-06 + for ; + Thu, 2 Dec 2004 01:35:29 +0000 (GMT) +Received: from web.private.deploylinux.net (fw.public.deploylinux.net + [207.178.245.100]) + by svr1.postgresql.org (Postfix) with ESMTP id 617223A5631 + for ; + Thu, 2 Dec 2004 01:35:30 +0000 (GMT) +Received: from Shelly.DeployLinuxConsulting.local + (shelly.private.deploylinux.net [10.240.1.12]) + by web.private.deploylinux.net (Postfix) with ESMTP id 921D69A773; + Wed, 1 Dec 2004 17:35:31 -0800 (PST) +Subject: Re: Alternatives to Dell? +To: Steven Rosenstein , josh@agliodbs.com +From: "Matthew Marlowe" +Reply-To: "Matthew Marlowe" +Cc: pgsql-performance@postgresql.org +Date: Wed, 01 Dec 2004 17:35:32 -0800 +X-Mailer: Time Matters 6.0.0 +Message-Id: <20041202013531.921D69A773@web.private.deploylinux.net> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/28 +X-Sequence-Number: 9403 + +Josh, Steve: + +I have also been looking at non-dell server vendors due to +recent concerns about the PERC RAID Controllers. That said, +I believe IBM just shoots itself in the foot via its sales/pricing +practices.... + +Price out a PE2850 w/ 8GB RAM and 6 18GB Drives on the +Dell website and you'll get a number in the $9-10K range. Talk +to your sales rep and you can get a $1-2K discount(total $7-8K). +That seems fair and it wins alot of business. + +Go the IBM website, try to find a comparative x86 system and +spec it out. The list pricing is in the $12-16K range. Yes, I know +I could get a good discount if I developed a relationship with +an IBM reseller here..and perhaps the end pricing would be +in the $10-12K range....but the Dell way just seems alot more honest +to me, and reasonable. The IBM gear doesn't seem that much better. + +And while I have concerns about some of the Dell +hardware, none of the issues have really caused any issues for me or my clients +here yet.....(crossing fingers..) + +I just don't think IBM makes it easy for new customers to buy their equipment and +if I went with them, I'd always have the lingering suspicion that I was paying too much. + +I really hope they change some day... Until then, I just see Dell winning more of the +server market share. + +Regards, +Matt +--- Original Message--- + To: josh@agliodbs.com + Cc: pgsql-performance@postgresql.org + From: Steven Rosenstein + Sent: 12/01/2004 4:17PM + Subject: Re: [PERFORM] Alternatives to Dell? + +>> +>> +>> +>> +>> I recommend IBM equipment, but in the spirit of caveat emptor I should let +>> you know I work for IBM... :-) +>> +>> Seriously, I've been using IBM laptops and desktops for about 5 years, even +>> before I started working for them. They tend to be a little more expensive +>> than Dell, but I think they use beefier components and don't cut the specs +>> quite as close as Dell does. IBM gear is designed more for industrial use +>> than home computing, which is reflected in the quality (and the price). +>> +>> IBM just released a new series of PowerPC-based servers that are +>> specifically designed to run Linux. They're at the higher end, but from +>> what I understand, they provide much more bang for the buck than +>> Intel-based servers. +>> +>> I hope this helps, +>> --- Steve +>> ________________________________________________________________________ +>> ___________ +>> +>> Steven Rosenstein +>> Senior IT Architect/Specialist | IBM Virtual Server Administration +>> Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 +>> Text Messaging: 6463456978 @ mobile.mycingular.com +>> Email: srosenst @ us.ibm.com +>> +>> "Learn from the mistakes of others because you can't live long enough to +>> make them all yourself." -- Eleanor Roosevelt +>> +>> +>> +>> Josh Berkus +>> > m> To +>> Sent by: pgsql-performance@postgresql.org +>> pgsql-performance cc +>> -owner@postgresql +>> .org Subject +>> [PERFORM] Alternatives to Dell? +>> +>> 12/01/2004 05:24 +>> PM +>> +>> +>> Please respond to +>> josh +>> +>> +>> +>> +>> +>> +>> Folks, +>> +>> A lot of people have been having a devilish time with Dell hardware lately. +>> +>> It seems like the quality control just isn't there on the Dell servers. +>> +>> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +>> vendors for hardware; they won't home-build. For those people, what +>> vendors +>> do others on this list recommend? What have been your good/bad +>> experiences? +>> +>> -- +>> --Josh +>> +>> Josh Berkus +>> Aglio Database Solutions +>> San Francisco +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 5: Have you checked our extensive FAQ? +>> +>> http://www.postgresql.org/docs/faqs/FAQ.html +>> +>> +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 4: Don't 'kill -9' the postmaster +>> + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 01:58:39 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CE95E3A561A + for ; + Thu, 2 Dec 2004 01:58:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42232-09 + for ; + Thu, 2 Dec 2004 01:58:27 +0000 (GMT) +Received: from 3times25.net (66-23-211-34.clients.speedfactory.net + [66.23.211.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 730BB3A5624 + for ; + Thu, 2 Dec 2004 01:58:28 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP id 359F2746B5 + for ; + Wed, 1 Dec 2004 20:58:29 -0500 (EST) +Message-ID: <41AE76C4.5070407@3times25.net> +Date: Wed, 01 Dec 2004 20:58:28 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <20041202013531.921D69A773@web.private.deploylinux.net> +In-Reply-To: <20041202013531.921D69A773@web.private.deploylinux.net> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/29 +X-Sequence-Number: 9404 + +Matthew Marlowe wrote: + +> I just don't think IBM makes it easy for new customers to buy their +> equipment and if I went with them, I'd always have the lingering +> suspicion that I was paying too much. +> +> I really hope they change some day... Until then, I just see Dell +> winning more of the server market share. + +Something to be said for the old saying, 'you get what you pay for.' + +-- +Until later, Geoffrey + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:09:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0232D3A5626 + for ; + Thu, 2 Dec 2004 02:09:49 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45910-06 + for ; + Thu, 2 Dec 2004 02:09:43 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 6DCC63A5642 + for ; + Thu, 2 Dec 2004 02:09:44 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iB229eZ25245; + Thu, 2 Dec 2004 11:09:40 +0900 +Message-ID: <001001c4d814$0ec62a30$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "Geoffrey" , + +References: <20041202013531.921D69A773@web.private.deploylinux.net> + <41AE76C4.5070407@3times25.net> +Subject: Re: Alternatives to Dell? +Date: Thu, 2 Dec 2004 11:10:07 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="iso-8859-1"; + reply-type=response +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/30 +X-Sequence-Number: 9405 + +I always say 'If you pay for quality it only hurts once', but then again I +don't equate high price with high quality ;-) + +----- Original Message ----- +From: "Geoffrey" + +> Something to be said for the old saying, 'you get what you pay for.' + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:18:57 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E70CB3A568A + for ; + Thu, 2 Dec 2004 02:16:29 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50785-05 + for ; + Thu, 2 Dec 2004 02:16:21 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id DBA423A564B + for ; + Thu, 2 Dec 2004 02:16:02 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB22G1aW011602; Wed, 1 Dec 2004 18:16:01 -0800 +Message-ID: <41AE7AC0.6010501@commandprompt.com> +Date: Wed, 01 Dec 2004 18:15:28 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Matthew Marlowe +Cc: Steven Rosenstein , josh@agliodbs.com, + pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <20041202013531.921D69A773@web.private.deploylinux.net> +In-Reply-To: <20041202013531.921D69A773@web.private.deploylinux.net> +Content-Type: multipart/mixed; boundary="------------080601040607010504010709" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/33 +X-Sequence-Number: 9408 + +This is a multi-part message in MIME format. +--------------080601040607010504010709 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + + +> +>Go the IBM website, try to find a comparative x86 system and +>spec it out. The list pricing is in the $12-16K range. Yes, I know +>I could get a good discount if I developed a relationship with +>an IBM reseller here..and perhaps the end pricing would be +>in the $10-12K range....but the Dell way just seems alot more honest +>to me, and reasonable. The IBM gear doesn't seem that much better. +> +> +It is my experience that IBM will get within 5% of Dell if you +provide IBM with a written quote from Dell. + +Sincerely, + +Joshua D. Drake + + + +>And while I have concerns about some of the Dell +>hardware, none of the issues have really caused any issues for me or my clients +>here yet.....(crossing fingers..) +> +>I just don't think IBM makes it easy for new customers to buy their equipment and +>if I went with them, I'd always have the lingering suspicion that I was paying too much. +> +>I really hope they change some day... Until then, I just see Dell winning more of the +>server market share. +> +>Regards, +>Matt +>--- Original Message--- +> To: josh@agliodbs.com +> Cc: pgsql-performance@postgresql.org +> From: Steven Rosenstein +> Sent: 12/01/2004 4:17PM +> Subject: Re: [PERFORM] Alternatives to Dell? +> +> +> +>>> +>>> +>>>I recommend IBM equipment, but in the spirit of caveat emptor I should let +>>>you know I work for IBM... :-) +>>> +>>>Seriously, I've been using IBM laptops and desktops for about 5 years, even +>>>before I started working for them. They tend to be a little more expensive +>>>than Dell, but I think they use beefier components and don't cut the specs +>>>quite as close as Dell does. IBM gear is designed more for industrial use +>>>than home computing, which is reflected in the quality (and the price). +>>> +>>>IBM just released a new series of PowerPC-based servers that are +>>>specifically designed to run Linux. They're at the higher end, but from +>>>what I understand, they provide much more bang for the buck than +>>>Intel-based servers. +>>> +>>>I hope this helps, +>>>--- Steve +>>>________________________________________________________________________ +>>>___________ +>>> +>>>Steven Rosenstein +>>>Senior IT Architect/Specialist | IBM Virtual Server Administration +>>>Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001 +>>>Text Messaging: 6463456978 @ mobile.mycingular.com +>>>Email: srosenst @ us.ibm.com +>>> +>>>"Learn from the mistakes of others because you can't live long enough to +>>>make them all yourself." -- Eleanor Roosevelt +>>> +>>> +>>> +>>> Josh Berkus +>>> >> m> To +>>> Sent by: pgsql-performance@postgresql.org +>>> pgsql-performance cc +>>> -owner@postgresql +>>> .org Subject +>>> [PERFORM] Alternatives to Dell? +>>> +>>> 12/01/2004 05:24 +>>> PM +>>> +>>> +>>> Please respond to +>>> josh +>>> +>>> +>>> +>>> +>>> +>>> +>>>Folks, +>>> +>>>A lot of people have been having a devilish time with Dell hardware lately. +>>> +>>>It seems like the quality control just isn't there on the Dell servers. +>>> +>>>Thing is, some companies are required to use 1st-tier or at least 2nd-tier +>>>vendors for hardware; they won't home-build. For those people, what +>>>vendors +>>>do others on this list recommend? What have been your good/bad +>>>experiences? +>>> +>>>-- +>>>--Josh +>>> +>>>Josh Berkus +>>>Aglio Database Solutions +>>>San Francisco +>>> +>>>---------------------------(end of broadcast)--------------------------- +>>>TIP 5: Have you checked our extensive FAQ? +>>> +>>> http://www.postgresql.org/docs/faqs/FAQ.html +>>> +>>> +>>> +>>>---------------------------(end of broadcast)--------------------------- +>>>TIP 4: Don't 'kill -9' the postmaster +>>> +>>> +>>> +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 2: you can get off all lists at once with the unregister command +> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) +> +> + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------080601040607010504010709 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------080601040607010504010709-- + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:21:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D3DD53A5642 + for ; + Thu, 2 Dec 2004 02:21:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52145-04 + for ; + Thu, 2 Dec 2004 02:21:36 +0000 (GMT) +Received: from 3times25.net (duck.3times25.net [66.23.211.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 4EF9A3A5624 + for ; + Thu, 2 Dec 2004 02:21:37 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP id 80A34746B5 + for ; + Wed, 1 Dec 2004 21:21:38 -0500 (EST) +Message-ID: <41AE7C31.5000504@3times25.net> +Date: Wed, 01 Dec 2004 21:21:37 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <20041202013531.921D69A773@web.private.deploylinux.net> + <41AE76C4.5070407@3times25.net> + <001001c4d814$0ec62a30$7201a8c0@mst1x5r347kymb> +In-Reply-To: <001001c4d814$0ec62a30$7201a8c0@mst1x5r347kymb> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/34 +X-Sequence-Number: 9409 + +Iain wrote: +> I always say 'If you pay for quality it only hurts once', but then again +> I don't equate high price with high quality ;-) + +True, but if you do your research, you'll more likely to get high +quality with high price then you are high quality with low price. + +-- +Until later, Geoffrey + +From pgsql-performance-owner@postgresql.org Thu Dec 2 02:23:28 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DB133A5675 + for ; + Thu, 2 Dec 2004 02:23:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51378-10 + for ; + Thu, 2 Dec 2004 02:23:20 +0000 (GMT) +Received: from smtp-gw-cl-c.dmv.com (smtp-gw-cl-c.dmv.com [216.240.97.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 26BD13A5673 + for ; + Thu, 2 Dec 2004 02:23:22 +0000 (GMT) +Received: from mail-gw-cl-a.dmv.com (mail-gw-cl-a.dmv.com [216.240.97.38]) + by smtp-gw-cl-c.dmv.com (8.12.10/8.12.10) with ESMTP id iB22UEEo046526 + for ; + Wed, 1 Dec 2004 21:30:14 -0500 (EST) (envelope-from sven@dmv.com) +Received: from [64.45.134.154] (dogpound.dyndns.org [64.45.134.154]) + by mail-gw-cl-a.dmv.com (8.12.9/8.12.9) with ESMTP id iB22U7Xe008476 + for ; + Wed, 1 Dec 2004 21:30:08 -0500 (EST) (envelope-from sven@dmv.com) +Message-ID: <41AE7C9B.4050509@dmv.com> +Date: Wed, 01 Dec 2004 21:23:23 -0500 +From: Sven Willenberger +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Off-list Re: Alternatives to Dell? +References: <200412011424.12137.josh@agliodbs.com> + + <200412011535.24003.josh@agliodbs.com> +In-Reply-To: <200412011535.24003.josh@agliodbs.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/35 +X-Sequence-Number: 9410 + + + +Josh Berkus wrote: +> Jeff, +> +> +>>I'm curious about the problem's you're seeing with Dell servers since +>>we're about to buy some 750s, 2850s and 1850s. +> +> +> The problems I've been dealing with have been on the *650s. They're the ones +> you name. +> +> +>>FYI ... the 750s, 1850s and 2850s use Intel chipsets (E7520 on 1850s +>>and 2850s, 7210 on 750s), Intel NICs, and come only with LSI Logic +>>RAID controllers. It looks like Dell has dropped the +>>Broadcom/ServerWorks and Adaptec junk. +> +> +> I don't know if Vivek is on this list; I think he just had a critical failure +> with one of the new Dells with LSI. +> + +On this note about "Adaptec junk", I have a question regarding hardware +as well. We tend to build a lot of servers in house (Supermicro based +with the Zero-channel raid). Does anyone have any anecdotal or empirical +data on using a ZCR card versus a full-blown RAID controller (adaptec or +other)?? I am trying to build a medium-duty database server with 8G RAM, +4x144GB U320 Scsi RAID 10, FreeBSD (5.3-stable or 4-stable) and was +wondering about performance differences between ZCR and Adaptec versus +other manufacturers' Full-RAID cards. (PCI-E) + +Sven + +From pgsql-performance-owner@postgresql.org Thu Dec 2 03:48:39 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DA3C63A566E + for ; + Thu, 2 Dec 2004 03:48:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83309-01 + for ; + Thu, 2 Dec 2004 03:48:25 +0000 (GMT) +Received: from vt-pe2550-001.VANTAGE.vantage.com (sol.vantage.com + [64.80.203.242]) + by svr1.postgresql.org (Postfix) with ESMTP id 075443A4BB7 + for ; + Thu, 2 Dec 2004 03:48:24 +0000 (GMT) +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: Alternatives to Dell? +Date: Wed, 1 Dec 2004 22:48:24 -0500 +Message-ID: + <4BAFBB6B9CC46F41B2AD7D9F4BBAF7850986CD@vt-pe2550-001.vantage.vantage.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Alternatives to Dell? +Thread-Index: AcTYFoZNPLiuVuOXQfSn6DmPDIavPQACeJ7b +From: "Anjan Dave" +To: "Joshua D. Drake" , + "Matthew Marlowe" +Cc: "Steven Rosenstein" , , + +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/43 +X-Sequence-Number: 9418 + +Tm90IGluIG15IGV4cGVyaWVuY2UgZm9yIElCTSwgZXZlbiBmb3IgYW4gb3JkZXIgYXBwcm9hY2hp +bmcgMTAway4gVGhlIHNhbGVzIGd1eSB3YXMgcnVkZSwganVtcGluZyBvbiBudW1iZXJzLCB1bmFi +bGUgdG8gdGFsayBhYm91dCBleGFjdGx5IHdoYXQgZGlmZmVyZW50aWF0ZXMgSUJNIGZyb20gRGVs +bCAoZXF1aXZhbGVudCBjb25maWcpIC0gb3RoZXIgdGhhbiB0aGUgbmFtZSBhbmQgdGhlaXIgMjBL +KyBkaWZmZXJlbmNlLg0KIA0KV2UgdXNlIG1hbnkgRGVsbCBzZXJ2ZXJzLCBubyBxdWFsaXR5IGlz +c3VlLCBidXQgYXMgc29tZW9uZSBwb2ludGVkIG91dCBlYXJsaWVyLCBsaW51eCBzdXBwb3J0IGlz +IG5vdCB0aGF0IGdyZWF0Lg0KIA0KT25seSBpc3N1ZSBzbyBmYXIgaGFyZHdhcmUgd2lzZSBpcyB0 +aGUgUEVSQyBjYXJkIG9uIG9uZSBvZiB0aGUgbWFjaGluZXMsIGFuZCBpIGJlbGlldmUgb25lIHNo +b3VsZCBzdGF5IGF3YXkgZnJvbSB0aGUgYWRhcHRlYyB2ZXJzaW9ucyBvZiBQRVJDLg0KIA0KLWFu +amFuDQogDQoNCgktLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLSANCglGcm9tOiBKb3NodWEgRC4g +RHJha2UgW21haWx0bzpqZEBjb21tYW5kcHJvbXB0LmNvbV0gDQoJU2VudDogV2VkIDEyLzEvMjAw +NCA5OjE1IFBNIA0KCVRvOiBNYXR0aGV3IE1hcmxvd2UgDQoJQ2M6IFN0ZXZlbiBSb3NlbnN0ZWlu +OyBqb3NoQGFnbGlvZGJzLmNvbTsgcGdzcWwtcGVyZm9ybWFuY2VAcG9zdGdyZXNxbC5vcmcgDQoJ +U3ViamVjdDogUmU6IFtQRVJGT1JNXSBBbHRlcm5hdGl2ZXMgdG8gRGVsbD8NCgkNCgkNCg0KDQoJ +PiANCgk+R28gdGhlIElCTSB3ZWJzaXRlLCB0cnkgdG8gZmluZCBhIGNvbXBhcmF0aXZlIHg4NiBz +eXN0ZW0gYW5kIA0KCT5zcGVjIGl0IG91dC4gVGhlIGxpc3QgcHJpY2luZyBpcyBpbiB0aGUgJDEy +LTE2SyByYW5nZS4gIFllcywgSSBrbm93IA0KCT5JIGNvdWxkIGdldCBhIGdvb2QgZGlzY291bnQg +aWYgSSBkZXZlbG9wZWQgYSByZWxhdGlvbnNoaXAgd2l0aCANCgk+YW4gSUJNIHJlc2VsbGVyIGhl +cmUuLmFuZCBwZXJoYXBzIHRoZSBlbmQgcHJpY2luZyB3b3VsZCBiZSANCgk+aW4gdGhlICQxMC0x +MksgcmFuZ2UuLi4uYnV0IHRoZSBEZWxsIHdheSBqdXN0IHNlZW1zIGFsb3QgbW9yZSBob25lc3Qg +DQoJPnRvIG1lLCBhbmQgcmVhc29uYWJsZS4gIFRoZSBJQk0gZ2VhciBkb2Vzbid0IHNlZW0gdGhh +dCBtdWNoIGJldHRlci4gDQoJPiAgDQoJPiANCglJdCBpcyBteSBleHBlcmllbmNlIHRoYXQgSUJN +IHdpbGwgZ2V0IHdpdGhpbiA1JSBvZiBEZWxsIGlmIHlvdSANCglwcm92aWRlIElCTSB3aXRoIGEg +d3JpdHRlbiBxdW90ZSBmcm9tIERlbGwuIA0KDQoJU2luY2VyZWx5LCANCg0KCUpvc2h1YSBELiBE +cmFrZSANCg0KDQoNCgk+QW5kIHdoaWxlIEkgaGF2ZSBjb25jZXJucyBhYm91dCBzb21lIG9mIHRo +ZSBEZWxsIA0KCT5oYXJkd2FyZSwgbm9uZSBvZiB0aGUgaXNzdWVzIGhhdmUgcmVhbGx5IGNhdXNl +ZCBhbnkgaXNzdWVzIGZvciBtZSBvciBteSBjbGllbnRzIA0KCT5oZXJlIHlldC4uLi4uKGNyb3Nz +aW5nIGZpbmdlcnMuLikgDQoJPiANCgk+SSBqdXN0IGRvbid0IHRoaW5rIElCTSBtYWtlcyBpdCBl +YXN5IGZvciBuZXcgY3VzdG9tZXJzIHRvIGJ1eSB0aGVpciBlcXVpcG1lbnQgYW5kIA0KCT5pZiBJ +IHdlbnQgd2l0aCB0aGVtLCBJJ2QgYWx3YXlzIGhhdmUgdGhlIGxpbmdlcmluZyBzdXNwaWNpb24g +dGhhdCBJIHdhcyBwYXlpbmcgdG9vIG11Y2guIA0KCT4gDQoJPkkgcmVhbGx5IGhvcGUgdGhleSBj +aGFuZ2Ugc29tZSBkYXkuLi4gIFVudGlsIHRoZW4sIEkganVzdCBzZWUgRGVsbCB3aW5uaW5nIG1v +cmUgb2YgdGhlIA0KCT5zZXJ2ZXIgbWFya2V0IHNoYXJlLiANCgk+IA0KCT5SZWdhcmRzLCANCgk+ +TWF0dCAgIA0KCT4tLS0gT3JpZ2luYWwgTWVzc2FnZS0tLSANCgk+IFRvOiBqb3NoQGFnbGlvZGJz +LmNvbSANCgk+IENjOiBwZ3NxbC1wZXJmb3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZyANCgk+IEZyb206 +IFN0ZXZlbiBSb3NlbnN0ZWluIDxzcm9zZW5zdEB1cy5pYm0uY29tPiANCgk+IFNlbnQ6IDEyLzAx +LzIwMDQgIDQ6MTdQTSANCgk+IFN1YmplY3Q6IFJlOiBbUEVSRk9STV0gQWx0ZXJuYXRpdmVzIHRv +IERlbGw/IA0KCT4gDQoJPiAgDQoJPiANCgk+Pj4gDQoJPj4+IA0KCT4+PkkgcmVjb21tZW5kIElC +TSBlcXVpcG1lbnQsIGJ1dCBpbiB0aGUgc3Bpcml0IG9mIGNhdmVhdCBlbXB0b3IgIEkgc2hvdWxk +IGxldCANCgk+Pj55b3Uga25vdyBJIHdvcmsgZm9yIElCTS4uLiA6LSkgDQoJPj4+IA0KCT4+PlNl +cmlvdXNseSwgSSd2ZSBiZWVuIHVzaW5nIElCTSBsYXB0b3BzIGFuZCBkZXNrdG9wcyBmb3IgYWJv +dXQgNSB5ZWFycywgZXZlbiANCgk+Pj5iZWZvcmUgSSBzdGFydGVkIHdvcmtpbmcgZm9yIHRoZW0u +ICBUaGV5IHRlbmQgdG8gYmUgYSBsaXR0bGUgbW9yZSBleHBlbnNpdmUgDQoJPj4+dGhhbiBEZWxs +LCBidXQgSSB0aGluayB0aGV5IHVzZSBiZWVmaWVyIGNvbXBvbmVudHMgYW5kIGRvbid0IGN1dCB0 +aGUgc3BlY3MgDQoJPj4+cXVpdGUgYXMgY2xvc2UgYXMgRGVsbCBkb2VzLiAgSUJNIGdlYXIgaXMg +ZGVzaWduZWQgbW9yZSBmb3IgaW5kdXN0cmlhbCB1c2UgDQoJPj4+dGhhbiBob21lIGNvbXB1dGlu +Zywgd2hpY2ggaXMgcmVmbGVjdGVkIGluIHRoZSBxdWFsaXR5IChhbmQgdGhlIHByaWNlKS4gDQoJ +Pj4+IA0KCT4+PklCTSBqdXN0IHJlbGVhc2VkIGEgbmV3IHNlcmllcyBvZiBQb3dlclBDLWJhc2Vk +IHNlcnZlcnMgdGhhdCBhcmUgDQoJPj4+c3BlY2lmaWNhbGx5IGRlc2lnbmVkIHRvIHJ1biBMaW51 +eC4gIFRoZXkncmUgYXQgdGhlIGhpZ2hlciBlbmQsIGJ1dCBmcm9tIA0KCT4+PndoYXQgSSB1bmRl +cnN0YW5kLCB0aGV5IHByb3ZpZGUgbXVjaCBtb3JlIGJhbmcgZm9yIHRoZSBidWNrIHRoYW4gDQoJ +Pj4+SW50ZWwtYmFzZWQgc2VydmVycy4gDQoJPj4+IA0KCT4+PkkgaG9wZSB0aGlzIGhlbHBzLCAN +Cgk+Pj4tLS0gU3RldmUgDQoJPj4+X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f +X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fIA0KCT4+Pl9fX19fX19fX19fIA0K +CT4+PiANCgk+Pj5TdGV2ZW4gUm9zZW5zdGVpbiANCgk+Pj5TZW5pb3IgSVQgQXJjaGl0ZWN0L1Nw +ZWNpYWxpc3QgfCBJQk0gVmlydHVhbCBTZXJ2ZXIgQWRtaW5pc3RyYXRpb24gDQoJPj4+Vm9pY2Uv +RkFYOiA4NDUtNjg5LTIwNjQgfCBDZWxsOiA2NDYtMzQ1LTY5NzggfCBUaWVsaW5lOiA5MzAtNjAw +MSANCgk+Pj5UZXh0IE1lc3NhZ2luZzogNjQ2MzQ1Njk3OCBAIG1vYmlsZS5teWNpbmd1bGFyLmNv +bSANCgk+Pj5FbWFpbDogc3Jvc2Vuc3QgQCB1cy5pYm0uY29tIA0KCT4+PiANCgk+Pj4iTGVhcm4g +ZnJvbSB0aGUgbWlzdGFrZXMgb2Ygb3RoZXJzIGJlY2F1c2UgeW91IGNhbid0IGxpdmUgbG9uZyBl +bm91Z2ggdG8gDQoJPj4+bWFrZSB0aGVtIGFsbCB5b3Vyc2VsZi4iIC0tIEVsZWFub3IgUm9vc2V2 +ZWx0IA0KCT4+PiANCgk+Pj4gDQoJPj4+IA0KCT4+PiAgICAgICAgICAgICBKb3NoIEJlcmt1cyAN +Cgk+Pj4gICAgICAgICAgICAgPGpvc2hAYWdsaW9kYnMuY28gDQoJPj4+ICAgICAgICAgICAgIG0+ +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg +VG8gDQoJPj4+ICAgICAgICAgICAgIFNlbnQgYnk6ICAgICAgICAgICAgICAgICAgcGdzcWwtcGVy +Zm9ybWFuY2VAcG9zdGdyZXNxbC5vcmcgDQoJPj4+ICAgICAgICAgICAgIHBnc3FsLXBlcmZvcm1h +bmNlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2MgDQoJPj4+ICAg +ICAgICAgICAgIC1vd25lckBwb3N0Z3Jlc3FsIA0KCT4+PiAgICAgICAgICAgICAub3JnICAgICAg +ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBTdWJqZWN0IA0KCT4+ +PiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFtQRVJGT1JNXSBBbHRlcm5h +dGl2ZXMgdG8gRGVsbD8gDQoJPj4+IA0KCT4+PiAgICAgICAgICAgICAxMi8wMS8yMDA0IDA1OjI0 +IA0KCT4+PiAgICAgICAgICAgICBQTSANCgk+Pj4gDQoJPj4+IA0KCT4+PiAgICAgICAgICAgICBQ +bGVhc2UgcmVzcG9uZCB0byANCgk+Pj4gICAgICAgICAgICAgICAgICAgam9zaCANCgk+Pj4gDQoJ +Pj4+IA0KCT4+PiANCgk+Pj4gDQoJPj4+IA0KCT4+PiANCgk+Pj5Gb2xrcywgDQoJPj4+IA0KCT4+ +PkEgbG90IG9mIHBlb3BsZSBoYXZlIGJlZW4gaGF2aW5nIGEgZGV2aWxpc2ggdGltZSB3aXRoIERl +bGwgaGFyZHdhcmUgbGF0ZWx5LiANCgk+Pj4gDQoJPj4+SXQgc2VlbXMgbGlrZSB0aGUgcXVhbGl0 +eSBjb250cm9sIGp1c3QgaXNuJ3QgdGhlcmUgb24gdGhlIERlbGwgc2VydmVycy4gDQoJPj4+IA0K +CT4+PlRoaW5nIGlzLCBzb21lIGNvbXBhbmllcyBhcmUgcmVxdWlyZWQgdG8gdXNlIDFzdC10aWVy +IG9yIGF0IGxlYXN0IDJuZC10aWVyIA0KCT4+PnZlbmRvcnMgZm9yIGhhcmR3YXJlOyB0aGV5IHdv +bid0IGhvbWUtYnVpbGQuICAgRm9yIHRob3NlIHBlb3BsZSwgd2hhdCANCgk+Pj52ZW5kb3JzIA0K +CT4+PmRvIG90aGVycyBvbiB0aGlzIGxpc3QgcmVjb21tZW5kPyAgIFdoYXQgaGF2ZSBiZWVuIHlv +dXIgZ29vZC9iYWQgDQoJPj4+ZXhwZXJpZW5jZXM/IA0KCT4+PiANCgk+Pj4tLSANCgk+Pj4tLUpv +c2ggDQoJPj4+IA0KCT4+Pkpvc2ggQmVya3VzIA0KCT4+PkFnbGlvIERhdGFiYXNlIFNvbHV0aW9u +cyANCgk+Pj5TYW4gRnJhbmNpc2NvIA0KCT4+PiANCgk+Pj4tLS0tLS0tLS0tLS0tLS0tLS0tLS0t +LS0tLS0oZW5kIG9mIGJyb2FkY2FzdCktLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gDQoJPj4+ +VElQIDU6IEhhdmUgeW91IGNoZWNrZWQgb3VyIGV4dGVuc2l2ZSBGQVE/IA0KCT4+PiANCgk+Pj4g +ICAgICAgICAgICAgICBodHRwOi8vd3d3LnBvc3RncmVzcWwub3JnL2RvY3MvZmFxcy9GQVEuaHRt +bCANCgk+Pj4gDQoJPj4+IA0KCT4+PiANCgk+Pj4tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0o +ZW5kIG9mIGJyb2FkY2FzdCktLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0gDQoJPj4+VElQIDQ6 +IERvbid0ICdraWxsIC05JyB0aGUgcG9zdG1hc3RlciANCgk+Pj4gDQoJPj4+ICAgICAgDQoJPj4+ +IA0KCT4gDQoJPiANCgk+LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZiBicm9hZGNh +c3QpLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIA0KCT5USVAgMjogeW91IGNhbiBnZXQgb2Zm +IGFsbCBsaXN0cyBhdCBvbmNlIHdpdGggdGhlIHVucmVnaXN0ZXIgY29tbWFuZCANCgk+ICAgIChz +ZW5kICJ1bnJlZ2lzdGVyIFlvdXJFbWFpbEFkZHJlc3NIZXJlIiB0byBtYWpvcmRvbW9AcG9zdGdy +ZXNxbC5vcmcpIA0KCT4gIA0KCT4gDQoNCg0KCS0tIA0KCUNvbW1hbmQgUHJvbXB0LCBJbmMuLCBo +b21lIG9mIE1hbW1vdGggUG9zdGdyZVNRTCAtIFMvT0RCQyBhbmQgUy9KREJDIA0KCVBvc3RncmVz +cWwgc3VwcG9ydCwgcHJvZ3JhbW1pbmcgc2hhcmVkIGhvc3RpbmcgYW5kIGRlZGljYXRlZCBob3N0 +aW5nLiANCgkrMS01MDMtNjY3LTQ1NjQgLSBqZEBjb21tYW5kcHJvbXB0LmNvbSAtIGh0dHA6Ly93 +d3cuY29tbWFuZHByb21wdC5jb20gDQoJUG9zdGdyZVNRTCBSZXBsaWNhdG9yIC0tIHByb2R1Y3Rp +b24gcXVhbGl0eSByZXBsaWNhdGlvbiBmb3IgUG9zdGdyZVNRTCANCg0K + +From pgsql-performance-owner@postgresql.org Thu Dec 2 03:56:50 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 597C83A562D + for ; + Thu, 2 Dec 2004 03:56:49 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82047-10 + for ; + Thu, 2 Dec 2004 03:56:42 +0000 (GMT) +Received: from 3times25.net (66-23-211-34.clients.speedfactory.net + [66.23.211.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BCCA3A4BB7 + for ; + Thu, 2 Dec 2004 03:56:44 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP id 121BE746B5 + for ; + Wed, 1 Dec 2004 22:56:44 -0500 (EST) +Message-ID: <41AE927C.408@3times25.net> +Date: Wed, 01 Dec 2004 22:56:44 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> +In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/44 +X-Sequence-Number: 9419 + +Merlin Moncure wrote: + +> For the budget or performance minded I'd suggest checking out SWT +> servers (http://www.swt.com) ...not sure what tier they fit into but +> they can get you into a quad Opteron for under 10k$ US, about half what +> you would pay for a comparable HP server (and Dell doesn't even offer +> Opteron). + +You can do the same with Monarch Computers. A 4u quad opteron. You can +also pay a lot more, depends on the configuration. They have a very +nice site for building a system as you want. + +-- +Until later, Geoffrey + +From pgsql-performance-owner@postgresql.org Thu Dec 2 06:18:14 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EC5E33A4BF2 + for ; + Thu, 2 Dec 2004 06:18:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 32414-02 + for ; + Thu, 2 Dec 2004 06:18:04 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 2984E3A56BF + for ; + Thu, 2 Dec 2004 06:18:04 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6733553; Wed, 01 Dec 2004 22:19:34 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Recommended Specs +Date: Wed, 1 Dec 2004 22:15:09 -0800 +User-Agent: KMail/1.6.2 +Cc: Hasnul Fadhly bin Hasan +References: <41AE5FBE.2010104@mimos.my> +In-Reply-To: <41AE5FBE.2010104@mimos.my> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412012215.09306.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/45 +X-Sequence-Number: 9420 + +Hasnul, + +> Hard disks - ?? how do i actually check how much space this records take +> on the hard drives? +> optimized queries is a must +> OS? linux? freebsd? solaris? +> cpu type? sun sparc? intel? amd? +> anything else? + +There have been treads discussing these as well. Work your way through the +archives. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Thu Dec 2 20:18:29 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 612983A5934 + for ; + Thu, 2 Dec 2004 20:18:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88799-08 + for ; + Thu, 2 Dec 2004 20:18:22 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 0E4173A58B1 + for ; + Thu, 2 Dec 2004 20:18:18 +0000 (GMT) +Received: from zaphod.profecta.se (zaphod.profecta.se [193.235.206.49]) + by www.postgresql.com (Postfix) with ESMTP id 2F36073B055 + for ; + Thu, 2 Dec 2004 07:35:45 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by zaphod.profecta.se (Postfix) with ESMTP + id B3937207; Thu, 2 Dec 2004 08:35:11 +0100 (CET) +Received: from pylver.localhost.nu. (ip050.noname4us.com [212.247.87.50]) + by zaphod.profecta.se (Postfix) with ESMTP + id 4EB71198; Thu, 2 Dec 2004 08:35:11 +0100 (CET) +Subject: Re: Alternatives to Dell? +From: Robin Ericsson +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +References: <200412011424.12137.josh@agliodbs.com> +Content-Type: text/plain +Organization: Profecta HB +Date: Thu, 02 Dec 2004 09:43:21 +0100 +Message-Id: <1101977001.11728.117.camel@pylver.localhost.nu.> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/74 +X-Sequence-Number: 9449 + +On Wed, 2004-12-01 at 14:24 -0800, Josh Berkus wrote: +> Folks, +> +> A lot of people have been having a devilish time with Dell hardware lately. +> It seems like the quality control just isn't there on the Dell servers. +> +> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> vendors for hardware; they won't home-build. For those people, what vendors +> do others on this list recommend? What have been your good/bad experiences? + + +We use a bunch of HP ProLiant DL360 and DL380 without any problems at +all. + + + +regards, + Robin + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:43:45 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EC7463A5815 + for ; + Thu, 2 Dec 2004 16:43:43 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10307-10 + for ; + Thu, 2 Dec 2004 16:43:25 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 410F13A5834 + for ; + Thu, 2 Dec 2004 16:41:45 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by www.postgresql.com (Postfix) with ESMTP id 6FDA973A125 + for ; + Thu, 2 Dec 2004 13:40:02 +0000 (GMT) +Received: from [2001:700:300:dc03:20e:cff:fe36:a766] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CZr8Q-0003Hr-9U + for pgsql-performance@postgresql.org; Thu, 02 Dec 2004 14:36:57 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CZr8D-0006tq-00 + for ; Thu, 02 Dec 2004 14:36:25 +0100 +Resent-From: sgunderson@bigfoot.com +Resent-Date: Thu, 2 Dec 2004 14:36:25 +0100 +Resent-Message-ID: <20041202133625.GB26501@uio.no> +Resent-To: pgsql-performance@postgresql.org +Date: Thu, 2 Dec 2004 11:59:45 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +Message-ID: <20041202105945.GC22208@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <200412011424.12137.josh@agliodbs.com> + <200412012225.iB1MP3T00619@candle.pha.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200412012225.iB1MP3T00619@candle.pha.pa.us> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/53 +X-Sequence-Number: 9428 + +On Wed, Dec 01, 2004 at 05:25:03PM -0500, Bruce Momjian wrote: +> I use Supermicro and have liked them. They make motherboards and systems. + +Many of their rack-based servers seem to be near-impossible to fit in a rack, +though. :-) (Many of their 4U servers are just desktop cases which you can +turn on their sides and apply an extra kit onto, and into the rack it goes... +after a lot of pain. :-) ) + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:45:23 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 034523A585E + for ; + Thu, 2 Dec 2004 16:45:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12473-03 + for ; + Thu, 2 Dec 2004 16:45:03 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 790883A5895 + for ; + Thu, 2 Dec 2004 16:41:49 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by www.postgresql.com (Postfix) with ESMTP id EB4EC739A02 + for ; + Thu, 2 Dec 2004 13:39:36 +0000 (GMT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CZr8H-0003Hw-Lf + for pgsql-performance@postgresql.org; Thu, 02 Dec 2004 14:36:29 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CZr8H-0006tt-00 + for ; Thu, 02 Dec 2004 14:36:29 +0100 +Resent-From: sgunderson@bigfoot.com +Resent-Date: Thu, 2 Dec 2004 14:36:29 +0100 +Resent-Message-ID: <20041202133629.GC26501@uio.no> +Resent-To: pgsql-performance@postgresql.org +Date: Thu, 2 Dec 2004 12:00:56 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +Message-ID: <20041202110056.GD22208@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/54 +X-Sequence-Number: 9429 + +On Wed, Dec 01, 2004 at 05:43:10PM -0500, Merlin Moncure wrote: +> Also, if choice of RAID controller is an option, I'd definitely suggest +> 3ware. They are cheap, have excellent linux support (including open +> source drivers) + +The drivers are open source, but the management tools are not. (This is quite +impractical for us running other distributions than Red Hat or SuSE, at least.) + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Thu Dec 2 18:38:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9565B3A5915 + for ; + Thu, 2 Dec 2004 18:38:32 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53219-06 + for ; + Thu, 2 Dec 2004 18:38:26 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 4985D3A581A + for ; + Thu, 2 Dec 2004 18:38:17 +0000 (GMT) +Received: from net2.micro-automation.com (net2.micro-automation.com + [64.7.141.29]) + by www.postgresql.com (Postfix) with SMTP id 1C7A573BC04 + for ; + Thu, 2 Dec 2004 12:07:28 +0000 (GMT) +Received: (qmail 31030 invoked from network); 2 Dec 2004 12:06:18 -0000 +Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) + by net2.micro-automation.com with SMTP; 2 Dec 2004 12:06:18 -0000 +Message-ID: <41AF0542.3000701@fastcrypt.com> +Date: Thu, 02 Dec 2004 07:06:26 -0500 +From: Dave Cramer +Reply-To: pg@fastcrypt.com +Organization: Postgres International +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Geoffrey +Cc: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> + <41AE927C.408@3times25.net> +In-Reply-To: <41AE927C.408@3times25.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/62 +X-Sequence-Number: 9437 + +Well, I've personally seen IBM's that were slower than Dell's, and +Dell's aren't particularly fast. + +I'm currently trying to find a name brand computer that is as fast as +something I could build myself. So far the HP looks like the fastest, +but still not as fast as a machine built from scratch +SuperMicro seems to be pretty good as Bruce mentioned. + +Dave + +Geoffrey wrote: + +> Merlin Moncure wrote: +> +>> For the budget or performance minded I'd suggest checking out SWT +>> servers (http://www.swt.com) ...not sure what tier they fit into but +>> they can get you into a quad Opteron for under 10k$ US, about half what +>> you would pay for a comparable HP server (and Dell doesn't even offer +>> Opteron). +> +> +> You can do the same with Monarch Computers. A 4u quad opteron. You +> can also pay a lot more, depends on the configuration. They have a +> very nice site for building a system as you want. +> + +-- +Dave Cramer +http://www.postgresintl.com +519 939 0336 +ICQ#14675561 + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:27:06 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4CCD33A57CE + for ; + Thu, 2 Dec 2004 16:27:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03445-06 + for ; + Thu, 2 Dec 2004 16:26:47 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id F3B623A581F + for ; + Thu, 2 Dec 2004 16:25:07 +0000 (GMT) +Received: from 3times25.net (duck.3times25.net [66.23.211.34]) + by www.postgresql.com (Postfix) with ESMTP id A1FE073B61B + for ; + Thu, 2 Dec 2004 13:13:19 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP id 762E5746B5 + for ; + Thu, 2 Dec 2004 08:12:52 -0500 (EST) +Message-ID: <41AF14D3.6040407@3times25.net> +Date: Thu, 02 Dec 2004 08:12:51 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <6EE64EF3AB31D5448D0007DD34EEB3412A754C@Herge.rcsinc.local> + <41AE927C.408@3times25.net> <41AF0542.3000701@fastcrypt.com> +In-Reply-To: <41AF0542.3000701@fastcrypt.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/49 +X-Sequence-Number: 9424 + +Dave Cramer wrote: +> Well, I've personally seen IBM's that were slower than Dell's, and +> Dell's aren't particularly fast. +> +> I'm currently trying to find a name brand computer that is as fast as +> something I could build myself. So far the HP looks like the fastest, +> but still not as fast as a machine built from scratch +> SuperMicro seems to be pretty good as Bruce mentioned. + +I've been very impressed with the Monarch machines. They are well +built, with good quality components. They are meticulously assembled, +with special care taken with cable routing and such. Very quiet +machines as well and that's not easy with AMD processors. + +These folks also specialize in Linux boxes and they preload Linux. You +won't find that with most of the large vendors. Plus, you can call and +actually talk to one of the folks who's actually building the box. It's +unlikely you'll get that kind of service from any of the big guys. + +As far as Dell is concerned, I've heard nothing but problems from other +folks using their boxes, both servers and desktops. My personal +experience reflects the same. + +-- +Until later, Geoffrey + +From pgsql-performance-owner@postgresql.org Thu Dec 2 14:38:23 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 41A2B3A4C7D + for ; + Thu, 2 Dec 2004 14:38:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61392-04 + for ; + Thu, 2 Dec 2004 14:38:14 +0000 (GMT) +Received: from web51305.mail.yahoo.com (web51305.mail.yahoo.com + [206.190.38.171]) + by svr1.postgresql.org (Postfix) with SMTP id 7D5873A573B + for ; + Thu, 2 Dec 2004 14:38:15 +0000 (GMT) +Received: (qmail 14228 invoked by uid 60001); 2 Dec 2004 14:38:16 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=Fk0JylXAScphLoF8SOAnk+SMWAZV+s3EV53WRcisgcrOE1wzoZfu77igpwyU+3tV5iKc2ApbUOlWZfWGQG7bB2eVxoqiPg/KO68ISySiRyPq/wG7v2JxbBD/BdJIWduZ0PCJ636h6CgaBuB5KvfvlPQLvneilQCOm4pqqZR/xqc= + ; +Message-ID: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +Received: from [65.218.182.242] by web51305.mail.yahoo.com via HTTP; + Thu, 02 Dec 2004 06:38:16 PST +Date: Thu, 2 Dec 2004 06:38:16 -0800 (PST) +From: sarlav kumar +Subject: pg replication tools? +To: pgsqlperform +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1985580427-1101998296=:13582" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.375 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/46 +X-Sequence-Number: 9421 + +--0-1985580427-1101998296=:13582 +Content-Type: text/plain; charset=us-ascii + +Hi all, + +Which is the best available PG replication tool in market now? + +>From searching on the internet, I found some resources on the following tools used for replication : + + + postgres �R + Usogres + eRServer/Rserv/Dbmirror + PgReplicator + Mammoth PostgreSQL Replicator + Slony-I + +Which one of these is a good option for replicating Postgres 7.3.2? + + + +Thanks again, + +Saranya + + +--------------------------------- +Do you Yahoo!? + Read only the mail you want - Yahoo! Mail SpamGuard. +--0-1985580427-1101998296=:13582 +Content-Type: text/html; charset=us-ascii + +
Hi all,
+
 
+
Which is the best available PG replication tool in market now?
+
 
+
From searching on the internet, I found some resources on the following tools used for replication :
+
 
+
    +
  • postgres �R 
  • +
  • Usogres
  • +
  • eRServer/Rserv/Dbmirror
  • +
  • PgReplicator
  • +
  • Mammoth PostgreSQL Replicator  
  • +
  • Slony-I
+

Which one of these is a good option for replicating Postgres 7.3.2?

+

 

+

Thanks again,

+

Saranya

+


Do you Yahoo!?
+Read only the mail you want - Yahoo! Mail SpamGuard. +--0-1985580427-1101998296=:13582-- + +From pgsql-performance-owner@postgresql.org Thu Dec 2 14:42:32 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F3153A5734 + for ; + Thu, 2 Dec 2004 14:42:30 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59505-08 + for ; + Thu, 2 Dec 2004 14:42:24 +0000 (GMT) +Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net + [24.249.201.67]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EF983A4C95 + for ; + Thu, 2 Dec 2004 14:42:25 +0000 (GMT) +Received: from [206.19.64.3] (account jconway HELO [172.16.1.115]) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 2370987; Thu, 02 Dec 2004 06:31:43 -0800 +Message-ID: <41AF29D2.9070208@joeconway.com> +Date: Thu, 02 Dec 2004 06:42:26 -0800 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20040921 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <200412011424.12137.josh@agliodbs.com> +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/47 +X-Sequence-Number: 9422 + +Josh Berkus wrote: +> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> vendors for hardware; they won't home-build. For those people, what vendors +> do others on this list recommend? What have been your good/bad experiences? + +I've had very good experiences with IBM hardware, and found their sales +and support to be responsive. + +Joe + +From pgsql-general-owner@postgresql.org Thu Dec 2 15:46:28 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 63EC73A5731 + for ; + Thu, 2 Dec 2004 15:46:25 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83237-08 + for ; + Thu, 2 Dec 2004 15:46:18 +0000 (GMT) +Received: from ecfrec.frec.bull.fr (ecfrec.frec.bull.fr [129.183.4.8]) + by svr1.postgresql.org (Postfix) with ESMTP id 485073A4C7D + for ; + Thu, 2 Dec 2004 15:46:16 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by ecfrec.frec.bull.fr (Postfix) with ESMTP + id 5C6C319D90A; Thu, 2 Dec 2004 16:46:13 +0100 (CET) +Received: from ecfrec.frec.bull.fr ([127.0.0.1]) + by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 01406-05; Thu, 2 Dec 2004 16:46:11 +0100 (CET) +Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6]) + by ecfrec.frec.bull.fr (Postfix) with ESMTP + id DE65519D908; Thu, 2 Dec 2004 16:46:10 +0100 (CET) +Received: from [129.183.101.115] ([129.183.101.115]) + by ecn002.frec.bull.fr (Lotus Domino Release 5.0.12) + with ESMTP id 2004120216532829:2840 ; Thu, 2 Dec 2004 16:53:28 +0100 +Message-ID: <41AF38C4.2000408@bull.net> +Date: Thu, 02 Dec 2004 16:46:12 +0100 +From: Thierry Missimilly +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; + rv:1.7.3) Gecko/20040910 +X-Accept-Language: fr, en +MIME-Version: 1.0 +To: grupos@carvalhaes.net +Cc: pgsql-general@postgresql.org +Subject: Re: pg_restore taking 4 hours! +References: <41ADA82A.7070405@carvalhaes.net> +In-Reply-To: <41ADA82A.7070405@carvalhaes.net> +X-MIMETrack: Itemize by SMTP Server on ECN002/FR/BULL(Release 5.0.12 |February + 13, 2003) at 02/12/2004 16:53:28, + Serialize by Router on ECN002/FR/BULL(Release 5.0.12 |February 13, + 2003) at 02/12/2004 16:53:30, + Serialize complete at 02/12/2004 16:53:30 +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +X-Virus-Scanned: by amavisd-new at frec.bull.fr +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/91 +X-Sequence-Number: 69703 + + +Rodrigo Carvalhaes a �crit : + +> Hi! +> +> I am using PostgreSQL with a proprietary ERP software in Brazil. The +> database have around 1.600 tables (each one with +/- 50 columns). +> My problem now is the time that takes to restore a dump. My customer +> database have arount 500mb (on the disk, not the dump file) and I am +> making the dump with pg_dump -Fc, my dumped file have 30mb. To make +> the dump, it's taking +/- 1,5 hours BUT to restore (using pg_restore ) +> it it takes 4 - 5 hours!!! + +I have notice that fac and one way to improve the restore prefomances, +is to avoid build indexes and checking the foreign key in the same step +than the restore. +So, as it is not possible to disable indexes and Foreign key, you have +to drop them and recreate them once the restore step has finished. To do +that you should have a script to recreate the indexes and the Foreign +Key afterward. + +> +> Our machine it's a Dell Server Power Edge 1600sc (Xeon 2,4Ghz, with +> 1GB memory, 7200 RPM disk). I don't think that there is a machine +> problem because it's a server dedicated for the database and the cpu +> utilization during the restore is around 30%. +> +> Looking on the lists arquives I found some messages about this and Tom +> Lane was saying that then you have a lot of convertions the dump can +> delay too much. 90% of the columns on my database are char columns and +> I don't have large objects on the database. The restore is delaying +> too much because the conversion of the char columns ? How can I have a +> better performance on this restore? +> +> I need to find a solution for this because I am convincing customers +> that are using SQL Server, DB2 and Oracle to change to PostgreSQL but +> this customers have databases of 5GB!!! I am thinking that even with a +> better server, the restore will take 2 days! +> +> My data: +> Conectiva Linux 10 , Kernel 2.6.8 +> PostgreSQL 7.4.6. +> +> postgresql.conf modified parameters (the other parameters are the +> default) +> tcpip_socket = true +> max_connections = 30 +> shared_buffers = 30000 +> sort_mem = 4096 vacuum_mem = 8192 +> max_fsm_pages = 20000 +> max_fsm_relations = 1000 +> +> Regards, +> +> Rodrigo Carvalhaes +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org +> + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:20:30 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 754933A5749 + for ; + Thu, 2 Dec 2004 16:07:34 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94400-05 + for ; + Thu, 2 Dec 2004 16:07:21 +0000 (GMT) +Received: from plab.ku.dk (plab.ku.dk [130.225.107.20]) + by svr1.postgresql.org (Postfix) with ESMTP id 6DE9C3A576A + for ; + Thu, 2 Dec 2004 16:07:20 +0000 (GMT) +Received: from plab.ku.dk (localhost [127.0.0.1]) + by plab.ku.dk (Postfix) with SMTP id 306A15A3C8 + for ; + Thu, 2 Dec 2004 17:07:18 +0100 (CET) +Received: by plab.ku.dk (Postfix, from userid 1003) + id B92D15A3C3; Thu, 2 Dec 2004 17:07:17 +0100 (CET) +Mime-version: 1.0 +Content-type: text/plain; charset="koi8-r" +Content-transfer-encoding: 8bit +Keywords: 2001334874 +X-Comment-To: Thomas Swan +To: pgsql-performance@postgresql.org +Subject: Re: VACUUM ANALYZE downgrades performance +References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> +From: Dmitry Karasik +In-Reply-To: Thomas Swan's message of "Tue, 30 Nov 2004 09:42:04 -0600" +Date: 02 Dec 2004 17:07:17 +0100 +Message-ID: <84wtw0d6q2.fsf@plab.ku.dk> +Lines: 39 +X-Mailer: Gnus v5.7/Emacs 20.7 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/48 +X-Sequence-Number: 9423 + + Hi Thomas! + + Thomas> Look at the ACTUAL TIME. It dropped from 0.029ms (using the index + Thomas> scan) to 0.009ms (using a sequential scan.) + + Thomas> Index scans are not always faster, and the planner/optimizer knows + Thomas> this. VACUUM ANALYZE is best run when a large proportion of data + Thomas> has been updated/loaded or in the off hours to refresh the + Thomas> statistics on large datasets. + +While I agree that generally this is true, look how stupid this +behavior looks in this particular case: A developer creates a table +and index, knowing that the table will be large and will be intensively +used. An admin runs 'VACUUM ANALYZE' when table is occasionally empty, +and next, say, 1 day, until another 'VACUUM ANALYZE' starts, the index +is simply not used! Sure you don't suppose to run 'VACUUM ANALYZE' every +5 minutes as a solution, right? + +I'm not sure if there's ever such thing like planner hints, such as, +"yes, we were switched from index back to seqscan, but this switch is +only valid until table has less than X records", but it sounds as a +reasonable solution. + +Well anyway, here's the scenario that cannot be fought neither by +SQL programming nor by administrative guidelines, at least as I see +it. And yes, I looked on the actual time, but somehow am not moved by +how fast postgresql can seqscan an empty table, really. I believe +there's something wrong if decisions based on a table when it is empty, +are suddenly applied when it is full. + +-- +Sincerely, + Dmitry Karasik + +--- +catpipe Systems ApS +*BSD solutions, consulting, development +www.catpipe.net ++45 7021 0050 + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:31:33 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A2313A581A + for ; + Thu, 2 Dec 2004 16:28:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05266-02 + for ; + Thu, 2 Dec 2004 16:28:38 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 09F503A57F4 + for ; + Thu, 2 Dec 2004 16:27:25 +0000 (GMT) +Received: from dyn-71-48.tor.dsl.tht.net (dyn-71-48.tor.dsl.tht.net + [134.22.71.48]) by tht.net (Postfix) with ESMTP + id E8D1A76A39; Thu, 2 Dec 2004 11:27:21 -0500 (EST) +Subject: Re: VACUUM ANALYZE downgrades performance +From: Rod Taylor +To: Dmitry Karasik +Cc: Postgresql Performance +In-Reply-To: <84wtw0d6q2.fsf@plab.ku.dk> +References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> + <84wtw0d6q2.fsf@plab.ku.dk> +Content-Type: text/plain +Date: Thu, 02 Dec 2004 11:25:18 -0500 +Message-Id: <1102004718.99116.220.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/50 +X-Sequence-Number: 9425 + +On Thu, 2004-12-02 at 17:07 +0100, Dmitry Karasik wrote: +> Hi Thomas! +> +> Thomas> Look at the ACTUAL TIME. It dropped from 0.029ms (using the index +> Thomas> scan) to 0.009ms (using a sequential scan.) +> +> Thomas> Index scans are not always faster, and the planner/optimizer knows +> Thomas> this. VACUUM ANALYZE is best run when a large proportion of data +> Thomas> has been updated/loaded or in the off hours to refresh the +> Thomas> statistics on large datasets. +> +> While I agree that generally this is true, look how stupid this +> behavior looks in this particular case: A developer creates a table +> and index, knowing that the table will be large and will be intensively +> used. An admin runs 'VACUUM ANALYZE' when table is occasionally empty, +> and next, say, 1 day, until another 'VACUUM ANALYZE' starts, the index +> is simply not used! Sure you don't suppose to run 'VACUUM ANALYZE' every +> 5 minutes as a solution, right? + +You might want to try this on the next 8.0 beta to come out, or against +CVS. Tom recently applied some changes which should mitigate this +situation. + +-- + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:33:14 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 49A733A5811 + for ; + Thu, 2 Dec 2004 16:33:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06344-08 + for ; + Thu, 2 Dec 2004 16:32:52 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id AB97B3A57FC + for ; + Thu, 2 Dec 2004 16:31:24 +0000 (GMT) +Received: from [2001:700:300:dc03:20e:cff:fe36:a766] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CZtr9-0005AN-FG + for pgsql-performance@postgresql.org; Thu, 02 Dec 2004 17:31:23 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CZtqu-0007wh-00 + for ; Thu, 02 Dec 2004 17:30:44 +0100 +Date: Thu, 2 Dec 2004 17:30:44 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: VACUUM ANALYZE downgrades performance +Message-ID: <20041202163044.GA30522@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> + <84wtw0d6q2.fsf@plab.ku.dk> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <84wtw0d6q2.fsf@plab.ku.dk> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/51 +X-Sequence-Number: 9426 + +On Thu, Dec 02, 2004 at 05:07:17PM +0100, Dmitry Karasik wrote: +> While I agree that generally this is true, look how stupid this +> behavior looks in this particular case: A developer creates a table +> and index, knowing that the table will be large and will be intensively +> used. An admin runs 'VACUUM ANALYZE' when table is occasionally empty, +> and next, say, 1 day, until another 'VACUUM ANALYZE' starts, the index +> is simply not used! Sure you don't suppose to run 'VACUUM ANALYZE' every +> 5 minutes as a solution, right? + +No, you run autovacuum, which automatically re-analyzes at approximately the +right time. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:38:55 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E2913A57FE + for ; + Thu, 2 Dec 2004 16:38:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09762-01 + for ; + Thu, 2 Dec 2004 16:38:34 +0000 (GMT) +Received: from velocity.dnsracks.com (unknown [69.93.167.170]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D5C13A57A2 + for ; + Thu, 2 Dec 2004 16:38:22 +0000 (GMT) +Received: from [203.199.147.2] (helo=ps0499.persistent.co.in) + by velocity.dnsracks.com with esmtpsa (TLSv1:RC4-MD5:128) (Exim 4.43) + id 1CZtyF-000690-8i; Thu, 02 Dec 2004 22:08:19 +0530 +From: Shridhar Daithankar +To: Dmitry Karasik +Subject: Re: VACUUM ANALYZE downgrades performance +Date: Thu, 2 Dec 2004 22:08:57 +0530 +User-Agent: KMail/1.7 +Cc: pgsql-performance@postgresql.org +References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> + <84wtw0d6q2.fsf@plab.ku.dk> +In-Reply-To: <84wtw0d6q2.fsf@plab.ku.dk> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="koi8-r" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200412022208.57760.ghodechhap@ghodechhap.net> +X-AntiAbuse: This header was added to track abuse, + please include it with any abuse report +X-AntiAbuse: Primary Hostname - velocity.dnsracks.com +X-AntiAbuse: Original Domain - postgresql.org +X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] +X-AntiAbuse: Sender Address Domain - ghodechhap.net +X-Source: +X-Source-Args: +X-Source-Dir: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/52 +X-Sequence-Number: 9427 + +On Thursday 02 Dec 2004 9:37 pm, Dmitry Karasik wrote: +> Hi Thomas! +> +> Thomas> Look at the ACTUAL TIME. It dropped from 0.029ms (using the index +> Thomas> scan) to 0.009ms (using a sequential scan.) +> +> Thomas> Index scans are not always faster, and the planner/optimizer knows +> Thomas> this. VACUUM ANALYZE is best run when a large proportion of data +> Thomas> has been updated/loaded or in the off hours to refresh the +> Thomas> statistics on large datasets. +> +> While I agree that generally this is true, look how stupid this +> behavior looks in this particular case: A developer creates a table +> and index, knowing that the table will be large and will be intensively +> used. An admin runs 'VACUUM ANALYZE' when table is occasionally empty, +> and next, say, 1 day, until another 'VACUUM ANALYZE' starts, the index +> is simply not used! Sure you don't suppose to run 'VACUUM ANALYZE' every +> 5 minutes as a solution, right? + +Why not? If the updates are frequent enough, that is *the* solution. + +But you could always use autovacuum daemon in most case. + +HTH + + Shridhar + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:50:02 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E57F3A57CC + for ; + Thu, 2 Dec 2004 16:50:01 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14003-06 + for ; + Thu, 2 Dec 2004 16:49:42 +0000 (GMT) +Received: from window.monsterlabs.com (window.monsterlabs.com + [216.183.105.176]) + by svr1.postgresql.org (Postfix) with SMTP id F08A93A5823 + for ; + Thu, 2 Dec 2004 16:47:25 +0000 (GMT) +Received: (qmail 30170 invoked from network); 2 Dec 2004 16:47:24 -0000 +Received: from pcp02680477pcs.nash01.tn.comcast.net (HELO ?192.168.0.100?) + (68.52.123.115) by 0 with SMTP; 2 Dec 2004 16:47:24 -0000 +In-Reply-To: <20041202105945.GC22208@uio.no> +References: <200412011424.12137.josh@agliodbs.com> + <200412012225.iB1MP3T00619@candle.pha.pa.us> + <20041202105945.GC22208@uio.no> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Thomas F.O'Connell +Subject: Re: Alternatives to Dell? +Date: Thu, 2 Dec 2004 10:47:22 -0600 +To: "Steinar H. Gunderson" +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/55 +X-Sequence-Number: 9430 + +I've been at companies where we've had good experiences with Penguin +Computing servers. + +http://www.penguincomputing.com/ + +I always evaluate their offerings when considering server purchases or +recommendations. + +-tfo + +-- +Thomas F. O'Connell +Co-Founder, Information Architect +Sitening, LLC +http://www.sitening.com/ +110 30th Avenue North, Suite 6 +Nashville, TN 37203-6320 +615-260-0005 + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 16:52:02 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 937BD3A5785 + for ; + Thu, 2 Dec 2004 16:52:01 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14044-10 + for ; + Thu, 2 Dec 2004 16:51:40 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id A51703A5831 + for ; + Thu, 2 Dec 2004 16:50:37 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB2GoaaW016857; Thu, 2 Dec 2004 08:50:36 -0800 +Message-ID: <41AF47BB.20903@commandprompt.com> +Date: Thu, 02 Dec 2004 08:50:03 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: sarlav kumar +Cc: pgsqlperform +Subject: Re: pg replication tools? +References: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +In-Reply-To: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +Content-Type: multipart/mixed; boundary="------------050802000400050504020701" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/56 +X-Sequence-Number: 9431 + +This is a multi-part message in MIME format. +--------------050802000400050504020701 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +sarlav kumar wrote: + +> Hi all, +> +> Which is the best available PG replication tool in market now? + +There is no "best", there is only best for your situation. The two +most supported are: + + +> * Mammoth PostgreSQL Replicator +> * Slony-I +> +> Which one of these is a good option for replicating Postgres 7.3.2? +> + +Mammoth PostgreSQL Replicator will automatically upgrade you to 7.3.8 +which you should be running anyway. + +I believe Slony will work with 7.3.2. + +Sincerely, + +Joshua D. Drake + + + +> +> +> Thanks again, +> +> Saranya +> +> ------------------------------------------------------------------------ +> Do you Yahoo!? +> Read only the mail you want - Yahoo! Mail SpamGuard +> . + + + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------050802000400050504020701 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------050802000400050504020701-- + +From pgsql-general-owner@postgresql.org Thu Dec 2 16:54:17 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2114D3A57EC + for ; + Thu, 2 Dec 2004 16:54:16 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15614-07 + for ; + Thu, 2 Dec 2004 16:53:58 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 5CF5F3A57CE + for ; + Thu, 2 Dec 2004 16:53:58 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB2GrXaW017508; Thu, 2 Dec 2004 08:53:33 -0800 +Message-ID: <41AF486C.8090706@commandprompt.com> +Date: Thu, 02 Dec 2004 08:53:00 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Thierry Missimilly +Cc: grupos@carvalhaes.net, pgsql-general@postgresql.org +Subject: Re: pg_restore taking 4 hours! +References: <41ADA82A.7070405@carvalhaes.net> <41AF38C4.2000408@bull.net> +In-Reply-To: <41AF38C4.2000408@bull.net> +Content-Type: multipart/mixed; boundary="------------070108070509070802090807" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/104 +X-Sequence-Number: 69716 + +This is a multi-part message in MIME format. +--------------070108070509070802090807 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit + +Thierry Missimilly wrote: + +> +> Rodrigo Carvalhaes a �crit : +> +>> Hi! +>> +>> I am using PostgreSQL with a proprietary ERP software in Brazil. The +>> database have around 1.600 tables (each one with +/- 50 columns). +>> My problem now is the time that takes to restore a dump. My customer +>> database have arount 500mb (on the disk, not the dump file) and I am +>> making the dump with pg_dump -Fc, my dumped file have 30mb. To make +>> the dump, it's taking +/- 1,5 hours BUT to restore (using pg_restore +>> ) it it takes 4 - 5 hours!!! +> +> +> I have notice that fac and one way to improve the restore prefomances, +> is to avoid build indexes and checking the foreign key in the same +> step than the restore. +> So, as it is not possible to disable indexes and Foreign key, you have +> to drop them and recreate them once the restore step has finished. To +> do that you should have a script to recreate the indexes and the +> Foreign Key afterward. +> +There are a couple of things you can do. + +1. Turn off Fsync for the restore +2. Restore in three phases: + + 1. Schema without constraints or indexes + 2. Restore data + 3. Apply rest of schema with constraints and indexes + +3. Increase the number of transaction logs. + +Sincerely, + +Joshua D. Drake + + + + + +>> +>> Our machine it's a Dell Server Power Edge 1600sc (Xeon 2,4Ghz, with +>> 1GB memory, 7200 RPM disk). I don't think that there is a machine +>> problem because it's a server dedicated for the database and the cpu +>> utilization during the restore is around 30%. +>> +>> Looking on the lists arquives I found some messages about this and +>> Tom Lane was saying that then you have a lot of convertions the dump +>> can delay too much. 90% of the columns on my database are char +>> columns and I don't have large objects on the database. The restore +>> is delaying too much because the conversion of the char columns ? How +>> can I have a better performance on this restore? +>> +>> I need to find a solution for this because I am convincing customers +>> that are using SQL Server, DB2 and Oracle to change to PostgreSQL but +>> this customers have databases of 5GB!!! I am thinking that even with +>> a better server, the restore will take 2 days! +>> +>> My data: +>> Conectiva Linux 10 , Kernel 2.6.8 +>> PostgreSQL 7.4.6. +>> +>> postgresql.conf modified parameters (the other parameters are the +>> default) +>> tcpip_socket = true +>> max_connections = 30 +>> shared_buffers = 30000 +>> sort_mem = 4096 vacuum_mem = 8192 +>> max_fsm_pages = 20000 +>> max_fsm_relations = 1000 +>> +>> Regards, +>> +>> Rodrigo Carvalhaes +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 6: Have you searched our list archives? +>> +>> http://archives.postgresql.org +>> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: Have you searched our list archives? +> +> http://archives.postgresql.org + + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------070108070509070802090807 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------070108070509070802090807-- + +From pgsql-performance-owner@postgresql.org Thu Dec 2 17:01:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43CA53A5740 + for ; + Thu, 2 Dec 2004 17:01:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18167-09 + for ; + Thu, 2 Dec 2004 17:01:10 +0000 (GMT) +Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) + by svr1.postgresql.org (Postfix) with SMTP id 1C56A3A58CD + for ; + Thu, 2 Dec 2004 16:58:49 +0000 (GMT) +Received: (qmail 1906 invoked from network); 2 Dec 2004 18:04:22 -0000 +Received: from dbitech.wavefire.com (HELO ?64.141.15.253?) + (darcy@64.141.15.253) + by radius.wavefire.com with SMTP; 2 Dec 2004 18:04:22 -0000 +From: Darcy Buskermolen +Organization: Wavefire Technologies Corp. +To: sarlav kumar +Subject: Re: pg replication tools? +Date: Thu, 2 Dec 2004 08:58:47 -0800 +User-Agent: KMail/1.6.2 +Cc: pgsqlperform +References: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +In-Reply-To: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412020858.47263.darcy@wavefire.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/57 +X-Sequence-Number: 9432 + +On December 2, 2004 06:38 am, sarlav kumar wrote: +> Hi all, +> +> Which is the best available PG replication tool in market now? +> +> From searching on the internet, I found some resources on the following +> tools used for replication : +> +> +> postgres =96R +> Usogres +> eRServer/Rserv/Dbmirror +> PgReplicator +> Mammoth PostgreSQL Replicator +> Slony-I +> +> Which one of these is a good option for replicating Postgres 7.3.2? + +What are your needs in a replication solution? for example, do you need to = +be=20 +able to replicate a running install with out needing to initdb, do you want= +=20 +to be able to replicate across versions; do you require sync or will async= +=20 +work, etc.. + +> +> +> +> Thanks again, +> +> Saranya +> +> +> --------------------------------- +> Do you Yahoo!? +> Read only the mail you want - Yahoo! Mail SpamGuard. + +=2D-=20 +Darcy Buskermolen +Wavefire Technologies Corp. +ph: 250.717.0200 +fx: 250.763.1759 +http://www.wavefire.com + +From pgsql-performance-owner@postgresql.org Thu Dec 2 17:06:17 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 572573A5776 + for ; + Thu, 2 Dec 2004 17:06:16 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20343-10 + for ; + Thu, 2 Dec 2004 17:05:59 +0000 (GMT) +Received: from mail.atua.com.br (unknown [200.248.138.61]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AEFB3A57E5 + for ; + Thu, 2 Dec 2004 17:05:58 +0000 (GMT) +Received: from [10.0.0.171] (ns2.atua.com.br [200.248.138.60]) + by mail.atua.com.br (Postfix) with ESMTP id 368701EC3AA + for ; + Thu, 2 Dec 2004 15:05:56 -0200 (BRST) +Subject: Normalization or Performance +From: Alvaro Nunes Melo +To: Pgsql-Performance +Content-Type: text/plain +Message-Id: <1102007155.23943.61.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Thu, 02 Dec 2004 15:05:55 -0200 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/58 +X-Sequence-Number: 9433 + +Hi, + +Before writing this mail, I'd researched a little about this topic, and +got some opinions from guys like Fabien Pascal, who argues that logical +design should be separated from physical design, and other sources. As +this is not fact, I'm writing to you guys, that make things work in real +world. + +We started our first big (for our company standards) project always +thinking in normalization. But once we imported legacy data into the DB, +things got harder. + +One example is the clients status. A client might be active, inactive or +pending (for many reasons). We store all the status a client have since +it is in the system. To check what is the actual status of a client, we +get the last status from this historical status table. This take a +considerable time, so our best results were achieved building a +function that checks the status and indexing this function. The problem +is that indexed functions mus bu immutable, so as you can figure, if the +status change after the creation of the index, the retunr of the +function is still the same. + +What do you suggest for situations like this? Should I add a field to +clients table and store its actual status, keep storing data in the +historical table an control its changes with a trigger? + +There are other situations that are making things difficult to us. For +example, one query must return the total amount a client bought in the +last 90 days. It's taking too long, when we must know it for many +clients, many times. So should I create summarization tables to store +this kind of stuff, update it with a trigger in daily basis (for +example), and solve this problem with one join? + +Our database is not that big. The larger table has about 7.000.000 rows. +About 50.000 clients, half of them active. All that I'd point out above +uses indexes for queries, etc. But even with this it's not been fast +enough. We have a Dell server for this (I know, the Dell issue), a Dual +Xeon 2.8, SCSI HD, 1 GB mem. Do we need better hardware for our system? + +-- ++---------------------------------------------------+ +| Alvaro Nunes Melo Atua Sistemas de Informacao | +| al_nunes@atua.com.br www.atua.com.br | +| UIN - 42722678 (54) 327-1044 | ++---------------------------------------------------+ + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 17:18:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9DA553A58A4 + for ; + Thu, 2 Dec 2004 17:18:26 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25709-07 + for ; + Thu, 2 Dec 2004 17:18:08 +0000 (GMT) +Received: from vsmtp1.tin.it (vsmtp1.tin.it [212.216.176.141]) + by svr1.postgresql.org (Postfix) with ESMTP id 5ADCD3A582D + for ; + Thu, 2 Dec 2004 17:16:36 +0000 (GMT) +Received: from angus.tin.it (82.51.70.45) by vsmtp1.tin.it (7.0.027) + id 41A37E5C003AE9A3 for pgsql-performance@postgresql.org; + Thu, 2 Dec 2004 18:16:34 +0100 +Message-Id: <6.1.2.0.2.20041202181157.03c21d10@box.tin.it> +X-Sender: angusgb@box.tin.it (Unverified) +X-Mailer: QUALCOMM Windows Eudora Version 6.1.2.0 +Date: Thu, 02 Dec 2004 18:16:31 +0100 +To: pgsql-performance@postgresql.org +From: Gabriele Bartolini +Subject: Different location or different instance +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed; + x-avg-checked=avg-ok-2FE7315D +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, + hits=1.376 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200412/59 +X-Sequence-Number: 9434 + +Hi guys, + + I have 2 big databases on the same system. They are logically not +connected, separate. + + I want to keep them separate. Do you think it is better to use the same +PostgreSQL server using a different location (on different disks) for each +one of them, or a separate PostgreSQL server for each of them, listening to +different ports and with data dirs residing on two different disks? + + I have a dual Pentium 4 1Ghz with 1.5 GB RAM and 6 36GB SCSI disks (160 +Ultra) on a 3 RAID 1 pairs configuration. + + Thank you (sorry I am in a hurry and did not have time to look properly +in the mailing list archive - please forgive me). + +Ciao, +-Gabriele +-- +Gabriele Bartolini: Web Programmer, ht://Dig & IWA/HWG Member, ht://Check +maintainer +Current Location: Prato, Toscana, Italia +angusgb@tin.it | http://www.prato.linux.it/~gbartolini | ICQ#129221447 + > "Leave every hope, ye who enter!", Dante Alighieri, Divine Comedy, The +Inferno + + +-- +No virus found in this outgoing message. +Checked by AVG Anti-Virus. +Version: 7.0.289 / Virus Database: 265.4.3 - Release Date: 26/11/2004 + + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 17:58:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 34DA83A581B + for ; + Thu, 2 Dec 2004 17:58:26 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 38343-10 + for ; + Thu, 2 Dec 2004 17:58:21 +0000 (GMT) +Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) + by svr1.postgresql.org (Postfix) with ESMTP id 29E463A5800 + for ; + Thu, 2 Dec 2004 17:58:21 +0000 (GMT) +Received: from leibniz.catalyst.net.nz ([202.49.159.7] + helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with asmtp + (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) + id 1CZvDc-0001Bf-8e; Fri, 03 Dec 2004 06:58:16 +1300 +Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) + by lamb.mcmillan.net.nz (Postfix) with ESMTP id 0A612AD98588; + Fri, 3 Dec 2004 06:58:16 +1300 (NZDT) +Subject: Re: pg_restore taking 4 hours! +From: Andrew McMillan +To: grupos@carvalhaes.net +Cc: pgsql-performance@postgresql.org +In-Reply-To: <41ADA82A.7070405@carvalhaes.net> +References: <41ADA82A.7070405@carvalhaes.net> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-KTKbSKVDNPY56RbXwJLa" +Date: Fri, 03 Dec 2004 06:58:15 +1300 +Message-Id: <1102010295.16058.271.camel@lamb.mcmillan.net.nz> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/60 +X-Sequence-Number: 9435 + + +--=-KTKbSKVDNPY56RbXwJLa +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Wed, 2004-12-01 at 09:16 -0200, Rodrigo Carvalhaes wrote: +>=20 +> I am using PostgreSQL with a proprietary ERP software in Brazil. The=20 +> database have around 1.600 tables (each one with +/- 50 columns). + +... + +> max_fsm_pages =3D 20000 +> max_fsm_relations =3D 1000 + +Hi, + +I doubt that this will improve your pg_restore performance, but if you +have 1600 tables in the database then you very likely want to increase +the above two settings. + +In general max_fsm_relations should be more than the total number of +tables across all databases in a given installation. The best way to +set these is to do a "VACUUM VERBOSE", which will print the appropriate +minimum numbers at the end of the run, along with the current setting. + +Cheers, + Andrew. + +------------------------------------------------------------------------- +Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington +WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St +DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 + Never trust a computer you can't repair yourself. +------------------------------------------------------------------------- + + +--=-KTKbSKVDNPY56RbXwJLa +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) + +iD8DBQBBr1e3jJA0f48GgBIRAiq9AJ9NJA5X1owQanYDLknTLzIsIK6hMQCdGYks +Zs2drMLOi5ncwJK6g9FEl2U= +=8mf8 +-----END PGP SIGNATURE----- + +--=-KTKbSKVDNPY56RbXwJLa-- + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 18:35:14 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E7D903A57E9 + for ; + Thu, 2 Dec 2004 18:35:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51034-06 + for ; + Thu, 2 Dec 2004 18:35:02 +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 2D54A3A57CE + for ; + Thu, 2 Dec 2004 18:35:02 +0000 (GMT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) + id 1CZvn3-0008w0-43; Thu, 02 Dec 2004 18:34:54 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id A3CE115A09; Thu, 2 Dec 2004 18:34:57 +0000 (GMT) +Message-ID: <41AF6050.9030302@archonet.com> +Date: Thu, 02 Dec 2004 18:34:56 +0000 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Alvaro Nunes Melo +Cc: Pgsql-Performance +Subject: Re: Normalization or Performance +References: <1102007155.23943.61.camel@localhost> +In-Reply-To: <1102007155.23943.61.camel@localhost> +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.139 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/61 +X-Sequence-Number: 9436 + +Alvaro Nunes Melo wrote: +> Hi, +> +> Before writing this mail, I'd researched a little about this topic, +> and got some opinions from guys like Fabien Pascal, who argues that +> logical design should be separated from physical design, and other +> sources. As this is not fact, I'm writing to you guys, that make +> things work in real world. + +I believe he's right. Or at least that you should only compromise your +logical design once it becomes absolutely necessary due to physical +limitations. + +> We started our first big (for our company standards) project always +> thinking in normalization. But once we imported legacy data into the +> DB, things got harder. +> +> One example is the clients status. A client might be active, inactive +> or pending (for many reasons). We store all the status a client have +> since it is in the system. To check what is the actual status of a +> client, we get the last status from this historical status table. +> This take a considerable time, so our best results were achieved +> building a function that checks the status and indexing this +> function. The problem is that indexed functions mus bu immutable, so +> as you can figure, if the status change after the creation of the +> index, the retunr of the function is still the same. +> +> What do you suggest for situations like this? Should I add a field to +> clients table and store its actual status, keep storing data in the +> historical table an control its changes with a trigger? + +Trigger + history table is a common solution, it's easy to implement and +there's nothing non-relational about it as a solution. + +> There are other situations that are making things difficult to us. +> For example, one query must return the total amount a client bought +> in the last 90 days. It's taking too long, when we must know it for +> many clients, many times. So should I create summarization tables to +> store this kind of stuff, update it with a trigger in daily basis +> (for example), and solve this problem with one join? + +One solution I use for this sort of thing is a summary table grouped by +date, and accurate until the start of today. Then, I check the summary +table and the "live" table for todays information and sum those. + +> Our database is not that big. The larger table has about 7.000.000 +> rows. About 50.000 clients, half of them active. All that I'd point +> out above uses indexes for queries, etc. But even with this it's not +> been fast enough. We have a Dell server for this (I know, the Dell +> issue), a Dual Xeon 2.8, SCSI HD, 1 GB mem. Do we need better +> hardware for our system? + +Swap one of your processors for more RAM and disks, perhaps. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Thu Dec 2 18:40:46 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E2DA63A5875 + for ; + Thu, 2 Dec 2004 18:40:44 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56012-01 + for ; + Thu, 2 Dec 2004 18:40:33 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D7213A58B4 + for ; + Thu, 2 Dec 2004 18:40:33 +0000 (GMT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Alternatives to Dell? +X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 +Date: Thu, 2 Dec 2004 13:39:32 -0500 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A754E@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Alternatives to Dell? +thread-index: AcTYjop34lLJePMISbqFLZ9+8DF/iQAD0t5g +From: "Merlin Moncure" +To: "Steinar H. Gunderson" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/63 +X-Sequence-Number: 9438 + +> On Wed, Dec 01, 2004 at 05:43:10PM -0500, Merlin Moncure wrote: +> > Also, if choice of RAID controller is an option, I'd definitely +suggest +> > 3ware. They are cheap, have excellent linux support (including open +> > source drivers) +>=20 +> The drivers are open source, but the management tools are not. (This +is +> quite +> impractical for us running other distributions than Red Hat or SuSE, +at +> least.) + +Ah, good point. FWIW, 3ware also supports FreeBSD. It is hard to +understand why they don't open source their utilities... + +Merlin + +From pgsql-performance-owner@postgresql.org Thu Dec 2 19:12:01 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 30ADE3A3E70 + for ; + Thu, 2 Dec 2004 19:12:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 63176-09 + for ; + Thu, 2 Dec 2004 19:11:51 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id D359B3A5877 + for ; + Thu, 2 Dec 2004 19:11:52 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP id 67ADE56558 + for ; + Thu, 2 Dec 2004 14:11:43 -0500 (EST) +Message-ID: <41AF68F2.1050206@deg.cc> +Date: Thu, 02 Dec 2004 14:11:46 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Poor Performance on a table +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/64 +X-Sequence-Number: 9439 + +Hi , + + I have a table in my production database which has 500k rows and +from the pg_class it shows the number of "relpages" of +around 750K for this table, the same table copied to a test database +shows "relpages" as 35k. I run vacuumdb on the whole +database (not on the table individually but the whole database) daily. +I think because of this most of queries are slowing down which used to +run much faster before. + Is there any way to fix this problem ? + +Thanks! +Pallav + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 19:19:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 784EA3A54F0 + for ; + Thu, 2 Dec 2004 19:19:47 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66246-05 + for ; + Thu, 2 Dec 2004 19:19:40 +0000 (GMT) +Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C5B33A3F05 + for ; + Thu, 2 Dec 2004 19:19:40 +0000 (GMT) +Received: from kungfu (frank.wiles.org [24.124.39.75]) + by frank.wiles.org (8.12.11/8.12.11) with SMTP id iB2KO54K004721; + Thu, 2 Dec 2004 14:24:05 -0600 +Date: Thu, 2 Dec 2004 13:20:14 -0600 +From: Frank Wiles +To: Pallav Kalva +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +Message-Id: <20041202132014.27456058.frank@wiles.org> +In-Reply-To: <41AF68F2.1050206@deg.cc> +References: <41AF68F2.1050206@deg.cc> +X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i386-redhat-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/65 +X-Sequence-Number: 9440 + +On Thu, 02 Dec 2004 14:11:46 -0500 +Pallav Kalva wrote: + +> Hi , +> +> I have a table in my production database which has 500k rows and +> from the pg_class it shows the number of "relpages" of +> around 750K for this table, the same table copied to a test database +> shows "relpages" as 35k. I run vacuumdb on the whole +> database (not on the table individually but the whole database) daily. +> +> I think because of this most of queries are slowing down which used to +> +> run much faster before. +> Is there any way to fix this problem ? + + Try a VACUUM FULL, this will clean up unused space. You might also + want to adjust your free space map so that you don't have to do FULL + vacuums as often ( or at all ). It is controlled by max_fsm_pages + and max_fsm_relations. + + --------------------------------- + Frank Wiles + http://www.wiles.org + --------------------------------- + + +From pgsql-hackers-win32-owner@postgresql.org Thu Dec 2 19:22:05 2004 +X-Original-To: pgsql-hackers-win32-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 032203A586A; + Thu, 2 Dec 2004 19:22:03 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66652-08; Thu, 2 Dec 2004 19:21:54 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id F39143A5848; + Thu, 2 Dec 2004 19:21:54 +0000 (GMT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: [PERFORM] scalability issues on win32 +X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 +Date: Thu, 2 Dec 2004 14:21:53 -0500 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A754F@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] [pgsql-hackers-win32] scalability issues on win32 +thread-index: AcTRBeAbNzp8hwlNRw2Aje7H/8x+CQAQS1aAAdbDhsA= +From: "Merlin Moncure" +To: "Dave Page" +Cc: , "Tom Lane" , + "Magnus Hagander" , + "Win 32 hackers PGSQL" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/3 +X-Sequence-Number: 2514 + +> > This was an intersting Win32/linux comparison. I expected +> > Linux to scale better, but I was surprised how poorly XP +> > scaled. It reinforces our perception that Win32 is for low +> > traffic servers. +>=20 +> That's a bit harsh given the lack of any further investigation so far +> isn't it? Win32 can run perfectly well with other DBMSs with hundreds +of +> users. +>=20 +> Any chance you can profile your test runs Merlin? +>=20 + +Ok, I am starting to strongly suspect the statistics collector of +various kinds of malfeasance. Right now I am running with the stats +collector off and I am getting much better scalability and much more +deterministic query times...that is, even when under moderate to heavy +load query running times are proportional to the number of users on the +system...the system is purring like a kitten right now with over a 100 +users logged in. + +This coupled with the fact that I was getting random restarts with the +collector process makes me think that there is some kind of issue with +the ipc between the collector and the backends that is blocking and/or +is being improperly handled after failure. + +I was running with statement level stats on under scenarios with +extremely high levels of query activity where the server might be +processing 500-1500 queries/second or more spread out over multiple +backends. + +I'll look into this issue more over next several days. I'll dip back +into the code and see if I can come up with a better +answer...unfortunately I can't run the stats collector on until I can +schedule another load test. + +Merlin + +From pgsql-hackers-win32-owner@postgresql.org Thu Dec 2 19:29:06 2004 +X-Original-To: pgsql-hackers-win32-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C79543A591E; + Thu, 2 Dec 2004 19:29:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71127-07; Thu, 2 Dec 2004 19:28:56 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id C318B3A58F8; + Thu, 2 Dec 2004 19:28:26 +0000 (GMT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id iB2JSHo09487; + Thu, 2 Dec 2004 14:28:17 -0500 (EST) +From: Bruce Momjian +Message-Id: <200412021928.iB2JSHo09487@candle.pha.pa.us> +Subject: Re: [PERFORM] scalability issues on win32 +In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A754F@Herge.rcsinc.local> +To: Merlin Moncure +Date: Thu, 2 Dec 2004 14:28:17 -0500 (EST) +Cc: Dave Page , + pgsql-performance@postgresql.org, Tom Lane , + Magnus Hagander , + Win 32 hackers PGSQL +X-Mailer: ELM [version 2.4ME+ PL108 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/4 +X-Sequence-Number: 2515 + +Merlin Moncure wrote: +> > > This was an intersting Win32/linux comparison. I expected +> > > Linux to scale better, but I was surprised how poorly XP +> > > scaled. It reinforces our perception that Win32 is for low +> > > traffic servers. +> > +> > That's a bit harsh given the lack of any further investigation so far +> > isn't it? Win32 can run perfectly well with other DBMSs with hundreds +> of +> > users. +> > +> > Any chance you can profile your test runs Merlin? +> > +> +> Ok, I am starting to strongly suspect the statistics collector of +> various kinds of malfeasance. Right now I am running with the stats +> collector off and I am getting much better scalability and much more +> deterministic query times...that is, even when under moderate to heavy +> load query running times are proportional to the number of users on the +> system...the system is purring like a kitten right now with over a 100 +> users logged in. +> +> This coupled with the fact that I was getting random restarts with the +> collector process makes me think that there is some kind of issue with +> the ipc between the collector and the backends that is blocking and/or +> is being improperly handled after failure. +> +> I was running with statement level stats on under scenarios with +> extremely high levels of query activity where the server might be +> processing 500-1500 queries/second or more spread out over multiple +> backends. +> +> I'll look into this issue more over next several days. I'll dip back +> into the code and see if I can come up with a better +> answer...unfortunately I can't run the stats collector on until I can +> schedule another load test. + +OK, the big problem is that we are nearing RC1. We would like some +feedback on this as soon as possible. A major Win32 cleanup for this +could delay the 8.0 release. + +-- + 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 Dec 2 19:33:31 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D61613A58B1 + for ; + Thu, 2 Dec 2004 19:33:06 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72805-04 + for ; + Thu, 2 Dec 2004 19:32:55 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DC773A58CC + for ; + Thu, 2 Dec 2004 19:32:55 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id 64A1856558; Thu, 2 Dec 2004 14:32:50 -0500 (EST) +Message-ID: <41AF6DE5.8020301@deg.cc> +Date: Thu, 02 Dec 2004 14:32:53 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Frank Wiles +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +References: <41AF68F2.1050206@deg.cc> + <20041202132014.27456058.frank@wiles.org> +In-Reply-To: <20041202132014.27456058.frank@wiles.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/68 +X-Sequence-Number: 9443 + +Hi Frank, + + Thanks! for the quick reply, here are my current default fsm setting . + max_fsm_pages = 20000 and max_fsm_relations = 1000 + What are the appropriates settings for these parameters ? are there +any guidlines ? postgres docs doesnt give much information on setting +these values. + +Thanks! +Pallav + +Frank Wiles wrote: + +>On Thu, 02 Dec 2004 14:11:46 -0500 +>Pallav Kalva wrote: +> +> +> +>>Hi , +>> +>> I have a table in my production database which has 500k rows and +>>from the pg_class it shows the number of "relpages" of +>>around 750K for this table, the same table copied to a test database +>>shows "relpages" as 35k. I run vacuumdb on the whole +>>database (not on the table individually but the whole database) daily. +>> +>>I think because of this most of queries are slowing down which used to +>> +>>run much faster before. +>> Is there any way to fix this problem ? +>> +>> +> +> Try a VACUUM FULL, this will clean up unused space. You might also +> want to adjust your free space map so that you don't have to do FULL +> vacuums as often ( or at all ). It is controlled by max_fsm_pages +> and max_fsm_relations. +> +> --------------------------------- +> Frank Wiles +> http://www.wiles.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 Thu Dec 2 19:37:18 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1C5083A5452 + for ; + Thu, 2 Dec 2004 19:37:16 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72724-08 + for ; + Thu, 2 Dec 2004 19:37:00 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id C6CAC3A54F8 + for ; + Thu, 2 Dec 2004 19:37:01 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB2JaxSU029228; + Thu, 2 Dec 2004 14:36:59 -0500 (EST) +To: Pallav Kalva +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +In-reply-to: <41AF68F2.1050206@deg.cc> +References: <41AF68F2.1050206@deg.cc> +Comments: In-reply-to Pallav Kalva + message dated "Thu, 02 Dec 2004 14:11:46 -0500" +Date: Thu, 02 Dec 2004 14:36:59 -0500 +Message-ID: <29227.1102016219@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/69 +X-Sequence-Number: 9444 + +Pallav Kalva writes: +> I have a table in my production database which has 500k rows and +> from the pg_class it shows the number of "relpages" of +> around 750K for this table, the same table copied to a test database +> shows "relpages" as 35k. I run vacuumdb on the whole +> database (not on the table individually but the whole database) daily. + +You're obviously suffering serious table bloat :-(. Depending on how +heavy the update traffic on that table is, it might be that once-a-day +vacuum is simply not often enough. Another likely problem is that you +need to increase the FSM settings (how big is your whole database?) + +> Is there any way to fix this problem ? + +VACUUM FULL will fix the immediate problem. You might well find CLUSTER +to be a faster alternative, though. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 2 19:37:46 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8FD8D3A5848 + for ; + Thu, 2 Dec 2004 19:37:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73932-05 + for ; + Thu, 2 Dec 2004 19:37:33 +0000 (GMT) +Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) + by svr1.postgresql.org (Postfix) with ESMTP id AA9333A584F + for ; + Thu, 2 Dec 2004 19:37:34 +0000 (GMT) +Received: from kungfu (frank.wiles.org [24.124.39.75]) + by frank.wiles.org (8.12.11/8.12.11) with SMTP id iB2Kg0pH004760; + Thu, 2 Dec 2004 14:42:00 -0600 +Date: Thu, 2 Dec 2004 13:38:09 -0600 +From: Frank Wiles +To: Pallav Kalva +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +Message-Id: <20041202133809.20af3079.frank@wiles.org> +In-Reply-To: <41AF6DE5.8020301@deg.cc> +References: <41AF68F2.1050206@deg.cc> + <20041202132014.27456058.frank@wiles.org> + <41AF6DE5.8020301@deg.cc> +X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i386-redhat-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/70 +X-Sequence-Number: 9445 + +On Thu, 02 Dec 2004 14:32:53 -0500 +Pallav Kalva wrote: + +> Hi Frank, +> +> Thanks! for the quick reply, here are my current default fsm +> setting . +> max_fsm_pages = 20000 and max_fsm_relations = 1000 +> What are the appropriates settings for these parameters ? are there +> +> any guidlines ? postgres docs doesnt give much information on setting +> these values. + + There really aren't any guidelines on these because it really depends + on your data and how you use the database. If you insert/update 99% + of the time and only delete 1% of the time, the defaults are probably + perfect for you. Probably up to a 80% insert/update, 20% delete + ratio. + + If however you're constantly deleting entries from your database, I + would suggest slowly raising those values in step with each other + over the course a few weeks and see where you're at. It is really + a matter of trial an error. + + With my databases, I can afford to do VACUUM FULLs fairly often + so I typically don't need to increase my fsm values. + + --------------------------------- + Frank Wiles + http://www.wiles.org + --------------------------------- + + +From pgsql-hackers-win32-owner@postgresql.org Thu Dec 2 19:42:43 2004 +X-Original-To: pgsql-hackers-win32-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EFA03A584F; + Thu, 2 Dec 2004 19:42:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75302-08; Thu, 2 Dec 2004 19:42:37 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9450C3A5875; + Thu, 2 Dec 2004 19:42:38 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB2Jgb7Y029327; + Thu, 2 Dec 2004 14:42:38 -0500 (EST) +To: Bruce Momjian +Cc: Merlin Moncure , + Dave Page , pgsql-performance@postgresql.org, + Magnus Hagander , + Win 32 hackers PGSQL +Subject: Re: [PERFORM] scalability issues on win32 +In-reply-to: <200412021928.iB2JSHo09487@candle.pha.pa.us> +References: <200412021928.iB2JSHo09487@candle.pha.pa.us> +Comments: In-reply-to Bruce Momjian + message dated "Thu, 02 Dec 2004 14:28:17 -0500" +Date: Thu, 02 Dec 2004 14:42:37 -0500 +Message-ID: <29326.1102016557@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/6 +X-Sequence-Number: 2517 + +Bruce Momjian writes: +> Merlin Moncure wrote: +>> Ok, I am starting to strongly suspect the statistics collector of +>> various kinds of malfeasance. + +> OK, the big problem is that we are nearing RC1. We would like some +> feedback on this as soon as possible. A major Win32 cleanup for this +> could delay the 8.0 release. + +I would say that it shouldn't delay the release --- worst case, we say +"the collector doesn't work very well under Win32 yet". It's probably +not the only part of the system we'll find needs work under Win32. + +This is moot if Merlin can find some simple fixable bug, but I'm worried +that doing anything significant might require major work. + +BTW, what about the issue we just identified with piperead() failing to +set errno on Windows? That would certainly account for the "random +collector restarts" complaint ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 2 19:54:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E8923A5781 + for ; + Thu, 2 Dec 2004 19:54:26 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79132-08 + for ; + Thu, 2 Dec 2004 19:54:22 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id C84663A5452 + for ; + Thu, 2 Dec 2004 19:54:23 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id 8D3FC56562; Thu, 2 Dec 2004 14:54:16 -0500 (EST) +Message-ID: <41AF72EB.1070900@deg.cc> +Date: Thu, 02 Dec 2004 14:54:19 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +References: <41AF68F2.1050206@deg.cc> <29227.1102016219@sss.pgh.pa.us> +In-Reply-To: <29227.1102016219@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/72 +X-Sequence-Number: 9447 + +Tom Lane wrote: + +>Pallav Kalva writes: +> +> +>> I have a table in my production database which has 500k rows and +>>from the pg_class it shows the number of "relpages" of +>>around 750K for this table, the same table copied to a test database +>>shows "relpages" as 35k. I run vacuumdb on the whole +>>database (not on the table individually but the whole database) daily. +>> +>> +> +>You're obviously suffering serious table bloat :-(. Depending on how +>heavy the update traffic on that table is, it might be that once-a-day +>vacuum is simply not often enough. Another likely problem is that you +>need to increase the FSM settings (how big is your whole database?) +> + Yes, you are right this table is heavily updated, the whole database +size is of 1.5 gigs, right now i have default fsm settings how much +should i increase max_fsm_pages and max_fsm_relations to ? + +> +> +> +>> Is there any way to fix this problem ? +>> +>> +> +>VACUUM FULL will fix the immediate problem. You might well find CLUSTER +>to be a faster alternative, though. +> +> +I am hesitant to do vacuum full on the table because it is one of the +crucial table in our application and we cant afford to have exclusive +lock on this table for long time. we can afford not to have writes and +updates but we need atleast reads on this table . +How does CLUSTER benefit me ? excuse me, i am new to this feature. + +> regards, tom lane +> +> +> + + + +From pgsql-performance-owner@postgresql.org Thu Dec 2 20:11:01 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 630B33A3F2B + for ; + Thu, 2 Dec 2004 20:10:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86881-02 + for ; + Thu, 2 Dec 2004 20:10:50 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0F9BA3A58AD + for ; + Thu, 2 Dec 2004 20:10:50 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB2KAnsj000703; + Thu, 2 Dec 2004 15:10:49 -0500 (EST) +To: Pallav Kalva +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +In-reply-to: <41AF72EB.1070900@deg.cc> +References: <41AF68F2.1050206@deg.cc> <29227.1102016219@sss.pgh.pa.us> + <41AF72EB.1070900@deg.cc> +Comments: In-reply-to Pallav Kalva + message dated "Thu, 02 Dec 2004 14:54:19 -0500" +Date: Thu, 02 Dec 2004 15:10:49 -0500 +Message-ID: <702.1102018249@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/73 +X-Sequence-Number: 9448 + +Pallav Kalva writes: +> Tom Lane wrote: +>> Another likely problem is that you +>> need to increase the FSM settings (how big is your whole database?) +>> +> Yes, you are right this table is heavily updated, the whole database +> size is of 1.5 gigs, right now i have default fsm settings how much +> should i increase max_fsm_pages and max_fsm_relations to ? + +A lot --- factor of 10 at least. Try "vacuum verbose" and look at the +last couple lines of output. + +>> VACUUM FULL will fix the immediate problem. You might well find CLUSTER +>> to be a faster alternative, though. + +> How does CLUSTER benefit me ? + +It'll probably take less time to rebuild the table. VACUUM FULL is +really optimized for the case of moving a relatively small fraction +of the table around, but it sounds like you need a complete rebuild. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 2 23:04:35 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BD0FB3A59A8 + for ; + Thu, 2 Dec 2004 23:04:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46736-05 + for ; + Thu, 2 Dec 2004 23:04:02 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) + by svr1.postgresql.org (Postfix) with ESMTP id 54AAC3A5989 + for ; + Thu, 2 Dec 2004 23:03:50 +0000 (GMT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 35FE21C927; Thu, 2 Dec 2004 17:03:48 -0600 (CST) +Date: Thu, 2 Dec 2004 17:03:48 -0600 +From: "Jim C. Nasby" +To: Alvaro Nunes Melo +Cc: Pgsql-Performance +Subject: Re: Normalization or Performance +Message-ID: <20041202230348.GG41545@decibel.org> +References: <1102007155.23943.61.camel@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1102007155.23943.61.camel@localhost> +X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/75 +X-Sequence-Number: 9450 + +On Thu, Dec 02, 2004 at 03:05:55PM -0200, Alvaro Nunes Melo wrote: +> Hi, +> +> Before writing this mail, I'd researched a little about this topic, and +> got some opinions from guys like Fabien Pascal, who argues that logical +> design should be separated from physical design, and other sources. As +> this is not fact, I'm writing to you guys, that make things work in real +> world. +> +> We started our first big (for our company standards) project always +> thinking in normalization. But once we imported legacy data into the DB, +> things got harder. +> +> One example is the clients status. A client might be active, inactive or +> pending (for many reasons). We store all the status a client have since +> it is in the system. To check what is the actual status of a client, we +> get the last status from this historical status table. This take a +> considerable time, so our best results were achieved building a +> function that checks the status and indexing this function. The problem +> is that indexed functions mus bu immutable, so as you can figure, if the +> status change after the creation of the index, the retunr of the +> function is still the same. +> +> What do you suggest for situations like this? Should I add a field to +> clients table and store its actual status, keep storing data in the +> historical table an control its changes with a trigger? + +It seems you shouldn't have to resort to this. SELECT status FROM +client_status WHERE client_id = blah ORDER BY status_date DESC LIMIT 1 +should be pretty fast given an index on client_id, status_date (which +should be able to be unique). + +> There are other situations that are making things difficult to us. For +> example, one query must return the total amount a client bought in the +> last 90 days. It's taking too long, when we must know it for many +> clients, many times. So should I create summarization tables to store +> this kind of stuff, update it with a trigger in daily basis (for +> example), and solve this problem with one join? + +This sounds like a more likely candidate for a summary table, though you +might not want to use a trigger. Unless you need absolutely up-to-date +information it seems like a nightly process to update the totals would +be better and more efficient. + +> Our database is not that big. The larger table has about 7.000.000 rows. +> About 50.000 clients, half of them active. All that I'd point out above +> uses indexes for queries, etc. But even with this it's not been fast +> enough. We have a Dell server for this (I know, the Dell issue), a Dual +> Xeon 2.8, SCSI HD, 1 GB mem. Do we need better hardware for our system? + +Is all this on a single HD? That's going to be a huge bottleneck. You'll +be much better off with a mirrored partition for your WAL files and +either raid5 or raid10 for the database itself. You'd probably be better +off with more memory as well. If you're going to buy a new box instead +of upgrade your existing one, I'd recommend going with an Opteron +because of it's much better memory bandwidth. + +For reference, stats.distributed.net is a dual Opteron 244 1.8GHz with +4G ram, a 200G mirror for WAL and the system files and a 6x200G RAID10 +for the database (all SATA drives). The largest table 120M rows and +825,000 8k pages. I can scan 1/5th of that table via an index scan in +about a minute. (The schema can be found at +http://minilink.org/cvs.distributed.net/l3.sql. +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +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 Fri Dec 3 01:43:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D3EB93A598C + for ; + Fri, 3 Dec 2004 01:43:16 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91275-07 + for ; + Fri, 3 Dec 2004 01:43:09 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 41CAB3A420C + for ; + Fri, 3 Dec 2004 01:43:11 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iB31h3Z29703; + Fri, 3 Dec 2004 10:43:03 +0900 +Message-ID: <009401c4d8d9$a5fc6160$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "Alvaro Nunes Melo" , + "Pgsql-Performance" +References: <1102007155.23943.61.camel@localhost> +Subject: Re: Normalization or Performance +Date: Fri, 3 Dec 2004 10:44:32 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="iso-2022-jp"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/76 +X-Sequence-Number: 9451 + +Hi, + +without knowing much about your system, it seems to me that the current +status of a client should be represented by a status code on the client +record. History is the list of *past* status codes. The full history, +including the current status of a client would be obtained using a union. + +I had a situation which might have some parallels with yours. nthis case the +tables represented orders and receivals. The status of an order item was +held on a code in the receival itemss table (an order item can be received +many times). This is seems to me to be not normalized as the status was +actually the status of the order item, not the receival. The receival just +caused the status of the order item to change. This arrangement required +ridiculously complex sql and resulted in poor performance. Moving the status +code to the order item and implementing a simple trigger on the receival +items table cleaned things up significantly. + +To put it simply, if the current status of an order item is a simple +attribute of the order item, then it should be in the order item table. The +same might be said for your client. + +This is just my personal opinion though and I'm always open to alternative +opinions, as I think you are. + +regards +Iain +----- Original Message ----- +From: "Alvaro Nunes Melo" +To: "Pgsql-Performance" +Sent: Friday, December 03, 2004 2:05 AM +Subject: [PERFORM] Normalization or Performance + + +> Hi, +> +> Before writing this mail, I'd researched a little about this topic, and +> got some opinions from guys like Fabien Pascal, who argues that logical +> design should be separated from physical design, and other sources. As +> this is not fact, I'm writing to you guys, that make things work in real +> world. +> +> We started our first big (for our company standards) project always +> thinking in normalization. But once we imported legacy data into the DB, +> things got harder. +> +> One example is the clients status. A client might be active, inactive or +> pending (for many reasons). We store all the status a client have since +> it is in the system. To check what is the actual status of a client, we +> get the last status from this historical status table. This take a +> considerable time, so our best results were achieved building a +> function that checks the status and indexing this function. The problem +> is that indexed functions mus bu immutable, so as you can figure, if the +> status change after the creation of the index, the retunr of the +> function is still the same. +> +> What do you suggest for situations like this? Should I add a field to +> clients table and store its actual status, keep storing data in the +> historical table an control its changes with a trigger? +> +> There are other situations that are making things difficult to us. For +> example, one query must return the total amount a client bought in the +> last 90 days. It's taking too long, when we must know it for many +> clients, many times. So should I create summarization tables to store +> this kind of stuff, update it with a trigger in daily basis (for +> example), and solve this problem with one join? +> +> Our database is not that big. The larger table has about 7.000.000 rows. +> About 50.000 clients, half of them active. All that I'd point out above +> uses indexes for queries, etc. But even with this it's not been fast +> enough. We have a Dell server for this (I know, the Dell issue), a Dual +> Xeon 2.8, SCSI HD, 1 GB mem. Do we need better hardware for our system? +> +> -- +> +---------------------------------------------------+ +> | Alvaro Nunes Melo Atua Sistemas de Informacao | +> | al_nunes@atua.com.br www.atua.com.br | +> | UIN - 42722678 (54) 327-1044 | +> +---------------------------------------------------+ +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 02:50:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 260963A5A13 + for ; + Fri, 3 Dec 2004 02:50:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07595-10 + for ; + Fri, 3 Dec 2004 02:50:02 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 02BDF3A5A0E + for ; + Fri, 3 Dec 2004 02:50:05 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 6A4E231919; Fri, 3 Dec 2004 03:50:06 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: pg replication tools? +Date: Thu, 02 Dec 2004 21:39:02 -0500 +Organization: cbbrowne Computing Inc +Lines: 32 +Message-ID: +References: <20041202143816.14226.qmail@web51305.mail.yahoo.com> + <41AF47BB.20903@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:oK/z6j575SLYggUv1R2iQv61CNc= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/77 +X-Sequence-Number: 9452 + +Clinging to sanity, jd@commandprompt.com ("Joshua D. Drake") mumbled into her beard: +> sarlav kumar wrote: +> +>> Hi all, +>> Which is the best available PG replication tool in market now? +> +> There is no "best", there is only best for your situation. The two +> most supported are: +> +> +>> * Mammoth PostgreSQL Replicator * Slony-I +>> +>> Which one of these is a good option for replicating Postgres 7.3.2? +>> +> +> Mammoth PostgreSQL Replicator will automatically upgrade you to +> 7.3.8 which you should be running anyway. +> +> I believe Slony will work with 7.3.2. + +No, it won't. + +I believe there was something about namespace support that did not +stabilize until PostgreSQL 7.3.3, and Slony-I works with that version, +at the earliest. + +And you're quite right; "best" is a slippery metric. Like many +things, it may be altered by perspective. +-- +If this was helpful, rate me +http://www3.sympatico.ca/cbbrowne/postgresql.html +I can see clearly now, the brain is gone... + +From pgsql-performance-owner@postgresql.org Fri Dec 3 05:16:44 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D333C3A5A4E + for ; + Fri, 3 Dec 2004 05:16:42 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50869-03 + for ; + Fri, 3 Dec 2004 05:16:33 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 67ABF3A5A2A + for ; + Fri, 3 Dec 2004 05:16:32 +0000 (GMT) +Received: by wproxy.gmail.com with SMTP id 69so105918wra + for ; + Thu, 02 Dec 2004 21:16:31 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=hTtvRqu7Dx89QeXZUkfc++Hu6eaa0QXVE9FuJIjDUNHrCFG0MVBRavLuZG9IMyn42RtfsXvlzzdpvxlP9uXzpKGPAFOrVXEWUh7tVotUjolvJN337zxY/tPfuwHjhOiG7VeGwocnQGErwwq2LsSK62ReX/OC21oy9wcjIUStUrc= +Received: by 10.54.23.56 with SMTP id 56mr460945wrw; + Thu, 02 Dec 2004 21:16:31 -0800 (PST) +Received: by 10.54.50.31 with HTTP; Thu, 2 Dec 2004 21:16:31 -0800 (PST) +Message-ID: <77b69d2104120221161ead727b@mail.gmail.com> +Date: Fri, 3 Dec 2004 10:46:31 +0530 +From: "Vishal Kashyap @ [SaiHertz]" +Reply-To: "Vishal Kashyap @ [SaiHertz]" +To: sarlav kumar +Subject: Re: pg replication tools? +Cc: pgsqlperform +In-Reply-To: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: quoted-printable +References: <20041202143816.14226.qmail@web51305.mail.yahoo.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/78 +X-Sequence-Number: 9453 + +Go for Slony its best thing to start with. + + +On Thu, 2 Dec 2004 06:38:16 -0800 (PST), sarlav kumar w= +rote: +>=20 +> Hi all,=20 +> =20 +> Which is the best available PG replication tool in market now?=20 +> =20 +> From searching on the internet, I found some resources on the following +> tools used for replication :=20 +> =20 +> postgres =E2=80=93R =20 +> Usogres=20 +> eRServer/Rserv/Dbmirror=20 +> PgReplicator=20 +> Mammoth PostgreSQL Replicator =20 +> Slony-I=20 +>=20 +> Which one of these is a good option for replicating Postgres 7.3.2?=20 +>=20 +> =20 +>=20 +> Thanks again,=20 +>=20 +> Saranya +>=20 +> ________________________________ +> Do you Yahoo!? +> Read only the mail you want - Yahoo! Mail SpamGuard.=20 +>=20 +>=20 + + +--=20 +With Best Regards, +Vishal Kashyap. +Lead Software Developer, +http://saihertz.com, +http://vishalkashyap.tk + +From pgsql-performance-owner@postgresql.org Fri Dec 3 05:59:59 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A32FF3A5A7C + for ; + Fri, 3 Dec 2004 05:59:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60977-03 + for ; + Fri, 3 Dec 2004 05:59:51 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id B7C613A59F7 + for ; + Fri, 3 Dec 2004 05:59:51 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6738281; Thu, 02 Dec 2004 22:01:24 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Poor Performance on a table +Date: Thu, 2 Dec 2004 21:57:00 -0800 +User-Agent: KMail/1.6.2 +Cc: Pallav Kalva , Tom Lane +References: <41AF68F2.1050206@deg.cc> <29227.1102016219@sss.pgh.pa.us> + <41AF72EB.1070900@deg.cc> +In-Reply-To: <41AF72EB.1070900@deg.cc> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412022157.00254.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/79 +X-Sequence-Number: 9454 + +Pallav, + +> Yes, you are right this table is heavily updated, the whole database +> size is of 1.5 gigs, right now i have default fsm settings how much +> should i increase max_fsm_pages and max_fsm_relations to ? + +1) fix the table (see below) +2) run the system for another day +3) run VACUUM FULL ANALYZE VERBOSE +4) if you're running 7.4 or better, at the end you'll see a total of FSM pages +needed. If you're running something earlier, you'll need to get out a +calculator and do the math yourself. + +Of course, if you're getting heavy update/delete activity, vacuuming more +often might be wise. Post the output of the above command if you have +questions. + +> I am hesitant to do vacuum full on the table because it is one of the +> crucial table in our application and we cant afford to have exclusive +> lock on this table for long time. we can afford not to have writes and +> updates but we need atleast reads on this table . + +You're going to have to do at least one or the table will just keep getting +worse. Schedule it for 3am. Once you've set FSM correctly, and are +vacuuming with the right frequency, the need to run VACUUM FULL will go away. + +Oh, and it's likely that any indexes on the table need to be REINDEXed. + + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Dec 3 20:38:36 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 871F43A3C24 + for ; + Fri, 3 Dec 2004 10:42:47 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33816-02 + for ; + Fri, 3 Dec 2004 10:42:14 +0000 (GMT) +Received: from plab.ku.dk (plab.ku.dk [130.225.107.20]) + by svr1.postgresql.org (Postfix) with ESMTP id 0BB963A4F5B + for ; + Fri, 3 Dec 2004 10:42:16 +0000 (GMT) +Received: from plab.ku.dk (localhost [127.0.0.1]) + by plab.ku.dk (Postfix) with SMTP id F24FD5A4C2 + for ; + Fri, 3 Dec 2004 11:42:14 +0100 (CET) +Received: by plab.ku.dk (Postfix, from userid 1003) + id 22CF05A4BF; Fri, 3 Dec 2004 11:42:14 +0100 (CET) +Mime-version: 1.0 +Content-type: text/plain; charset="koi8-r" +Content-transfer-encoding: 8bit +Keywords: 2001334874 +X-Comment-To: Rod Taylor +To: Postgresql Performance +Subject: Re: VACUUM ANALYZE downgrades performance +References: <84fz2ra2gy.fsf_-_@plab.ku.dk> <41AC94CC.1020602@idigx.com> + <84wtw0d6q2.fsf@plab.ku.dk> <1102004718.99116.220.camel@home> +From: Dmitry Karasik +In-Reply-To: Rod Taylor's message of "Thu, 02 Dec 2004 11:25:18 -0500" +Date: 03 Dec 2004 11:42:13 +0100 +Message-ID: <84k6rz64u2.fsf@plab.ku.dk> +Lines: 29 +X-Mailer: Gnus v5.7/Emacs 20.7 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/85 +X-Sequence-Number: 9460 + + Hi Rod! + + Thomas> Index scans are not always faster, and the planner/optimizer knows + Thomas> this. VACUUM ANALYZE is best run when a large proportion of data + Thomas> has been updated/loaded or in the off hours to refresh the + Thomas> statistics on large datasets. + >> While I agree that generally this is true, look how stupid this + >> behavior looks in this particular case: A developer creates a table and + >> index, knowing that the table will be large and will be intensively + >> used. An admin runs 'VACUUM ANALYZE' when table is occasionally empty, + >> and next, say, 1 day, until another 'VACUUM ANALYZE' starts, the index + >> is simply not used! Sure you don't suppose to run 'VACUUM ANALYZE' + >> every 5 minutes as a solution, right? + + Rod> You might want to try this on the next 8.0 beta to come out, or + Rod> against CVS. Tom recently applied some changes which should mitigate + Rod> this situation. + +But this would affect only VACUUM, and not ANALYZE, right? + +-- +Sincerely, + Dmitry Karasik + +--- +catpipe Systems ApS +*BSD solutions, consulting, development +www.catpipe.net ++45 7021 0050 + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 14:20:26 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A8FA63A58A5 + for ; + Fri, 3 Dec 2004 14:20:25 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99290-01 + for ; + Fri, 3 Dec 2004 14:19:52 +0000 (GMT) +Received: from jinx.internetstaff.com (unknown [63.214.174.241]) + by svr1.postgresql.org (Postfix) with ESMTP id CF1873A56D0 + for ; + Fri, 3 Dec 2004 14:19:53 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by jinx.internetstaff.com (Postfix) with ESMTP + id 472504BC328; Fri, 3 Dec 2004 07:19:53 -0700 (MST) +Received: from jinx.internetstaff.com ([127.0.0.1]) + by localhost (jinx [127.0.0.1]) (amavisd-new, port 10024) with LMTP + id 06619-01-10; Fri, 3 Dec 2004 07:19:42 -0700 (MST) +Received: from blackbox.internetstaff.com (ip24-251-65-14.ph.ph.cox.net + [24.251.65.14]) by jinx.internetstaff.com (Postfix) with ESMTP + id 76FB94BC0A7; Fri, 3 Dec 2004 07:19:42 -0700 (MST) +Subject: Re: Alternatives to Dell? +From: Cott Lang +To: josh@agliodbs.com +Cc: pgsql-performance@postgresql.org +In-Reply-To: <200412011424.12137.josh@agliodbs.com> +References: <200412011424.12137.josh@agliodbs.com> +Content-Type: text/plain +Date: Fri, 03 Dec 2004 07:19:37 -0700 +Message-Id: <1102083578.3656.9.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at internetstaff.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/80 +X-Sequence-Number: 9455 + +Consider Sun's new line of Opterons. They've been around for a couple of +years under the Newisys name. I'm using dozens of them for web servers +and PG servers and so far both the v20z and v40z have been excellent +performers with solid reliability. The pricing was also competitive +since Sun is looking to break into the market. + + + +On Wed, 2004-12-01 at 14:24 -0800, Josh Berkus wrote: +> Folks, +> +> A lot of people have been having a devilish time with Dell hardware lately. +> It seems like the quality control just isn't there on the Dell servers. +> +> Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> vendors for hardware; they won't home-build. For those people, what vendors +> do others on this list recommend? What have been your good/bad experiences? +> + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 14:31:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AA13D3A5801 + for ; + Fri, 3 Dec 2004 14:31:25 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00663-09 + for ; + Fri, 3 Dec 2004 14:30:58 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 01C2F3A58C8 + for ; + Fri, 3 Dec 2004 14:31:01 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB3EUwaW028953; Fri, 3 Dec 2004 06:30:59 -0800 +Message-ID: <41B07882.7060809@commandprompt.com> +Date: Fri, 03 Dec 2004 06:30:26 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Cott Lang +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> +In-Reply-To: <1102083578.3656.9.camel@localhost> +Content-Type: multipart/mixed; boundary="------------010206050509030208040209" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/81 +X-Sequence-Number: 9456 + +This is a multi-part message in MIME format. +--------------010206050509030208040209 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Cott Lang wrote: + +>Consider Sun's new line of Opterons. They've been around for a couple of +>years under the Newisys name. I'm using dozens of them for web servers +>and PG servers and so far both the v20z and v40z have been excellent +>performers with solid reliability. The pricing was also competitive +>since Sun is looking to break into the market. +> +> +Really? I am not being sarcastic, but I found their prices pretty sad. +Did you go direct or web purchase? I have thought about using them +several times but.... + +Sincerely, + +Joshua D. Drake + + + +> +> +>On Wed, 2004-12-01 at 14:24 -0800, Josh Berkus wrote: +> +> +>>Folks, +>> +>>A lot of people have been having a devilish time with Dell hardware lately. +>>It seems like the quality control just isn't there on the Dell servers. +>> +>>Thing is, some companies are required to use 1st-tier or at least 2nd-tier +>>vendors for hardware; they won't home-build. For those people, what vendors +>>do others on this list recommend? What have been your good/bad experiences? +>> +>> +>> +> +> +>---------------------------(end of broadcast)--------------------------- +>TIP 4: Don't 'kill -9' the postmaster +> +> + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------010206050509030208040209 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------010206050509030208040209-- + +From pgsql-performance-owner@postgresql.org Fri Dec 3 14:34:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2523E3A58C1 + for ; + Fri, 3 Dec 2004 14:34:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01391-06 + for ; + Fri, 3 Dec 2004 14:33:46 +0000 (GMT) +Received: from jinx.internetstaff.com (unknown [63.214.174.241]) + by svr1.postgresql.org (Postfix) with ESMTP id D9FCF3A585A + for ; + Fri, 3 Dec 2004 14:33:49 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by jinx.internetstaff.com (Postfix) with ESMTP + id 4D0044BC374; Fri, 3 Dec 2004 07:33:50 -0700 (MST) +Received: from jinx.internetstaff.com ([127.0.0.1]) + by localhost (jinx [127.0.0.1]) (amavisd-new, port 10024) with LMTP + id 05054-03-27; Fri, 3 Dec 2004 07:33:39 -0700 (MST) +Received: from blackbox.internetstaff.com (ip24-251-65-14.ph.ph.cox.net + [24.251.65.14]) by jinx.internetstaff.com (Postfix) with ESMTP + id 7B4BD4BC3B4; Fri, 3 Dec 2004 07:33:39 -0700 (MST) +Subject: Re: Alternatives to Dell? +From: Cott Lang +To: "Joshua D. Drake" +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org +In-Reply-To: <41B07882.7060809@commandprompt.com> +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> + <41B07882.7060809@commandprompt.com> +Content-Type: text/plain +Date: Fri, 03 Dec 2004 07:33:39 -0700 +Message-Id: <1102084419.3656.12.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at internetstaff.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/82 +X-Sequence-Number: 9457 + +Most of mine I got through a Sun reseller. Some of mine I got off of +Ebay. You should be able to get them a lot cheaper than than retail web +pricing. :) + +However, even full retail seems like it was a hell of a lot cheaper for +a v40z than a DL585. :) + + +On Fri, 2004-12-03 at 06:30 -0800, Joshua D. Drake wrote: +> Cott Lang wrote: +> +> >Consider Sun's new line of Opterons. They've been around for a couple of +> >years under the Newisys name. I'm using dozens of them for web servers +> >and PG servers and so far both the v20z and v40z have been excellent +> >performers with solid reliability. The pricing was also competitive +> >since Sun is looking to break into the market. +> > +> > +> Really? I am not being sarcastic, but I found their prices pretty sad. +> Did you go direct or web purchase? I have thought about using them +> several times but.... +> +> Sincerely, +> +> Joshua D. Drake +> +> +> +> > +> > +> >On Wed, 2004-12-01 at 14:24 -0800, Josh Berkus wrote: +> > +> > +> >>Folks, +> >> +> >>A lot of people have been having a devilish time with Dell hardware lately. +> >>It seems like the quality control just isn't there on the Dell servers. +> >> +> >>Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> >>vendors for hardware; they won't home-build. For those people, what vendors +> >>do others on this list recommend? What have been your good/bad experiences? +> >> +> >> +> >> +> > +> > +> >---------------------------(end of broadcast)--------------------------- +> >TIP 4: Don't 'kill -9' the postmaster +> > +> > +> +> + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 14:39:52 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 30D4C3A57B6 + for ; + Fri, 3 Dec 2004 14:39:51 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06432-01 + for ; + Fri, 3 Dec 2004 14:39:21 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id E82153A58C8 + for ; + Fri, 3 Dec 2004 14:39:24 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB3EdMaW031166; Fri, 3 Dec 2004 06:39:23 -0800 +Message-ID: <41B07A7A.8010904@commandprompt.com> +Date: Fri, 03 Dec 2004 06:38:50 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Cott Lang +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> + <41B07882.7060809@commandprompt.com> + <1102084419.3656.12.camel@localhost> +In-Reply-To: <1102084419.3656.12.camel@localhost> +Content-Type: multipart/mixed; boundary="------------030204050704030302090706" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/83 +X-Sequence-Number: 9458 + +This is a multi-part message in MIME format. +--------------030204050704030302090706 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Cott Lang wrote: + +>Most of mine I got through a Sun reseller. Some of mine I got off of +>Ebay. You should be able to get them a lot cheaper than than retail web +>pricing. :) +> +>However, even full retail seems like it was a hell of a lot cheaper for +>a v40z than a DL585. :) +> +> +That's true :) One of the reasons the compaq's are expensive +is they supposedly use a quad board, even for the dual machine. +Which means a different opteron chip as well. + +I don't know this for a fact, it is just what one of their +"ahem" sales guys told me. + +The IBM machines are seem reasonable though. + +Sincerely, + +Joshua D. Drake + + + +> +>On Fri, 2004-12-03 at 06:30 -0800, Joshua D. Drake wrote: +> +> +>>Cott Lang wrote: +>> +>> +>> +>>>Consider Sun's new line of Opterons. They've been around for a couple of +>>>years under the Newisys name. I'm using dozens of them for web servers +>>>and PG servers and so far both the v20z and v40z have been excellent +>>>performers with solid reliability. The pricing was also competitive +>>>since Sun is looking to break into the market. +>>> +>>> +>>> +>>> +>>Really? I am not being sarcastic, but I found their prices pretty sad. +>>Did you go direct or web purchase? I have thought about using them +>>several times but.... +>> +>>Sincerely, +>> +>>Joshua D. Drake +>> +>> +>> +>> +>> +>>>On Wed, 2004-12-01 at 14:24 -0800, Josh Berkus wrote: +>>> +>>> +>>> +>>> +>>>>Folks, +>>>> +>>>>A lot of people have been having a devilish time with Dell hardware lately. +>>>>It seems like the quality control just isn't there on the Dell servers. +>>>> +>>>>Thing is, some companies are required to use 1st-tier or at least 2nd-tier +>>>>vendors for hardware; they won't home-build. For those people, what vendors +>>>>do others on this list recommend? What have been your good/bad experiences? +>>>> +>>>> +>>>> +>>>> +>>>> +>>>---------------------------(end of broadcast)--------------------------- +>>>TIP 4: Don't 'kill -9' the postmaster +>>> +>>> +>>> +>>> +>> +>> + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------030204050704030302090706 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------030204050704030302090706-- + +From pgsql-performance-owner@postgresql.org Fri Dec 3 17:00:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 25FFD3A5A2D + for ; + Fri, 3 Dec 2004 17:00:08 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 48677-06 + for ; + Fri, 3 Dec 2004 16:59:37 +0000 (GMT) +Received: from jinx.internetstaff.com (unknown [63.214.174.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 867B03A5445 + for ; + Fri, 3 Dec 2004 16:56:07 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by jinx.internetstaff.com (Postfix) with ESMTP + id E2B9A4BC25A; Fri, 3 Dec 2004 09:56:06 -0700 (MST) +Received: from jinx.internetstaff.com ([127.0.0.1]) + by localhost (jinx [127.0.0.1]) (amavisd-new, port 10024) with LMTP + id 16343-01-53; Fri, 3 Dec 2004 09:55:56 -0700 (MST) +Received: from blackbox.vcommerce.com (unknown [65.161.175.220]) + by jinx.internetstaff.com (Postfix) with ESMTP + id 264304BC339; Fri, 3 Dec 2004 09:55:56 -0700 (MST) +Subject: Re: Alternatives to Dell? +From: Cott Lang +To: "Joshua D. Drake" +Cc: josh@agliodbs.com, pgsql-performance@postgresql.org +In-Reply-To: <41B07A7A.8010904@commandprompt.com> +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> + <41B07882.7060809@commandprompt.com> + <1102084419.3656.12.camel@localhost> + <41B07A7A.8010904@commandprompt.com> +Content-Type: text/plain +Date: Fri, 03 Dec 2004 09:55:55 -0700 +Message-Id: <1102092955.3695.2.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at internetstaff.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/84 +X-Sequence-Number: 9459 + +We were originally heading towards an IBM deployment, but the 325 was +all that was available at the time, and it only supported 12GB. Then +when I heard they canceled their rumored quad processor 350, I feared +Intel/AMD politics and IBM dropped from the running. :) + +(IBM now has the 326 that supports 16GB of RAM) + + + + +On Fri, 2004-12-03 at 06:38 -0800, Joshua D. Drake wrote: +> Cott Lang wrote: +> +> >Most of mine I got through a Sun reseller. Some of mine I got off of +> >Ebay. You should be able to get them a lot cheaper than than retail web +> >pricing. :) +> > +> >However, even full retail seems like it was a hell of a lot cheaper for +> >a v40z than a DL585. :) +> > +> > +> That's true :) One of the reasons the compaq's are expensive +> is they supposedly use a quad board, even for the dual machine. +> Which means a different opteron chip as well. +> +> I don't know this for a fact, it is just what one of their +> "ahem" sales guys told me. +> +> The IBM machines are seem reasonable though. +> +> Sincerely, +> +> Joshua D. Drake +> +> +> +> > +> >On Fri, 2004-12-03 at 06:30 -0800, Joshua D. Drake wrote: +> > +> > +> >>Cott Lang wrote: +> >> +> >> +> >> +> >>>Consider Sun's new line of Opterons. They've been around for a couple of +> >>>years under the Newisys name. I'm using dozens of them for web servers +> >>>and PG servers and so far both the v20z and v40z have been excellent +> >>>performers with solid reliability. The pricing was also competitive +> >>>since Sun is looking to break into the market. +> >>> +> >>> +> >>> +> >>> +> >>Really? I am not being sarcastic, but I found their prices pretty sad. +> >>Did you go direct or web purchase? I have thought about using them +> >>several times but.... +> >> +> >>Sincerely, +> >> +> >>Joshua D. Drake +> >> +> >> +> >> +> >> +> >> +> >>>On Wed, 2004-12-01 at 14:24 -0800, Josh Berkus wrote: +> >>> +> >>> +> >>> +> >>> +> >>>>Folks, +> >>>> +> >>>>A lot of people have been having a devilish time with Dell hardware lately. +> >>>>It seems like the quality control just isn't there on the Dell servers. +> >>>> +> >>>>Thing is, some companies are required to use 1st-tier or at least 2nd-tier +> >>>>vendors for hardware; they won't home-build. For those people, what vendors +> >>>>do others on this list recommend? What have been your good/bad experiences? +> >>>> +> >>>> +> >>>> +> >>>> +> >>>> +> >>>---------------------------(end of broadcast)--------------------------- +> >>>TIP 4: Don't 'kill -9' the postmaster +> >>> +> >>> +> >>> +> >>> +> >> +> >> +> +> + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 20:39:07 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8FC263A5AEB + for ; + Fri, 3 Dec 2004 20:39:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39197-01 + for ; + Fri, 3 Dec 2004 20:38:53 +0000 (GMT) +Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B14B3A5AB3 + for ; + Fri, 3 Dec 2004 20:38:53 +0000 (GMT) +Received: from [82.234.66.131] (mna75-1-82-234-66-131.fbx.proxad.net + [82.234.66.131] (may be forged)) (authenticated bits=0) + by mail.rilk.com (8.13.0/8.13.0) with ESMTP id iB3KcoEg017037 + (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) + for ; + Fri, 3 Dec 2004 21:38:51 +0100 (CET) +Mime-Version: 1.0 (Apple Message framework v619) +Content-Transfer-Encoding: quoted-printable +Message-Id: <56141B8E-456B-11D9-9C9F-000A95DE2550@rilk.com> +Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= +Subject: DB2 feature +Date: Fri, 3 Dec 2004 21:38:49 +0100 +X-Mailer: Apple Mail (2.619) +X-DCC-sgs_public_dcc_server-Metrics: mail.rilk.com 1199; Body=1 Fuz1=1 Fuz2=1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/86 +X-Sequence-Number: 9461 + +Hi + +I see this article about DB2 +http://www-106.ibm.com/developerworks/db2/library/techarticle/dm=20 +-0411rielau/?ca=3Ddgr-lnxw06SQL-Speed + +The listing 2 example: +1 SELECT D_TAX, D_NEXT_O_ID +2 INTO :dist_tax , :next_o_id +3 FROM OLD TABLE ( UPDATE DISTRICT +4 SET D_NEXT_O_ID =3D D_NEXT_O_ID + 1 +5 WHERE D_W_ID =3D :w_id +6 AND D_ID =3D :d_id +7 ) AS OT + +I am not a expert in Rule System. +But I ad a look to +http://www.postgresql.org/docs/7.4/static/rules-update.html +And it seems possible in PostgreSQL to build non standard SQL query to =20= + +do thing like listing 2. + +I would like to know from an "expert" of PostgreSQL if such query is =20 +really a new stuff to DB2 as the artcile states ? or if PostgreSQL has =20= + +already the same type of power ? + +Cordialement, +Jean-G=E9rard Pailloncy= + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 20:59:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E3263A5AD5 + for ; + Fri, 3 Dec 2004 20:59:48 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44733-04 + for ; + Fri, 3 Dec 2004 20:59:42 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 846093A5AD3 + for ; + Fri, 3 Dec 2004 20:59:42 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6741313; Fri, 03 Dec 2004 13:01:15 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: DB2 feature +Date: Fri, 3 Dec 2004 13:02:46 -0800 +User-Agent: KMail/1.6.2 +Cc: Pailloncy =?iso-8859-1?q?Jean-G=E9rard?= +References: <56141B8E-456B-11D9-9C9F-000A95DE2550@rilk.com> +In-Reply-To: <56141B8E-456B-11D9-9C9F-000A95DE2550@rilk.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412031302.46772.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.14 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200412/87 +X-Sequence-Number: 9462 + +Jean-Gerard, + +> The listing 2 example: +> 1 =A0SELECT D_TAX, D_NEXT_O_ID +> 2 =A0 =A0 INTO :dist_tax , :next_o_id +> 3 =A0 =A0 FROM OLD TABLE ( UPDATE DISTRICT +> 4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 SET =A0D_NEXT_O_ID =3D D_NE= +XT_O_ID + 1 +> 5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 WHERE D_W_ID =3D :w_id +> 6 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 AND D_ID =3D :d_id +> 7 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ) AS OT + +A lot of this is non-standard SQL, so I can't really tell what DB2 is doing= +=20 +here. Can you explain it? + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Dec 4 04:59:15 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BE7E93A59EC + for ; + Fri, 3 Dec 2004 22:12:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65774-01 + for ; + Fri, 3 Dec 2004 22:12:29 +0000 (GMT) +Received: from ohm.gene.com (fw-open-virt.gene.com [192.12.78.250]) + by svr1.postgresql.org (Postfix) with ESMTP id 0D15A3A59D6 + for ; + Fri, 3 Dec 2004 22:12:29 +0000 (GMT) +Received: from [128.137.187.34] (dhcp187-34.gene.com [128.137.187.34]) + by ohm.gene.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + iB3MCQuR013233 for ; + Fri, 3 Dec 2004 14:12:26 -0800 (PST) +Subject: Performance difference in similar queries +From: Kiran Mukhyala +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Message-Id: <1102111946.31836.102.camel@scifi.gene.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Fri, 03 Dec 2004 14:12:26 -0800 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/93 +X-Sequence-Number: 9468 + +Hi Folks, + + I have two queries that are of the form : +select ... from ... where ... in (list1) AND ... in (list2). The two +queries differ only in the size of list2 by 1, but their performances +are quite different. Query2 runs much faster than Query1. The queries +are: + +Query 1: +SELECT svm,pmodel_id,pseq_id FROM paprospect2 WHERE pseq_id in +(8880,10507,10600,10605,10724,10852 ...) AND pmodel_id in +(4757,8221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + +Query 2: +SELECT svm,pmodel_id,pseq_id FROM paprospect2 WHERE pseq_id in +(8880,10507,10600,10605,10724,10852 ...) AND pmodel_id in +(4757,8221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + +=>Notice the extra zero at the end of query2. The size of list1 is 800 +and size of list2 is 49 in case of query1 and 50 in case of query2 + +The Query Plans are: + +QUERY PLAN 1: + +Index Scan using paprospect2_search1, paprospect2_search1, +paprospect2_search1, paprospect2_search1, paprospect2_search1, +paprospect2_search1, paprospect2_search1, paprospect2_search1 .......... +(cost=0.00..10959914.42 rows=45760 width=12) + + Index Cond: ((pmodel_id = 4757) OR (pmodel_id = 8221) OR (pmodel_id = +0) OR (pmodel_id = 0) OR (pmodel_id = 0) OR (pmodel_id = 0) OR +(pmodel_id = 0) OR (pmodel_id = 0) OR ...) + + Filter: ((pseq_id = 0) OR (pseq_id = 8880) OR (pseq_id = 10507) OR +(pseq_id = 10600) OR (pseq_id = 10605) OR ...) + +QUERY PLAN 2: + +Index Scan using +paprospect2_pseq_id_params_id,paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id ....... +(cost=0.00..11050741.64 rows=46520 width=12) + + Index Cond: ((pseq_id = 0) OR (pseq_id = 8880) OR (pseq_id = 10507) +OR (pseq_id = 10600) OR (pseq_id = 10605) OR (pseq_id = 10724) OR +(pseq_id = 10852) OR (pseq_id = 10905) OR (pseq_id = 10945) OR (pseq_id += 10964)....) + +Filter: ((pmodel_id = 4757) OR (pmodel_id = 8221) OR (pmodel_id = 0) OR +(pmodel_id = 0) OR (pmodel_id = 0) OR ...) + +=> Notice that the Index, Index Cond. and Filter are different in the +two plans. +In short the query plans and performance are quite different although +the queries are similar. Can you please explain the difference in +performance? Thank you, + +-Kiran + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 22:50:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 725FA3A503A + for ; + Fri, 3 Dec 2004 22:50:19 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73908-03 + for ; + Fri, 3 Dec 2004 22:50:05 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 5A6653A3EA3 + for ; + Fri, 3 Dec 2004 22:50:07 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id B9AD63192A; Fri, 3 Dec 2004 23:50:05 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: DB2 feature +Date: Fri, 03 Dec 2004 17:27:14 -0500 +Organization: cbbrowne Computing Inc +Lines: 64 +Message-ID: +References: <56141B8E-456B-11D9-9C9F-000A95DE2550@rilk.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:DCSrtHJU/lzYa/fOmtdCZa4Qhnw= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/90 +X-Sequence-Number: 9465 + +Clinging to sanity, jg@rilk.com (Pailloncy Jean-G�rard) mumbled into her beard: +> I see this article about DB2 +> http://www-106.ibm.com/developerworks/db2/library/techarticle/dm +> -0411rielau/?ca=dgr-lnxw06SQL-Speed +> +> The listing 2 example: +> 1 SELECT D_TAX, D_NEXT_O_ID +> 2 INTO :dist_tax , :next_o_id +> 3 FROM OLD TABLE ( UPDATE DISTRICT +> 4 SET D_NEXT_O_ID = D_NEXT_O_ID + 1 +> 5 WHERE D_W_ID = :w_id +> 6 AND D_ID = :d_id +> 7 ) AS OT +> +> I am not a expert in Rule System. +> But I ad a look to +> http://www.postgresql.org/docs/7.4/static/rules-update.html +> And it seems possible in PostgreSQL to build non standard SQL query to +> do thing like listing 2. +> +> I would like to know from an "expert" of PostgreSQL if such query is +> really a new stuff to DB2 as the artcile states ? or if PostgreSQL has +> already the same type of power ? + +This feature (which evidently was derived from something in Sybase, +which Microsoft therefore brought into their version of SQL Server) +allows the Gentle User to do a mass update on a table (what's +parenthesized), and then do some manipulations on the rows that ware +affected by that mass update, where OLD TABLE returns the _former_ +state of rows that were updated/deleted, and NEW TABLE would return +the _new_ state of rows that were inserted/updated. + +It would be possible to do something analagous using rules, but the +implementation would look VERY different from this. + +In effect, you would have to add, temporarily, a rule that does the +thing akin to "select d_tax, d_next_o_id into some table" for the +three cases: + + 1. on insert, do something with NEW.D_TAX, NEW.D_NEXT_O_ID + to correspond to the insert case; + + 2. on update, do something with NEW.D_TAX, NEW.D_NEXT_O_ID to + correspond with an update, doing something with the NEW values; + + 3. on update, do something with OLD.D_TAX, OLD.D_NEXT_O_ID to + correspond with an update, doing something with the OLD values; + + 4. on delete, do something with OLD.D_TAX, OLD.D_NEXT_O_ID... + +You'd create the a rule to do things row-by-row. + +The efficiency of this actually ought to be pretty good; such rules +would be tightly firing over and over each time a row was affected by +the query, and since the data being processed would be in cache, it +would be eminently quickly accessible. + +But, compared to the DB2 approach, it involves creating and dropping +rules on the fly... +-- +"cbbrowne","@","acm.org" +http://www.ntlug.org/~cbbrowne/linuxdistributions.html +Signs of a Klingon Programmer - 11. "By filing this bug report you +have challenged the honor of my family. Prepare to die!" + +From pgsql-performance-owner@postgresql.org Fri Dec 3 22:31:26 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C218B3A5A88 + for ; + Fri, 3 Dec 2004 22:31:22 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70697-02 + for ; + Fri, 3 Dec 2004 22:31:14 +0000 (GMT) +Received: from compton.gene.com (fw-open-virt.gene.com [192.12.78.250]) + by svr1.postgresql.org (Postfix) with ESMTP id ADF103A5A06 + for ; + Fri, 3 Dec 2004 22:31:13 +0000 (GMT) +Received: from [128.137.187.34] (dhcp187-34.gene.com [128.137.187.34]) + by compton.gene.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id + iB3MVBuE027983 for ; + Fri, 3 Dec 2004 14:31:11 -0800 (PST) +Subject: Performance difference in similar queries +From: Kiran Mukhyala +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Message-Id: <1102113071.31836.107.camel@scifi.gene.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Fri, 03 Dec 2004 14:31:11 -0800 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/88 +X-Sequence-Number: 9463 + +Hi Folks, + + I have two queries that are of the form : +select ... from ... where ... in (list1) AND ... in (list2). The two +queries differ only in the size of list2 by 1, but their performances +are quite different. Query2 runs much faster than Query1. The queries +are: + +Query 1: +SELECT svm,pmodel_id,pseq_id FROM paprospect2 WHERE pseq_id in +(8880,10507,10600,10605,10724,10852 ...) AND pmodel_id in +(4757,8221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + +Query 2: +SELECT svm,pmodel_id,pseq_id FROM paprospect2 WHERE pseq_id in +(8880,10507,10600,10605,10724,10852 ...) AND pmodel_id in +(4757,8221,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + +=>Notice the extra zero at the end of query2. The size of list1 is 800 +and size of list2 is 49 in case of query1 and 50 in case of query2 + +The Query Plans are: + +QUERY PLAN 1: + +Index Scan using paprospect2_search1, paprospect2_search1, +paprospect2_search1, paprospect2_search1, paprospect2_search1, +paprospect2_search1, paprospect2_search1, paprospect2_search1 .......... +(cost=0.00..10959914.42 rows=45760 width=12) + + Index Cond: ((pmodel_id = 4757) OR (pmodel_id = 8221) OR (pmodel_id = +0) OR (pmodel_id = 0) OR (pmodel_id = 0) OR (pmodel_id = 0) OR +(pmodel_id = 0) OR (pmodel_id = 0) OR ...) + + Filter: ((pseq_id = 0) OR (pseq_id = 8880) OR (pseq_id = 10507) OR +(pseq_id = 10600) OR (pseq_id = 10605) OR ...) + +QUERY PLAN 2: + +Index Scan using +paprospect2_pseq_id_params_id,paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id, +paprospect2_pseq_id_params_id, paprospect2_pseq_id_params_id ....... +(cost=0.00..11050741.64 rows=46520 width=12) + + Index Cond: ((pseq_id = 0) OR (pseq_id = 8880) OR (pseq_id = 10507) +OR (pseq_id = 10600) OR (pseq_id = 10605) OR (pseq_id = 10724) OR +(pseq_id = 10852) OR (pseq_id = 10905) OR (pseq_id = 10945) OR (pseq_id += 10964)....) + +Filter: ((pmodel_id = 4757) OR (pmodel_id = 8221) OR (pmodel_id = 0) OR +(pmodel_id = 0) OR (pmodel_id = 0) OR ...) + +=> Notice that the Index, Index Cond. and Filter are different in the +two plans. +In short the query plans and performance are quite different although +the queries are similar. Can you please explain the difference in +performance? Thank you, + +-Kiran + + + + + +From pgsql-performance-owner@postgresql.org Fri Dec 3 22:48:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EEF543A3EA3 + for ; + Fri, 3 Dec 2004 22:48:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72719-07 + for ; + Fri, 3 Dec 2004 22:48:21 +0000 (GMT) +Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D3523A505F + for ; + Fri, 3 Dec 2004 22:48:20 +0000 (GMT) +Received: from [82.234.66.131] (mna75-1-82-234-66-131.fbx.proxad.net + [82.234.66.131] (may be forged)) (authenticated bits=0) + by mail.rilk.com (8.13.0/8.13.0) with ESMTP id iB3MmDNg013250 + (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) + for ; + Fri, 3 Dec 2004 23:48:17 +0100 (CET) +Mime-Version: 1.0 (Apple Message framework v619) +In-Reply-To: <200412031302.46772.josh@agliodbs.com> +References: <56141B8E-456B-11D9-9C9F-000A95DE2550@rilk.com> + <200412031302.46772.josh@agliodbs.com> +Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed +Message-Id: <6851768D-457D-11D9-9C9F-000A95DE2550@rilk.com> +Content-Transfer-Encoding: quoted-printable +From: =?ISO-8859-1?Q?Pailloncy_Jean-G=E9rard?= +Subject: Re: DB2 feature +Date: Fri, 3 Dec 2004 23:48:10 +0100 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619) +X-DCC--Metrics: mail.rilk.com ??; Body=1 Fuz1=1 Fuz2=1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/89 +X-Sequence-Number: 9464 + +>> The listing 2 example: +>> 1 =A0SELECT D_TAX, D_NEXT_O_ID +>> 2 =A0 =A0 INTO :dist_tax , :next_o_id +>> 3 =A0 =A0 FROM OLD TABLE ( UPDATE DISTRICT +>> 4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 SET =A0D_NEXT_O_ID =3D = +D_NEXT_O_ID + 1 +>> 5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 WHERE D_W_ID =3D :w_id +>> 6 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 AND D_ID =3D :d_id +>> 7 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ) AS OT +> +> A lot of this is non-standard SQL, so I can't really tell what DB2 is =20= + +> doing +> here. Can you explain it? + +Quote from the article at: +http://www-106.ibm.com/developerworks/db2/library/techarticle/dm=20 +-0411rielau/?ca=3Ddgr-lnxw06SQL-Speed +> First, DB2 deals with the DISTRICT table. Data needs to be returned =20= + +> and an update needs to be performed. Conventional wisdom states that =20= + +> this requires 2 SQL statements, and that the UPDATE ought to be done =20= + +> prior to the SELECT; otherwise deadlocks may occur as concurrency =20 +> increases. +> +> DB2 however supports a new SQL feature which is in the process of =20 +> being standardized. This feature allows access to what is known as =20 +> transition tables in triggers. The OLD TABLE transition table holds =20= + +> the original state of the affected rows before they are processed by =20= + +> the UPDATE or DELETE statement. The NEW TABLE transition table holds =20= + +> the affected rows immediately after an INSERT or UPDATE was processed. = +=20 +> That is the state prior to when AFTER triggers fire. Users with a =20 +> Microsoft or Sybase background may know these tables by the names =20 +> DELETED and INSERTED. + +So, if I understand they use only ONE query to get the UPDATE and the =20= + +SELECT of the old value. + +Cordialement, +Jean-G=E9rard Pailloncy + + +From pgsql-performance-owner@postgresql.org Sat Dec 4 01:53:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C15F63A5AC2 + for ; + Sat, 4 Dec 2004 01:53:18 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14065-03 + for ; + Sat, 4 Dec 2004 01:53:05 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.197]) + by svr1.postgresql.org (Postfix) with ESMTP id 776A53A4E6E + for ; + Sat, 4 Dec 2004 01:53:07 +0000 (GMT) +Received: by rproxy.gmail.com with SMTP id a36so973129rnf + for ; + Fri, 03 Dec 2004 17:53:07 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=tnaG555gEPCX3nIEDMKYJEhaCB+aafJXR1FfrnuyyAfuGu5gQrq1eKpeyPWIZdKor3IFiW5d1VqHGZiItpAOg47mpzjoB+HsCXlKaGEm4qJZr30meQgAEthpnruik3QvQcWSs62k6yqmMZUZcdXNR2ZrtYhtmft66UlHLkHWdq4= +Received: by 10.38.15.61 with SMTP id 61mr1707456rno; + Fri, 03 Dec 2004 17:53:07 -0800 (PST) +Received: by 10.38.126.16 with HTTP; Fri, 3 Dec 2004 17:53:07 -0800 (PST) +Message-ID: +Date: Fri, 3 Dec 2004 20:53:07 -0500 +From: Mike Rylander +Reply-To: Mike Rylander +To: "Joshua D. Drake" +Subject: Re: Alternatives to Dell? +Cc: Cott Lang , josh@agliodbs.com, + pgsql-performance@postgresql.org +In-Reply-To: <41B07A7A.8010904@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> + <41B07882.7060809@commandprompt.com> + <1102084419.3656.12.camel@localhost> + <41B07A7A.8010904@commandprompt.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/91 +X-Sequence-Number: 9466 + +On Fri, 03 Dec 2004 06:38:50 -0800, Joshua D. Drake + wrote: +> That's true :) One of the reasons the compaq's are expensive +> is they supposedly use a quad board, even for the dual machine. +> Which means a different opteron chip as well. + +I can confirm that. You have a choice of CPUs, but all the DL585s are +expandable to 4 procs if you get the 800 series Opterons. Each CPU +sits on it's own daughter board that links up the HyperTransport +busses between all the others. Each CPU card has (I think...) 8 slots +for DIMMS, for a max of 64G. + +> +> I don't know this for a fact, it is just what one of their +> "ahem" sales guys told me. +> + +At least in that case they were being accurate. ;) + + +-- +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Sat Dec 4 03:47:11 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 020913A5B2D + for ; + Sat, 4 Dec 2004 03:46:55 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34919-10 + for ; + Sat, 4 Dec 2004 03:46:41 +0000 (GMT) +Received: from smtp-gw-cl-c.dmv.com (smtp-gw-cl-c.dmv.com [216.240.97.41]) + by svr1.postgresql.org (Postfix) with ESMTP id 70BAE3A5B38 + for ; + Sat, 4 Dec 2004 03:46:44 +0000 (GMT) +Received: from mail-gw-cl-b.dmv.com (mail-gw-cl-b.dmv.com [216.240.97.39]) + by smtp-gw-cl-c.dmv.com (8.12.10/8.12.10) with ESMTP id iB43rnEo052028 + for ; + Fri, 3 Dec 2004 22:53:49 -0500 (EST) (envelope-from sven@dmv.com) +Received: from [64.45.134.154] (dogpound.dyndns.org [64.45.134.154]) + by mail-gw-cl-b.dmv.com (8.12.9/8.12.9) with ESMTP id iB43vJLR020738 + for ; + Fri, 3 Dec 2004 22:57:21 -0500 (EST) (envelope-from sven@dmv.com) +Message-ID: <41B13325.3070202@dmv.com> +Date: Fri, 03 Dec 2004 22:46:45 -0500 +From: Sven Willenberger +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Overhead of dynamic query in trigger +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/92 +X-Sequence-Number: 9467 + +(Originally asked in [General], realized that it would probably be +better asked in [Perform]: + +I am curious as to how much overhead building a dynamic query in a +trigger adds to the process. The example: + +Have a list of subcontractors, each of which gets unique pricing. There +is a total of roughly 100,000 items available and some 100 +subcontractors. The 2 design choices would be 100 tables (one for each +sub) at 100,000 rows or 1 table with 10,000,000 rows. + +Choice 1: +table has item number (indexed) and price + +Choice 2: +table has subcontractor id, item number, and price; index on +(subcontractorid, item number). + +Table of orders would have a trigger to insert line item cost: +----------------------------------- +Trigger Choice 1: +Select into thetable lookupprice from subcontractors where +subcontractorid = NEW.subcontractorid; + +thequery := ''Select price from '' || thetable.lookupprice || '' where +itemnumber = '' || NEW.itemnumber; + +FOR therow IN EXECUTE thequery LOOP + NEW.itemcost := therow.price; +END LOOP; +RETURN NEW; +----------------------------------- +Trigger Choice 2: +Select into thetable lookupprice from subcontractors where +subcontractorid = NEW.subcontractorid; + +Select into therow price from mastertable where subcontractorid = +NEW.subcontractorid and itemnumber = NEW.itemnumber; + +NEW.itemcost := therow.price; +RETURN NEW; +----------------------------------- + +Doing a select from the command line, the mastertable method (with id +and partno index) is faster than looking up a single item in a named +table (with partno index). At what point would Trigger Choice 2 fall +behind performance with Trigger Choice 1 (if ever)? Is there a way to +analyze the performance of dynamic queries? If I had only 10 +subcontractors or if I had 1000 subcontractors, at what point is the +overhead of building/executing a dynamic query negated by the amount of +time to look up both the subid and part number in one massive table? + +Thanks, + +Sven + +From pgsql-performance-owner@postgresql.org Sat Dec 4 13:37:41 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 96E643A5C34 + for ; + Sat, 4 Dec 2004 13:37:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 50335-05 + for ; + Sat, 4 Dec 2004 13:37:30 +0000 (GMT) +Received: from nitrogenio.carvalhaes.net (oxigenio.carvalhaes.net + [200.102.144.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 33A3D3A5C24 + for ; + Sat, 4 Dec 2004 13:37:31 +0000 (GMT) +Received: from [192.168.0.5] ([192.168.0.5]) (authenticated bits=0) + by nitrogenio.carvalhaes.net (8.12.11/8.12.11) with ESMTP id + iB4DT4iT004761 + for ; Sat, 4 Dec 2004 11:29:04 -0200 +Message-ID: <41B1BE1B.10301@carvalhaes.net> +Date: Sat, 04 Dec 2004 11:39:39 -0200 +From: Grupos +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Improve BULK insertion +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: quoted-printable +X-Carvalhaes-MailScanner-Information: Favor contactar o suporte t�cnico para maiores informa��es suporte@triade.com +X-Carvalhaes-MailScanner: Found to be clean +X-MailScanner-From: grupos@carvalhaes.net +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E9 hex) in message + header 'X-Carvalhaes-MailScanner-Information': + X-Carvalhaes-MailScanner-Information: Favor contactar o suporte + t\351cnico para maio... +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/94 +X-Sequence-Number: 9469 + +Hi ! + +I need to insert 500.000 records on a table frequently. It=B4s a bulk=20 +insertion from my applicatoin. +I am with a very poor performance. PostgreSQL insert very fast until the = + +tuple 200.000 and after it the insertion starts to be really slow. +I am seeing on the log and there is a lot of transaction logs, something = + +like : + +2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000012= +" +2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000013= +" +2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000011= +" +2004-12-04 11:14:04 LOG: recycled transaction log file "0000000600000015= +" +2004-12-04 11:14:04 LOG: recycled transaction log file "0000000600000014= +" +2004-12-04 11:19:08 LOG: recycled transaction log file "0000000600000016= +" +2004-12-04 11:19:08 LOG: recycled transaction log file "0000000600000017= +" +2004-12-04 11:24:10 LOG: recycled transaction log file "0000000600000018= +" + +How can I configure PostgreSQL to have a better performance on this bulk = + +insertions ? I already increased the memory values. + +My data: +Conectiva linux kernel 2.6.9 +PostgreSQL 7.4.6 - 1,5gb memory +max_connections =3D 30 +shared_buffers =3D 30000 +sort_mem =3D 32768 +vacuum_mem =3D 32768 +max_fsm_pages =3D 30000 +max_fsm_relations =3D 1500 + +The other configurations are default. + + +Cheers, + +Rodrigo Carvalhaes =20 + + + +From pgsql-performance-owner@postgresql.org Sat Dec 4 15:01:00 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C9D03A3B1E + for ; + Sat, 4 Dec 2004 15:00:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69908-10 + for ; + Sat, 4 Dec 2004 15:00:50 +0000 (GMT) +Received: from fdd00lnhub.fds.com (external.fds.com [208.15.90.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 043CE3A2B22 + for ; + Sat, 4 Dec 2004 15:00:50 +0000 (GMT) +Importance: Normal +X-Priority: 3 (Normal) +Subject: Re: Improve BULK insertion +MIME-Version: 1.0 +From: Patrick Hatcher +To: "Christopher Browne +Cc: pgsql-performance@postgresql.org +Date: Sat, 4 Dec 2004 06:47:17 -0800 +Message-ID: + +X-MIMETrack: Serialize by Notes Server on FDD02MCOMLN01/MCOM/SVR/FDD(Release + 6.5.2|June 01, 2004) at 12/04/2004 06:47:17 AM, + Serialize complete at 12/04/2004 06:47:18 AM, + Itemize by Notes Server on FDD02MCOMLN01/MCOM/SVR/FDD(Release + 6.5.2|June 01, 2004) at 12/04/2004 06:47:18 AM, + Serialize by Router on FDD00LNHUB/FSG/SVR/FDD(Release 6.5.2|June 01, + 2004) at 12/04/2004 10:00:00 AM, + Serialize complete at 12/04/2004 10:00:00 AM +Content-Transfer-Encoding: quoted-printable +MIME-Version: 1.0 +Content-Type: text/html; + charset=ISO-8859-1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.946 tagged_above=0 required=5 tests=HTML_20_30, + HTML_MESSAGE, HTML_MIME_NO_HTML_TAG, MIME_HTML_ONLY, PRIORITY_NO_NAME +X-Spam-Level: ** +X-Archive-Number: 200412/96 +X-Sequence-Number: 9471 + +
I do mass inserts daily into PG.  I drop the all indexes e= +xcept my primary key and then use the COPY FROM command.  This usually= + takes less than 30 seconds.  I spend more time waiting for indexes to= + recreate.


Patrick Hatcher
Macys.Com
 -----pgsql-performance-owner@postgresql.org wrote: = +-----

To: pgsql-performance@postgresql.org
From: Christoph= +er Browne <cbbrowne@acm.org>
Sent by: pgsql-performance-owner@post= +gresql.org
Date: 2004-12-04 06:48AM
Subject: Re: [PERFORM] Improve BU= +LK insertion

In the last exciting = +episode, grupos@carvalhaes.net (Grupos) wrote:
> Hi !
>
>= + I need to insert 500.000 records on a table frequently. It=B4s a bulk
&= +gt; insertion from my applicatoin.
> I am with a very poor performanc= +e. PostgreSQL insert very fast until
> the tuple 200.000 and after it= + the insertion starts to be really slow.
> I am seeing on the log and= + there is a lot of transaction logs,
> something like :
>
&g= +t; 2004-12-04 11:08:59 LOG:  recycled transaction log file "0000000600= +000012"
> 2004-12-04 11:08:59 LOG:  recycled transaction log fil= +e "0000000600000013"
> 2004-12-04 11:08:59 LOG:  recycled transa= +ction log file "0000000600000011"
> 2004-12-04 11:14:04 LOG:  re= +cycled transaction log file "0000000600000015"
> 2004-12-04 11:14:04 = +LOG:  recycled transaction log file "0000000600000014"
> 2004-12= +-04 11:19:08 LOG:  recycled transaction log file "0000000600000016"> 2004-12-04 11:19:08 LOG:  recycled transaction log file "0000000= +600000017"
> 2004-12-04 11:24:10 LOG:  recycled transaction log = +file "0000000600000018"

It is entirely normal for there to be a lot = +of transaction log file
recycling when bulk inserts are taking place; th= +at goes through a lot
of transaction logs.

> How can I configu= +re PostgreSQL to have a better performance on this
> bulk insertions = +? I already increased the memory values.

Memory is, as likely as not= +, NOT the issue.

Two questions:

1.  How are you doing t= +he inserts?  Via INSERT statements?  Or
    via COP= +Y statements?  What sort of transaction grouping
    is = +involved?

    COPY is way faster than INSERT, and groupin= +g plenty of updates
    into a single transaction is generall= +y a "win."

2.  What is the schema like?  Does the table h= +ave a foreign key
    constraint?  Does it have a bunch = +of indices?

    If there should eventually be lots of ind= +ices, it tends to be
    faster to create the table with none= +/minimal indices, and add
    indexes afterwards, as long as = +your "load" process can be trusted
    to not break "unique" = +constraints...

    If there is some secondary table with = +a foreign key constraint,
    and =5Fthat=5F table is growing= +, it is possible that a sequential
    scan is being used to = +search the secondary table where, if you
    did an ANALYZE o= +n that table, an index scan would be preferred
    once it gr= +ew to larger size...

There isn't a particular reason for PostgreSQL = +to "hit a wall" upon
seeing 200K records; I and coworkers routinely load= + database dumps
that have millions of (sometimes pretty fat) records, an= +d they don't
"choke."  That's true whether talking about loading th= +ings onto my
(somewhat wimpy) desktop PC, or a SMP Xeon system with a sm= +all RAID
array, or higher end stuff involving high end SMP and EMC disk = +arrays.
The latter obviously being orders of magnitude faster than deskt= +op
equipment :-).
--
(format nil "~S@~S" "cbbrowne" "acm.org")htt= +p://www3.sympatico.ca/cbbrowne/unix.html
Rules of the  Evil Ove= +rlord #207. "Employees will  have conjugal visit
trailers which &nb= +sp;they may use provided  they call in  a replacement and
sign= + out on  the timesheet. Given this, anyone caught  making out in = +a
closet  while  leaving  their   station  unmo= +nitored  will  be  shot."
<http://www.eviloverlord.com/>

--= +-------------------------(end of broadcast)---------------------------
T= +IP 7: don't forget to increase your free space map settings
= + +From pgsql-performance-owner@postgresql.org Sat Dec 4 14:50:16 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6426D3A5C43 + for ; + Sat, 4 Dec 2004 14:50:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68690-09 + for ; + Sat, 4 Dec 2004 14:50:04 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 00E8E3A5C2D + for ; + Sat, 4 Dec 2004 14:50:07 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id C46213192A; Sat, 4 Dec 2004 15:50:07 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Improve BULK insertion +Date: Sat, 04 Dec 2004 09:48:15 -0500 +Organization: cbbrowne Computing Inc +Lines: 67 +Message-ID: +References: <41B1BE1B.10301@carvalhaes.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:EXqqnDJxdQ7XffFO8mth6mWPyB4= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/95 +X-Sequence-Number: 9470 + +In the last exciting episode, grupos@carvalhaes.net (Grupos) wrote: +> Hi ! +> +> I need to insert 500.000 records on a table frequently. It�s a bulk +> insertion from my applicatoin. +> I am with a very poor performance. PostgreSQL insert very fast until +> the tuple 200.000 and after it the insertion starts to be really slow. +> I am seeing on the log and there is a lot of transaction logs, +> something like : +> +> 2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000012" +> 2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000013" +> 2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000011" +> 2004-12-04 11:14:04 LOG: recycled transaction log file "0000000600000015" +> 2004-12-04 11:14:04 LOG: recycled transaction log file "0000000600000014" +> 2004-12-04 11:19:08 LOG: recycled transaction log file "0000000600000016" +> 2004-12-04 11:19:08 LOG: recycled transaction log file "0000000600000017" +> 2004-12-04 11:24:10 LOG: recycled transaction log file "0000000600000018" + +It is entirely normal for there to be a lot of transaction log file +recycling when bulk inserts are taking place; that goes through a lot +of transaction logs. + +> How can I configure PostgreSQL to have a better performance on this +> bulk insertions ? I already increased the memory values. + +Memory is, as likely as not, NOT the issue. + +Two questions: + + 1. How are you doing the inserts? Via INSERT statements? Or + via COPY statements? What sort of transaction grouping + is involved? + + COPY is way faster than INSERT, and grouping plenty of updates + into a single transaction is generally a "win." + + 2. What is the schema like? Does the table have a foreign key + constraint? Does it have a bunch of indices? + + If there should eventually be lots of indices, it tends to be + faster to create the table with none/minimal indices, and add + indexes afterwards, as long as your "load" process can be trusted + to not break "unique" constraints... + + If there is some secondary table with a foreign key constraint, + and _that_ table is growing, it is possible that a sequential + scan is being used to search the secondary table where, if you + did an ANALYZE on that table, an index scan would be preferred + once it grew to larger size... + +There isn't a particular reason for PostgreSQL to "hit a wall" upon +seeing 200K records; I and coworkers routinely load database dumps +that have millions of (sometimes pretty fat) records, and they don't +"choke." That's true whether talking about loading things onto my +(somewhat wimpy) desktop PC, or a SMP Xeon system with a small RAID +array, or higher end stuff involving high end SMP and EMC disk arrays. +The latter obviously being orders of magnitude faster than desktop +equipment :-). +-- +(format nil "~S@~S" "cbbrowne" "acm.org") +http://www3.sympatico.ca/cbbrowne/unix.html +Rules of the Evil Overlord #207. "Employees will have conjugal visit +trailers which they may use provided they call in a replacement and +sign out on the timesheet. Given this, anyone caught making out in a +closet while leaving their station unmonitored will be shot." + + +From pgsql-performance-owner@postgresql.org Sat Dec 4 16:56:54 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 73F2B3A5C1E + for ; + Sat, 4 Dec 2004 16:56:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93344-05 + for ; + Sat, 4 Dec 2004 16:56:44 +0000 (GMT) +Received: from web51306.mail.yahoo.com (web51306.mail.yahoo.com + [206.190.38.172]) + by svr1.postgresql.org (Postfix) with SMTP id 6128D3A2B22 + for ; + Sat, 4 Dec 2004 16:56:43 +0000 (GMT) +Received: (qmail 75037 invoked by uid 60001); 4 Dec 2004 16:56:41 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=A/n3CK7ff0KQ0E05kjekjaA88x5Q3JJRclp+R6+/pALXWxiWlMpCmJe2x1cJ+YKG6KhS1NXQ+PEMkF+KR1u65bQVGJJNAOlKZhC0IdWYELJDRLP3YpjA+SW7bLhtCqn0nlRyiwMjsHed5umMWQSwzG/h0L5BJlMdwLlfUYm7Bgg= + ; +Message-ID: <20041204165641.75035.qmail@web51306.mail.yahoo.com> +Received: from [65.218.182.242] by web51306.mail.yahoo.com via HTTP; + Sat, 04 Dec 2004 08:56:41 PST +Date: Sat, 4 Dec 2004 08:56:41 -0800 (PST) +From: sarlav kumar +Subject: lock problem +To: pgsqlperform +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-241292561-1102179401=:74288" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.415 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_10_20, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/97 +X-Sequence-Number: 9472 + +--0-241292561-1102179401=:74288 +Content-Type: text/plain; charset=us-ascii + +Hi All, + +Thanks for the information on replication tools!! + +Now, I have a question regarding locking tables and updating tables that have a relationship to the locked table. + +I opened up two pgsql windows logged in using same userid. +Let's say I lock a table "customerdata" on one window. +begin; +lock table customerdata; + +Then in the other window,I want to make an update to table "customer". +begin; +update customer set status=0 where id=111; + +The relation ship between the two tables is as follows +customerdata.uid is FK on customer.id. There are no triggers that will try to update customerdata table when the above update statement is issued. + +My problem is the update does not continue unless the lock on customerdata is released. Is it because the lock statement does a lock on all related tables? Is it possible to lock only the particular table we want to lock and not the related tables? + +Any help would be appreciated. Thanks in advance. + +Thanks, +Saranya + + + +--------------------------------- +Do you Yahoo!? + Yahoo! Mail - Easier than ever with enhanced search. Learn more. +--0-241292561-1102179401=:74288 +Content-Type: text/html; charset=us-ascii + +
Hi All,

Thanks for the information on replication tools!!
+
 
+
Now, I have a question regarding locking tables and updating tables that have a relationship to the locked table.

I opened up two pgsql windows logged in using same userid.
Let's say I lock a table "customerdata" on one window.
begin;
lock table customerdata;

Then in the other window,I want to make an update to table "customer".
begin;
update customer set status=0 where id=111;

The relation ship between the two tables is as follows
customerdata.uid is FK on customer.id. There are no triggers that will try to update customerdata table when the above update statement is issued.

My problem is the update does not continue unless the lock on customerdata is released. Is it because the lock statement does a lock on all related tables? Is it possible to lock only the particular table we want to lock and not the related tables?

Any help would be appreciated. Thanks in advance.

Thanks,
Saranya

+


Do you Yahoo!?
+Yahoo! Mail - Easier than ever with enhanced search. Learn more. +--0-241292561-1102179401=:74288-- + +From pgsql-performance-owner@postgresql.org Sat Dec 4 17:22:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8EC7B3A5C73 + for ; + Sat, 4 Dec 2004 17:22:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00317-02 + for ; + Sat, 4 Dec 2004 17:22:31 +0000 (GMT) +Received: from jinx.internetstaff.com (unknown [63.214.174.241]) + by svr1.postgresql.org (Postfix) with ESMTP id F40273A2B22 + for ; + Sat, 4 Dec 2004 17:22:31 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by jinx.internetstaff.com (Postfix) with ESMTP + id 2D18A4BC3C8; Sat, 4 Dec 2004 10:22:30 -0700 (MST) +Received: from jinx.internetstaff.com ([127.0.0.1]) + by localhost (jinx [127.0.0.1]) (amavisd-new, port 10024) with LMTP + id 05472-05-15; Sat, 4 Dec 2004 10:22:29 -0700 (MST) +Received: from blackbox.internetstaff.com (ip24-251-65-14.ph.ph.cox.net + [24.251.65.14]) by jinx.internetstaff.com (Postfix) with ESMTP + id 541D34BC39E; Sat, 4 Dec 2004 10:22:29 -0700 (MST) +Subject: Re: Alternatives to Dell? +From: Cott Lang +To: Mike Rylander +Cc: "Joshua D. Drake" , josh@agliodbs.com, + pgsql-performance@postgresql.org +In-Reply-To: +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> + <41B07882.7060809@commandprompt.com> + <1102084419.3656.12.camel@localhost> + <41B07A7A.8010904@commandprompt.com> + +Content-Type: text/plain +Date: Sat, 04 Dec 2004 10:22:24 -0700 +Message-Id: <1102180944.8032.2.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-3) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at internetstaff.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/98 +X-Sequence-Number: 9473 + +On Fri, 2004-12-03 at 20:53 -0500, Mike Rylander wrote: +> On Fri, 03 Dec 2004 06:38:50 -0800, Joshua D. Drake +> wrote: +> > That's true :) One of the reasons the compaq's are expensive +> > is they supposedly use a quad board, even for the dual machine. +> > Which means a different opteron chip as well. +> +> I can confirm that. You have a choice of CPUs, but all the DL585s are +> expandable to 4 procs if you get the 800 series Opterons. Each CPU +> sits on it's own daughter board that links up the HyperTransport +> busses between all the others. Each CPU card has (I think...) 8 slots +> for DIMMS, for a max of 64G. + +Why would I want that giant beast when a 1U will do for dual +opterons? :) + +The V40zs have dual procs on the main board with a daughter board for +the other two procs. Each CPU has 4 DIMM slots. Sun has the daughter +boards for an outrageous price, but you can buy white box Newisys +daughter boards for a lot less. + +The 64GB of 2GB DIMMs I am jealous of, other than that, the DL585 is so +outrageously priced I never considered it. + + +From pgsql-performance-owner@postgresql.org Sat Dec 4 17:35:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E86D33A5C1E + for ; + Sat, 4 Dec 2004 17:35:49 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02183-06 + for ; + Sat, 4 Dec 2004 17:35:44 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id 243143A5C48 + for ; + Sat, 4 Dec 2004 17:35:44 +0000 (GMT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id 4C37C35649; Sat, 4 Dec 2004 09:34:31 -0800 (PST) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id 4AC1135647; Sat, 4 Dec 2004 09:34:31 -0800 (PST) +Date: Sat, 4 Dec 2004 09:34:31 -0800 (PST) +From: Stephan Szabo +To: sarlav kumar +Cc: pgsqlperform +Subject: Re: lock problem +In-Reply-To: <20041204165641.75035.qmail@web51306.mail.yahoo.com> +Message-ID: <20041204093004.D37548@megazone.bigpanda.com> +References: <20041204165641.75035.qmail@web51306.mail.yahoo.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/99 +X-Sequence-Number: 9474 + +On Sat, 4 Dec 2004, sarlav kumar wrote: + +> Thanks for the information on replication tools!! +> Now, I have a question regarding locking tables and updating tables +> that have a relationship to the locked table. +> +> I opened up two pgsql windows logged in using same userid. +> Let's say I lock a table "customerdata" on one window. +> begin; +> lock table customerdata; +> +> Then in the other window,I want to make an update to table "customer". +> begin; +> update customer set status=0 where id=111; +> +> The relation ship between the two tables is as follows +> customerdata.uid is FK on customer.id. There are no triggers that will +> try to update customerdata table when the above update statement is +> issued. +> +> My problem is the update does not continue unless the lock on +> customerdata is released. Is it because the lock statement does a lock +> on all related tables? Is it possible to lock only the particular table +> we want to lock and not the related tables? + +The no action foreign key triggers grab a Row Share on the referencing +table which conflicts with the Exclusive lock that LOCK TABLE takes by +default. Depending on what you're trying to prevent, you may be able to +ask lock table for a lesser lock (see the list and descriptions here: +http://www.postgresql.org/docs/7.4/static/explicit-locking.html#LOCKING-TABLES +). + +From pgsql-performance-owner@postgresql.org Sat Dec 4 19:17:32 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9B1AE3A5C9A + for ; + Sat, 4 Dec 2004 19:17:31 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33838-02 + for ; + Sat, 4 Dec 2004 19:17:24 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 679E23A5C86 + for ; + Sat, 4 Dec 2004 19:17:23 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6745021; Sat, 04 Dec 2004 11:18:54 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Improve BULK insertion +Date: Sat, 4 Dec 2004 11:14:18 -0800 +User-Agent: KMail/1.6.2 +Cc: Grupos +References: <41B1BE1B.10301@carvalhaes.net> +In-Reply-To: <41B1BE1B.10301@carvalhaes.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412041114.18460.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/100 +X-Sequence-Number: 9475 + +Rodrigo, + +> I need to insert 500.000 records on a table frequently. It=B4s a bulk +> insertion from my applicatoin. +> I am with a very poor performance. PostgreSQL insert very fast until the +> tuple 200.000 and after it the insertion starts to be really slow. +> I am seeing on the log and there is a lot of transaction logs, something + +In addition to what Chris Browne asked: +What's your transaction log setup? Are your database transaction logs on = +a=20 +seperate disk resource? What is checkpoint_segments and checkpoint_timeou= +t=20 +set to? + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sun Dec 5 02:45:13 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 89B333A5D55 + for ; + Sun, 5 Dec 2004 02:45:08 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36291-05 + for ; + Sun, 5 Dec 2004 02:45:01 +0000 (GMT) +Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B05B3A5D4C + for ; + Sun, 5 Dec 2004 02:45:01 +0000 (GMT) +Received: from grownups (c-24-21-166-228.client.comcast.net[24.21.166.228]) + by comcast.net (rwcrmhc13) with SMTP + id <2004120502450001500n3a3oe>; Sun, 5 Dec 2004 02:45:00 +0000 +Message-ID: <000a01c4da74$84e072e0$0200a8c0@grownups> +From: "Stacy White" +To: +Subject: Partitioned table performance +Date: Sat, 4 Dec 2004 18:45:44 -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.1409 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/101 +X-Sequence-Number: 9476 + +We're working with a Postgres database that includes a fairly large table +(100M rows, increasing at around 2M per day). + +In some cases we've seen some increased performance in tests by splitting +the table into several smaller tables. Both 'UNION ALL' views, and the +superclass/subclass scheme work well at pruning down the set of rows a query +uses, but they seem to introduce a large performance hit to the time to +process each row (~50% for superclass/subclass, and ~150% for union views). + +Is this to be expected? Or is this a problem with our test setup? + +I've listed details on our tests at the end of this message. The results +are similar with our larger tables; the overhead appears to be per record +returned from the subquery/subclass; it's not a constant overhead per query. +Our production instance is running 7.4.2, but the results are the same on +8.0. + +For reference, I tested with this setup (for the superclass/subclass +partitioning scheme): + + CREATE TABLE super_foo ( partition NUMERIC, bar NUMERIC ); + ANALYZE super_foo ; + + CREATE TABLE sub_foo1 () INHERITS ( super_foo ); + INSERT INTO sub_foo1 VALUES ( 1, 1 ); + -- repeat insert until sub_foo1 has 1,000,000 rows + CREATE INDEX idx_subfoo1_partition ON sub_foo1 ( partition ); + ANALYZE sub_foo1 ; + + CREATE TABLE sub_foo2 () INHERITS ( super_foo ); + INSERT INTO sub_foo2 VALUES ( 2, 1 ); + -- repeat insert until sub_foo2 has 1,000,000 rows + CREATE INDEX idx_subfoo2_partition ON sub_foo2 ( partition ); + ANALYZE sub_foo2 ; + +and this setup for the union all scheme: + + CREATE TABLE union_foo1 ( bar NUMERIC ); + INSERT INTO union_foo1 VALUES ( 1 ) ; + -- repeat insert until union_foo1 has 1,000,000 rows + ANALYZE union_foo1 ; + + CREATE TABLE union_foo2 ( bar NUMERIC ); + INSERT INTO union_foo2 VALUES ( 1 ) ; + -- repeat insert until union_foo2 has 1,000,000 rows + ANALYZE union_foo2 ; + + CREATE VIEW union_foo AS + SELECT 1 AS partition, * FROM union_foo1 + UNION ALL + SELECT 2 AS partition, * FROM union_foo2 ; + +The partition pruning works marvelously: + + EXPLAIN SELECT SUM(bar) FROM super_foo WHERE partition = 2 ; + QUERY PLAN + --------------------------------------------------------------------------- +---------------------------------- + Aggregate (cost=21899.02..21899.02 rows=1 width=32) + -> Append (cost=0.00..19399.01 rows=1000002 width=32) + -> Seq Scan on super_foo (cost=0.00..0.00 rows=1 width=32) + Filter: (partition = 2::numeric) + -> Index Scan using idx_subfoo1_partition on sub_foo1 super_foo +(cost=0.00..2.01 rows=1 width=10) + Index Cond: (partition = 2::numeric) + -> Seq Scan on sub_foo2 super_foo (cost=0.00..19397.00 +rows=1000000 width=10) + Filter: (partition = 2::numeric) + +and + + EXPLAIN SELECT SUM(bar) FROM union_foo WHERE partition = 2 ; + QUERY PLAN + --------------------------------------------------------------------------- +---------------------- + Aggregate (cost=75819.15..75819.15 rows=1 width=32) + -> Subquery Scan union_foo (cost=0.00..70818.60 rows=2000220 width=32) + -> Append (cost=0.00..50816.40 rows=2000220 width=10) + -> Subquery Scan "*SELECT* 1" (cost=0.00..25408.20 +rows=1000110 width=10) + -> Result (cost=0.00..15407.10 rows=1000110 width=10) + One-Time Filter: false + -> Seq Scan on union_foo1 (cost=0.00..15407.10 +rows=1000110 width=10) + -> Subquery Scan "*SELECT* 2" (cost=0.00..25408.20 +rows=1000110 width=10) + -> Seq Scan on union_foo2 (cost=0.00..15407.10 +rows=1000110 width=10) + + +But you can see a fair amount of overhead, espcially in the case of the +union view: + + SELECT SUM(bar) FROM sub_foo1 UNION ALL SELECT SUM(bar) FROM sub_foo2 ; + Time: 2291.637 ms + + SELECT SUM(bar) FROM union_foo1 UNION ALL SELECT SUM(bar) FROM union_foo2 +; + Time: 2248.225 ms + + SELECT SUM(bar) FROM super_foo ; + Time: 3329.953 ms + + SELECT SUM(bar) FROM union_foo ; + Time: 5267.742 ms + + + SELECT SUM(bar) FROM sub_foo2 ; + Time: 1124.496 ms + + SELECT SUM(bar) FROM union_foo2 ; + Time: 1090.616 ms + + SELECT SUM(bar) FROM super_foo WHERE partition = 2 ; + Time: 2137.767 ms + + SELECT SUM(bar) FROM union_foo WHERE partition = 2 ; + Time: 2774.887 ms + + +From pgsql-performance-owner@postgresql.org Sun Dec 5 19:44:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 723F73A5E0C + for ; + Sun, 5 Dec 2004 19:44:33 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56222-05 + for ; + Sun, 5 Dec 2004 19:44:21 +0000 (GMT) +Received: from nitrogenio.carvalhaes.net (oxigenio.carvalhaes.net + [200.102.144.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A0A3B3A5E05 + for ; + Sun, 5 Dec 2004 19:44:19 +0000 (GMT) +Received: from [192.168.0.10] ([200.215.220.2]) (authenticated bits=0) + by nitrogenio.carvalhaes.net (8.12.11/8.12.11) with ESMTP id + iB5JZhAd014978 + for ; Sun, 5 Dec 2004 17:35:43 -0200 +Message-ID: <41B364E8.3060406@carvalhaes.net> +Date: Sun, 05 Dec 2004 17:43:36 -0200 +From: Rodrigo Carvalhaes +Reply-To: grupos@carvalhaes.net +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: pg_restore taking 4 hours! +References: <41ADA82A.7070405@carvalhaes.net> + <200412011955.23543.ghodechhap@ghodechhap.net> +In-Reply-To: <200412011955.23543.ghodechhap@ghodechhap.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Carvalhaes-MailScanner-Information: Favor contactar o suporte t�cnico para maiores informa��es suporte@triade.com +X-Carvalhaes-MailScanner: Found to be clean +X-MailScanner-From: grupos@carvalhaes.net +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E9 hex) in message + header 'X-Carvalhaes-MailScanner-Information': + X-Carvalhaes-MailScanner-Information: Favor contactar o suporte + t\351cnico para maio... +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/102 +X-Sequence-Number: 9477 + +Hi ! + +Thanks for the lots of tips that I received on this matter. + +Some points: + +1. I bumped the sort_mem and vaccum_mem to 202800 (200mb each) and the +performance was quite the same , the total difference was 10 minutes +2. I made the restore without the index and the total time was 3 hours +so, I don't think that the botle neck is the index creation +3. I changed my max_fsm_pages to 30000 and max_fsm_relations = 2000 as +was recommended on the vacuum analyze but I had no significante change +on the performance. +4. I made the backup with pg_dump -Fc and -Ft . The performance of -Ft +was better (around 10%), maybe because the data it's already uncompressed. + +I am thinking that the key point on this delay is the converstions from +char fields because this database is full of char fields, see below one +structure of one table + +There is something more that I can try to improve this performance? + +Cheers (and thanks for all the oppinions) + +Rodrigo Carvalhaes + +dadosadv=# \d sb1010 + Table +"public.sb1010" + Column | Type +| Modifiers + +------------+------------------+--------------------------------------------------------------------------------------------- +---------------- + b1_filial | character(2) | not null default ' '::bpchar + b1_cod | character(15) | not null default ' '::bpchar + b1_desc | character(30) | not null default +' '::bpchar + b1_tipo | character(2) | not null default ' '::bpchar + b1_codite | character(27) | not null default +' '::bpchar + b1_um | character(2) | not null default ' '::bpchar + b1_locpad | character(2) | not null default ' '::bpchar + b1_grupo | character(4) | not null default ' '::bpchar + b1_picm | double precision | not null default 0.0 + b1_ipi | double precision | not null default 0.0 + b1_posipi | character(10) | not null default ' '::bpchar + b1_especie | double precision | not null default 0.0 + b1_ex_ncm | character(3) | not null default ' '::bpchar + b1_ex_nbm | character(3) | not null default ' '::bpchar + b1_aliqiss | double precision | not null default 0.0 + b1_codiss | character(8) | not null default ' '::bpchar + b1_te | character(3) | not null default ' '::bpchar + b1_ts | character(3) | not null default ' '::bpchar + b1_picmret | double precision | not null default 0.0 + b1_picment | double precision | not null default 0.0 + b1_impzfrc | character(1) | not null default ' '::bpchar + b1_bitmap | character(8) | not null default ' '::bpchar + b1_segum | character(2) | not null default ' '::bpchar + b1_conv | double precision | not null default 0.0 + b1_tipconv | character(1) | not null default ' '::bpchar + b1_alter | character(15) | not null default ' '::bpchar + b1_qe | double precision | not null default 0.0 + b1_prv1 | double precision | not null default 0.0 + b1_emin | double precision | not null default 0.0 + b1_custd | double precision | not null default 0.0 + b1_mcustd | character(1) | not null default ' '::bpchar + b1_uprc | double precision | not null default 0.0 + b1_ucom | character(8) | not null default ' '::bpchar + b1_peso | double precision | not null default 0.0 + b1_pesob | double precision | not null default 0.0 + b1_estseg | double precision | not null default 0.0 + b1_estfor | character(3) | not null default ' '::bpchar + b1_forprz | character(3) | not null default ' '::bpchar + b1_pe | double precision | not null default 0.0 + b1_tipe | character(1) | not null default ' '::bpchar + b1_le | double precision | not null default 0.0 + b1_lm | double precision | not null default 0.0 + b1_conta | character(20) | not null default ' +'::bpchar + b1_cc | character(9) | not null default ' '::bpchar + b1_toler | double precision | not null default 0.0 + b1_itemcc | character(9) | not null default ' '::bpchar + b1_familia | character(1) | not null default ' '::bpchar + b1_proc | character(6) | not null default ' '::bpchar + b1_lojproc | character(2) | not null default ' '::bpchar + b1_qb | double precision | not null default 0.0 + b1_apropri | character(1) | not null default ' '::bpchar + b1_fantasm | character(1) | not null default ' '::bpchar + b1_tipodec | character(1) | not null default ' '::bpchar + b1_origem | character(2) | not null default ' '::bpchar + b1_clasfis | character(2) | not null default ' '::bpchar + b1_datref | character(8) | not null default ' '::bpchar + b1_rastro | character(1) | not null default ' '::bpchar + b1_urev | character(8) | not null default ' '::bpchar + b1_foraest | character(1) | not null default ' '::bpchar + b1_comis | double precision | not null default 0.0 + b1_mono | character(1) | not null default ' '::bpchar + b1_mrp | character(1) | not null default ' '::bpchar + b1_perinv | double precision | not null default 0.0 + b1_dtrefp1 | character(8) | not null default ' '::bpchar + b1_grtrib | character(3) | not null default ' '::bpchar + b1_notamin | double precision | not null default 0.0 + b1_prvalid | double precision | not null default 0.0 + b1_numcop | double precision | not null default 0.0 + b1_contsoc | character(1) | not null default ' '::bpchar + b1_conini | character(8) | not null default ' '::bpchar + b1_irrf | character(1) | not null default ' '::bpchar + b1_codbar | character(15) | not null default ' '::bpchar + b1_grade | character(1) | not null default ' '::bpchar + b1_formlot | character(3) | not null default ' '::bpchar + b1_localiz | character(1) | not null default ' '::bpchar + b1_fpcod | character(2) | not null default ' '::bpchar + b1_operpad | character(2) | not null default ' '::bpchar + b1_contrat | character(1) | not null default ' '::bpchar + b1_desc_p | character(6) | not null default ' '::bpchar + b1_desc_gi | character(6) | not null default ' '::bpchar + b1_desc_i | character(6) | not null default ' '::bpchar + b1_vlrefus | double precision | not null default 0.0 + b1_import | character(1) | not null default ' '::bpchar + b1_opc | character(80) | not null default ' + '::bpchar + b1_anuente | character(1) | not null default ' '::bpchar + b1_codobs | character(6) | not null default ' '::bpchar + b1_sitprod | character(2) | not null default ' '::bpchar + b1_fabric | character(20) | not null default ' +'::bpchar + b1_modelo | character(15) | not null default ' '::bpchar + b1_setor | character(2) | not null default ' '::bpchar + b1_balanca | character(1) | not null default ' '::bpchar + b1_tecla | character(3) | not null default ' '::bpchar + b1_prodpai | character(15) | not null default ' '::bpchar + b1_tipocq | character(1) | not null default ' '::bpchar + b1_solicit | character(1) | not null default ' '::bpchar + b1_grupcom | character(6) | not null default ' '::bpchar + b1_numcqpr | double precision | not null default 0.0 + b1_contcqp | double precision | not null default 0.0 + b1_revatu | character(3) | not null default ' '::bpchar + b1_inss | character(1) | not null default ' '::bpchar + b1_codemb | character(20) | not null default ' +'::bpchar + b1_especif | character(80) | not null default ' + '::bpchar + b1_mat_pri | character(20) | not null default ' +'::bpchar + b1_redinss | double precision | not null default 0.0 + b1_nalncca | character(7) | not null default ' '::bpchar + b1_aladi | character(3) | not null default ' '::bpchar + b1_nalsh | character(8) | not null default ' '::bpchar + b1_redirrf | double precision | not null default 0.0 + b1_tab_ipi | character(2) | not null default ' '::bpchar + b1_grudes | character(3) | not null default ' '::bpchar + b1_datasub | character(8) | not null default ' '::bpchar + b1_pcsll | double precision | not null default 0.0 + b1_pcofins | double precision | not null default 0.0 + b1_ppis | double precision | not null default 0.0 + b1_mtbf | double precision | not null default 0.0 + b1_mttr | double precision | not null default 0.0 + b1_flagsug | character(1) | not null default ' '::bpchar + b1_classve | character(1) | not null default ' '::bpchar + b1_midia | character(1) | not null default ' '::bpchar + b1_midia | character(1) | not null default ' '::bpchar + b1_qtmidia | double precision | not null default 0.0 + b1_vlr_ipi | double precision | not null default 0.0 + b1_envobr | character(1) | not null default ' '::bpchar + b1_qtdser | double precision | not null default 0.0 + b1_serie | character(20) | not null default ' +'::bpchar + b1_faixas | double precision | not null default 0.0 + b1_nropag | double precision | not null default 0.0 + b1_isbn | character(10) | not null default ' '::bpchar + b1_titorig | character(50) | not null default +' '::bpchar + b1_lingua | character(20) | not null default ' +'::bpchar + b1_edicao | character(3) | not null default ' '::bpchar + b1_obsisbn | character(40) | not null default +' '::bpchar + b1_clvl | character(9) | not null default ' '::bpchar + b1_ativo | character(1) | not null default ' '::bpchar + b1_pesbru | double precision | not null default 0.0 + b1_tipcar | character(6) | not null default ' '::bpchar + b1_vlr_icm | double precision | not null default 0.0 + b1_vlrselo | double precision | not null default 0.0 + b1_codnor | character(3) | not null default ' '::bpchar + b1_corpri | character(6) | not null default ' '::bpchar + b1_corsec | character(6) | not null default ' '::bpchar + b1_nicone | character(15) | not null default ' '::bpchar + b1_atrib1 | character(6) | not null default ' '::bpchar + b1_atrib2 | character(6) | not null default ' '::bpchar + b1_atrib3 | character(6) | not null default ' '::bpchar + b1_regseq | character(6) | not null default ' '::bpchar + b1_ucalstd | character(8) | not null default ' '::bpchar + b1_cpotenc | character(1) | not null default ' '::bpchar + b1_potenci | double precision | not null default 0.0 + b1_qtdacum | double precision | not null default 0.0 + b1_qtdinic | double precision | not null default 0.0 + b1_requis | character(1) | not null default ' '::bpchar + d_e_l_e_t_ | character(1) | not null default ' '::bpchar + r_e_c_n_o_ | double precision | not null default 0.0 +Indexes: + "sb1010_pkey" primary key, btree (r_e_c_n_o_) + "sb10101" btree (b1_filial, b1_cod, r_e_c_n_o_, d_e_l_e_t_) + "sb10102" btree (b1_filial, b1_tipo, b1_cod, r_e_c_n_o_, d_e_l_e_t_) + "sb10103" btree (b1_filial, b1_desc, b1_cod, r_e_c_n_o_, d_e_l_e_t_) + "sb10104" btree (b1_filial, b1_grupo, b1_cod, r_e_c_n_o_, d_e_l_e_t_) + "sb10105" btree (b1_filial, b1_codbar, r_e_c_n_o_, d_e_l_e_t_) + "sb10106" btree (b1_filial, b1_proc, r_e_c_n_o_, d_e_l_e_t_) + + +Shridhar Daithankar wrote: + +>On Wednesday 01 Dec 2004 4:46 pm, Rodrigo Carvalhaes wrote: +> +> +>>I need to find a solution for this because I am convincing customers +>>that are using SQL Server, DB2 and Oracle to change to PostgreSQL but +>>this customers have databases of 5GB!!! I am thinking that even with a +>>better server, the restore will take 2 days! +>> +>>My data: +>>Conectiva Linux 10 , Kernel 2.6.8 +>>PostgreSQL 7.4.6. +>> +>>postgresql.conf modified parameters (the other parameters are the default) +>>tcpip_socket = true +>>max_connections = 30 +>>shared_buffers = 30000 +>>sort_mem = 4096 +>>vacuum_mem = 8192 +>>max_fsm_pages = 20000 +>>max_fsm_relations = 1000 +>> +>> +> +>Can you try bumping sort mem lot higher(basically whatever the machine can +>afford) so that index creation is faster? +> +>Just try setting sort mem for the restore session and see if it helps.. +> +> Shridhar +> +> +> + +From pgsql-performance-owner@postgresql.org Sun Dec 5 19:53:31 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B88D33A5E0A + for ; + Sun, 5 Dec 2004 19:53:29 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58949-03 + for ; + Sun, 5 Dec 2004 19:53:20 +0000 (GMT) +Received: from nitrogenio.carvalhaes.net (oxigenio.carvalhaes.net + [200.102.144.130]) + by svr1.postgresql.org (Postfix) with ESMTP id A4E413A5E0C + for ; + Sun, 5 Dec 2004 19:53:20 +0000 (GMT) +Received: from [192.168.0.10] ([200.215.220.2]) (authenticated bits=0) + by nitrogenio.carvalhaes.net (8.12.11/8.12.11) with ESMTP id + iB5JiA1L015174; Sun, 5 Dec 2004 17:44:11 -0200 +Message-ID: <41B366E3.7040109@carvalhaes.net> +Date: Sun, 05 Dec 2004 17:52:03 -0200 +From: Rodrigo Carvalhaes +Reply-To: grupos@carvalhaes.net +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Christopher Browne +Cc: pgsql-performance@postgresql.org +Subject: Re: Improve BULK insertion +References: <41B1BE1B.10301@carvalhaes.net> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit +X-Carvalhaes-MailScanner-Information: Favor contactar o suporte t�cnico para maiores informa��es suporte@triade.com +X-Carvalhaes-MailScanner: Found to be clean +X-MailScanner-From: grupos@carvalhaes.net +X-Virus-Scanned: by amavisd-new at hub.org +X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E9 hex) in message + header 'X-Carvalhaes-MailScanner-Information': + X-Carvalhaes-MailScanner-Information: Favor contactar o suporte + t\351cnico para maio... +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/103 +X-Sequence-Number: 9478 + +Hi! + +1. I am doing the inserts using pg_restore. The dump was created using +pg_dump and the standard format (copy statements) +2. See below the table schema. There are only 7 indexes. +3. My transaction log configuration are : checkpoint_segments = 3 and +checkpoint_timeout = 300 and my transaction logs are on the same disk . + +I know that I can increase the performance separating the transaction +logs and making a RAID 5 array BUT I am really curious about WHY this +performance is so poor and HOW can I try to improve on this actual +machine because actualy this inserts are taking around 90 minutes!!! + +Cheers! + +Rodrigo + +dadosadv=# \d si2010 + Table "public.si2010" + Column | Type | Modifiers +------------+------------------+--------------------------------------------------------------------- + i2_filial | character(2) | not null default ' '::bpchar + i2_num | character(10) | not null default ' '::bpchar + i2_linha | character(2) | not null default ' '::bpchar + i2_data | character(8) | not null default ' '::bpchar + i2_dc | character(1) | not null default ' '::bpchar + i2_debito | character(20) | not null default ' +'::bpchar + i2_dcd | character(1) | not null default ' '::bpchar + i2_credito | character(20) | not null default ' +'::bpchar + i2_dcc | character(1) | not null default ' '::bpchar + i2_moedas | character(5) | not null default ' '::bpchar + i2_valor | double precision | not null default 0.0 + i2_hp | character(3) | not null default ' '::bpchar + i2_hist | character(40) | not null default +' '::bpchar + i2_ccd | character(9) | not null default ' '::bpchar + i2_ccc | character(9) | not null default ' '::bpchar + i2_ativdeb | character(6) | not null default ' '::bpchar + i2_ativcrd | character(6) | not null default ' '::bpchar + i2_vlmoed2 | double precision | not null default 0.0 + i2_vlmoed3 | double precision | not null default 0.0 + i2_vlmoed4 | double precision | not null default 0.0 + i2_vlmoed5 | double precision | not null default 0.0 + i2_dtvenc | character(8) | not null default ' '::bpchar + i2_criter | character(4) | not null default ' '::bpchar + i2_rotina | character(8) | not null default ' '::bpchar + i2_periodo | character(6) | not null default ' '::bpchar + i2_listado | character(1) | not null default ' '::bpchar + i2_origem | character(40) | not null default +' '::bpchar + i2_permat | character(4) | not null default ' '::bpchar + i2_filorig | character(2) | not null default ' '::bpchar + i2_intercp | character(1) | not null default ' '::bpchar + i2_identcp | character(12) | not null default ' '::bpchar + i2_lote | character(4) | not null default ' '::bpchar + i2_doc | character(6) | not null default ' '::bpchar + i2_emporig | character(2) | not null default ' '::bpchar + i2_lp | character(3) | not null default ' '::bpchar + i2_itemd | character(9) | not null default ' '::bpchar + i2_itemc | character(9) | not null default ' '::bpchar + i2_prelan | character(1) | not null default ' '::bpchar + i2_tipo | character(2) | not null default ' '::bpchar + i2_dcc | character(1) | not null default ' '::bpchar + i2_moedas | character(5) | not null default ' '::bpchar + i2_valor | double precision | not null default 0.0 + i2_hp | character(3) | not null default ' '::bpchar + i2_hist | character(40) | not null default +' '::bpchar + i2_ccd | character(9) | not null default ' '::bpchar + i2_ccc | character(9) | not null default ' '::bpchar + i2_ativdeb | character(6) | not null default ' '::bpchar + i2_ativcrd | character(6) | not null default ' '::bpchar + i2_vlmoed2 | double precision | not null default 0.0 + i2_vlmoed3 | double precision | not null default 0.0 + i2_vlmoed4 | double precision | not null default 0.0 + i2_vlmoed5 | double precision | not null default 0.0 + i2_dtvenc | character(8) | not null default ' '::bpchar + i2_criter | character(4) | not null default ' '::bpchar + i2_rotina | character(8) | not null default ' '::bpchar + i2_periodo | character(6) | not null default ' '::bpchar + i2_listado | character(1) | not null default ' '::bpchar + i2_origem | character(40) | not null default +' '::bpchar + i2_permat | character(4) | not null default ' '::bpchar + i2_filorig | character(2) | not null default ' '::bpchar + i2_intercp | character(1) | not null default ' '::bpchar + i2_identcp | character(12) | not null default ' '::bpchar + i2_lote | character(4) | not null default ' '::bpchar + i2_doc | character(6) | not null default ' '::bpchar + i2_emporig | character(2) | not null default ' '::bpchar + i2_lp | character(3) | not null default ' '::bpchar + i2_itemd | character(9) | not null default ' '::bpchar + i2_itemc | character(9) | not null default ' '::bpchar + i2_prelan | character(1) | not null default ' '::bpchar + i2_tipo | character(2) | not null default ' '::bpchar + d_e_l_e_t_ | character(1) | not null default ' '::bpchar + r_e_c_n_o_ | double precision | not null default 0.0 +Indexes: + "si2010_pkey" primary key, btree (r_e_c_n_o_) + "si20101" btree (i2_filial, i2_num, i2_linha, i2_periodo, +r_e_c_n_o_, d_e_l_e_t_) + "si20102" btree (i2_filial, i2_periodo, i2_num, i2_linha, +r_e_c_n_o_, d_e_l_e_t_) + "si20103" btree (i2_filial, i2_data, i2_num, i2_linha, r_e_c_n_o_, +d_e_l_e_t_) + "si20104" btree (i2_filial, i2_debito, i2_data, i2_num, i2_linha, +r_e_c_n_o_, d_e_l_e_t_) + "si20105" btree (i2_filial, i2_credito, i2_data, i2_num, i2_linha, +r_e_c_n_o_, d_e_l_e_t_) + "si20106" btree (i2_filial, i2_doc, i2_periodo, r_e_c_n_o_, d_e_l_e_t_) + "si20107" btree (i2_filial, i2_origem, r_e_c_n_o_, d_e_l_e_t_) + + +Christopher Browne wrote: + +>In the last exciting episode, grupos@carvalhaes.net (Grupos) wrote: +> +> +>>Hi ! +>> +>>I need to insert 500.000 records on a table frequently. It�s a bulk +>>insertion from my applicatoin. +>>I am with a very poor performance. PostgreSQL insert very fast until +>>the tuple 200.000 and after it the insertion starts to be really slow. +>>I am seeing on the log and there is a lot of transaction logs, +>>something like : +>> +>>2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000012" +>>2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000013" +>>2004-12-04 11:08:59 LOG: recycled transaction log file "0000000600000011" +>>2004-12-04 11:14:04 LOG: recycled transaction log file "0000000600000015" +>>2004-12-04 11:14:04 LOG: recycled transaction log file "0000000600000014" +>>2004-12-04 11:19:08 LOG: recycled transaction log file "0000000600000016" +>>2004-12-04 11:19:08 LOG: recycled transaction log file "0000000600000017" +>>2004-12-04 11:24:10 LOG: recycled transaction log file "0000000600000018" +>> +>> +> +>It is entirely normal for there to be a lot of transaction log file +>recycling when bulk inserts are taking place; that goes through a lot +>of transaction logs. +> +> +> +>>How can I configure PostgreSQL to have a better performance on this +>>bulk insertions ? I already increased the memory values. +>> +>> +> +>Memory is, as likely as not, NOT the issue. +> +>Two questions: +> +> 1. How are you doing the inserts? Via INSERT statements? Or +> via COPY statements? What sort of transaction grouping +> is involved? +> +> COPY is way faster than INSERT, and grouping plenty of updates +> into a single transaction is generally a "win." +> +> 2. What is the schema like? Does the table have a foreign key +> constraint? Does it have a bunch of indices? +> +> If there should eventually be lots of indices, it tends to be +> faster to create the table with none/minimal indices, and add +> indexes afterwards, as long as your "load" process can be trusted +> to not break "unique" constraints... +> +> If there is some secondary table with a foreign key constraint, +> and _that_ table is growing, it is possible that a sequential +> scan is being used to search the secondary table where, if you +> did an ANALYZE on that table, an index scan would be preferred +> once it grew to larger size... +> +>There isn't a particular reason for PostgreSQL to "hit a wall" upon +>seeing 200K records; I and coworkers routinely load database dumps +>that have millions of (sometimes pretty fat) records, and they don't +>"choke." That's true whether talking about loading things onto my +>(somewhat wimpy) desktop PC, or a SMP Xeon system with a small RAID +>array, or higher end stuff involving high end SMP and EMC disk arrays. +>The latter obviously being orders of magnitude faster than desktop +>equipment :-). +> +> + +From pgsql-performance-owner@postgresql.org Sun Dec 5 22:48:35 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0AC183A5E0C + for ; + Sun, 5 Dec 2004 22:48:34 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96479-09 + for ; + Sun, 5 Dec 2004 22:48:27 +0000 (GMT) +Received: from loki.globexplorer.com (unknown [208.35.14.101]) + by svr1.postgresql.org (Postfix) with ESMTP id B82AA3A5E00 + for ; + Sun, 5 Dec 2004 22:48:28 +0000 (GMT) +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: Improve BULK insertion +Date: Sun, 5 Dec 2004 14:48:28 -0800 +Message-ID: + <71E37EF6B7DCC1499CEA0316A256832801D4BBDF@loki.wc.globexplorer.net> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Improve BULK insertion +Thread-Index: AcTbBTRpZ6OlveA6TkCALaLxX/XyvAAFDA2d +From: "Gregory S. Williamson" +To: , "Christopher Browne" +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/104 +X-Sequence-Number: 9479 + +Rodrigo -- + +You should definitely drop the indexes and any other FK constraints = +before loading and then rebuild them. Check your logs and see if there = +are warnings about checkpoint intervals -- only 3 logs seems like it = +might be small; if you have the disk space I would definitely consider = +raising the number. If you haven't already posted your config settings = +you might do so -- this seems very slow. I regularly use COPY to load or = +unload data sets in the 200k-900k range and they don't take 90 minutes, = +even on slower hardware (and usually only a few minutes on our = +production servers; rebuilding the indexes usually takes longer. =20 + +This unloading a 300k+ row data set on a dell linux box with not very = +good disks and 1 gig of RAM: + +Starting copy of parcel staging table parcels_12031 at Thu Dec 2 = +01:13:52 2004 +Done with staging table copy at Thu Dec 2 01:15:16 2004 +... +Starting compression of parcel file at Thu Dec 2 01:15:22 2004 +gzip: /tmp/parcels_12031.unl.gz already exists; do you wish to overwrite = +(y or n +)? y +Done with compression of parcel file at Thu Dec 2 01:17:23 2004 +... + +And loading them on a rather faster server: + +Starting unzip of parcels at Thu Dec 2 01:29:15 2004 +Finished with unzip at Thu Dec 2 01:29:22 2004 +... +Target db detail table updated at Thu Dec 2 01:29:29 2004 +Dropping indexes +Dropping fk constraint on tracking id +Dropping indexes +Done dropping indexes on target parcels table at Thu Dec 2 01:29:30 = +2004 +NOTICE: drop cascades to table f12031.parcel_pins +NOTICE: drop cascades to table f12031.parcel_addresses +NOTICE: drop cascades to table f12031.parcel_owner_fti +NOTICE: drop cascades to table f12031.parcel_owners +Removing old parcels entries starting at Thu Dec 2 01:29:30 2004 +Done deleting schema and parcels for track_id 10163541 at Thu Dec 2 = +01:33:04 2004 +Starting load of parcels at Thu Dec 2 01:33:04 2004 +Done copying data into parcels at Thu Dec 2 01:35:18 2004 +Deleting old v_detail reference for track_id 10163541 +Done with delete of old v_detail reference +Starting creation of foreign key constraint at Thu Dec 2 01:39:43 2004 +Done with creation of foreign key constraint at Thu Dec 2 01:42:14 2004 +Starting spatial index create at Thu Dec 2 01:42:14 2004 +Done creating spatial index at Thu Dec 2 01:55:04 2004 +Starting stats on geometry column now +Done doing stats for spatial index at Thu Dec 2 02:03:47 2004 +Starting index on PIN now +Done creating pin index at Thu Dec 2 02:09:36 2004 +Starting index on tracking id now +Done creating trid index at Thu Dec 2 02:12:35 2004 +Starting centroid index now +Done creating centroid index at Thu Dec 2 02:24:11 2004 +Starting stats on centroid column +Done doing stats for spatial index at Thu Dec 2 02:29:55 2004 +Doing City/Street Index on parcels table ...Done creating city/street = +index at Thu Dec 2 02:42:41 2004 with result <-1> +Committing changes + +So this took about 70 minutes to delete 200000+ rows from a table with = +about 5 million rows, load a new set and reindex them (and do some = +statistics for spatial geometry). If the table had only this data the = +indexing would have been *much* faster. These are moderate size columns = +-- about 2 dozen columns and some spatial data (polygon and point). Both = +servers have rather more log files than your setup, but I am not = +familiar enough with postgres to know how much of an impact that alone = +will have. The comment about it slowing down part way through a load = +makes me suspect indexing issues, somehow (not from postgres experience = +but it rings a bell with other DBs); if you explicitly drop the indexes = +first and then load does it show the same performance behavior ? + +If you are doing the data read from, the database write and the WAL = +logging all on single disk drive, then I would guess that that is your = +bottleneck. If you use vmstat and/or top or the like, is your I/O pegged = +? + +HTH + +Greg WIlliamson +DBA +GlobeXplorer LLC + +-----Original Message----- +From: Rodrigo Carvalhaes [mailto:grupos@carvalhaes.net] +Sent: Sun 12/5/2004 11:52 AM +To: Christopher Browne +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Improve BULK insertion +Hi! + +1. I am doing the inserts using pg_restore. The dump was created using=20 +pg_dump and the standard format (copy statements) +2. See below the table schema. There are only 7 indexes. =20 +3. My transaction log configuration are : checkpoint_segments =3D 3 and = + +checkpoint_timeout =3D 300 and my transaction logs are on the same disk = +. + +I know that I can increase the performance separating the transaction=20 +logs and making a RAID 5 array BUT I am really curious about WHY this=20 +performance is so poor and HOW can I try to improve on this actual=20 +machine because actualy this inserts are taking around 90 minutes!!! + +Cheers! + +Rodrigo + +dadosadv=3D# \d si2010 + Table "public.si2010" + Column | Type | Modifiers +------------+------------------+-----------------------------------------= +---------------------------- + i2_filial | character(2) | not null default ' '::bpchar + i2_num | character(10) | not null default ' '::bpchar + i2_linha | character(2) | not null default ' '::bpchar + i2_data | character(8) | not null default ' '::bpchar + i2_dc | character(1) | not null default ' '::bpchar + i2_debito | character(20) | not null default ' =20 +'::bpchar + i2_dcd | character(1) | not null default ' '::bpchar + i2_credito | character(20) | not null default ' =20 +'::bpchar + i2_dcc | character(1) | not null default ' '::bpchar + i2_moedas | character(5) | not null default ' '::bpchar + i2_valor | double precision | not null default 0.0 + i2_hp | character(3) | not null default ' '::bpchar + i2_hist | character(40) | not null default=20 +' '::bpchar + i2_ccd | character(9) | not null default ' '::bpchar + i2_ccc | character(9) | not null default ' '::bpchar + i2_ativdeb | character(6) | not null default ' '::bpchar + i2_ativcrd | character(6) | not null default ' '::bpchar + i2_vlmoed2 | double precision | not null default 0.0 + i2_vlmoed3 | double precision | not null default 0.0 + i2_vlmoed4 | double precision | not null default 0.0 + i2_vlmoed5 | double precision | not null default 0.0 + i2_dtvenc | character(8) | not null default ' '::bpchar + i2_criter | character(4) | not null default ' '::bpchar + i2_rotina | character(8) | not null default ' '::bpchar + i2_periodo | character(6) | not null default ' '::bpchar + i2_listado | character(1) | not null default ' '::bpchar + i2_origem | character(40) | not null default=20 +' '::bpchar + i2_permat | character(4) | not null default ' '::bpchar + i2_filorig | character(2) | not null default ' '::bpchar + i2_intercp | character(1) | not null default ' '::bpchar + i2_identcp | character(12) | not null default ' '::bpchar + i2_lote | character(4) | not null default ' '::bpchar + i2_doc | character(6) | not null default ' '::bpchar + i2_emporig | character(2) | not null default ' '::bpchar + i2_lp | character(3) | not null default ' '::bpchar + i2_itemd | character(9) | not null default ' '::bpchar + i2_itemc | character(9) | not null default ' '::bpchar + i2_prelan | character(1) | not null default ' '::bpchar + i2_tipo | character(2) | not null default ' '::bpchar + i2_dcc | character(1) | not null default ' '::bpchar + i2_moedas | character(5) | not null default ' '::bpchar + i2_valor | double precision | not null default 0.0 + i2_hp | character(3) | not null default ' '::bpchar + i2_hist | character(40) | not null default=20 +' '::bpchar + i2_ccd | character(9) | not null default ' '::bpchar + i2_ccc | character(9) | not null default ' '::bpchar + i2_ativdeb | character(6) | not null default ' '::bpchar + i2_ativcrd | character(6) | not null default ' '::bpchar + i2_vlmoed2 | double precision | not null default 0.0 + i2_vlmoed3 | double precision | not null default 0.0 + i2_vlmoed4 | double precision | not null default 0.0 + i2_vlmoed5 | double precision | not null default 0.0 + i2_dtvenc | character(8) | not null default ' '::bpchar + i2_criter | character(4) | not null default ' '::bpchar + i2_rotina | character(8) | not null default ' '::bpchar + i2_periodo | character(6) | not null default ' '::bpchar + i2_listado | character(1) | not null default ' '::bpchar + i2_origem | character(40) | not null default=20 +' '::bpchar + i2_permat | character(4) | not null default ' '::bpchar + i2_filorig | character(2) | not null default ' '::bpchar + i2_intercp | character(1) | not null default ' '::bpchar + i2_identcp | character(12) | not null default ' '::bpchar + i2_lote | character(4) | not null default ' '::bpchar + i2_doc | character(6) | not null default ' '::bpchar + i2_emporig | character(2) | not null default ' '::bpchar + i2_lp | character(3) | not null default ' '::bpchar + i2_itemd | character(9) | not null default ' '::bpchar + i2_itemc | character(9) | not null default ' '::bpchar + i2_prelan | character(1) | not null default ' '::bpchar + i2_tipo | character(2) | not null default ' '::bpchar + d_e_l_e_t_ | character(1) | not null default ' '::bpchar + r_e_c_n_o_ | double precision | not null default 0.0 +Indexes: + "si2010_pkey" primary key, btree (r_e_c_n_o_) + "si20101" btree (i2_filial, i2_num, i2_linha, i2_periodo,=20 +r_e_c_n_o_, d_e_l_e_t_) + "si20102" btree (i2_filial, i2_periodo, i2_num, i2_linha,=20 +r_e_c_n_o_, d_e_l_e_t_) + "si20103" btree (i2_filial, i2_data, i2_num, i2_linha, r_e_c_n_o_,=20 +d_e_l_e_t_) + "si20104" btree (i2_filial, i2_debito, i2_data, i2_num, i2_linha,=20 +r_e_c_n_o_, d_e_l_e_t_) + "si20105" btree (i2_filial, i2_credito, i2_data, i2_num, i2_linha,=20 +r_e_c_n_o_, d_e_l_e_t_) + "si20106" btree (i2_filial, i2_doc, i2_periodo, r_e_c_n_o_, = +d_e_l_e_t_) + "si20107" btree (i2_filial, i2_origem, r_e_c_n_o_, d_e_l_e_t_) + + +Christopher Browne wrote: + +>In the last exciting episode, grupos@carvalhaes.net (Grupos) wrote: +> =20 +> +>>Hi ! +>> +>>I need to insert 500.000 records on a table frequently. It=B4s a bulk +>>insertion from my applicatoin. +>>I am with a very poor performance. PostgreSQL insert very fast until +>>the tuple 200.000 and after it the insertion starts to be really slow. +>>I am seeing on the log and there is a lot of transaction logs, +>>something like : +>> +>>2004-12-04 11:08:59 LOG: recycled transaction log file = +"0000000600000012" +>>2004-12-04 11:08:59 LOG: recycled transaction log file = +"0000000600000013" +>>2004-12-04 11:08:59 LOG: recycled transaction log file = +"0000000600000011" +>>2004-12-04 11:14:04 LOG: recycled transaction log file = +"0000000600000015" +>>2004-12-04 11:14:04 LOG: recycled transaction log file = +"0000000600000014" +>>2004-12-04 11:19:08 LOG: recycled transaction log file = +"0000000600000016" +>>2004-12-04 11:19:08 LOG: recycled transaction log file = +"0000000600000017" +>>2004-12-04 11:24:10 LOG: recycled transaction log file = +"0000000600000018" +>> =20 +>> +> +>It is entirely normal for there to be a lot of transaction log file +>recycling when bulk inserts are taking place; that goes through a lot +>of transaction logs. +> +> =20 +> +>>How can I configure PostgreSQL to have a better performance on this +>>bulk insertions ? I already increased the memory values. +>> =20 +>> +> +>Memory is, as likely as not, NOT the issue. +> +>Two questions: +> +> 1. How are you doing the inserts? Via INSERT statements? Or +> via COPY statements? What sort of transaction grouping +> is involved? +> +> COPY is way faster than INSERT, and grouping plenty of updates +> into a single transaction is generally a "win." +> +> 2. What is the schema like? Does the table have a foreign key +> constraint? Does it have a bunch of indices? +> +> If there should eventually be lots of indices, it tends to be +> faster to create the table with none/minimal indices, and add +> indexes afterwards, as long as your "load" process can be trusted +> to not break "unique" constraints... +> +> If there is some secondary table with a foreign key constraint, +> and _that_ table is growing, it is possible that a sequential +> scan is being used to search the secondary table where, if you +> did an ANALYZE on that table, an index scan would be preferred +> once it grew to larger size... +> +>There isn't a particular reason for PostgreSQL to "hit a wall" upon +>seeing 200K records; I and coworkers routinely load database dumps +>that have millions of (sometimes pretty fat) records, and they don't +>"choke." That's true whether talking about loading things onto my +>(somewhat wimpy) desktop PC, or a SMP Xeon system with a small RAID +>array, or higher end stuff involving high end SMP and EMC disk arrays. +>The latter obviously being orders of magnitude faster than desktop +>equipment :-). +> =20 +> + +---------------------------(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 Sun Dec 5 23:10:05 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E2FBD3A2307 + for ; + Sun, 5 Dec 2004 23:10:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01245-06 + for ; + Sun, 5 Dec 2004 23:09:52 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 884003A50E8 + for ; + Sun, 5 Dec 2004 23:09:53 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6748879; Sun, 05 Dec 2004 15:11:26 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Partitioned table performance +Date: Sun, 5 Dec 2004 15:06:40 -0800 +User-Agent: KMail/1.6.2 +Cc: "Stacy White" +References: <000a01c4da74$84e072e0$0200a8c0@grownups> +In-Reply-To: <000a01c4da74$84e072e0$0200a8c0@grownups> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412051506.41025.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/105 +X-Sequence-Number: 9480 + +Stacy, + +Thanks for the stats! + +> In some cases we've seen some increased performance in tests by splitting +> the table into several smaller tables. =A0Both 'UNION ALL' views, and the +> superclass/subclass scheme work well at pruning down the set of rows a +> query uses, but they seem to introduce a large performance hit to the time +> to process each row (~50% for superclass/subclass, and ~150% for union +> views). + +This seems reasonable, actually, given your test. Really, what you should= + be=20 +comparing it against is not against selecting from an individual partition,= +=20 +but selecting from the whole business as one large table. =20 + +I also suspect that wider rows results in less overhead proportionally; not= +e=20 +that your test contains *only* the indexed rows. I should soon have a tes= +t=20 +to prove this, hopefully. + +However, I would be interested in seeing EXPLAIN ANALYZE from your tests=20 +rather than just EXPLAIN. + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sun Dec 5 23:23:01 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CB023A5CEB + for ; + Sun, 5 Dec 2004 23:22:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02134-09 + for ; + Sun, 5 Dec 2004 23:22:50 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 8F2293A5B6D + for ; + Sun, 5 Dec 2004 23:22:52 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6748919; Sun, 05 Dec 2004 15:24:25 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org, grupos@carvalhaes.net +Subject: Re: Improve BULK insertion +Date: Sun, 5 Dec 2004 15:19:45 -0800 +User-Agent: KMail/1.6.2 +References: <41B1BE1B.10301@carvalhaes.net> + + <41B366E3.7040109@carvalhaes.net> +In-Reply-To: <41B366E3.7040109@carvalhaes.net> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412051519.45328.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/106 +X-Sequence-Number: 9481 + +Rodrigo, + +> 3. My transaction log configuration are : checkpoint_segments =3D 3 =A0and +> checkpoint_timeout =3D 300 and my transaction logs are on the same disk . + +Well, you need to move your transaction logs to another disk, and increase= +=20 +them to a large number ... like 128, which is about 1GB (you'll need that=20 +much disk space). Also, increase the checkpoint_timeout to minimize=20 +checkpointing during the load; like, 1500. + +> I know that I can increase the performance separating the transaction +> logs and making a RAID 5 array=20 + +Actually, RAID5, unless you're using > 5 disks, would make things slower. = +=20 +Speeding writes up through RAID would require at least 6 drives, and probab= +ly=20 +RAID 1+0. + +> BUT I am really curious about WHY this=20 +> performance is so poor and HOW can I try to improve on this actual +> machine because actualy this inserts are taking around 90 minutes!!! + +Are you doing INSERTS and not COPY? If so, are you batching them in=20 +transactions? + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Dec 6 09:28:57 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 584273A5E48 + for ; + Mon, 6 Dec 2004 09:28:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55749-10 + for ; + Mon, 6 Dec 2004 09:28:45 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) + by svr1.postgresql.org (Postfix) with ESMTP id E15643A2307 + for ; + Mon, 6 Dec 2004 09:28:46 +0000 (GMT) +Received: by wproxy.gmail.com with SMTP id 70so60513wra + for ; + Mon, 06 Dec 2004 01:28:46 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; + b=UmMWR2ibGZG75w1W5sRduIGHRTRFrdNs4QsNuirAwFzbGcLQSOI0XW8HPJ9iP1W87YiaE2PfP4vMWOWrCclqjhV9kX/BcWPxBUhmq34p3A0Hm9pvG7gBCK7Io53Rc8jGjjB6GoT7ymnVnXGtZs+wYtIwD8gNdaPnDnl/EcLWDNM= +Received: by 10.54.32.22 with SMTP id f22mr98864wrf; + Mon, 06 Dec 2004 01:28:46 -0800 (PST) +Received: by 10.54.37.32 with HTTP; Mon, 6 Dec 2004 01:28:46 -0800 (PST) +Message-ID: +Date: Mon, 6 Dec 2004 14:58:46 +0530 +From: Postgres Learner +Reply-To: Postgres Learner +To: pgsql-performance@postgresql.org +Subject: 8.0 vs. 7.4 benchmarks +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/107 +X-Sequence-Number: 9482 + +Hi all! +Has anyone done any performance benchmarking of postgresql 7.4 vs 8.0? +Are there any scenarios where 8.0 can be expected to be faster? I +would love to get my hands on any numbers that someone might have. +Also does anyone know how long it will take for a stable release of +8.0 to come? Given the loads of additional features in 8.0, I can't +wait to use it in production. :-) + +thanks a lot everyone!!! +ps + +From pgsql-performance-owner@postgresql.org Tue Dec 7 00:53:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E2E03A54FA + for ; + Mon, 6 Dec 2004 13:53:01 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 31499-10 + for ; + Mon, 6 Dec 2004 13:52:52 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 3574B3A5F0C + for ; + Mon, 6 Dec 2004 13:52:55 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id C6F5E3193B; Mon, 6 Dec 2004 14:52:52 +0100 (MET) +From: "Rosny" +X-Newsgroups: pgsql.performance +Subject: TableSpace Design issues on Postgres 8.0 beta 5 +Date: Mon, 6 Dec 2004 05:52:53 -0800 +Organization: Hub.Org Networking Services +Lines: 102 +Message-ID: +Reply-To: "Rosny" +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.3790.181 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.264 tagged_above=0 required=5 + tests=FORGED_HOTMAIL_RCVD2, PRIORITY_NO_NAME +X-Spam-Level: ** +X-Archive-Number: 200412/125 +X-Sequence-Number: 9500 + +Hi, + +This kind of long email. + + After searching the mailing list, have not found good answer + for TableSpace. So, I try to post this question. + +My question +Question : + 1 Which option from below scenario will be good in term of performance and +future scalability? + 2. Is it Option B1 below the right approach? + 3. Is progresql will have problems if I have 7000 tablespace? + +------------------------------------------------------------------- +Environment : + - Windows 2003 + - Postgresql 8.0 beta 5 + +Scenario : +Original Design: + Total Tables 40: + - 20 tables are main tables responsible for the others 20 tables + - the others 20 tables are specific for each department. + - from these 20 tables(departments) + there are 4-5 tables that will contain approx 20 millions records + (these tables will be hit every times access to the website). + +Refering to 20 tables which can be partition +A. All departments tables is put into 20 tables. + some querying of 20 millions records. + +B. For each department create tablespace. (Which means, if there + are 7000 departments, there will be 7000 tablespace each contains + 20 tables). + + +Question : Which option will be good in term of performance + and future scalability? + +A1. Use A option, + As tables become huge. partition the tables which hits often + and has large size file(usually when it bigger than 2-3 GB size) + into separate tablespace. + + Problems in A1 approach : + 1. query take very long. It might be resolved + - indexing, better written pgsql statement. + + Advantage : total files are small. around 1000 in one directory + + +B1. Use B option, + Creating 7000 TableSpace for Departments + - One Department has one tablespace + - Each Department has 20 tables + + Advantage : + - each table is small and query is very fast. + - scalability. As the sites grows, contents grows. will + not effect future scalability as much as A1. + in A1 the query already max out for performance partition. + in B1 the query has not max out yet because the data is + already distribute across thousands of tables + + Disadvantage: + - total numbers of files is huge. + (after creating 7000 tablespace, and start + table automatic generator to create 20 tables + for each 7000 tablespace. + After running the 1500th tablespace. + Each TableSpace has : 35 files + Surprisingly the default table space already has 20000 files) + - Need to use dynamic table name query. (this is ok, + since there are not very complex sql statement logic) + +I am trying to choose option B1, as it is good for future scability. + +Question : + 1. Is it B1 the right approach? + 2. Is progresql will have problems if I have 7000 tablespace? + + +Thank you, +Rosny + +note: previously posted on cygwin. but I think it is more appropriate for +this group + + + + + + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Tue Dec 7 00:52:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 626533A5F2B + for ; + Mon, 6 Dec 2004 14:40:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46366-09 + for ; + Mon, 6 Dec 2004 14:40:16 +0000 (GMT) +Received: from midus.bright.net (midus.bright.net [216.255.50.23]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C3083A5F00 + for ; + Mon, 6 Dec 2004 14:40:19 +0000 (GMT) +Received: from [216.255.15.11] (bvest.bright.net [216.255.15.11]) + by midus.bright.net (8.12.10/8.12.10) with ESMTP id iB6EeIgD018163 + for ; Mon, 6 Dec 2004 09:40:18 -0500 +Message-ID: <41B46F52.4000607@bright.net> +Date: Mon, 06 Dec 2004 09:40:18 -0500 +From: Bryan Vest +User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Config review +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/123 +X-Sequence-Number: 9498 + +Postgresql is the backbone of our spam filtering system. Currently the +performance is OK. Wanted to know if someone could give this config a +quick run down and see if there is anything we can adjust here to smooth +out the performance. The IO Wait Times are outrageous, at times the load +will spike up to the 70 - 90 range. + +Hardware: +Quad Opteron 2Ghz +Tyan Quad Opteron Board +16GB DDR Ram +Emulex LightPulse LP1050 +EMC Clarion Fiber Array running Raid5 +----------------------------------------- +Software: +RedHat Linux AS +Postgresql 7.4.6 +----------------------------------------- +Detail: +pg_xlog is stored on a local 10k RPM SCSI drive. +The rest of the database is stored on the Fiber Array. + +Currently the database is at a size of 87.6Gig. A Vacuum Analyze runs +every night and has been taking 4 or 5 hours to complete. Everything +seems to run fine for a while, then at some point the load goes through +the roof and the iowait % also goes way up. It will recover after a +little bit and then do the same thing all over again. When this happens +access to the web based user interface slows way down for our customers. +Any input for improvements to this config would be appreciated, Thanks. + +------------------------------------------ + +------------------------------------------ +Vacuum Output: + +INFO: analyzing "pg_catalog.pg_listener" +INFO: "pg_listener": 0 pages, 0 rows sampled, 0 estimated total rows +INFO: free space map: 79 relations, 1948399 pages stored; 5306160 total +pages needed +DETAIL: Allocated FSM size: 500 relations + 2000000 pages = 11769 kB +shared memory. +VACUUM +-------------------------------------------- + +<--config--> + +tcpip_socket = true +max_connections = 800 +#superuser_reserved_connections = 2 +port = 5432 +#port = 9999 +#unix_socket_directory = '' +#unix_socket_group = '' +#unix_socket_permissions = 0777 # octal +#virtual_host = '' # what interface to listen on; defaults +to any +#rendezvous_name = '' # defaults to the computer name + +# - Security & Authentication - + +#authentication_timeout = 60 # 1-600, in seconds +#ssl = false +#password_encryption = true +#krb_server_keyfile = '' +#db_user_namespace = false + + +#--------------------------------------------------------------------------- +# RESOURCE USAGE (except WAL) +#--------------------------------------------------------------------------- + +# - Memory - + +shared_buffers = 16000 +sort_mem = 16384 +vacuum_mem = 3200000 + +# - Free Space Map - + +max_fsm_pages = 2000000 +max_fsm_relations = 500 + +# - Kernel Resource Usage - + +max_files_per_process = 100 # min 25 +#preload_libraries = '' + + +#--------------------------------------------------------------------------- +# WRITE AHEAD LOG +#--------------------------------------------------------------------------- + +# - Settings - + +fsync = true # turns forced synchronization on or off +#wal_sync_method = fsync # the default varies across platforms: + # fsync, fdatasync, open_sync, or +open_datasync +wal_buffers = 64 # min 4, 8KB each + +# - Checkpoints - + +checkpoint_segments = 50 # in logfile segments, min 1, 16MB each +#checkpoint_timeout = 60 # range 30-3600, in seconds +#checkpoint_warning = 30 # 0 is off, in seconds +#commit_delay = 0 # range 0-100000, in microseconds +#commit_siblings = 10 # range 1-1000 + + +#--------------------------------------------------------------------------- +# QUERY TUNING +#--------------------------------------------------------------------------- + +# - Planner Method Enabling - + +#enable_hashagg = true +#enable_hashjoin = true +enable_indexscan = true +#enable_mergejoin = true +#enable_nestloop = true +#enable_seqscan = true +#enable_sort = true +#enable_tidscan = true + +# - Planner Cost Constants - + +effective_cache_size = 50000 # typically 8KB each +random_page_cost = 20 # units are one sequential page fetch cost +#cpu_tuple_cost = 0.01 # (same) +#cpu_index_tuple_cost = 0.001 # (same) +#cpu_operator_cost = 0.0025 # (same) + +# - Genetic Query Optimizer - + +geqo = true +geqo_threshold = 11 +geqo_effort = 1 +geqo_generations = 0 +geqo_pool_size = 0 # default based on tables in statement, + # range 128-1024 +geqo_selection_bias = 2.0 # range 1.5-2.0 + +# - Other Planner Options - + +#default_statistics_target = 10 # range 1-1000 +#from_collapse_limit = 8 +#join_collapse_limit = 8 # 1 disables collapsing of explicit JOINs + + +#--------------------------------------------------------------------------- +# ERROR REPORTING AND LOGGING +#--------------------------------------------------------------------------- + +# - Syslog - + +syslog = 2 # range 0-2; 0=stdout; 1=both; 2=syslog +#syslog_facility = 'LOCAL0' +#syslog_ident = 'postgres' + +# - When to Log - + +client_min_messages = error # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # log, info, notice, warning, error + +log_min_messages = error # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # info, notice, warning, error, log, +fatal, + # panic + +log_error_verbosity = terse # terse, default, or verbose messages + +#log_min_error_statement = panic # Values in order of increasing severity: + # debug5, debug4, debug3, debug2, +debug1, + # info, notice, warning, error, +panic(off) + +#log_min_duration_statement = -1 # Log all statements whose + # execution time exceeds the value, in + # milliseconds. Zero prints all queries. + # Minus-one disables. + +#silent_mode = false # DO NOT USE without Syslog! + +# - What to Log - + +debug_print_parse = false +debug_print_rewritten = false +debug_print_plan = false +debug_pretty_print = false +log_connections = false +log_duration = false +log_pid = false +log_statement = false +log_timestamp = true +log_hostname = true +log_source_port = false + + +#--------------------------------------------------------------------------- +# RUNTIME STATISTICS +#--------------------------------------------------------------------------- + +# - Statistics Monitoring - + +log_parser_stats = false +log_planner_stats = false +log_executor_stats = false +log_statement_stats = false + +# - Query/Index Statistics Collector - + +#stats_start_collector = true +#stats_command_string = false +#stats_block_level = false +#stats_row_level = false +#stats_reset_on_server_start = true + + +#--------------------------------------------------------------------------- +# CLIENT CONNECTION DEFAULTS +#--------------------------------------------------------------------------- + +# - Statement Behavior - + +#search_path = '$user,public' # schema names +#check_function_bodies = true +#default_transaction_isolation = 'read committed' +#default_transaction_read_only = false +#statement_timeout = 0 # 0 is disabled, in milliseconds + +# - Locale and Formatting - + +#datestyle = 'iso, mdy' +#timezone = unknown # actually, defaults to TZ environment +setting +#australian_timezones = false +#extra_float_digits = 0 # min -15, max 2 +#client_encoding = sql_ascii # actually, defaults to database encoding + +# These settings are initialized by initdb -- they may be changed +lc_messages = 'en_US.UTF-8' # locale for system error +message strings +lc_monetary = 'en_US.UTF-8' # locale for monetary formatting +lc_numeric = 'en_US.UTF-8' # locale for number formatting +lc_time = 'en_US.UTF-8' # locale for time formatting + +# - Other Defaults - + +#explain_pretty_print = true +#dynamic_library_path = '$libdir' +#max_expr_depth = 10000 # min 10 + + +#--------------------------------------------------------------------------- +# LOCK MANAGEMENT +#--------------------------------------------------------------------------- + +#deadlock_timeout = 1000 # in milliseconds +max_locks_per_transaction = 200 # min 10, ~260*max_connections bytes each + + +#--------------------------------------------------------------------------- +# VERSION/PLATFORM COMPATIBILITY +#--------------------------------------------------------------------------- + +# - Previous Postgres Versions - + +#add_missing_from = true +#regex_flavor = advanced # advanced, extended, or basic +#sql_inheritance = true + +# - Other Platforms & Clients - + +#transform_null_equals = false + +<--config--> + + +Thanks +-- +--------------------------------------------------------------- +Bryan Vest +ComNet Inc. +bright.net Network Administration/Network Operations +(888)-618-4638 +net-admin@bright.net Pager: pagenoc@bright.net +--------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Mon Dec 6 14:43:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 016623A5F1D + for ; + Mon, 6 Dec 2004 14:43:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49791-08 + for ; + Mon, 6 Dec 2004 14:43:39 +0000 (GMT) +Received: from midus.bright.net (midus.bright.net [216.255.50.23]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A18F3A5F00 + for ; + Mon, 6 Dec 2004 14:43:41 +0000 (GMT) +Received: from [216.255.15.11] (bvest.bright.net [216.255.15.11]) + by midus.bright.net (8.12.10/8.12.10) with ESMTP id iB6EhggD018256 + for ; Mon, 6 Dec 2004 09:43:42 -0500 +Message-ID: <41B4701E.2090101@rhondasworld.com> +Date: Mon, 06 Dec 2004 09:43:42 -0500 +From: Bryan +User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Config Check +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/108 +X-Sequence-Number: 9483 + + +Postgresql is the backbone of our spam filtering system. Currently the +performance is OK. Wanted to know if someone could give this config a +quick run down and see if there is anything we can adjust here to smooth +out the performance. The IO Wait Times are outrageous, at times the load +will spike up to the 70 - 90 range. + +Hardware: +Quad Opteron 2Ghz +Tyan Quad Opteron Board +16GB DDR Ram +Emulex LightPulse LP1050 +EMC Clarion Fiber Array running Raid5 +----------------------------------------- +Software: +RedHat Linux AS +Postgresql 7.4.6 +----------------------------------------- +Detail: +pg_xlog is stored on a local 10k RPM SCSI drive. +The rest of the database is stored on the Fiber Array. + +Currently the database is at a size of 87.6Gig. A Vacuum Analyze runs +every night and has been taking 4 or 5 hours to complete. Everything +seems to run fine for a while, then at some point the load goes through +the roof and the iowait % also goes way up. It will recover after a +little bit and then do the same thing all over again. When this happens +access to the web based user interface slows way down for our customers. +Any input for improvements to this config would be appreciated, Thanks. + +------------------------------------------ + +------------------------------------------ +Vacuum Output: + +INFO: analyzing "pg_catalog.pg_listener" +INFO: "pg_listener": 0 pages, 0 rows sampled, 0 estimated total rows +INFO: free space map: 79 relations, 1948399 pages stored; 5306160 total +pages needed +DETAIL: Allocated FSM size: 500 relations + 2000000 pages = 11769 kB +shared memory. +VACUUM +-------------------------------------------- + +<--config--> + +tcpip_socket = true +max_connections = 800 +#superuser_reserved_connections = 2 +port = 5432 +#port = 9999 +#unix_socket_directory = '' +#unix_socket_group = '' +#unix_socket_permissions = 0777 # octal +#virtual_host = '' # what interface to listen on; defaults +to any +#rendezvous_name = '' # defaults to the computer name + +# - Security & Authentication - + +#authentication_timeout = 60 # 1-600, in seconds +#ssl = false +#password_encryption = true +#krb_server_keyfile = '' +#db_user_namespace = false + + +#--------------------------------------------------------------------------- +# RESOURCE USAGE (except WAL) +#--------------------------------------------------------------------------- + +# - Memory - + +shared_buffers = 16000 +sort_mem = 16384 +vacuum_mem = 3200000 + +# - Free Space Map - + +max_fsm_pages = 2000000 +max_fsm_relations = 500 + +# - Kernel Resource Usage - + +max_files_per_process = 100 # min 25 +#preload_libraries = '' + + +#--------------------------------------------------------------------------- +# WRITE AHEAD LOG +#--------------------------------------------------------------------------- + +# - Settings - + +fsync = true # turns forced synchronization on or off +#wal_sync_method = fsync # the default varies across platforms: + # fsync, fdatasync, open_sync, or +open_datasync +wal_buffers = 64 # min 4, 8KB each + +# - Checkpoints - + +checkpoint_segments = 50 # in logfile segments, min 1, 16MB each +#checkpoint_timeout = 60 # range 30-3600, in seconds +#checkpoint_warning = 30 # 0 is off, in seconds +#commit_delay = 0 # range 0-100000, in microseconds +#commit_siblings = 10 # range 1-1000 + + +#--------------------------------------------------------------------------- +# QUERY TUNING +#--------------------------------------------------------------------------- + +# - Planner Method Enabling - + +#enable_hashagg = true +#enable_hashjoin = true +enable_indexscan = true +#enable_mergejoin = true +#enable_nestloop = true +#enable_seqscan = true +#enable_sort = true +#enable_tidscan = true + +# - Planner Cost Constants - + +effective_cache_size = 50000 # typically 8KB each +random_page_cost = 20 # units are one sequential page fetch cost +#cpu_tuple_cost = 0.01 # (same) +#cpu_index_tuple_cost = 0.001 # (same) +#cpu_operator_cost = 0.0025 # (same) + +# - Genetic Query Optimizer - + +geqo = true +geqo_threshold = 11 +geqo_effort = 1 +geqo_generations = 0 +geqo_pool_size = 0 # default based on tables in statement, + # range 128-1024 +geqo_selection_bias = 2.0 # range 1.5-2.0 + +# - Other Planner Options - + +#default_statistics_target = 10 # range 1-1000 +#from_collapse_limit = 8 +#join_collapse_limit = 8 # 1 disables collapsing of explicit JOINs + + +#--------------------------------------------------------------------------- +# ERROR REPORTING AND LOGGING +#--------------------------------------------------------------------------- + +# - Syslog - + +syslog = 2 # range 0-2; 0=stdout; 1=both; 2=syslog +#syslog_facility = 'LOCAL0' +#syslog_ident = 'postgres' + +# - When to Log - + +client_min_messages = error # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # log, info, notice, warning, error + +log_min_messages = error # Values, in order of decreasing detail: + # debug5, debug4, debug3, debug2, debug1, + # info, notice, warning, error, log, +fatal, + # panic + +log_error_verbosity = terse # terse, default, or verbose messages + +#log_min_error_statement = panic # Values in order of increasing severity: + # debug5, debug4, debug3, debug2, +debug1, + # info, notice, warning, error, +panic(off) + +#log_min_duration_statement = -1 # Log all statements whose + # execution time exceeds the value, in + # milliseconds. Zero prints all queries. + # Minus-one disables. + +#silent_mode = false # DO NOT USE without Syslog! + +# - What to Log - + +debug_print_parse = false +debug_print_rewritten = false +debug_print_plan = false +debug_pretty_print = false +log_connections = false +log_duration = false +log_pid = false +log_statement = false +log_timestamp = true +log_hostname = true +log_source_port = false + + +#--------------------------------------------------------------------------- +# RUNTIME STATISTICS +#--------------------------------------------------------------------------- + +# - Statistics Monitoring - + +log_parser_stats = false +log_planner_stats = false +log_executor_stats = false +log_statement_stats = false + +# - Query/Index Statistics Collector - + +#stats_start_collector = true +#stats_command_string = false +#stats_block_level = false +#stats_row_level = false +#stats_reset_on_server_start = true + + +#--------------------------------------------------------------------------- +# CLIENT CONNECTION DEFAULTS +#--------------------------------------------------------------------------- + +# - Statement Behavior - + +#search_path = '$user,public' # schema names +#check_function_bodies = true +#default_transaction_isolation = 'read committed' +#default_transaction_read_only = false +#statement_timeout = 0 # 0 is disabled, in milliseconds + +# - Locale and Formatting - + +#datestyle = 'iso, mdy' +#timezone = unknown # actually, defaults to TZ environment +setting +#australian_timezones = false +#extra_float_digits = 0 # min -15, max 2 +#client_encoding = sql_ascii # actually, defaults to database encoding + +# These settings are initialized by initdb -- they may be changed +lc_messages = 'en_US.UTF-8' # locale for system error +message strings +lc_monetary = 'en_US.UTF-8' # locale for monetary formatting +lc_numeric = 'en_US.UTF-8' # locale for number formatting +lc_time = 'en_US.UTF-8' # locale for time formatting + +# - Other Defaults - + +#explain_pretty_print = true +#dynamic_library_path = '$libdir' +#max_expr_depth = 10000 # min 10 + + +#--------------------------------------------------------------------------- +# LOCK MANAGEMENT +#--------------------------------------------------------------------------- + +#deadlock_timeout = 1000 # in milliseconds +max_locks_per_transaction = 200 # min 10, ~260*max_connections bytes each + + +#--------------------------------------------------------------------------- +# VERSION/PLATFORM COMPATIBILITY +#--------------------------------------------------------------------------- + +# - Previous Postgres Versions - + +#add_missing_from = true +#regex_flavor = advanced # advanced, extended, or basic +#sql_inheritance = true + +# - Other Platforms & Clients - + +#transform_null_equals = false + +<--config--> + + +Thanks +-- +--------------------------------------------------------------- +Bryan Vest +ComNet Inc. +bright.net Network Administration/Network Operations +(888)-618-4638 +net-admin@bright.net Pager: pagenoc@bright.net +--------------------------------------------------------------- + +From pgsql-performance-owner@postgresql.org Mon Dec 6 15:15:02 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 972143A5F4E + for ; + Mon, 6 Dec 2004 15:14:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62181-05 + for ; + Mon, 6 Dec 2004 15:14:49 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 233133A5F17 + for ; + Mon, 6 Dec 2004 15:14:52 +0000 (GMT) +Received: (qmail 30296 invoked from network); 6 Dec 2004 16:15:30 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 6 Dec 2004 16:15:30 +0100 +Date: Mon, 06 Dec 2004 16:18:00 +0100 +To: Bryan , pgsql-performance@postgresql.org +Subject: Re: Config Check +References: <41B4701E.2090101@rhondasworld.com> +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <41B4701E.2090101@rhondasworld.com> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/109 +X-Sequence-Number: 9484 + + + + According to these lines you should set max_fsm_pages to at the very +least 5306160 + You have a humongous amount of RAM, you could set it to 10000000 + +> INFO: free space map: 79 relations, 1948399 pages stored; 5306160 total +> pages needed +> DETAIL: Allocated FSM size: 500 relations + 2000000 pages = 11769 kB +> shared memory. + + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 15:28:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0337F3A5F37 + for ; + Mon, 6 Dec 2004 15:28:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65157-08 + for ; + Mon, 6 Dec 2004 15:28:22 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 4A6013A5E84 + for ; + Mon, 6 Dec 2004 15:28:24 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP id EA9B3562D4 + for ; + Mon, 6 Dec 2004 10:28:21 -0500 (EST) +Message-ID: <41B47A97.1090708@deg.cc> +Date: Mon, 06 Dec 2004 10:28:23 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Poor Query +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/110 +X-Sequence-Number: 9485 + +Hi Everybody, + + I have a performance problem with this query , it takes lot of time +on the production database. is there a way to improve it ? i do vacuumdb +on this database and do anlyze on the users table separately daily + + +select userID, fname, lname, email, phone, dateEntered, dateCanceled, +dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as searches +from Users u +where 1=1 AND exists (select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.accountnumber = '12345678') + AND exists (select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.routingNumber = '12345678') +order by UserID desc +limit 500 + + QUERY PLAN +----------------------------------------------------------------------------------------------------- + Limit (cost=0.00..12752.61 rows=500 width=120) + -> Index Scan Backward using users_pkey on users u +(cost=0.00..2460462.79 rows=96469 width=120) + Filter: ((subplan) AND (subplan)) + SubPlan + -> Index Scan using bankaccount_pkey on bankaccount ba +(cost=0.00..3.07 rows=1 width=0) + Index Cond: (bankaccountid = $1) + Filter: (routingnumber = '12345678'::text) + -> Index Scan using bankaccount_pkey on bankaccount ba +(cost=0.00..3.07 rows=1 width=0) + Index Cond: (bankaccountid = $1) + Filter: (accountnumber = '12345678'::text) + +I tried changing it but it still takes lot of time + + +select userID, fname, lname, email, phone, dateEntered, dateCanceled, +dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as searches +from Users u +where 1=1 AND exists (select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.accountnumber = '12345678' + and ba.routingNumber = '12345678') +order by UserID desc +limit 500 + QUERY PLAN +------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..3309.62 rows=500 width=120) + -> Index Scan Backward using users_pkey on users u +(cost=0.00..1277101.86 rows=192938 width=120) + Filter: (subplan) + SubPlan + -> Index Scan using bankaccount_pkey on bankaccount ba +(cost=0.00..3.07 rows=1 width=0) + Index Cond: (bankaccountid = $1) + Filter: ((accountnumber = '12345678'::text) AND +(routingnumber = '12345678'::text)) + + + the users_pkey index on the primary key userid is on users table. it +seems to be using index but it still takes lot of time. + here is the output from the pg_class for the users and bankaccount +table . Table doesnt have lot of records but this query take anywhere +from 3 to 5 min to run which is really bad for us. Can we improve the +performance on this query ? + +relname | relpages | reltuples +---------+----------+----------- + users | 39967 | 385875 +bankaccount | 242 | 16453 + + +Thanks! +Pallav + + + + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 15:45:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 138E73A5F46 + for ; + Mon, 6 Dec 2004 15:45:10 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71934-03 + for ; + Mon, 6 Dec 2004 15:44:54 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 636BD3A5F1D + for ; + Mon, 6 Dec 2004 15:44:57 +0000 (GMT) +Received: (qmail 393 invoked from network); 6 Dec 2004 16:45:35 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 6 Dec 2004 16:45:35 +0100 +To: "Pallav Kalva" , pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> +Message-ID: +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Date: Mon, 06 Dec 2004 16:48:05 +0100 +In-Reply-To: <41B47A97.1090708@deg.cc> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/111 +X-Sequence-Number: 9486 + + + How many rows do the following queries return : + +select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.accountnumber = '12345678' + +select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.routingNumber = '12345678' + + Can you post EXPLAIN ANALYZE for these two queries ? + Regards. + +From pgsql-performance-owner@postgresql.org Mon Dec 6 15:52:59 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CE2123A55D6 + for ; + Mon, 6 Dec 2004 15:52:57 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 74819-06 + for ; + Mon, 6 Dec 2004 15:52:48 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 781F23A5F74 + for ; + Mon, 6 Dec 2004 15:52:51 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id 85A3156100; Mon, 6 Dec 2004 10:52:49 -0500 (EST) +Message-ID: <41B48053.7090805@deg.cc> +Date: Mon, 06 Dec 2004 10:52:51 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: =?ISO-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/112 +X-Sequence-Number: 9487 + +Pierre-Fr�d�ric Caillaud wrote: + +> +> How many rows do the following queries return : +> +> select userID +> from bankaccount ba +> where ba.bankaccountID = u.bankaccountID +> and ba.accountnumber = '12345678' +> +> select userID +> from bankaccount ba +> where ba.bankaccountID = u.bankaccountID +> and ba.routingNumber = '12345678' +> +> Can you post EXPLAIN ANALYZE for these two queries ? +> Regards. +> +Thanks! for the quick reply. It should usually return just one account +for that user so its only one record. Actually userid column doesnt +exist on bankaccount table it exists only on the user table and it is +joined with bankaccountid column, if i run this query separately i +wouldnt able to run it . + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 15:56:11 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1457E3A5F47 + for ; + Mon, 6 Dec 2004 15:56:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76450-08 + for ; + Mon, 6 Dec 2004 15:55:58 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 775793A5F1D + for ; + Mon, 6 Dec 2004 15:56:01 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB6Fu1Dq001891; + Mon, 6 Dec 2004 10:56:01 -0500 (EST) +To: Bryan +Cc: pgsql-performance@postgresql.org +Subject: Re: Config Check +In-reply-to: <41B4701E.2090101@rhondasworld.com> +References: <41B4701E.2090101@rhondasworld.com> +Comments: In-reply-to Bryan + message dated "Mon, 06 Dec 2004 09:43:42 -0500" +Date: Mon, 06 Dec 2004 10:56:01 -0500 +Message-ID: <1890.1102348561@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/113 +X-Sequence-Number: 9488 + +Bryan writes: +> vacuum_mem = 3200000 + +Yikes. You do realize that's measured in kilobytes? Try backing it off +to something saner, like half a gig or less. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Dec 6 16:13:31 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0CA1F3A55C4 + for ; + Mon, 6 Dec 2004 16:13:30 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83985-01 + for ; + Mon, 6 Dec 2004 16:13:04 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 032B43A5F17 + for ; + Mon, 6 Dec 2004 16:13:03 +0000 (GMT) +Received: (qmail 2977 invoked from network); 6 Dec 2004 17:13:39 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 6 Dec 2004 17:13:39 +0100 +To: "Pallav Kalva" +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> + <41B48053.7090805@deg.cc> +Message-ID: +Date: Mon, 06 Dec 2004 17:16:10 +0100 +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <41B48053.7090805@deg.cc> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/114 +X-Sequence-Number: 9489 + + + + Just wanted to know the selectivity of the accountnumber and +routingNumber columns. + I shoulda written : + +>> How many rows do the following queries return : + One or few at most, or a lot ? +>> +>> select userID +>> from bankaccount +>> WHERE accountnumber = '12345678' +>> +>> select userID +>> from bankaccount +>> WHERE routingNumber = '12345678' +>> +>> Can you post EXPLAIN ANALYZE for these two queries ? +>> Regards. +>> +> Thanks! for the quick reply. It should usually return just one account +> for that user so its only one record. Actually userid column doesnt +> exist on bankaccount table it exists only on the user table and it is +> joined with bankaccountid column, if i run this query separately i +> wouldnt able to run it . +> +> + + + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 16:38:10 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A17BB3A5F99 + for ; + Mon, 6 Dec 2004 16:38:01 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92016-06 + for ; + Mon, 6 Dec 2004 16:37:55 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C8513A5FA0 + for ; + Mon, 6 Dec 2004 16:37:53 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id CCDAC56338; Mon, 6 Dec 2004 11:37:45 -0500 (EST) +Message-ID: <41B48ADB.7000100@deg.cc> +Date: Mon, 06 Dec 2004 11:37:47 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: =?ISO-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> + <41B48053.7090805@deg.cc> +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/115 +X-Sequence-Number: 9490 + +Pierre-Fr�d�ric Caillaud wrote: + +> +> +> Just wanted to know the selectivity of the accountnumber and +> routingNumber columns. +> I shoulda written : +> +>>> How many rows do the following queries return : +>> +> One or few at most, or a lot ? + + +Just One, user can i have only one bankaccount. + +> +>>> +>>> select userID +>>> from bankaccount +>>> WHERE accountnumber = '12345678' +>>> +>>> select userID +>>> from bankaccount +>>> WHERE routingNumber = '12345678' +>>> +>>> Can you post EXPLAIN ANALYZE for these two queries ? +>>> Regards. +>>> +>> Thanks! for the quick reply. It should usually return just one +>> account for that user so its only one record. Actually userid column +>> doesnt exist on bankaccount table it exists only on the user table +>> and it is joined with bankaccountid column, if i run this query +>> separately i wouldnt able to run it . +>> +>> +> +> +> + + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 17:29:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 594DF3A5FA6 + for ; + Mon, 6 Dec 2004 17:29:51 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11547-08 + for ; + Mon, 6 Dec 2004 17:29:45 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 2F6AF3A5F9D + for ; + Mon, 6 Dec 2004 17:29:46 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6751848 for pgsql-performance@postgresql.org; + Mon, 06 Dec 2004 09:31:18 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Processor optimization compile options? +Date: Mon, 6 Dec 2004 09:26:34 -0800 +User-Agent: KMail/1.6.2 +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: 7bit +Message-Id: <200412060926.34124.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/116 +X-Sequence-Number: 9491 + +Folks, + +I'm wondering if people have had success with 7.4 and 8.0 using specific +compile optimizations not provided by the default PG install. Since -O2 +and others have been built into config, I've not been doing much myself. + +What are other people's experiences in this area? Do you have any stats to +back it up? + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Dec 6 17:31:45 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 92EF33A5F9E + for ; + Mon, 6 Dec 2004 17:31:43 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12965-04 + for ; + Mon, 6 Dec 2004 17:31:17 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 6881F3A5EC7 + for ; + Mon, 6 Dec 2004 17:31:16 +0000 (GMT) +Received: (qmail 9810 invoked from network); 6 Dec 2004 18:31:52 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 6 Dec 2004 18:31:52 +0100 +Date: Mon, 06 Dec 2004 18:34:22 +0100 +To: "Pallav Kalva" +Subject: Re: Poor Query +Cc: pgsql-performance@postgresql.org +References: <41B47A97.1090708@deg.cc> + <41B48053.7090805@deg.cc> + <41B48ADB.7000100@deg.cc> +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <41B48ADB.7000100@deg.cc> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/117 +X-Sequence-Number: 9492 + + + +> Just One, user can i have only one bankaccount. + + Ah well, in that case : + This is your query : + +select userID, fname, lname, email, phone, dateEntered, dateCanceled, +dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as searches + from Users u +where 1=1 AND exists (select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.accountnumber = '12345678') +AND exists (select userID + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.routingNumber = '12345678') +order by UserID desc +limit 500 + + What it does is scan all users, and for each user, test if it has the +accountnumber or the routingNumber you seek. You're reversing the problem +: you should first look for accountnumber and routingNumber, THEN look for +the user : + + +SELECT * FROM Users WHERE bankaccountID IN +(SELECT bankaccountID FROM bankaccount WHERE accountnumber = '12345678' +OR/AND routingNumber = '12345678') + +or : + +SELECT * FROM Users WHERE userID IN +(SELECT userID FROM bankaccount WHERE accountnumber = '12345678' OR/AND +routingNumber = '12345678') + +There is something very strange in your query, it seems that bankaccount +and Users both have a UserID column and a bankaccountID column. Is this +normal ? It looks denormalized to me... + +From pgsql-performance-owner@postgresql.org Mon Dec 6 18:00:43 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BDD983A5F1D + for ; + Mon, 6 Dec 2004 18:00:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23932-02 + for ; + Mon, 6 Dec 2004 18:00:35 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 714BB3A5FC4 + for ; + Mon, 6 Dec 2004 18:00:29 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id EEC0B56369; Mon, 6 Dec 2004 13:00:24 -0500 (EST) +Message-ID: <41B49E3B.7030407@deg.cc> +Date: Mon, 06 Dec 2004 13:00:27 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: =?ISO-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> + <41B48053.7090805@deg.cc> + <41B48ADB.7000100@deg.cc> +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/118 +X-Sequence-Number: 9493 + +Pierre-Fr�d�ric Caillaud wrote: + +> +> +>> Just One, user can i have only one bankaccount. +> +> +> Ah well, in that case : +> This is your query : +> +> select userID, fname, lname, email, phone, dateEntered, dateCanceled, +> dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as +> searches +> from Users u +> where 1=1 AND exists (select userID +> from bankaccount ba +> where ba.bankaccountID = u.bankaccountID +> and ba.accountnumber = '12345678') +> AND exists (select userID +> from bankaccount ba +> where ba.bankaccountID = u.bankaccountID +> and ba.routingNumber = '12345678') +> order by UserID desc +> limit 500 +> +> What it does is scan all users, and for each user, test if it has +> the accountnumber or the routingNumber you seek. You're reversing the +> problem : you should first look for accountnumber and routingNumber, +> THEN look for the user : +> +> +> SELECT * FROM Users WHERE bankaccountID IN +> (SELECT bankaccountID FROM bankaccount WHERE accountnumber = +> '12345678' OR/AND routingNumber = '12345678') +> +> or : +> +> SELECT * FROM Users WHERE userID IN +> (SELECT userID FROM bankaccount WHERE accountnumber = '12345678' +> OR/AND routingNumber = '12345678') +> +> There is something very strange in your query, it seems that +> bankaccount and Users both have a UserID column and a bankaccountID +> column. Is this normal ? It looks denormalized to me... +> +Userid column is only in users table not in bankaccounts table , based +on your suggestion i made changes to the query and here are the explain +plans : + + +select userID, fname, lname, email, phone, dateEntered, dateCanceled, +dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as searches +from Users u +where bankaccountid in (select bankaccountid + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.accountnumber = '12345678') + AND bankaccountid in (select bankaccountid + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.routingNumber = '12345678') +order by UserID desc +limit 500 + + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..6642.59 rows=500 width=121) (actual +time=40180.116..93650.837 rows=1 loops=1) + -> Index Scan Backward using users_pkey on users u +(cost=0.00..1087936.69 rows=81891 width=121) (actual +time=40180.112..93650.829 rows=1 loops=1) + Filter: ((subplan) AND (subplan)) + SubPlan + -> Index Scan using bankaccount_pkey on bankaccount ba +(cost=0.00..3.08 rows=1 width=4) (actual time=0.019..0.019 rows=0 loops=3) + Index Cond: (bankaccountid = $0) + Filter: (routingnumber = '12345678'::text) + -> Index Scan using bankaccount_pkey on bankaccount ba +(cost=0.00..3.08 rows=1 width=4) (actual time=0.004..0.004 rows=0 +loops=385914) + Index Cond: (bankaccountid = $0) + Filter: (accountnumber = '12345678'::text) + Total runtime: 93684.307 ms + + + +select userID, fname, lname, email, phone, dateEntered, dateCanceled, +dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as searches +from Users u +where bankaccountid in (select bankaccountid + from bankaccount ba + where ba.bankaccountID = u.bankaccountID + and ba.accountnumber = '12345678' + and ba.routingNumber = '12345678') +order by UserID desc +limit 500 + + + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..1777.53 rows=500 width=121) (actual +time=18479.669..63584.437 rows=1 loops=1) + -> Index Scan Backward using users_pkey on users u +(cost=0.00..582250.93 rows=163781 width=121) (actual +time=18479.663..63584.428 rows=1 loops=1) + Filter: (subplan) + SubPlan + -> Index Scan using bankaccount_pkey on bankaccount ba +(cost=0.00..3.09 rows=1 width=4) (actual time=0.004..0.004 rows=0 +loops=385914) + Index Cond: (bankaccountid = $0) + Filter: ((accountnumber = '12345678'::text) AND +(routingnumber = '12345678'::text)) + Total runtime: 63596.222 ms + +What's wierd is even though there is a index on bankaccountid table it +doesnt use that index, it uses the index on the userid table and the +execution time is little better but it still takes over a minute to +execute . + + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 18:58:07 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DB6113A414A + for ; + Mon, 6 Dec 2004 18:58:05 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42266-04 + for ; + Mon, 6 Dec 2004 18:57:46 +0000 (GMT) +Received: from smtp103.rog.mail.re2.yahoo.com (smtp103.rog.mail.re2.yahoo.com + [206.190.36.81]) + by svr1.postgresql.org (Postfix) with SMTP id 6C3D43A5D85 + for ; + Mon, 6 Dec 2004 18:57:46 +0000 (GMT) +Received: from unknown (HELO phlogiston.dydns.org) + (a.sullivan@rogers.com@65.49.125.184 with login) + by smtp103.rog.mail.re2.yahoo.com with SMTP; 6 Dec 2004 18:57:45 -0000 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id 135E940DC; Mon, 6 Dec 2004 13:57:38 -0500 (EST) +Date: Mon, 6 Dec 2004 13:57:38 -0500 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Alternatives to Dell? +Message-ID: <20041206185738.GD22712@phlogiston.dyndns.org> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <200412011424.12137.josh@agliodbs.com> + <1102083578.3656.9.camel@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1102083578.3656.9.camel@localhost> +User-Agent: Mutt/1.5.6+20040722i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/119 +X-Sequence-Number: 9494 + +On Fri, Dec 03, 2004 at 07:19:37AM -0700, Cott Lang wrote: +> Consider Sun's new line of Opterons. They've been around for a couple of + +I wouldn't buy a ray of sunshine from Sun in the middle of January at +the north pole, given the customer experience I had with them. They +had consistent failures in some critical hardware, and it was like +asking them to donate a kidney when we tried to get the things fixed. +Finally, they told us that they'd sell us the new line of hardware +instead. In other words, "The last version was broken, but _this_ +one works! We promise!" We told them to take a long walk off a +short pier. Their service people sure _try_ hard in the field, but +some machines required three and four visits to fix. + +I also find the Sun Opteron offering to be way overpriced compared to +the competition. + +In case it's not obvious, I don't speak for my employer. + +A + +-- +Andrew Sullivan | ajs@crankycanuck.ca +This work was visionary and imaginative, and goes to show that visionary +and imaginative work need not end up well. + --Dennis Ritchie + +From pgsql-performance-owner@postgresql.org Mon Dec 6 20:15:32 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C6AF23A414A + for ; + Mon, 6 Dec 2004 20:15:31 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68244-05 + for ; + Mon, 6 Dec 2004 20:15:20 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 23F543A6014 + for ; + Mon, 6 Dec 2004 20:15:20 +0000 (GMT) +Received: (qmail 24886 invoked from network); 6 Dec 2004 21:15:57 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 6 Dec 2004 21:15:57 +0100 +To: "Pallav Kalva" +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> + <41B48053.7090805@deg.cc> + <41B48ADB.7000100@deg.cc> + <41B49E3B.7030407@deg.cc> +Message-ID: +Date: Mon, 06 Dec 2004 21:18:28 +0100 +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <41B49E3B.7030407@deg.cc> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/120 +X-Sequence-Number: 9495 + + + Your suffering comes from the "where ba.bankaccountID = u.bankaccountID" +in the subselect. It means postgres has to run the subselect once for each +row in Users. You want the subselect to run only once, and return one (or +more?) bankaccountid's, then fetch the users from Users. + + Just remove the "where ba.bankaccountID = u.bankaccountID" ! + +> select userID, fname, lname, email, phone, dateEntered, dateCanceled, +> dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as +> searches +> from Users u +> where bankaccountid in (select bankaccountid +> from bankaccount ba +> where ba.bankaccountID = u.bankaccountID +> and ba.accountnumber = '12345678' +> and ba.routingNumber = '12345678') +> order by UserID desc +> limit 500 + +New version : + + select userID, fname, lname, email, phone, dateEntered, dateCanceled, + dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as + searches + from Users u + where bankaccountid in (select bankaccountid + from bankaccount ba + WHERE ba.accountnumber = '12345678' + and ba.routingNumber = '12345678') + +You could also do this : + + select u.* from Users u, bankaccount ba + where u.bankaccountid = ba.bankaccountid + and ba.accountnumber = '12345678' + and ba.routingNumber = '12345678') + + + + +From pgsql-performance-owner@postgresql.org Tue Dec 7 00:51:06 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E7E33A5FD3 + for ; + Mon, 6 Dec 2004 20:29:28 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71192-03 + for ; + Mon, 6 Dec 2004 20:29:19 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7D2493A414A + for ; + Mon, 6 Dec 2004 20:29:20 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 3DFBD3193E; Mon, 6 Dec 2004 21:29:19 +0100 (MET) +From: "Rosny" +X-Newsgroups: pgsql.performance +Subject: Re: TableSpace Design issues on Postgres 8.0 beta 5 +Date: Mon, 6 Dec 2004 12:28:54 -0800 +Organization: Hub.Org Networking Services +Lines: 145 +Message-ID: +References: +Reply-To: "Rosny" +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.3790.181 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.264 tagged_above=0 required=5 + tests=FORGED_HOTMAIL_RCVD2, PRIORITY_NO_NAME +X-Spam-Level: ** +X-Archive-Number: 200412/122 +X-Sequence-Number: 9497 + +Additional update: +After spending time in searching more option. +Both Postgresql and MySQL Claims +1. Postgresql: +http://www.postgresql.org/users-lounge/limitations.html +2.MySQL +(Drawback creating large numbers of tables) +http://forums.devshed.com/t27778/s.html + +This might sound like crazy ideas. I just try to experiment several option +which are easy todo before developing). + +After running auto generate tables 12 tables each for each of 1600 +Tablespaces +Here are some statistics +1. For every 12 tables created in each Tablespace will create 35 files in +tablespace directory +2. For every 12 tables for each 1 tables space will creates additional +approx 17 additional new(eventhough it has it's own tablespace files for +default database directory +3. The above screnario creating 19200 tables in database +4. It take approximately 2 hours for pgAdmin III when starting just to load +all tables info when first starting. + Good news(it did not hang, it able to handle all 19200 tables once +loaded and easily browse all tables info) + +I have not try to actually query the database from the web. +Seems like the whole approach of "large number of tables" is not good. +(As College Database Design course said....:):). + +By creating 12 tables for each of 7000 Tablespace. Now files in folder is +not as huge as when everything in one TableSpace. + + +Any opinion is welcome... + + + +"Rosny" wrote in message +news:cp1o7f$13ad$2@news.hub.org... +> Hi, +> +> This kind of long email. +> +> After searching the mailing list, have not found good answer +> for TableSpace. So, I try to post this question. +> +> My question +> Question : +> 1 Which option from below scenario will be good in term of performance +and +> future scalability? +> 2. Is it Option B1 below the right approach? +> 3. Is progresql will have problems if I have 7000 tablespace? +> +> ------------------------------------------------------------------- +> Environment : +> - Windows 2003 +> - Postgresql 8.0 beta 5 +> +> Scenario : +> Original Design: +> Total Tables 40: +> - 20 tables are main tables responsible for the others 20 tables +> - the others 20 tables are specific for each department. +> - from these 20 tables(departments) +> there are 4-5 tables that will contain approx 20 millions records +> (these tables will be hit every times access to the website). +> +> Refering to 20 tables which can be partition +> A. All departments tables is put into 20 tables. +> some querying of 20 millions records. +> +> B. For each department create tablespace. (Which means, if there +> are 7000 departments, there will be 7000 tablespace each contains +> 20 tables). +> +> +> Question : Which option will be good in term of performance +> and future scalability? +> +> A1. Use A option, +> As tables become huge. partition the tables which hits often +> and has large size file(usually when it bigger than 2-3 GB size) +> into separate tablespace. +> +> Problems in A1 approach : +> 1. query take very long. It might be resolved +> - indexing, better written pgsql statement. +> +> Advantage : total files are small. around 1000 in one directory +> +> +> B1. Use B option, +> Creating 7000 TableSpace for Departments +> - One Department has one tablespace +> - Each Department has 20 tables +> +> Advantage : +> - each table is small and query is very fast. +> - scalability. As the sites grows, contents grows. will +> not effect future scalability as much as A1. +> in A1 the query already max out for performance partition. +> in B1 the query has not max out yet because the data is +> already distribute across thousands of tables +> +> Disadvantage: +> - total numbers of files is huge. +> (after creating 7000 tablespace, and start +> table automatic generator to create 20 tables +> for each 7000 tablespace. +> After running the 1500th tablespace. +> Each TableSpace has : 35 files +> Surprisingly the default table space already has 20000 files) +> - Need to use dynamic table name query. (this is ok, +> since there are not very complex sql statement logic) +> +> I am trying to choose option B1, as it is good for future scability. +> +> Question : +> 1. Is it B1 the right approach? +> 2. Is progresql will have problems if I have 7000 tablespace? +> +> +> Thank you, +> Rosny +> +> note: previously posted on cygwin. but I think it is more appropriate for +> this group +> +> +> +> +> +> +> +> +> +> +> +> +> +> + + + +From pgsql-performance-owner@postgresql.org Mon Dec 6 20:44:13 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 86BCB3A6011 + for ; + Mon, 6 Dec 2004 20:44:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77149-02 + for ; + Mon, 6 Dec 2004 20:44:06 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id 05E833A6006 + for ; + Mon, 6 Dec 2004 20:44:06 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id 6B61C563A3; Mon, 6 Dec 2004 15:44:01 -0500 (EST) +Message-ID: <41B4C494.5090304@deg.cc> +Date: Mon, 06 Dec 2004 15:44:04 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: =?ISO-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Cc: pgsql-performance@postgresql.org +Subject: Re: Poor Query +References: <41B47A97.1090708@deg.cc> + <41B48053.7090805@deg.cc> + <41B48ADB.7000100@deg.cc> + <41B49E3B.7030407@deg.cc> +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/121 +X-Sequence-Number: 9496 + +Pierre-Fr�d�ric Caillaud wrote: + +> +> Your suffering comes from the "where ba.bankaccountID = +> u.bankaccountID" in the subselect. It means postgres has to run the +> subselect once for each row in Users. You want the subselect to run +> only once, and return one (or more?) bankaccountid's, then fetch the +> users from Users. +> +> Just remove the "where ba.bankaccountID = u.bankaccountID" ! +> +>> select userID, fname, lname, email, phone, dateEntered, dateCanceled, +>> dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as +>> searches +>> from Users u +>> where bankaccountid in (select bankaccountid +>> from bankaccount ba +>> where ba.bankaccountID = u.bankaccountID +>> and ba.accountnumber = '12345678' +>> and ba.routingNumber = '12345678') +>> order by UserID desc +>> limit 500 +> +> +> New version : +> +> select userID, fname, lname, email, phone, dateEntered, dateCanceled, +> dateSuspended, billAmount, billDate, dateBilled, datePaid, '?' as +> searches +> from Users u +> where bankaccountid in (select bankaccountid +> from bankaccount ba +> WHERE ba.accountnumber = '12345678' +> and ba.routingNumber = '12345678') +> +> You could also do this : +> +> select u.* from Users u, bankaccount ba +> where u.bankaccountid = ba.bankaccountid +> and ba.accountnumber = '12345678' +> and ba.routingNumber = '12345678') +> +> +> +Thanks! a lot that was it , it is way much better now. + + +From pgsql-performance-owner@postgresql.org Tue Dec 7 00:52:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EFC83A5FC2 + for ; + Mon, 6 Dec 2004 22:21:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07073-03 + for ; + Mon, 6 Dec 2004 22:21:30 +0000 (GMT) +Received: from mail.cipsoft.com (mail.cipsoft.com [62.146.47.42]) + by svr1.postgresql.org (Postfix) with ESMTP id EF99E3A601E + for ; + Mon, 6 Dec 2004 22:21:29 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by mail.cipsoft.com (Postfix) with ESMTP id 93E031B8454 + for ; + Mon, 6 Dec 2004 23:21:27 +0100 (CET) +Received: from mail.cipsoft.com ([127.0.0.1]) + by localhost (regina.cipsoft.com [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 23620-10 for ; + Mon, 6 Dec 2004 23:21:27 +0100 (CET) +Received: from sam.cipsoft.de (p5091D441.dip0.t-ipconnect.de [80.145.212.65]) + by mail.cipsoft.com (Postfix) with ESMTP id 155F21B8160 + for ; + Mon, 6 Dec 2004 23:21:27 +0100 (CET) +Received: from bilbo (bilbo.cipsoft.de [192.168.0.103]) + by sam.cipsoft.de (Postfix) with ESMTP id 8054DC92DC + for ; + Mon, 6 Dec 2004 23:21:26 +0100 (CET) +From: vogler@cipsoft.com +To: pgsql-performance@postgresql.org +Date: Mon, 06 Dec 2004 23:18:14 +0100 +MIME-Version: 1.0 +Subject: scaling beyond 4 processors +Message-ID: <41B4E8B6.6059.1FBEABB@localhost> +X-mailer: Pegasus Mail for Windows (4.21a) +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Content-description: Mail message body +X-Virus-Scanned: by amavisd-new at mail.cipsoft.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.228 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200412/124 +X-Sequence-Number: 9499 + +Hello everyone! + +Since our current Postgres server, a quad Xeon system, finally can't keep up with our +load anymore we're ready to take the next step. + +So the question is: Has anyone experiences with running Postgres on systems with +more than 4 processors in a production environment? Which systems and +architectures are you using (e.g. IBM xseries, IBM pseries, HP Proliant, Sun Fire, 8- +way Opteron)? How about conflicts between Postgres' shared memory approach and +the NUMA architecture of most multi-processor machines? + +Maybe it's time to switch to Oracle or DB2, but before I give up on Postgres, I wanted +to hear some other opinions. + +Thanks for any hints and suggestions. + +Best regards, +Stephan Vogler +CipSoft GmbH + +From pgsql-performance-owner@postgresql.org Tue Dec 7 02:41:03 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 145323A60C5 + for ; + Tue, 7 Dec 2004 02:41:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 77375-02 + for ; + Tue, 7 Dec 2004 02:40:46 +0000 (GMT) +Received: from ew.mimos.my (unknown [192.228.129.34]) + by svr1.postgresql.org (Postfix) with ESMTP id B30973A60C0 + for ; + Tue, 7 Dec 2004 02:40:47 +0000 (GMT) +Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) + by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id iB72ed90036339; + Tue, 7 Dec 2004 10:40:44 +0800 (MYT) + (envelope-from hasnulfadhly.h@mimos.my) +Message-ID: <41B51829.9030307@mimos.my> +Date: Tue, 07 Dec 2004 10:40:41 +0800 +From: Hasnul Fadhly bin Hasan +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: Bryan +Cc: pgsql-performance@postgresql.org +Subject: Re: Config Check +References: <41B4701E.2090101@rhondasworld.com> +In-Reply-To: <41B4701E.2090101@rhondasworld.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.08 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/126 +X-Sequence-Number: 9501 + +Hi Bryan, + +Just wondering, i ran vacuumdb but didn't get the information that you +get about the free space even when i set the verbose option. How did +you get that? + +Thanks, + +Hasnul + + +Bryan wrote: + +> +> Postgresql is the backbone of our spam filtering system. Currently the +> performance is OK. Wanted to know if someone could give this config a +> quick run down and see if there is anything we can adjust here to +> smooth out the performance. The IO Wait Times are outrageous, at times +> the load will spike up to the 70 - 90 range. +> +> Hardware: +> Quad Opteron 2Ghz +> Tyan Quad Opteron Board +> 16GB DDR Ram +> Emulex LightPulse LP1050 +> EMC Clarion Fiber Array running Raid5 +> ----------------------------------------- +> Software: +> RedHat Linux AS +> Postgresql 7.4.6 +> ----------------------------------------- +> Detail: +> pg_xlog is stored on a local 10k RPM SCSI drive. +> The rest of the database is stored on the Fiber Array. +> +> Currently the database is at a size of 87.6Gig. A Vacuum Analyze runs +> every night and has been taking 4 or 5 hours to complete. Everything +> seems to run fine for a while, then at some point the load goes +> through the roof and the iowait % also goes way up. It will recover +> after a little bit and then do the same thing all over again. When +> this happens access to the web based user interface slows way down for +> our customers. Any input for improvements to this config would be +> appreciated, Thanks. +> +> ------------------------------------------ +> +> ------------------------------------------ +> Vacuum Output: +> +> INFO: analyzing "pg_catalog.pg_listener" +> INFO: "pg_listener": 0 pages, 0 rows sampled, 0 estimated total rows +> INFO: free space map: 79 relations, 1948399 pages stored; 5306160 +> total pages needed +> DETAIL: Allocated FSM size: 500 relations + 2000000 pages = 11769 kB +> shared memory. +> VACUUM +> -------------------------------------------- +> +> <--config--> +> +> tcpip_socket = true +> max_connections = 800 +> #superuser_reserved_connections = 2 +> port = 5432 +> #port = 9999 +> #unix_socket_directory = '' +> #unix_socket_group = '' +> #unix_socket_permissions = 0777 # octal +> #virtual_host = '' # what interface to listen on; +> defaults to any +> #rendezvous_name = '' # defaults to the computer name +> +> # - Security & Authentication - +> +> #authentication_timeout = 60 # 1-600, in seconds +> #ssl = false +> #password_encryption = true +> #krb_server_keyfile = '' +> #db_user_namespace = false +> +> +> #--------------------------------------------------------------------------- +> +> # RESOURCE USAGE (except WAL) +> #--------------------------------------------------------------------------- +> +> +> # - Memory - +> +> shared_buffers = 16000 +> sort_mem = 16384 +> vacuum_mem = 3200000 +> +> # - Free Space Map - +> +> max_fsm_pages = 2000000 +> max_fsm_relations = 500 +> +> # - Kernel Resource Usage - +> +> max_files_per_process = 100 # min 25 +> #preload_libraries = '' +> +> +> #--------------------------------------------------------------------------- +> +> # WRITE AHEAD LOG +> #--------------------------------------------------------------------------- +> +> +> # - Settings - +> +> fsync = true # turns forced synchronization on or off +> #wal_sync_method = fsync # the default varies across platforms: +> # fsync, fdatasync, open_sync, or +> open_datasync +> wal_buffers = 64 # min 4, 8KB each +> +> # - Checkpoints - +> +> checkpoint_segments = 50 # in logfile segments, min 1, 16MB each +> #checkpoint_timeout = 60 # range 30-3600, in seconds +> #checkpoint_warning = 30 # 0 is off, in seconds +> #commit_delay = 0 # range 0-100000, in microseconds +> #commit_siblings = 10 # range 1-1000 +> +> +> #--------------------------------------------------------------------------- +> +> # QUERY TUNING +> #--------------------------------------------------------------------------- +> +> +> # - Planner Method Enabling - +> +> #enable_hashagg = true +> #enable_hashjoin = true +> enable_indexscan = true +> #enable_mergejoin = true +> #enable_nestloop = true +> #enable_seqscan = true +> #enable_sort = true +> #enable_tidscan = true +> +> # - Planner Cost Constants - +> +> effective_cache_size = 50000 # typically 8KB each +> random_page_cost = 20 # units are one sequential page fetch +> cost +> #cpu_tuple_cost = 0.01 # (same) +> #cpu_index_tuple_cost = 0.001 # (same) +> #cpu_operator_cost = 0.0025 # (same) +> +> # - Genetic Query Optimizer - +> +> geqo = true +> geqo_threshold = 11 +> geqo_effort = 1 +> geqo_generations = 0 +> geqo_pool_size = 0 # default based on tables in statement, +> # range 128-1024 +> geqo_selection_bias = 2.0 # range 1.5-2.0 +> +> # - Other Planner Options - +> +> #default_statistics_target = 10 # range 1-1000 +> #from_collapse_limit = 8 +> #join_collapse_limit = 8 # 1 disables collapsing of explicit JOINs +> +> +> #--------------------------------------------------------------------------- +> +> # ERROR REPORTING AND LOGGING +> #--------------------------------------------------------------------------- +> +> +> # - Syslog - +> +> syslog = 2 # range 0-2; 0=stdout; 1=both; 2=syslog +> #syslog_facility = 'LOCAL0' +> #syslog_ident = 'postgres' +> +> # - When to Log - +> +> client_min_messages = error # Values, in order of decreasing detail: +> # debug5, debug4, debug3, debug2, +> debug1, +> # log, info, notice, warning, error +> +> log_min_messages = error # Values, in order of decreasing detail: +> # debug5, debug4, debug3, debug2, +> debug1, +> # info, notice, warning, error, log, +> fatal, +> # panic +> +> log_error_verbosity = terse # terse, default, or verbose messages +> +> #log_min_error_statement = panic # Values in order of increasing +> severity: +> # debug5, debug4, debug3, debug2, +> debug1, +> # info, notice, warning, error, +> panic(off) +> +> #log_min_duration_statement = -1 # Log all statements whose +> # execution time exceeds the value, in +> # milliseconds. Zero prints all +> queries. +> # Minus-one disables. +> +> #silent_mode = false # DO NOT USE without Syslog! +> +> # - What to Log - +> +> debug_print_parse = false +> debug_print_rewritten = false +> debug_print_plan = false +> debug_pretty_print = false +> log_connections = false +> log_duration = false +> log_pid = false +> log_statement = false +> log_timestamp = true +> log_hostname = true +> log_source_port = false +> +> +> #--------------------------------------------------------------------------- +> +> # RUNTIME STATISTICS +> #--------------------------------------------------------------------------- +> +> +> # - Statistics Monitoring - +> +> log_parser_stats = false +> log_planner_stats = false +> log_executor_stats = false +> log_statement_stats = false +> +> # - Query/Index Statistics Collector - +> +> #stats_start_collector = true +> #stats_command_string = false +> #stats_block_level = false +> #stats_row_level = false +> #stats_reset_on_server_start = true +> +> +> #--------------------------------------------------------------------------- +> +> # CLIENT CONNECTION DEFAULTS +> #--------------------------------------------------------------------------- +> +> +> # - Statement Behavior - +> +> #search_path = '$user,public' # schema names +> #check_function_bodies = true +> #default_transaction_isolation = 'read committed' +> #default_transaction_read_only = false +> #statement_timeout = 0 # 0 is disabled, in milliseconds +> +> # - Locale and Formatting - +> +> #datestyle = 'iso, mdy' +> #timezone = unknown # actually, defaults to TZ environment +> setting +> #australian_timezones = false +> #extra_float_digits = 0 # min -15, max 2 +> #client_encoding = sql_ascii # actually, defaults to database encoding +> +> # These settings are initialized by initdb -- they may be changed +> lc_messages = 'en_US.UTF-8' # locale for system error +> message strings +> lc_monetary = 'en_US.UTF-8' # locale for monetary formatting +> lc_numeric = 'en_US.UTF-8' # locale for number formatting +> lc_time = 'en_US.UTF-8' # locale for time formatting +> +> # - Other Defaults - +> +> #explain_pretty_print = true +> #dynamic_library_path = '$libdir' +> #max_expr_depth = 10000 # min 10 +> +> +> #--------------------------------------------------------------------------- +> +> # LOCK MANAGEMENT +> #--------------------------------------------------------------------------- +> +> +> #deadlock_timeout = 1000 # in milliseconds +> max_locks_per_transaction = 200 # min 10, ~260*max_connections bytes each +> +> +> #--------------------------------------------------------------------------- +> +> # VERSION/PLATFORM COMPATIBILITY +> #--------------------------------------------------------------------------- +> +> +> # - Previous Postgres Versions - +> +> #add_missing_from = true +> #regex_flavor = advanced # advanced, extended, or basic +> #sql_inheritance = true +> +> # - Other Platforms & Clients - +> +> #transform_null_equals = false +> +> <--config--> +> +> +> Thanks + + + +From pgsql-performance-owner@postgresql.org Tue Dec 7 02:51:49 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7969B3A60EB + for ; + Tue, 7 Dec 2004 02:51:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 78199-08 + for ; + Tue, 7 Dec 2004 02:51:30 +0000 (GMT) +Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id 7FD9D3A60E3 + for ; + Tue, 7 Dec 2004 02:51:32 +0000 (GMT) +Received: from jefftrout.com ([24.128.241.68]) + by comcast.net (rwcrmhc13) with SMTP + id <2004120702512901500nh6m7e>; Tue, 7 Dec 2004 02:51:30 +0000 +Received: (qmail 70744 invoked from network); 7 Dec 2004 02:51:29 -0000 +Received: from unknown (HELO ?192.168.0.100?) (10.10.10.20) + by 10.10.10.10 with SMTP; 7 Dec 2004 02:51:29 -0000 +In-Reply-To: <41B4E8B6.6059.1FBEABB@localhost> +References: <41B4E8B6.6059.1FBEABB@localhost> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <0736B0F0-47FB-11D9-A0F2-000393D1F76E@torgo.978.org> +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Jeff +Subject: Re: scaling beyond 4 processors +Date: Mon, 6 Dec 2004 21:52:26 -0500 +To: vogler@cipsoft.com +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.653 tagged_above=0 required=5 tests=RCVD_BY_IP, + URIBL_SBL +X-Spam-Level: +X-Archive-Number: 200412/127 +X-Sequence-Number: 9502 + + +On Dec 6, 2004, at 5:18 PM, vogler@cipsoft.com wrote: + +> Hello everyone! +> +> Since our current Postgres server, a quad Xeon system, finally can't +> keep up with our +> load anymore we're ready to take the next step. +> + +I'm assuming you've already done as much query tweaking as possible. + +and are you sure you are CPU bound and not IO bound? +(Symptoms of IO bound are low cpu usage, high load average, poor +performance. Many processes in "D" state) + +> So the question is: Has anyone experiences with running Postgres on +> systems with +> more than 4 processors in a production environment? Which systems and + +Have you also considered a replicated approach? + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Mon Dec 13 01:16:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 25CCC3A60E0 + for ; + Tue, 7 Dec 2004 02:55:07 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80402-07 + for ; + Tue, 7 Dec 2004 02:55:01 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id 242FF3A60D0 + for ; + Tue, 7 Dec 2004 02:55:04 +0000 (GMT) +Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id iB72so311756; + Mon, 6 Dec 2004 20:54:50 -0600 +Message-ID: <41B51B72.3050000@arbash-meinel.com> +Date: Mon, 06 Dec 2004 20:54:42 -0600 +From: John A Meinel +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Hasnul Fadhly bin Hasan +Cc: Bryan , pgsql-performance@postgresql.org +Subject: Re: Config Check +References: <41B4701E.2090101@rhondasworld.com> <41B51829.9030307@mimos.my> +In-Reply-To: <41B51829.9030307@mimos.my> +X-Enigmail-Version: 0.89.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enig5771A769226BE94FAA64832E" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/153 +X-Sequence-Number: 9528 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enig5771A769226BE94FAA64832E +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Hasnul Fadhly bin Hasan wrote: +> Hi Bryan, +> +> Just wondering, i ran vacuumdb but didn't get the information that you +> get about the free space even when i set the verbose option. How did +> you get that? +> +> Thanks, +> +> Hasnul + + +I believe it is +VACUUM FULL ANALYZE VERBOSE; + +At the very end you will get a listing like + +INFO: free space map: 167 relations, 423 pages stored; 2912 total pages +needed +DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 186 kB +shared memory. + +(Yes, mine is done on a very static table.) + +John +=:-> + +--------------enig5771A769226BE94FAA64832E +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFBtRt0JdeBCYSNAAMRAgw2AJ4xf40kjIy7DQ4Pg87cauthV/2VjQCcDV0b +pPGnHgIgfTmKdw4heQrQHIY= +=192a +-----END PGP SIGNATURE----- + +--------------enig5771A769226BE94FAA64832E-- + +From pgsql-performance-owner@postgresql.org Tue Dec 7 04:18:08 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 186C83A60DB + for ; + Tue, 7 Dec 2004 04:17:55 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17928-07 + for ; + Tue, 7 Dec 2004 04:17:44 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 423783A4DC1 + for ; + Tue, 7 Dec 2004 04:17:44 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 5179A31941; Tue, 7 Dec 2004 05:17:43 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: scaling beyond 4 processors +Date: Mon, 06 Dec 2004 23:16:01 -0500 +Organization: cbbrowne Computing Inc +Lines: 30 +Message-ID: +References: <41B4E8B6.6059.1FBEABB@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:eO03lk/ExMEWjRoYl5v6sx6CSQE= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/128 +X-Sequence-Number: 9503 + +In the last exciting episode, vogler@cipsoft.com wrote: +> Hello everyone! +> +> Since our current Postgres server, a quad Xeon system, finally can't +> keep up with our load anymore we're ready to take the next step. +> +> So the question is: Has anyone experiences with running Postgres on +> systems with more than 4 processors in a production environment? +> Which systems and architectures are you using (e.g. IBM xseries, IBM +> pseries, HP Proliant, Sun Fire, 8- way Opteron)? How about conflicts +> between Postgres' shared memory approach and the NUMA architecture +> of most multi-processor machines? + +The perhaps odd thing is that just about any alternative to quad-Xeon +is likely to be _way_ better. There are some context switching +problems that lead to it being remarkably poorer than you'd expect. +Throw in less-than ideal performance of the PAE memory addressing +system and it seems oddly crippled overall. + +We've been getting pretty good results with IBM pSeries systems; +they're expensive, but definitely very fast. + +Preliminary results with Opterons are also looking very promising. +One process seemed about 25x as fast on a 4-way 8GB Opteron as it was +on a 4-way 8GB Xeon, albeit with enough differences to make the +comparison dangerous. +-- +wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com'). +http://www.ntlug.org/~cbbrowne/sgml.html +The IETF motto: "Rough consensus *and* working code." + +From pgsql-performance-owner@postgresql.org Tue Dec 7 04:18:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7E7E83A60C8 + for ; + Tue, 7 Dec 2004 04:17:36 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 18434-06 + for ; + Tue, 7 Dec 2004 04:17:27 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7843B3A60C2 + for ; + Tue, 7 Dec 2004 04:17:27 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 9EFCC31941; Tue, 7 Dec 2004 05:17:26 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: scaling beyond 4 processors +Date: 7 Dec 2004 04:17:24 GMT +Organization: cbbrowne Computing Inc +Lines: 17 +Message-ID: <31kp6jF3ad57bU5@individual.net> +References: <41B4E8B6.6059.1FBEABB@localhost> +X-Draft-From: ("nntp+wolfe:pgsql.performance" 170) +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/129 +X-Sequence-Number: 9504 + +The perhaps odd thing is that just about any alternative to quad-Xeon +is likely to be _way_ better. There are some context switching +problems that lead to it being remarkably poorer than you'd expect. +Throw in less-than ideal performance of the PAE memory addressing +system and it seems oddly crippled overall. + +We've been getting pretty good results with IBM pSeries systems; +they're expensive, but definitely very fast. + +Preliminary results with Opterons are also looking very promising. +One process seemed about 25x as fast on a 4-way 8GB Opteron as it was +on a 4-way 8GB Xeon, albeit with enough differences to make the +comparison dangerous. +-- +wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com'). +http://www.ntlug.org/~cbbrowne/sgml.html +The IETF motto: "Rough consensus *and* working code." + +From pgsql-performance-owner@postgresql.org Tue Dec 7 04:44:41 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CC9F13A6121 + for ; + Tue, 7 Dec 2004 04:44:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23581-09 + for ; + Tue, 7 Dec 2004 04:44:38 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 418D83A6120 + for ; + Tue, 7 Dec 2004 04:44:38 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB74iaYX010165; + Mon, 6 Dec 2004 23:44:36 -0500 (EST) +To: "Rosny" +Cc: pgsql-performance@postgresql.org +Subject: Re: TableSpace Design issues on Postgres 8.0 beta 5 +In-reply-to: +References: +Comments: In-reply-to "Rosny" + message dated "Mon, 06 Dec 2004 05:52:53 -0800" +Date: Mon, 06 Dec 2004 23:44:36 -0500 +Message-ID: <10164.1102394676@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/130 +X-Sequence-Number: 9505 + +"Rosny" writes: +> B. For each department create tablespace. (Which means, if there +> are 7000 departments, there will be 7000 tablespace each contains +> 20 tables). + +If your system has seven thousand separate logical filesystems attached +to it, there might be some value in having seven thousand tablespaces. +But I will bet a great deal that it does not and there isn't. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Dec 7 05:04:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C8FC23A612C + for ; + Tue, 7 Dec 2004 05:04:15 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30220-06 + for ; + Tue, 7 Dec 2004 05:04:05 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 9062F3A6125 + for ; + Tue, 7 Dec 2004 05:04:05 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB753uqJ010360; + Tue, 7 Dec 2004 00:03:56 -0500 (EST) +To: Hasnul Fadhly bin Hasan +Cc: Bryan , pgsql-performance@postgresql.org +Subject: Re: Config Check +In-reply-to: <41B51829.9030307@mimos.my> +References: <41B4701E.2090101@rhondasworld.com> <41B51829.9030307@mimos.my> +Comments: In-reply-to Hasnul Fadhly bin Hasan + message dated "Tue, 07 Dec 2004 10:40:41 +0800" +Date: Tue, 07 Dec 2004 00:03:56 -0500 +Message-ID: <10359.1102395836@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/131 +X-Sequence-Number: 9506 + +Hasnul Fadhly bin Hasan writes: +> Just wondering, i ran vacuumdb but didn't get the information that you +> get about the free space even when i set the verbose option. How did +> you get that? + +PG version? IIRC 7.4 was the first to include that info in the VACUUM +VERBOSE output. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Dec 13 01:05:30 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 823F93A5F13 + for ; + Tue, 7 Dec 2004 07:58:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71831-08 + for ; + Tue, 7 Dec 2004 07:58:11 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id E016A3A5645 + for ; + Tue, 7 Dec 2004 07:58:09 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id F006331941; Tue, 7 Dec 2004 08:58:06 +0100 (MET) +From: "Rosny" +X-Newsgroups: pgsql.performance +Subject: Re: TableSpace Design issues on Postgres 8.0 beta 5 +Date: Mon, 6 Dec 2004 23:58:06 -0800 +Organization: Hub.Org Networking Services +Lines: 38 +Message-ID: +References: <10164.1102394676@sss.pgh.pa.us> +Reply-To: "Rosny" +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.3790.181 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.264 tagged_above=0 required=5 tests=AWL, + FORGED_HOTMAIL_RCVD2, PRIORITY_NO_NAME +X-Spam-Level: ** +X-Archive-Number: 200412/151 +X-Sequence-Number: 9526 + +Thanks for the response. + +I just start to get a feel of where TableSpace will be used. You are right I +do not have 7000 logical filesystems. +I am assuming using TableSpace as organization of files in folders in +Windows 2003 Environment. So, each +TableSpace will represent one folder(directory) in a drive. But this doesnot +work to well for my design. + +Since pgAdmin III GUI take 2 hours just to load approximately 14000 tables. +I am not using TableSpace approach anymore. I am using multiple database +approach. + +Anyway, thanks for the response. Today testing by taking several option to +the limit. I kind of having some ideas +for future scability. + +Rosny + + +"Tom Lane" wrote in message +news:10164.1102394676@sss.pgh.pa.us... +> "Rosny" writes: +> > B. For each department create tablespace. (Which means, if there +> > are 7000 departments, there will be 7000 tablespace each contains +> > 20 tables). +> +> If your system has seven thousand separate logical filesystems attached +> to it, there might be some value in having seven thousand tablespaces. +> But I will bet a great deal that it does not and there isn't. +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +> + + + +From pgsql-performance-owner@postgresql.org Tue Dec 7 08:03:30 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 512493A5EFC + for ; + Tue, 7 Dec 2004 08:03:23 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73490-03 + for ; + Tue, 7 Dec 2004 08:03:11 +0000 (GMT) +Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) + by svr1.postgresql.org (Postfix) with ESMTP id B85163A5F23 + for ; + Tue, 7 Dec 2004 08:03:11 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1CbaJQ-0001s1-00; Tue, 07 Dec 2004 03:03:08 -0500 +To: Bryan Vest +Cc: pgsql-performance@postgresql.org +Subject: Re: Config review +References: <41B46F52.4000607@bright.net> +In-Reply-To: <41B46F52.4000607@bright.net> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 07 Dec 2004 03:03:08 -0500 +Message-ID: <87r7m2zgar.fsf@stark.xeocode.com> +Lines: 43 +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 hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/132 +X-Sequence-Number: 9507 + + +Bryan Vest writes: + +> Currently the database is at a size of 87.6Gig. A Vacuum Analyze runs every +> night and has been taking 4 or 5 hours to complete. Everything seems to run +> fine for a while, then at some point the load goes through the roof and the +> iowait % also goes way up. It will recover after a little bit and then do the +> same thing all over again. When this happens access to the web based user +> interface slows way down for our customers. Any input for improvements to this +> config would be appreciated, Thanks. + +While others have pointed out problems with the config I don't think any of +them explains this irregular behaviour. From what you're describing the +response time is ok most of the time except for these particular bursts? + +Do they occur at regular intervals? Is it possible it's just the +checkpointing? Can you see which volumes the i/o traffic is on? Is it on the +local transaction log files or is it on the data files? Does the write i/o +spike upwards or is it just a storm of read i/o? Also, incidentally, Is it +possible you have a cron job running vacuum and don't realize it? + +If it happens at irregular intervals then it could be a single bad query +that's causing the problem. One bad query would cause a sequential scan of +your 87G and potentially push out a lot of data from the cache. I imagine this +might also be especially bad with the shared_buffers being out of whack. + +You might start by checking the easiest thing first, set +log_min_duration_statement to something high and slowly lower it until it's +printing a handful of queries during the heaviest period. + +You could also look for a pgsql_tmp directory that indicate a disk sort is +happening, which would mean some query is trying to sort a lot of data. You +might have to lower sort_mem to a conservative value before you could see that +though. + +The pgsql_tmp directory appears (and disappears?) as needed, it's something +like this: + +bash-2.05b# ls /var/lib/postgres/data/base/17150/pgsql_tmp +pgsql_tmp22184.0 + +-- +greg + + +From pgsql-general-owner@postgresql.org Tue Dec 7 09:18:05 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 447083A6154 + for ; + Tue, 7 Dec 2004 09:18:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92342-07 + for ; + Tue, 7 Dec 2004 09:17:58 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BFA03A6139 + for ; + Tue, 7 Dec 2004 09:17:58 +0000 (GMT) +Received: by wproxy.gmail.com with SMTP id 69so135145wra + for ; + Tue, 07 Dec 2004 01:17:58 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=taYUdrnoJaQ0R3iFxe8z/Zy6IRwAgzkcxV137q7MvIwsw0GGo4xw2hoSHDTd7ofRCcg4YSCsSOvJJCLwEwxQAZCVEfar6iZILDFRXuJjVAilZxdaq59uSHBFmzshxTmrHimiwZODJwwSP5Ni67grwPXn4HjHyUCND9Yb9YDnpEk= +Received: by 10.54.18.31 with SMTP id 31mr1001099wrr; + Tue, 07 Dec 2004 01:17:58 -0800 (PST) +Received: by 10.54.37.32 with HTTP; Tue, 7 Dec 2004 01:17:58 -0800 (PST) +Message-ID: +Date: Tue, 7 Dec 2004 14:47:58 +0530 +From: Postgres Learner +Reply-To: Postgres Learner +To: pgsql-general@postgresql.org +Subject: Fwd: 8.0 vs. 7.4 benchmarks +In-Reply-To: +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +References: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/424 +X-Sequence-Number: 70036 + +Hi all! +I posted this on pgsql-performance but got no reply, so here it is: +thanks! +ps + + +---------- Forwarded message ---------- +From: Postgres Learner +Date: Mon, 6 Dec 2004 14:58:46 +0530 +Subject: 8.0 vs. 7.4 benchmarks +To: pgsql-performance@postgresql.org + + +Hi all! +Has anyone done any performance benchmarking of postgresql 7.4 vs 8.0? +Are there any scenarios where 8.0 can be expected to be faster? +I would love to get my hands on any numbers that someone might have. + +Also does anyone know how long it will take for a stable release of +8.0 to come (any estimates would be good) ? +Given the loads of additional features in 8.0, I can't +wait to use it in production. :-) + +thanks a lot everyone!!! +ps + +From pgsql-performance-owner@postgresql.org Tue Dec 7 11:09:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E13E3A618D + for ; + Tue, 7 Dec 2004 11:09:07 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21930-10 + for ; + Tue, 7 Dec 2004 11:08:59 +0000 (GMT) +Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) + by svr1.postgresql.org (Postfix) with ESMTP id 60BA73A6197 + for ; + Tue, 7 Dec 2004 11:08:58 +0000 (GMT) +Received: from fuji.krosing.net (localhost [127.0.0.1]) + by fuji.krosing.net (8.12.11/8.12.11) with ESMTP id iB7B8kH2004292; + Tue, 7 Dec 2004 13:08:46 +0200 +Received: (from hannu@localhost) + by fuji.krosing.net (8.12.11/8.12.11/Submit) id iB7B8cIo004291; + Tue, 7 Dec 2004 13:08:38 +0200 +X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee + using -f +Subject: Re: pg_restore taking 4 hours! +From: Hannu Krosing +To: grupos@carvalhaes.net +Cc: pgsql-performance@postgresql.org +In-Reply-To: <41B364E8.3060406@carvalhaes.net> +References: <41ADA82A.7070405@carvalhaes.net> + <200412011955.23543.ghodechhap@ghodechhap.net> + <41B364E8.3060406@carvalhaes.net> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1102417717.3916.5.camel@fuji.krosing.net> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 07 Dec 2004 13:08:38 +0200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/133 +X-Sequence-Number: 9508 + +On P, 2004-12-05 at 21:43, Rodrigo Carvalhaes wrote: +> Hi ! +> +> Thanks for the lots of tips that I received on this matter. +> +... +> There is something more that I can try to improve this performance? + +check the speed of your ide drive. maybe tweak some params with +/sbin/hdparm . Sometimes the defaults result in 2MB/sec r/w speeds +(instead on(30-70 MB/sec) + +------------ +Hannu + + +From pgsql-general-owner@postgresql.org Tue Dec 7 14:40:13 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C850B3A620E + for ; + Tue, 7 Dec 2004 14:40:11 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 90227-07 + for ; + Tue, 7 Dec 2004 14:40:04 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id EB53F3A61FB + for ; + Tue, 7 Dec 2004 14:40:07 +0000 (GMT) +Received: (qmail 8545 invoked by uid 500); 7 Dec 2004 14:52:33 -0000 +Date: Tue, 7 Dec 2004 08:52:33 -0600 +From: Bruno Wolff III +To: Postgres Learner +Cc: pgsql-general@postgresql.org +Subject: Re: Fwd: 8.0 vs. 7.4 benchmarks +Message-ID: <20041207145233.GA7581@wolff.to> +Mail-Followup-To: Postgres Learner , + pgsql-general@postgresql.org +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/435 +X-Sequence-Number: 70047 + +On Tue, Dec 07, 2004 at 14:47:58 +0530, + Postgres Learner wrote: +> +> Has anyone done any performance benchmarking of postgresql 7.4 vs 8.0? +> Are there any scenarios where 8.0 can be expected to be faster? + +Have you read the release notes? + +> I would love to get my hands on any numbers that someone might have. +> +> Also does anyone know how long it will take for a stable release of +> 8.0 to come (any estimates would be good) ? + +The last target date I saw mentioned was 2004-12-15. If a second release +candidate is needed, I don't know if that date will be met. + +From pgsql-performance-owner@postgresql.org Tue Dec 7 15:08:18 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AC8F93A620E + for ; + Tue, 7 Dec 2004 15:08:17 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00935-02 + for ; + Tue, 7 Dec 2004 15:07:58 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 51D323A6193 + for ; + Tue, 7 Dec 2004 15:08:01 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iB7F7tZv015132; + Tue, 7 Dec 2004 10:07:55 -0500 (EST) +To: Greg Stark +Cc: Bryan Vest , pgsql-performance@postgresql.org +Subject: Re: Config review +In-reply-to: <87r7m2zgar.fsf@stark.xeocode.com> +References: <41B46F52.4000607@bright.net> <87r7m2zgar.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "07 Dec 2004 03:03:08 -0500" +Date: Tue, 07 Dec 2004 10:07:54 -0500 +Message-ID: <15131.1102432074@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/134 +X-Sequence-Number: 9509 + +Greg Stark writes: +> Bryan Vest writes: +>> Currently the database is at a size of 87.6Gig. A Vacuum Analyze runs every +>> night and has been taking 4 or 5 hours to complete. Everything seems to run +>> fine for a while, then at some point the load goes through the roof and the +>> iowait % also goes way up. It will recover after a little bit and then do the +>> same thing all over again. + +> While others have pointed out problems with the config I don't think any of +> them explains this irregular behaviour. + +As Greg says, it might be checkpoints or a background query. If it +actually is the vacuum itself causing the variation in load, the theory +that comes to mind is that the performance tanks when the vacuum run +switches from find-dead-tuples to clean-indexes mode; clean-indexes is +usually a lot more I/O intensive. + +ISTM it actually doesn't matter much which of these explanations is +correct, because all three imply the same thing: not enough disk I/O +bandwidth. The disk is near saturation already and any increase in +demand drives response time over the knee of the curve. + +If you are using a RAID configuration it might just be that you need +to adjust the configuration (IIRC, there are some RAID setups that +are not very write-friendly). Otherwise you may have little alternative +but to buy faster disks. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Dec 7 15:19:43 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F247C3A624A + for ; + Tue, 7 Dec 2004 15:19:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06185-01 + for ; + Tue, 7 Dec 2004 15:19:31 +0000 (GMT) +Received: from smtp104.rog.mail.re2.yahoo.com (smtp104.rog.mail.re2.yahoo.com + [206.190.36.82]) + by svr1.postgresql.org (Postfix) with SMTP id 9D5423A6230 + for ; + Tue, 7 Dec 2004 15:19:32 +0000 (GMT) +Received: from unknown (HELO phlogiston.dydns.org) + (a.sullivan@rogers.com@65.49.125.184 with login) + by smtp104.rog.mail.re2.yahoo.com with SMTP; 7 Dec 2004 15:19:33 -0000 +Received: by phlogiston.dydns.org (Postfix, from userid 1000) + id 9F26240DC; Tue, 7 Dec 2004 10:19:26 -0500 (EST) +Date: Tue, 7 Dec 2004 10:19:26 -0500 +From: Andrew Sullivan +To: pgsql-performance@postgresql.org +Subject: Re: Config review +Message-ID: <20041207151926.GD27594@phlogiston.dyndns.org> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <41B46F52.4000607@bright.net> <87r7m2zgar.fsf@stark.xeocode.com> + <15131.1102432074@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <15131.1102432074@sss.pgh.pa.us> +User-Agent: Mutt/1.5.6+20040722i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.035 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/135 +X-Sequence-Number: 9510 + +On Tue, Dec 07, 2004 at 10:07:54AM -0500, Tom Lane wrote: +> If you are using a RAID configuration it might just be that you need +> to adjust the configuration (IIRC, there are some RAID setups that +> are not very write-friendly). Otherwise you may have little alternative +> but to buy faster disks. + +It might be that altering the Clariion array from RAID 5 to RAID 1+0 +would make a difference; but I'd be very surprised to learn that you +could get that array to go a whole lot faster. + +One thing that might also be worth investigating is whether +performance actually goes up by moveing the WAL into the array. +We've had some remarkably good experiences with our recently-acquired +EMC. + +A + +-- +Andrew Sullivan | ajs@crankycanuck.ca +When my information changes, I alter my conclusions. What do you do sir? + --attr. John Maynard Keynes + +From pgsql-general-owner@postgresql.org Sat Dec 11 01:26:30 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9A2FF3AAEF5 + for ; + Fri, 10 Dec 2004 21:38:10 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 73779-09 + for ; + Fri, 10 Dec 2004 21:37:36 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 549843ABF79 + for ; + Fri, 10 Dec 2004 18:44:07 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr4.postgresql.org (Postfix) with ESMTP id BA79F5AFA2C + for ; + Tue, 7 Dec 2004 16:45:34 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB7GhVLj020181; Tue, 7 Dec 2004 08:43:32 -0800 +Message-ID: <41B5DD97.60406@commandprompt.com> +Date: Tue, 07 Dec 2004 08:43:03 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Bruno Wolff III +Cc: Postgres Learner , + pgsql-general@postgresql.org +Subject: Re: Fwd: 8.0 vs. 7.4 benchmarks +References: + + <20041207145233.GA7581@wolff.to> +In-Reply-To: <20041207145233.GA7581@wolff.to> +Content-Type: multipart/mixed; boundary="------------000906050304010500070500" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/487 +X-Sequence-Number: 70099 + +This is a multi-part message in MIME format. +--------------000906050304010500070500 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + + +>>I would love to get my hands on any numbers that someone might have. +>> +>>Also does anyone know how long it will take for a stable release of +>>8.0 to come (any estimates would be good) ? +>> +>> +> +>The last target date I saw mentioned was 2004-12-15. If a second release +>candidate is needed, I don't know if that date will be met. +> +> +It should also be noted that putting any .0 release into +production right away is typically a bad idea. This is not +a reflection on PostgreSQL but a reflection on software in general. + +IMHO 8.0 means, hey all you external developers -- time to test +with your applications and report bugs. + +8.1 means, alright we got some wide reports -- fixed a few mistakes +and now were ready. + +Sincerely, + +Joshua D. Drake + + + +>---------------------------(end of broadcast)--------------------------- +>TIP 7: don't forget to increase your free space map settings +> +> + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------000906050304010500070500 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------000906050304010500070500-- + +From pgsql-general-owner@postgresql.org Sat Dec 11 01:13:49 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BF7F53AB29B + for ; + Fri, 10 Dec 2004 21:52:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81725-09 + for ; + Fri, 10 Dec 2004 21:52:17 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 220B63AC3D6 + for ; + Fri, 10 Dec 2004 18:45:43 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr4.postgresql.org (Postfix) with SMTP id C89225AF90B + for ; + Tue, 7 Dec 2004 17:33:28 +0000 (GMT) +Received: (qmail 12473 invoked by uid 500); 7 Dec 2004 17:43:55 -0000 +Date: Tue, 7 Dec 2004 11:43:55 -0600 +From: Bruno Wolff III +To: "Joshua D. Drake" +Cc: Postgres Learner , + pgsql-general@postgresql.org +Subject: Re: Fwd: 8.0 vs. 7.4 benchmarks +Message-ID: <20041207174355.GA12296@wolff.to> +Mail-Followup-To: "Joshua D. Drake" , + Postgres Learner , + pgsql-general@postgresql.org +References: + + <20041207145233.GA7581@wolff.to> <41B5DD97.60406@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <41B5DD97.60406@commandprompt.com> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/482 +X-Sequence-Number: 70094 + +On Tue, Dec 07, 2004 at 08:43:03 -0800, + "Joshua D. Drake" wrote: +> +> IMHO 8.0 means, hey all you external developers -- time to test +> with your applications and report bugs. +> +> 8.1 means, alright we got some wide reports -- fixed a few mistakes +> and now were ready. + +That should probably be 8.0.1. That is what the next release will be named. +Typically there is a *.*.1 release not too long after the *.* release. My memory +is that this has been around 2-3 months for the last serveral *.* +releases. + +8.1 will be an important release as it should include integrated autovacuum, +some tools for handling PITR recoveries and other changes related to lessons +learned from the several major feature additions in 8.0. I will be surprised +if 8.1 is released before next fall. + +We did have a thread about *.* releases about a month ago and the data seemed +to suggest that the *.* releases tended to be better than the latest version +of the previous *.* release. (I think the main problem is that some fixes +were not being back ported because they are too extensive to be safely +back ported.) So with 8.0, it might be a good idea to hold off for a little +bit to see if anything major was missed during beta, but that it might be +desirable to upgrade to 8.0 without waiting for 8.0.1 if there aren't any +major problems reported within a few weeks of the release. + +From pgsql-performance-owner@postgresql.org Sat Dec 11 02:07:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3F2633A408E + for ; + Fri, 10 Dec 2004 19:40:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14810-09 + for ; + Fri, 10 Dec 2004 19:39:37 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 045E33A965F + for ; + Fri, 10 Dec 2004 18:30:37 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr4.postgresql.org (Postfix) with ESMTP id 3ECF75AFB64 + for ; + Tue, 7 Dec 2004 18:00:08 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6756600; Tue, 07 Dec 2004 09:54:12 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: scaling beyond 4 processors +Date: Tue, 7 Dec 2004 09:49:20 -0800 +User-Agent: KMail/1.6.2 +Cc: vogler@cipsoft.com +References: <41B4E8B6.6059.1FBEABB@localhost> +In-Reply-To: <41B4E8B6.6059.1FBEABB@localhost> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412070949.20020.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/139 +X-Sequence-Number: 9514 + +Volger, + +> Since our current Postgres server, a quad Xeon system, finally can't keep +> up with our load anymore we're ready to take the next step. + +There are a lot of reasons this could be happening; Quad Xeon is a problematic +platform, the more so if you're on Dell hardware. + +I've run PostgreSQL on 8-ways, and I know there are a few Sunfire users around +the community (16-way). There are definitely specific performance issues +around specific query loads on multi-way systems; search this list archives +for "Context Switch Bug". + +I will echo others in saying that moving to Opteron on premium hardware should +jump you at least 2x on performance, and it's a lot cheaper than DB2 or +Oracle. + +And, of course, if you really want help from this list, you'll post more +specific problems. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-general-owner@postgresql.org Sat Dec 11 01:33:20 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 34A933AAB61 + for ; + Fri, 10 Dec 2004 21:24:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66930-05 + for ; + Fri, 10 Dec 2004 21:23:43 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id A1E0E3ABB59 + for ; + Fri, 10 Dec 2004 18:42:14 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr4.postgresql.org (Postfix) with ESMTP id A92DF5B01FF + for ; + Tue, 7 Dec 2004 18:37:24 +0000 (GMT) +Received: from [192.168.1.51] (dsl093-038-087.pdx1.dsl.speakeasy.net + [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iB7IZDLj000366; Tue, 7 Dec 2004 10:35:13 -0800 +Message-ID: <41B5F7D7.2090102@commandprompt.com> +Date: Tue, 07 Dec 2004 10:35:03 -0800 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0RC1 (X11/20041201) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Bruno Wolff III +Cc: Postgres Learner , + pgsql-general@postgresql.org +Subject: Re: Fwd: 8.0 vs. 7.4 benchmarks +References: + + <20041207145233.GA7581@wolff.to> <41B5DD97.60406@commandprompt.com> + <20041207174355.GA12296@wolff.to> +In-Reply-To: <20041207174355.GA12296@wolff.to> +Content-Type: multipart/mixed; boundary="------------000506030007060903010908" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/491 +X-Sequence-Number: 70103 + +This is a multi-part message in MIME format. +--------------000506030007060903010908 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Bruno Wolff III wrote: +> On Tue, Dec 07, 2004 at 08:43:03 -0800, +> "Joshua D. Drake" wrote: +> +>>IMHO 8.0 means, hey all you external developers -- time to test +>>with your applications and report bugs. +>> +>>8.1 means, alright we got some wide reports -- fixed a few mistakes +>>and now were ready. +> +> +> That should probably be 8.0.1. That is what the next release will be named. + +Your right that was my bad. + +Sincerely, + +Joshua D. Drake + + +> We did have a thread about *.* releases about a month ago and the data seemed +> to suggest that the *.* releases tended to be better than the latest version +> of the previous *.* release. (I think the main problem is that some fixes +> were not being back ported because they are too extensive to be safely +> back ported.) So with 8.0, it might be a good idea to hold off for a little +> bit to see if anything major was missed during beta, but that it might be +> desirable to upgrade to 8.0 without waiting for 8.0.1 if there aren't any +> major problems reported within a few weeks of the release. + + + +-- +Command Prompt, Inc., home of PostgreSQL Replication, and plPHP. +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL + +--------------000506030007060903010908 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua D. Drake +n:Drake;Joshua D. +org:Command Prompt, Inc. +adr:;;PO Box 215;Cascade Locks;Oregon;97014;USA +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +note:Command Prompt, Inc. is the largest and oldest US based commercial PostgreSQL support provider. We provide the only commercially viable integrated PostgreSQL replication solution, but also custom programming, and support. We authored the book Practical PostgreSQL, the procedural language plPHP, and adding trigger capability to plPerl. +x-mozilla-html:FALSE +url:http://www.commandprompt.com/ +version:2.1 +end:vcard + + +--------------000506030007060903010908-- + +From pgsql-performance-owner@postgresql.org Sat Dec 11 01:30:52 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 23FF83AABBF + for ; + Fri, 10 Dec 2004 21:26:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67738-08 + for ; + Fri, 10 Dec 2004 21:25:43 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id C4FB83ABBF3 + for ; + Fri, 10 Dec 2004 18:42:25 +0000 (GMT) +Received: from houston.familyhealth.com.au (houston.au.fhnetwork.com + [203.22.197.21]) + by svr4.postgresql.org (Postfix) with ESMTP id A46F75AF0A2 + for ; + Wed, 8 Dec 2004 02:42:03 +0000 (GMT) +Received: from houston.familyhealth.com.au (localhost [127.0.0.1]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 57D0A25067 + for ; + Wed, 8 Dec 2004 10:40:56 +0800 (WST) +Received: from [192.168.0.40] (work-40.internal [192.168.0.40]) + by houston.familyhealth.com.au (Postfix) with ESMTP id 37B6124FCD + for ; + Wed, 8 Dec 2004 10:40:56 +0800 (WST) +Message-ID: <41B66A0B.1090003@familyhealth.com.au> +Date: Wed, 08 Dec 2004 10:42:19 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Slow insert +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.264 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/137 +X-Sequence-Number: 9512 + +Hi guys, + +Why would an INSERT ever be really slow? This is what I see a lot of in +our site logs: + +Dec 5 15:57:48 marshall postgres[19599]: [3-1] LOG: duration: +13265.492 ms statement: INSERT INTO users_sessions (sid, cobrand_id, +uid) VALUES ('145982ac39e1d09fec99cc8a606155e7', '1', '0') + +13 seconds to insert a single row! + +It seems to happen at random times during the day. That sessions table +is heavily updated and inserted, and has pg_autovacuum running vacuum +analyze and analyze on it every few minutes I think. + +We don't run any exclusive lock stuff on it. + +So what lock or concurrency issue could cause a single-row insert to +take 13 seconds? Could vacuum analyze be doing it? + +Thanks, + +Chris + +From pgsql-performance-owner@postgresql.org Sat Dec 11 01:30:43 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AD1A03AABEE + for ; + Fri, 10 Dec 2004 21:26:46 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67955-06 + for ; + Fri, 10 Dec 2004 21:26:07 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C4C33ABC13 + for ; + Fri, 10 Dec 2004 18:42:30 +0000 (GMT) +Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) + by svr4.postgresql.org (Postfix) with ESMTP id AD35C5B03C2 + for ; + Wed, 8 Dec 2004 04:33:25 +0000 (GMT) +Received: from grownups (c-24-21-166-228.client.comcast.net[24.21.166.228]) + by comcast.net (rwcrmhc12) with SMTP + id <2004120804315601400c7834e>; Wed, 8 Dec 2004 04:32:01 +0000 +Message-ID: <001b01c4dcde$fc27be50$0200a8c0@grownups> +From: "Stacy White" +To: +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412051506.41025.josh@agliodbs.com> +Subject: Re: Partitioned table performance +Date: Tue, 7 Dec 2004 20:32:49 -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.1409 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.249 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/136 +X-Sequence-Number: 9511 + +Thanks for the quick reply, Josh. Here are some more, with wider tables and +'EXPLAIN ANALYZE' output. These tests use the same basic structure as +before, but with 20 data columns rather than just the one: + + CREATE TABLE one_big_foo ( + partition INTEGER, + bar1 INTEGER, + ... + bar20 INTEGER + ) + +Each set of test tables holds 1,000,000 tuples with a partition value of +'1', and 1,000,000 with a partition value of '2'. The bar* columns are all +set to non-null values. The 'one_big_foo' table stores all 2M rows in one +table. 'super_foo' and 'union_foo' split the data into two tables, and use +inheritance and union views (respectively) to tie them together, as +described in my previous message. + +Query timings and 'EXPLAIN ANALYZE' results for full table scans and for +partition scans follow: + + +vod=# SELECT COUNT(*), MAX(bar1) FROM one_big_foo ; +Time: 3695.274 ms + +vod=# SELECT COUNT(*), MAX(bar1) FROM super_foo ; +Time: 4641.992 ms + +vod=# SELECT COUNT(*), MAX(bar1) FROM union_foo ; +Time: 16035.025 ms + + +vod=# SELECT COUNT(*), MAX(bar1) FROM one_big_foo WHERE partition = 1 ; +Time: 4395.274 ms + +vod=# SELECT COUNT(*), MAX(bar1) FROM super_foo WHERE partition = 1 ; +Time: 3050.920 ms + +vod=# SELECT COUNT(*), MAX(bar1) FROM union_foo WHERE partition = 1 ; +Time: 7468.664 ms + + + + +vod=# EXPLAIN ANALYZE SELECT COUNT(*), MAX(bar1) FROM one_big_foo ; + QUERY PLAN +---------------------------------------------------------------------------- +--------------------------------------------------- + Aggregate (cost=61747.92..61747.92 rows=1 width=4) (actual +time=18412.471..18412.474 rows=1 loops=1) + -> Seq Scan on one_big_foo (cost=0.00..51747.61 rows=2000061 +width=4) (actual time=0.097..10079.192 rows=2000000 loops=1) + Total runtime: 18412.597 ms +(3 rows) + +Time: 18413.919 ms + + +vod=# EXPLAIN ANALYZE SELECT COUNT(*), MAX(bar1) FROM super_foo ; + QUERY +PLAN +---------------------------------------------------------------------------- +--------------------------------------------------------------- + Aggregate (cost=61749.87..61749.87 rows=1 width=4) (actual +time=30267.913..30267.916 rows=1 loops=1) + -> Append (cost=0.00..51749.24 rows=2000125 width=4) (actual +time=0.127..22830.610 rows=2000000 loops=1) + -> Seq Scan on super_foo (cost=0.00..0.00 rows=1 width=4) +(actual time=0.005..0.005 rows=0 loops=1) + -> Seq Scan on sub_foo1 super_foo (cost=0.00..25874.62 +rows=1000062 width=4) (actual time=0.113..5808.899 rows=1000000 loops=1) + -> Seq Scan on sub_foo2 super_foo (cost=0.00..25874.62 +rows=1000062 width=4) (actual time=0.075..5829.095 rows=1000000 loops=1) + Total runtime: 30268.061 ms +(6 rows) + +Time: 30303.271 ms + + +vod=# EXPLAIN ANALYZE SELECT COUNT(*), MAX(bar1) FROM union_foo ; + QUERY +PLAN +---------------------------------------------------------------------------- +-------------------------------------------------------------------- + Aggregate (cost=98573.40..98573.40 rows=1 width=4) (actual +time=62542.849..62542.852 rows=1 loops=1) + -> Subquery Scan union_foo (cost=0.00..88573.20 rows=2000040 +width=4) (actual time=0.130..55536.040 rows=2000000 loops=1) + -> Append (cost=0.00..68572.80 rows=2000040 width=80) (actual +time=0.122..43210.763 rows=2000000 loops=1) + -> Subquery Scan "*SELECT* 1" (cost=0.00..34286.40 +rows=1000020 width=80) (actual time=0.118..16312.708 rows=1000000 +loops=1) -> Seq Scan on union_foo1 +(cost=0.00..24286.20 rows=1000020 width=80) (actual time=0.107..7763.460 +rows=1000000 loops=1) + -> Subquery Scan "*SELECT* 2" (cost=0.00..34286.40 +rows=1000020 width=80) (actual time=0.116..16610.387 rows=1000000 +loops=1) -> Seq Scan on union_foo2 +(cost=0.00..24286.20 rows=1000020 width=80) (actual time=0.095..7549.522 +rows=1000000 loops=1) + Total runtime: 62543.098 ms + + + +vod=# EXPLAIN ANALYZE SELECT COUNT(*), MAX(bar1) FROM one_big_foo WHERE +partition = 1 ; +QUERY PLAN +---------------------------------------------------------------------------- +------------------------------------------------- + Aggregate (cost=61711.25..61711.25 rows=1 width=4) (actual +time=11592.135..11592.139 rows=1 loops=1) + -> Seq Scan on one_big_foo (cost=0.00..56747.76 rows=992697 +width=4) (actual time=0.106..7627.170 rows=1000000 loops=1) + Filter: (partition = 1::numeric) + Total runtime: 11592.264 ms +(4 rows) + +Time: 11593.749 ms + +vod=# EXPLAIN ANALYZE SELECT COUNT(*), MAX(bar1) FROM super_foo WHERE +partition = 1 ; + +QUERY PLAN +---------------------------------------------------------------------------- +--------------------------------------------------------------------------- + Aggregate (cost=33377.11..33377.11 rows=1 width=4) (actual +time=15670.309..15670.312 rows=1 loops=1) + -> Append (cost=0.00..28376.79 rows=1000064 width=4) (actual +time=6.699..12072.483 rows=1000000 loops=1) + -> Seq Scan on super_foo (cost=0.00..0.00 rows=1 width=4) +(actual time=0.005..0.005 rows=0 loops=1) + Filter: (partition = 1::numeric) + -> Seq Scan on sub_foo1 super_foo (cost=0.00..28374.78 +rows=1000062 width=4) (actual time=0.106..6688.812 rows=1000000 loops=1) + Filter: (partition = 1::numeric) + -> Index Scan using idx_sub_foo2_partition on sub_foo2 +super_foo (cost=0.00..2.01 rows=1 width=4) (actual time=0.221..0.221 +rows=0 loops=1) + Index Cond: (partition = 1::numeric) + Total runtime: 15670.463 ms +(9 rows) + +Time: 15672.235 ms + +vod=# EXPLAIN ANALYZE SELECT COUNT(*), MAX(bar1) FROM union_foo WHERE +partition = 1 ; + QUERY +PLAN +---------------------------------------------------------------------------- +-------------------------------------------------------------------- + Aggregate (cost=98573.40..98573.40 rows=1 width=4) (actual +time=31897.629..31897.632 rows=1 loops=1) + -> Subquery Scan union_foo (cost=0.00..88573.20 rows=2000040 +width=4) (actual time=0.134..28323.692 rows=1000000 loops=1) + -> Append (cost=0.00..68572.80 rows=2000040 width=80) (actual +time=0.125..21969.522 rows=1000000 loops=1) + -> Subquery Scan "*SELECT* 1" (cost=0.00..34286.40 +rows=1000020 width=80) (actual time=0.120..16867.005 rows=1000000 +loops=1) + -> Seq Scan on union_foo1 (cost=0.00..24286.20 +rows=1000020 width=80) (actual time=0.108..8017.931 rows=1000000 +loops=1) + -> Subquery Scan "*SELECT* 2" (cost=0.00..34286.40 +rows=1000020 width=80) (actual time=0.011..0.011 rows=0 loops=1) + -> Result (cost=0.00..24286.20 rows=1000020 +width=80) (actual time=0.004..0.004 rows=0 loops=1) + One-Time Filter: false + -> Seq Scan on union_foo2 +(cost=0.00..24286.20 rows=1000020 width=80) (never executed) + Total runtime: 31897.897 ms +(10 rows) + +Time: 31900.204 ms + + + +----- Original Message ----- +From: "Josh Berkus" +To: +Cc: "Stacy White" +Sent: Sunday, December 05, 2004 3:06 PM +Subject: Re: [PERFORM] Partitioned table performance + + +Stacy, + +Thanks for the stats! + +> In some cases we've seen some increased performance in tests by splitting +> the table into several smaller tables. Both 'UNION ALL' views, and the +> superclass/subclass scheme work well at pruning down the set of rows a +> query uses, but they seem to introduce a large performance hit to the time +> to process each row (~50% for superclass/subclass, and ~150% for union +> views). + +This seems reasonable, actually, given your test. Really, what you should +be +comparing it against is not against selecting from an individual partition, +but selecting from the whole business as one large table. + +I also suspect that wider rows results in less overhead proportionally; note +that your test contains *only* the indexed rows. I should soon have a test +to prove this, hopefully. + +However, I would be interested in seeing EXPLAIN ANALYZE from your tests +rather than just EXPLAIN. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + + +From pgsql-general-owner@postgresql.org Sat Dec 11 02:09:55 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C69AF3A6B4C; + Fri, 10 Dec 2004 19:38:46 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15785-01; Fri, 10 Dec 2004 19:38:08 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id D31AF3A759A; + Fri, 10 Dec 2004 18:30:27 +0000 (GMT) +Received: from junk.nocrew.org (junk.nocrew.org [213.242.147.30]) + by svr4.postgresql.org (Postfix) with ESMTP id 2E6F25B3FCE; + Fri, 10 Dec 2004 11:40:54 +0000 (GMT) +Received: from tomas by junk.nocrew.org with local (Exim 3.35 #1 (Debian)) + id 1Ccj8k-00006d-00; Fri, 10 Dec 2004 12:40:50 +0100 +To: pgsql-general@postgresql.org +Cc: pgsql-performance@postgresql.org +Subject: Query is not using index when it should +From: tomas@nocrew.org (Tomas =?iso-8859-1?q?Sk=E4re?=) +Date: 10 Dec 2004 12:40:50 +0100 +Message-ID: <80oeh2tm7x.fsf@junk.nocrew.org> +Lines: 61 +User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/500 +X-Sequence-Number: 70112 + +I tried to subscribe to pgsql-performance, but there seems to be +something wrong with the majordomo, so I'm sending to general too, +where I'm already subscribed. + +My problem is this, using PostgreSQL 7.4.6: + + +I have a table that looks like this: + + Table "public.cjm_object" + Column | Type | Modifiers +-----------+-------------------+----------- + timestamp | bigint | not null + jobid | bigint | not null + objectid | bigint | not null + class | integer | not null + field | character varying | not null + data | bytea | +Indexes: + "cjm_object_pkey" primary key, btree ("timestamp", jobid, objectid, "class", field) + "idx_cjm_object1" btree (objectid, "class", field) + + +The table has 283465 rows, and the column combination +(objectid,class,field) can occur several times. + +Doing a search with all columns in the pkey works, it uses the index: + +db=# explain analyze select * from cjm_object where timestamp=1102497954815296 and jobid=9 and objectid=4534 and class=12 and field='paroid'; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------ + Index Scan using cjm_object_pkey on cjm_object (cost=0.00..32.75 rows=1 width=54) (actual time=0.169..0.172 rows=1 loops=1) + Index Cond: ("timestamp" = 1102497954815296::bigint) + Filter: ((jobid = 9) AND (objectid = 4534) AND ("class" = 12) AND ((field)::text = 'paroid'::text)) + Total runtime: 0.381 ms +(4 rows) + + + +But when doing a search with objectid, class and field, it doesn't use +the idx_cjm_object1 index. +db=# explain analyze select * from cjm_object where objectid=4534 and class=12 and field='paroid'; + QUERY PLAN +----------------------------------------------------------------------------------------------------------- + Seq Scan on cjm_object (cost=0.00..7987.83 rows=2 width=54) (actual time=21.660..475.664 rows=1 loops=1) + Filter: ((objectid = 4534) AND ("class" = 12) AND ((field)::text = 'paroid'::text)) + Total runtime: 475.815 ms +(3 rows) + + +I have tried to set enable_seqscan to false, but it gives the same +result, except that the estimated cost is higher. + +I have also done a vacuum full analyze, and I have reindexed the +database, the table and the index. I have dropped the index and +recreated it, but it still gives the same result. + +Please, could someone give me a clue to this? + + +Tomas + +From pgsql-performance-owner@postgresql.org Sat Dec 11 01:52:16 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A20893AA5C8 + for ; + Fri, 10 Dec 2004 21:03:23 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55498-04 + for ; + Fri, 10 Dec 2004 21:02:46 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.204]) + by svr1.postgresql.org (Postfix) with ESMTP id 943A53AB56D + for ; + Fri, 10 Dec 2004 18:39:55 +0000 (GMT) +Received: by rproxy.gmail.com with SMTP id z35so463539rne + for ; + Fri, 10 Dec 2004 10:40:02 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; + b=GtDGpKYtnLvQM7eirKoGVYQDLhVbO5B1atiklhrq2Z2VGvr7mNsjDegQoPaTZ1oGKM3IUmskZkq+v3AOJyJq2WIufNgcKzGnOAe95mnMlpt5ZfwONEk3e4KmT5hLXUjBAICNzCJ7O9W/oQOUpDPoSHHeCScdL/mddZATm8jJPXk= +Received: by 10.38.104.13 with SMTP id b13mr600084rnc; + Fri, 10 Dec 2004 10:40:02 -0800 (PST) +Received: by 10.38.126.16 with HTTP; Fri, 10 Dec 2004 10:40:02 -0800 (PST) +Message-ID: +Date: Fri, 10 Dec 2004 13:40:02 -0500 +From: Mike Rylander +Reply-To: Mike Rylander +To: pgsql-performance@postgresql.org +Subject: LIMIT causes SEQSCAN in subselect +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.125 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/138 +X-Sequence-Number: 9513 + +First off, WOO-HOO! The lists are back and I can finally get my PG +fix!!! Now, on to the business at hand... + +I have four query plans below, the first two help explain my question, +and the last two are about a speculative alternative. The first query +use a subselects that are generated from a middleware layer and are +then joined to create the final result set. In order to keep total +execution time down, the middleware imposes a LIMIT clause on each. + +I'm using the fact that Postgres can elevate a subselect-join to a +simple join when there are no aggregates involved and I think I +remember there has been some work recently on elevating subselects +that contain a LIMIT, so I went back and ran the plans without the +LIMITs to see what would happen. Well, the limit killed the subselect +elevation. I'm not too worried about the relative execution times +since it's very fast, but more curious about the plan that was chosen. + +It seems that the planner knows that the results from subselect 'b' +will contain just one row due to the fact that the index it is +scanning is unique. Would it not make sense to discard the LIMIT +clause on that subselect? That would result in the third plan, which +has better performance than the generated query, and is guaranteed to +return the same results since the index in use is unique. Also, +wouldn't it make sense for subselect 'a' to be elevated sans LIMIT +just to see if there is a unique index it might be able to use? + +I realize this is a rather specialized case and not really great form. + But because PG can, in some cases, elevate subselects, writing +middleware to join results becomes pretty easy. Just a matter of +defining result sets independently, and creating a simple wrapper to +join them. + +In any case, I will probably end up just detecting the subselect +condition in the middleware and drop the limit when there are some +WHERE clauses on the inner query. I just thought I'd bring up a +possible optimization for the future, and was curious what the gurus +might have to say! + + + +-- Version info and queries in question. + +oils4=# select version(); + +version +--------------------------------------------------------------------------------------------------------------------------------------------- + PostgreSQL 8.0.0beta4 on x86_64-unknown-linux-gnu, compiled by GCC +gcc (GCC) 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, +pie-8.7.6) +(1 row) + + +-- query 1: the query generated by middleware + +oils4=# EXPLAIN ANALYZE select a.record, b.control from (select * from +biblio.record where id = 100000 limit 1000) b, (select * from +biblio.metarecord_field_entry limit 1000) a where a.source = b.id; + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------ + Hash Join (cost=3.68..44.49 rows=5 width=40) (actual +time=2.066..2.066 rows=0 loops=1) + Hash Cond: ("outer".source = "inner".id) + -> Subquery Scan a (cost=0.00..35.75 rows=1000 width=16) (actual +time=0.005..1.295 rows=1000 loops=1) + -> Limit (cost=0.00..25.75 rows=1000 width=87) (actual +time=0.003..0.641 rows=1000 loops=1) + -> Seq Scan on metarecord_field_entry +(cost=0.00..43379.75 rows=1684575 width=87) (actual time=0.003..0.435 +rows=1000 loops=1) + -> Hash (cost=3.68..3.68 rows=1 width=40) (actual +time=0.039..0.039 rows=0 loops=1) + -> Subquery Scan b (cost=0.00..3.68 rows=1 width=40) +(actual time=0.031..0.033 rows=1 loops=1) + -> Limit (cost=0.00..3.67 rows=1 width=1070) (actual +time=0.029..0.030 rows=1 loops=1) + -> Index Scan using biblio_record_pkey on record + (cost=0.00..3.67 rows=1 width=1070) (actual time=0.027..0.028 rows=1 +loops=1) + Index Cond: (id = 100000) + Total runtime: 2.171 ms +(11 rows) + + +-- query 2: the fast query, no limit allows elevation of subselects + +oils4=# EXPLAIN ANALYZE select a.record, b.control from (select * from +biblio.record where id = 100000) b, (select * from +biblio.metarecord_field_entry) a where a.source = b.id; + + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------ + Nested Loop (cost=0.00..19.95 rows=9 width=22) (actual +time=0.043..0.055 rows=7 loops=1) + -> Index Scan using biblio_record_pkey on record (cost=0.00..3.67 +rows=1 width=22) (actual time=0.025..0.026 rows=1 loops=1) + Index Cond: (id = 100000) + -> Index Scan using metarecord_field_entry_source_idx on +metarecord_field_entry (cost=0.00..16.19 rows=9 width=16) (actual +time=0.011..0.018 rows=7 loops=1) + Index Cond: (source = 100000) + Total runtime: 0.101 ms +(6 rows) + + + +-- query 3: if we were to drop the limit, since we're using a unique index + +oils4=# EXPLAIN ANALYZE select a.record, b.control from (select * from +biblio.record where id = 100000) b, (select * from +biblio.metarecord_field_entry limit 1000) a where a.source = b.id; + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------ + Nested Loop (cost=0.00..41.97 rows=5 width=22) (actual +time=1.169..1.169 rows=0 loops=1) + -> Index Scan using biblio_record_pkey on record (cost=0.00..3.67 +rows=1 width=22) (actual time=0.036..0.038 rows=1 loops=1) + Index Cond: (id = 100000) + -> Subquery Scan a (cost=0.00..38.25 rows=5 width=16) (actual +time=1.126..1.126 rows=0 loops=1) + Filter: (source = 100000) + -> Limit (cost=0.00..25.75 rows=1000 width=87) (actual +time=0.005..0.673 rows=1000 loops=1) + -> Seq Scan on metarecord_field_entry +(cost=0.00..43379.75 rows=1684575 width=87) (actual time=0.004..0.424 +rows=1000 loops=1) + Total runtime: 1.243 ms +(8 rows) + + + +-- query 4: what I would like the seqscan in query 3 to become... + +oils4=# EXPLAIN ANALYZE select * from biblio.metarecord_field_entry +where source = 100000 limit 1000; + + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------------------ + Limit (cost=0.00..16.19 rows=9 width=87) (actual time=0.026..0.035 +rows=7 loops=1) + -> Index Scan using metarecord_field_entry_source_idx on +metarecord_field_entry (cost=0.00..16.19 rows=9 width=87) (actual +time=0.025..0.032 rows=7 loops=1) + Index Cond: (source = 100000) + Total runtime: 0.069 ms +(4 rows) + +-- +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Sat Dec 11 07:31:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EF91D3A6D8D + for ; + Sat, 11 Dec 2004 02:57:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82823-10 + for ; + Sat, 11 Dec 2004 02:56:28 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id B49DA3AA5BC + for ; + Sat, 11 Dec 2004 01:46:21 +0000 (GMT) +Received: from [2001:700:300:dc03:20e:cff:fe36:a766] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CcwKR-0002ve-L5 + for pgsql-performance@postgresql.org; Sat, 11 Dec 2004 02:46:20 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CcwK8-0004bC-00 + for ; Sat, 11 Dec 2004 02:45:28 +0100 +Date: Sat, 11 Dec 2004 02:45:28 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Slow insert +Message-ID: <20041211014528.GA16264@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <41B66A0B.1090003@familyhealth.com.au> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <41B66A0B.1090003@familyhealth.com.au> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/143 +X-Sequence-Number: 9518 + +On Wed, Dec 08, 2004 at 10:42:19AM +0800, Christopher Kings-Lynne wrote: +> Why would an INSERT ever be really slow? This is what I see a lot of in +> our site logs: +> +> Dec 5 15:57:48 marshall postgres[19599]: [3-1] LOG: duration: +> 13265.492 ms statement: INSERT INTO users_sessions (sid, cobrand_id, +> uid) VALUES ('145982ac39e1d09fec99cc8a606155e7', '1', '0') +> +> 13 seconds to insert a single row! + +Do you have a foreign key or other check which could be really slow? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-general-owner@postgresql.org Sat Dec 11 03:39:57 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7CD923A66B7; + Sat, 11 Dec 2004 03:24:02 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93703-01; Sat, 11 Dec 2004 03:23:26 +0000 (GMT) +Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) + by svr1.postgresql.org (Postfix) with ESMTP id B472E3A9BEF; + Sat, 11 Dec 2004 02:28:38 +0000 (GMT) +Received: by megazone.bigpanda.com (Postfix, from userid 1001) + id C49D135834; Fri, 10 Dec 2004 18:28:38 -0800 (PST) +Received: from localhost (localhost [127.0.0.1]) + by megazone.bigpanda.com (Postfix) with ESMTP + id C2FC83582F; Fri, 10 Dec 2004 18:28:38 -0800 (PST) +Date: Fri, 10 Dec 2004 18:28:38 -0800 (PST) +From: Stephan Szabo +To: Tomas =?iso-8859-1?q?Sk=E4re?= +Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: Query is not using index when it should +In-Reply-To: <80oeh2tm7x.fsf@junk.nocrew.org> +Message-ID: <20041210182453.G92467@megazone.bigpanda.com> +References: <80oeh2tm7x.fsf@junk.nocrew.org> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=X-UNKNOWN +Content-Transfer-Encoding: QUOTED-PRINTABLE +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/510 +X-Sequence-Number: 70122 + +On Fri, 10 Dec 2004, Tomas [iso-8859-1] Sk=E4re wrote: + +> I have a table that looks like this: +> +> Table "public.cjm_object" +> Column | Type | Modifiers +> -----------+-------------------+----------- +> timestamp | bigint | not null +> jobid | bigint | not null +> objectid | bigint | not null +> class | integer | not null +> field | character varying | not null + +In 7.4.x and earlier, you need to cast the value you're comparing to into +a bigint in order to make sure the indexes are used (in your timestamp +case it appears to work because the value doesn't fit in a plain integer). +8.0 should handle this better. + +> But when doing a search with objectid, class and field, it doesn't use +> the idx_cjm_object1 index. +> db=3D# explain analyze select * from cjm_object where objectid=3D4534 and= + class=3D12 and field=3D'paroid'; + +Using one of + objectid=3D4534::bigint + objectid=3D'4534' + objectid=3DCAST(4534 as bigint) +rather than objectid=3D4534 should make this indexable in 7.4.x. + +From pgsql-performance-owner@postgresql.org Sat Dec 11 07:03:00 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8AAE83A5C51 + for ; + Sat, 11 Dec 2004 05:41:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 28843-01 + for ; + Sat, 11 Dec 2004 05:41:20 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 1AB963A6368 + for ; + Sat, 11 Dec 2004 05:40:45 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6772219; Fri, 10 Dec 2004 21:42:07 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org, + Mike Rylander +Subject: Re: LIMIT causes SEQSCAN in subselect +Date: Fri, 10 Dec 2004 21:40:18 -0800 +User-Agent: KMail/1.6.2 +References: +In-Reply-To: +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412102140.18456.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/142 +X-Sequence-Number: 9517 + +Mike, + +> I'm using the fact that Postgres can elevate a subselect-join to a +> simple join when there are no aggregates involved and I think I +> remember there has been some work recently on elevating subselects +> that contain a LIMIT, so I went back and ran the plans without the +> LIMITs to see what would happen. Well, the limit killed the subselect +> elevation. + +Actually, this makes sense. A LIMIT requires the data to be ordered first, +and then cut based on the order; it prevents collapsing the subselect into +the main query. Some sort of materializing is necessary, even in cases like +yours where the limit is inherently meaningless because you've neglected to +use an ORDER BY. + +The fact that the estimator knows that the LIMIT is pointless because there +are less rows in the subselect than the LIMIT will return is not something we +want to count on; sometimes the estimator has innaccurate information. The +UNIQUE index makes this more certain, except that I'm not sure that the +planner distinguishes between actual UNIQUE indexes and columns which are +estimated unique (per the pg_stats). And I think you can see in your case +that there's quite a difference between a column we're CERTAIN is unique, +versus a column we THINK is unique. + +> I realize this is a rather specialized case and not really great form. + +Exactly. You've grasped the main issue: that this has not been optimized +because it's bizarre and not very sensible query writing. Someday we'll get +around to optimizing the really wierd queries, but there's still a lot of +work to be done on the common ones (like count(*) ...). + +Keep in mind that the only reason we support LIMIT inside subqueries in the +first place is a workaround to slow aggregates, and a way to do RANK. It's +certainly not SQL-standard. + +> Just a matter of +> defining result sets independently, and creating a simple wrapper to +> join them. + +Well, if you think so, you know where to submit patches ... + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Sat Dec 11 07:00:10 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 79D1B3A622D + for ; + Sat, 11 Dec 2004 05:52:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30533-03 + for ; + Sat, 11 Dec 2004 05:52:56 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 60C763A621B + for ; + Sat, 11 Dec 2004 05:52:55 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6772252; Fri, 10 Dec 2004 21:54:29 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Partitioned table performance +Date: Fri, 10 Dec 2004 21:52:40 -0800 +User-Agent: KMail/1.6.2 +Cc: "Stacy White" +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412051506.41025.josh@agliodbs.com> + <001b01c4dcde$fc27be50$0200a8c0@grownups> +In-Reply-To: <001b01c4dcde$fc27be50$0200a8c0@grownups> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412102152.40442.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/141 +X-Sequence-Number: 9516 + +Stacy, + +> Each set of test tables holds 1,000,000 tuples with a partition value of +> '1', and 1,000,000 with a partition value of '2'. =A0The bar* columns are= + all +> set to non-null values. =A0The 'one_big_foo' table stores all 2M rows in = +one +> table. =A0'super_foo' and 'union_foo' split the data into two tables, and= + use +> inheritance and union views (respectively) to tie them together, as +> described in my previous message. +> +> Query timings and 'EXPLAIN ANALYZE' results for full table scans and for +> partition scans follow: + +Hmmm .... interesting. I think you've demonstrated that pseudo-partitioni= +ng=20 +doesn't pay for having only 2 partitions. Examine this: + +=A0 =A0 =A0 =A0 =A0-> =A0Index Scan using idx_sub_foo2_partition on sub_foo2 +super_foo =A0(cost=3D0.00..2.01 rows=3D1 width=3D4) (actual time=3D0.221..0= +=2E221 +rows=3D0 loops=3D1) +=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Index Cond: (partition =3D 1::numeric) +=A0Total runtime: 15670.463 ms + +As you see, even though the aggregate operation requires a seq scan, the=20 +planner is still able to scan, and discard, sub_foo2, using its index in 0.= +2=20 +seconds. Unfortunately, super_foo still needs to contend with: + +=A0 =A0-> =A0Append =A0(cost=3D0.00..28376.79 rows=3D1000064 width=3D4) (ac= +tual +time=3D6.699..12072.483 rows=3D1000000 loops=3D1) + +Right there, in the Append, you lose 6 seconds. This means that=20 +pseudo-partitioning via inheritance will become a speed gain once you can=20 +"make up" that 6 seconds by being able to discard more partitions. If you= +=20 +want, do a test with 6 partitions instead of 2 and let us know how it comes= +=20 +out. + +Also, keep in mind that there are other reasons to do pseudo-partitioning t= +han=20 +your example. Data write performance, expiring partitions, and vacuum are= +=20 +big reasons that can motivate partitioning even in cases when selects are=20 +slower. + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-general-owner@postgresql.org Sat Dec 11 14:17:35 2004 +X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 09B0C3A62A5; + Sat, 11 Dec 2004 14:17:34 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 45331-04; Sat, 11 Dec 2004 14:17:20 +0000 (GMT) +Received: from junk.nocrew.org (junk.nocrew.org [213.242.147.30]) + by svr1.postgresql.org (Postfix) with ESMTP id 6960B3A1D4C; + Sat, 11 Dec 2004 14:17:22 +0000 (GMT) +Received: from tomas by junk.nocrew.org with local (Exim 3.35 #1 (Debian)) + id 1Cd83d-0008LO-00; Sat, 11 Dec 2004 15:17:13 +0100 +To: Stephan Szabo +Cc: pgsql-general@postgresql.org, pgsql-performance@postgresql.org, + pgsql-sql@postgresql.org +Subject: Re: Query is not using index when it should +References: <80oeh2tm7x.fsf@junk.nocrew.org> + <20041210182453.G92467@megazone.bigpanda.com> +From: tomas@nocrew.org (Tomas =?iso-8859-1?q?Sk=E4re?=) +Date: 11 Dec 2004 15:17:13 +0100 +In-Reply-To: <20041210182453.G92467@megazone.bigpanda.com> +Message-ID: <80d5xgudg6.fsf@junk.nocrew.org> +Lines: 88 +User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/555 +X-Sequence-Number: 70167 + +Stephan Szabo writes: + +> On Fri, 10 Dec 2004, Tomas [iso-8859-1] Sk�re wrote: +> +> > I have a table that looks like this: +> > +> > Table "public.cjm_object" +> > Column | Type | Modifiers +> > -----------+-------------------+----------- +> > timestamp | bigint | not null +> > jobid | bigint | not null +> > objectid | bigint | not null +> > class | integer | not null +> > field | character varying | not null +> +> In 7.4.x and earlier, you need to cast the value you're comparing to into +> a bigint in order to make sure the indexes are used (in your timestamp +> case it appears to work because the value doesn't fit in a plain integer). +> 8.0 should handle this better. + +Thanks, casting worked well for that query. Now, could someone please +help me to get this query faster? With the 283465 rows, it takes far +too long time, I think. This is on a 2GHz Celeron running Linux 2.6. +shared_buffers=1000, sort_mem=1024. + +select c.* from cjm_object c + inner join + (select max(timestamp) as timestamp,objectid,field from cjm_object + group by objectid,field) t + using(timestamp,objectid,field) + where 1=1 and data is not null + order by objectid,field; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- + Merge Join (cost=145511.85..150759.75 rows=1 width=54) (actual time=17036.147..20968.811 rows=208246 loops=1) + Merge Cond: (("outer".objectid = "inner".objectid) AND ("outer"."?column7?" = "inner"."?column4?") AND ("outer"."timestamp" = "inner"."timestamp")) + -> Sort (cost=47007.75..47611.06 rows=241324 width=54) (actual time=5113.099..5586.094 rows=236710 loops=1) + Sort Key: c.objectid, (c.field)::text, c."timestamp" + -> Seq Scan on cjm_object c (cost=0.00..5862.65 rows=241324 width=54) (actual time=0.129..1788.125 rows=236710 loops=1) + Filter: (data IS NOT NULL) + -> Sort (cost=98504.09..99212.75 rows=283465 width=48) (actual time=11922.081..12427.683 rows=255001 loops=1) + Sort Key: t.objectid, (t.field)::text, t."timestamp" + -> Subquery Scan t (cost=45534.39..51912.35 rows=283465 width=48) (actual time=5484.943..9289.061 rows=255001 loops=1) + -> GroupAggregate (cost=45534.39..49077.70 rows=283465 width=25) (actual time=5484.925..8178.531 rows=255001 loops=1) + -> Sort (cost=45534.39..46243.05 rows=283465 width=25) (actual time=5484.285..6324.067 rows=283465 loops=1) + Sort Key: objectid, field + -> Seq Scan on cjm_object (cost=0.00..5862.65 rows=283465 width=25) (actual time=0.124..852.749 rows=283465 loops=1) + Total runtime: 21161.144 ms + + +Quick explanation of the query: + +Each row in the table is a field, which is part of an object. Ex: + +timestamp objectid field data + 1 1 name test + 1 1 type something + 1 2 name test2 + 1 2 type whatever + +Timestamp is when the entry was inserted in the databas. When updating +a single field for an object, a new line with the new value is added, +data set to NULL if the field is deleted. So the above content could +now be: + +timestamp objectid field data + 1 1 name test + 1 1 type something + 1 2 name test2 + 1 2 type whatever + 2 1 name newname + 2 1 type + +Now, the query picks out the highest timestamp for each +(objectid,field) and then selects all columns for each match, +filtering out NULL data and ordering per objectid. + +Is there any way to make this query faster? I've tried rewriting it, +putting the subquery as EXISTS condition, but it doesn't make it +faster. I've tried to create different indices, but they don't seem to +be used in this query. + + +Greetings, + +Tomas + + + +From pgsql-performance-owner@postgresql.org Sat Dec 11 14:32:28 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 40F843A62A8 + for ; + Sat, 11 Dec 2004 14:32:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49451-02 + for ; + Sat, 11 Dec 2004 14:32:13 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 060173A62E8 + for ; + Sat, 11 Dec 2004 14:32:16 +0000 (GMT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1Cd8IA-0001er-2Q + for pgsql-performance@postgresql.org; Sat, 11 Dec 2004 15:32:15 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1Cd8I9-0000ih-00 + for ; Sat, 11 Dec 2004 15:32:13 +0100 +Date: Sat, 11 Dec 2004 15:32:13 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: [GENERAL] Query is not using index when it should +Message-ID: <20041211143213.GA2659@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <80oeh2tm7x.fsf@junk.nocrew.org> + <20041210182453.G92467@megazone.bigpanda.com> + <80d5xgudg6.fsf@junk.nocrew.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <80d5xgudg6.fsf@junk.nocrew.org> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/145 +X-Sequence-Number: 9520 + +On Sat, Dec 11, 2004 at 03:17:13PM +0100, Tomas Sk�re wrote: +> select c.* from cjm_object c +> inner join +> (select max(timestamp) as timestamp,objectid,field from cjm_object +> group by objectid,field) t +> using(timestamp,objectid,field) +> where 1=1 and data is not null +> order by objectid,field; + +Usually, SELECT max(field) FROM table is better written in PostgreSQL as +SELECT field FROM table ORDER field DESC LIMIT 1. + +I don't see the point of "where 1=1", though... + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sat Dec 11 14:38:30 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 54E7C3A62F1 + for ; + Sat, 11 Dec 2004 14:38:29 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 49488-05 + for ; + Sat, 11 Dec 2004 14:38:23 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.195]) + by svr1.postgresql.org (Postfix) with ESMTP id 92F883A62EE + for ; + Sat, 11 Dec 2004 14:38:23 +0000 (GMT) +Received: by rproxy.gmail.com with SMTP id z35so515497rne + for ; + Sat, 11 Dec 2004 06:38:24 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=FXsxQFJdqwa8aBEcGZ2UEjQQkEGdv+oawfgwJ90zdnfmQ4wWzbbz0HfRMU7PCepstF54Z6VRXfe6f7PX2bvBLbQTXdGFxugtgg6AFRrQI8UGqsw/W4MjlkqK5+SSDky05ZiJrbV7YCN6VZfQH06fzay/9BholY+SGICRpiwW5SU= +Received: by 10.38.75.31 with SMTP id x31mr5695rna; + Sat, 11 Dec 2004 06:37:15 -0800 (PST) +Received: by 10.38.126.16 with HTTP; Sat, 11 Dec 2004 06:37:15 -0800 (PST) +Message-ID: +Date: Sat, 11 Dec 2004 09:37:15 -0500 +From: Mike Rylander +Reply-To: Mike Rylander +To: Josh Berkus , pgsql-performance@postgresql.org +Subject: Re: LIMIT causes SEQSCAN in subselect +In-Reply-To: <200412102140.18456.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +References: + <200412102140.18456.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.128 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/146 +X-Sequence-Number: 9521 + +On Fri, 10 Dec 2004 21:40:18 -0800, Josh Berkus wrote: +> Mike, +> The fact that the estimator knows that the LIMIT is pointless because there +> are less rows in the subselect than the LIMIT will return is not something we +> want to count on; sometimes the estimator has innaccurate information. The +> UNIQUE index makes this more certain, except that I'm not sure that the +> planner distinguishes between actual UNIQUE indexes and columns which are +> estimated unique (per the pg_stats). And I think you can see in your case +> that there's quite a difference between a column we're CERTAIN is unique, +> versus a column we THINK is unique. + +Absolutely. At first I was going to ask if perhaps using the stats to +discard the LIMIT would be possible, but since the stats are only +guidelines I dropped that. The stats are just so tempting! + +> +> > I realize this is a rather specialized case and not really great form. +> +> Exactly. You've grasped the main issue: that this has not been optimized +> because it's bizarre and not very sensible query writing. Someday we'll get +> around to optimizing the really wierd queries, but there's still a lot of +> work to be done on the common ones (like count(*) ...). + +Absolutely. And if I can help out with the common cases to gain some +Karmic currency I will. ;) After thinking about it some more, I don't +think those queries we really all that wacky though. The problem with +the example is that the generated query is very simple, and real-world +queries that would be used in the subselect would be much more +complex, and row estimation would be untrustworthy without a UNIQUE +index. + +> +> Keep in mind that the only reason we support LIMIT inside subqueries in the +> first place is a workaround to slow aggregates, and a way to do RANK. It's +> certainly not SQL-standard. +> + +No it's not, but then nobody ever accused the authors of the SQL spec +of being omniscient... I' cant think of another way to get, say, a +'top 10' list from a subselect, or use a paging iterator (LIMIT .. +OFFSET ..) as the seed for an outer query. Well, other than an SRF of +course. + +> > Just a matter of +> > defining result sets independently, and creating a simple wrapper to +> > join them. +> +> Well, if you think so, you know where to submit patches ... +> + +Well, I do, but I was talking about it being 'easy' in the middleware. + Just let PG handle optimizing the subselects. + +For example, you have a pile of predefined SELECTS that don't know +they are related and are used for simple lookups. You tell the SQL +generator thingy that it should use two of those, queries A and B, +that they are related on x, and that you want to see the 'id' from A +and the 'value' from B. Instead of having to preplan every possible +combination of JOINS the SQL generator will toss the preplanned ones +into subselects and join them in the outer query instead of having to +rip them apart and calculate the join syntax. And yes, I know that +view will take care of most of that for me... :) + +Thanks for all your comments. Pretty much what I expected, but I +thought I'd raise a use case. I'll just have to give the query +builder more smarts. + +> -- +> Josh Berkus +> Aglio Database Solutions +> San Francisco +> + + +-- +Mike Rylander +mrylander@gmail.com +GPLS -- PINES Development +Database Developer +http://open-ils.org + +From pgsql-performance-owner@postgresql.org Sat Dec 11 16:25:52 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 428C33A62DD + for ; + Sat, 11 Dec 2004 16:25:51 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70766-10 + for ; + Sat, 11 Dec 2004 16:25:45 +0000 (GMT) +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by svr1.postgresql.org (Postfix) with ESMTP id 917953A3BA1 + for ; + Sat, 11 Dec 2004 16:25:44 +0000 (GMT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id iBBGPesW005883 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) + for ; + Sat, 11 Dec 2004 09:25:43 -0700 (MST) + (envelope-from mfuhr@winnie.fuhr.org) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id iBBGPexY072943 + for ; + Sat, 11 Dec 2004 09:25:40 -0700 (MST) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.1/8.13.1/Submit) id iBBGPdBV072942 + for pgsql-performance@postgresql.org; + Sat, 11 Dec 2004 09:25:39 -0700 (MST) (envelope-from mfuhr) +Date: Sat, 11 Dec 2004 09:25:39 -0700 +From: Michael Fuhr +To: pgsql-performance@postgresql.org +Subject: Re: [GENERAL] Query is not using index when it should +Message-ID: <20041211162539.GA66539@winnie.fuhr.org> +References: <80oeh2tm7x.fsf@junk.nocrew.org> + <20041210182453.G92467@megazone.bigpanda.com> + <80d5xgudg6.fsf@junk.nocrew.org> <20041211143213.GA2659@uio.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <20041211143213.GA2659@uio.no> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/147 +X-Sequence-Number: 9522 + +On Sat, Dec 11, 2004 at 03:32:13PM +0100, Steinar H. Gunderson wrote: +> On Sat, Dec 11, 2004 at 03:17:13PM +0100, Tomas Sk�re wrote: +> > select c.* from cjm_object c +> > inner join +> > (select max(timestamp) as timestamp,objectid,field from cjm_object +> > group by objectid,field) t +> > using(timestamp,objectid,field) +> > where 1=1 and data is not null +> > order by objectid,field; +> +> Usually, SELECT max(field) FROM table is better written in PostgreSQL as +> SELECT field FROM table ORDER field DESC LIMIT 1. +> +> I don't see the point of "where 1=1", though... + +I've seen that in generated queries. The generating program uses +"WHERE 1=1" to simplify the addition of other conditions: instead +of checking if it needs to add a WHERE and putting ANDs in the right +places, it simply appends subsequent conditions with " AND condition". + +-- +Michael Fuhr +http://www.fuhr.org/~mfuhr/ + +From pgsql-performance-owner@postgresql.org Sat Dec 11 17:01:42 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 263D23A6352 + for ; + Sat, 11 Dec 2004 17:01:40 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82087-05 + for ; + Sat, 11 Dec 2004 17:01:28 +0000 (GMT) +Received: from mail.atua.com.br (unknown [200.248.138.61]) + by svr1.postgresql.org (Postfix) with ESMTP id C08F03A6344 + for ; + Sat, 11 Dec 2004 17:01:26 +0000 (GMT) +Received: from [10.0.0.171] (ns2.atua.com.br [200.248.138.60]) + by mail.atua.com.br (Postfix) with ESMTP id 8AED91EC2F8 + for ; + Sat, 11 Dec 2004 15:01:24 -0200 (BRST) +Subject: Very different index usage on similar tables +From: Alvaro Nunes Melo +To: Pgsql-Performance +Content-Type: multipart/mixed; boundary="=-E++lZY0ZEY9O788aYkTo" +Message-Id: <1102784484.4166.8.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Sat, 11 Dec 2004 15:01:24 -0200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/148 +X-Sequence-Number: 9523 + + +--=-E++lZY0ZEY9O788aYkTo +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Hi, + +I have two similar tables in a database, one stores persons and the +other stores telephones. They have a similar number of records (around +70.000), but a indexed search on the persons' table is way faster than +in the telephones' table. I'm sending the explains atacched, and I +believe that the problem can be in the fact the the explain extimates a +worng number of rows in the telefones' explain. I'm sending the explains +atacched, and the table and columns' names are in Portuguese, but if it +makes easier for you guys I can translate them in my next posts. + +The in dex in the telephone table is multicolumn, I'd tried to drop it +and create a single-column index, but the results were quite the same. + +Thanks, + +-- ++---------------------------------------------------+ +| Alvaro Nunes Melo Atua Sistemas de Informacao | +| al_nunes@atua.com.br www.atua.com.br | +| UIN - 42722678 (54) 327-1044 | ++---------------------------------------------------+ + +--=-E++lZY0ZEY9O788aYkTo +Content-Disposition: attachment; filename=explains +Content-Type: text/plain; name=explains; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + +db=> EXPLAIN ANALYZE SELECT * FROM telefone WHERE cd_pessoa = 1; + QUERY PLAN + +------------------------------------------------------------------------------------------------------------------------------------------------------- + Index Scan using idx_telefone_cd_pessoa_id_principal on telefone (cost=0.00..1057.21 rows=354 width=101) (actual time=25.650..25.655 rows=1 loops=1) + Index Cond: (cd_pessoa = 1) + Total runtime: 25.731 ms +(3 registros) + +Tempo: 26,972 ms +db=> EXPLAIN ANALYZE SELECT * FROM pessoa WHERE cd_pessoa = 1; + QUERY PLAN + +------------------------------------------------------------------------------------------------------------------- + Index Scan using pk_pessoa on pessoa (cost=0.00..6.01 rows=1 width=48) (actual time=0.123..0.126 rows=1 loops=1) + Index Cond: (cd_pessoa = 1) + Total runtime: 0.189 ms +(3 registros) + +Tempo: 1,233 ms +db=> \d pessoa + Tabela "public.pessoa" + Coluna | Tipo | Modificadores +---------------+-----------------------------+--------------------------------------------------------------- + cd_pessoa | integer | not null default nextval('public.pessoa_cd_pessoa_seq'::text) + nm_pessoa | text | not null + dt_nascimento | date | + dt_importacao | timestamp without time zone | +�ndices: + "pk_pessoa"chave prim�ria, btree (cd_pessoa) + "idx_pessoa_cliente_liberado" btree (cliente_liberado(cd_pessoa)) + "idx_pessoa_obtem_cd_cidade_comercial" btree (obtem_cd_cidade_comercial(cd_pessoa)) + +db=> \d telefone + Tabela "public.telefone" + Coluna | Tipo | Modificadores +--------------+------------------------+------------------------------------------------------------------- + cd_telefone | integer | not null default nextval('public.telefone_cd_telefone_seq'::text) + cd_pessoa | integer | not null + nr_telefone | character varying(15) | not null + id_tipo | smallint | not null default 1 + id_principal | smallint | not null + nr_ramal | smallint | + ds_contato | character varying(100) | +�ndices: + "pk_telefone"chave prim�ria, btree (cd_telefone) + "idx_telefone_cd_pessoa_id_principal" btree (cd_pessoa, id_principal) +Restri��es de checagem: + "ckc_id_tipo_telefone" CHECK (id_tipo = 1 OR id_tipo = 2 OR id_tipo = 3 OR id_tipo = 4) + "ckc_id_principal_telefone" CHECK (id_principal = 0 OR id_principal = 1) +Restri��es de chave estrangeira: + "fk_telefone_pessoa" FOREIGN KEY (cd_pessoa) REFERENCES pessoa(cd_pessoa) ON UPDATE RESTRICT ON DELETE RESTRICT + + +--=-E++lZY0ZEY9O788aYkTo-- + + +From pgsql-performance-owner@postgresql.org Sat Dec 11 18:09:03 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CD82A3A63A9 + for ; + Sat, 11 Dec 2004 18:06:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99934-06 + for ; + Sat, 11 Dec 2004 18:06:27 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 35C0E3A63B3 + for ; + Sat, 11 Dec 2004 18:06:27 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBBI6OLb017529; + Sat, 11 Dec 2004 13:06:24 -0500 (EST) +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, + Mike Rylander +Subject: Re: LIMIT causes SEQSCAN in subselect +In-reply-to: <200412102140.18456.josh@agliodbs.com> +References: + <200412102140.18456.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Fri, 10 Dec 2004 21:40:18 -0800" +Date: Sat, 11 Dec 2004 13:06:23 -0500 +Message-ID: <17528.1102788383@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/149 +X-Sequence-Number: 9524 + +Josh Berkus writes: +> The fact that the estimator knows that the LIMIT is pointless because there +> are less rows in the subselect than the LIMIT will return is not something we +> want to count on; sometimes the estimator has innaccurate information. + +However, when the estimator is basing that estimate on the existence of +a unique index for the column, the estimate could be trusted. There are +a couple of reasons that we don't perform that optimization at present, +though: + +1. If the finished query plan doesn't actually *use* the index in +question, then dropping the index would not directly invalidate the +query plan, but nonetheless the query would be broken. You could +subsequently get silently-wrong answers. + +2. For the particular point at hand, there's an implementation problem, +which is that decisions about whether to flatten subqueries are taken +before we do any rowcount estimation. So even if we discarded the LIMIT +clause once we realized it was redundant, it'd be too late to get the +optimal overall plan. + +Point #1 is something I would like to fix whenever we get around to +implementing proper invalidation of cached plans. There would need to +be a way to list "indirect" as well as direct dependencies of a plan. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Dec 12 08:32:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CF7F83A65B5 + for ; + Sun, 12 Dec 2004 08:32:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88887-04 + for ; + Sun, 12 Dec 2004 08:32:27 +0000 (GMT) +Received: from junk.nocrew.org (junk.nocrew.org [213.242.147.30]) + by svr1.postgresql.org (Postfix) with ESMTP id AC29B3A65AB + for ; + Sun, 12 Dec 2004 08:32:28 +0000 (GMT) +Received: from tomas by junk.nocrew.org with local (Exim 3.35 #1 (Debian)) + for pgsql-performance@postgresql.org + id 1CdP9V-0000sP-00; Sun, 12 Dec 2004 09:32:25 +0100 +To: pgsql-performance@postgresql.org +Subject: Re: [GENERAL] Query is not using index when it should +References: <80oeh2tm7x.fsf@junk.nocrew.org> + <20041210182453.G92467@megazone.bigpanda.com> + <80d5xgudg6.fsf@junk.nocrew.org> <20041211143213.GA2659@uio.no> +From: tomas@nocrew.org (Tomas =?iso-8859-1?q?Sk=E4re?=) +Date: 12 Dec 2004 09:32:25 +0100 +In-Reply-To: <20041211143213.GA2659@uio.no> +Message-ID: <806537udba.fsf@junk.nocrew.org> +Lines: 38 +User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/150 +X-Sequence-Number: 9525 + +"Steinar H. Gunderson" writes: + +> On Sat, Dec 11, 2004 at 03:17:13PM +0100, Tomas Sk�re wrote: +> > select c.* from cjm_object c +> > inner join +> > (select max(timestamp) as timestamp,objectid,field from cjm_object +> > group by objectid,field) t +> > using(timestamp,objectid,field) +> > where 1=1 and data is not null +> > order by objectid,field; +> +> Usually, SELECT max(field) FROM table is better written in PostgreSQL as +> SELECT field FROM table ORDER field DESC LIMIT 1. + +Well, my subquery doesn't return just one row, but one for each +objectid,field combination in the table. I could rewrite it to +something like this: + +select c.* from cjm_object c +where exists (select timestamp from cjm_object t + where c.objectid=t.objectid + and c.field=t.field + order by timestamp desc limit 1) +and data is not null +order by objectid; + +But that seems to be even slower, even if it can use an index scan in +the subquery. Also it doesn't give the same result set, but I haven't +looked into what's wrong yet. + +> I don't see the point of "where 1=1", though... + +It's just because the actual query is generated by a program, and it's +easier to always have "where 1=1" and then add optional conditions +with "and ...". + + +Tomas + +From pgsql-performance-owner@postgresql.org Mon Dec 13 02:49:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 548543A6829 + for ; + Mon, 13 Dec 2004 02:49:06 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27252-07 + for ; + Mon, 13 Dec 2004 02:48:57 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id DDF133A6844 + for ; + Mon, 13 Dec 2004 02:48:59 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6779046; Sun, 12 Dec 2004 18:50:33 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Query is not using index when it should +Date: Sun, 12 Dec 2004 18:48:27 -0800 +User-Agent: KMail/1.6.2 +Cc: tomas@nocrew.org (Tomas =?iso-8859-1?q?Sk=E4re?=) +References: <80oeh2tm7x.fsf@junk.nocrew.org> +In-Reply-To: <80oeh2tm7x.fsf@junk.nocrew.org> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412121848.27513.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/154 +X-Sequence-Number: 9529 + +Tomas, + +> I tried to subscribe to pgsql-performance, but there seems to be +> something wrong with the majordomo, so I'm sending to general too, +> where I'm already subscribed. + +Well, I got your e-mail, so obviously you're subscribed to Performance. + +> But when doing a search with objectid, class and field, it doesn't use +> the idx_cjm_object1 index. +> db=# explain analyze select * from cjm_object where objectid=4534 and +> class=12 and field='paroid'; QUERY PLAN + +Try: + +explain analyze select * from cjm_object where objectid=4534::BIGINT and +class=12 and field='paroid'; + +Sometimes the planner needs a little extra help on BIGINT fields. This +problem is fixed in 8.0. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Dec 13 06:13:56 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 567093A6888 + for ; + Mon, 13 Dec 2004 06:13:55 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82798-02 + for ; + Mon, 13 Dec 2004 06:13:44 +0000 (GMT) +Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) + by svr1.postgresql.org (Postfix) with ESMTP id A77A73A678A + for ; + Mon, 13 Dec 2004 06:13:43 +0000 (GMT) +Received: from mail-gw-cl-b.dmv.com (mail-gw-cl-b.dmv.com [216.240.97.39]) + by smtp-gw-cl-d.dmv.com (8.12.10/8.12.10) with ESMTP id iBD6KwWa041846 + for ; + Mon, 13 Dec 2004 01:21:00 -0500 (EST) (envelope-from sven@dmv.com) +Received: from [64.45.134.154] (dogpound.dyndns.org [64.45.134.154]) + by mail-gw-cl-b.dmv.com (8.12.9/8.12.9) with ESMTP id iBD6DeeE014781 + for ; + Mon, 13 Dec 2004 01:13:40 -0500 (EST) (envelope-from sven@dmv.com) +Message-ID: <41BD3317.9090507@dmv.com> +Date: Mon, 13 Dec 2004 01:13:43 -0500 +From: Sven Willenberger +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Using LIMIT changes index used by planner +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.48 on 216.240.97.42 +X-Scanned-By: MIMEDefang 2.48 on 216.240.97.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/155 +X-Sequence-Number: 9530 + +I have a question regarding a serious performance hit taken when using a +LIMIT clause. I am using version 7.4.6 on FreeBSD 4.10-STABLE with 2GB +of memory. The table in question contains some 25 million rows with a +bigserial primary key, orderdate index and a referrer index. The 2 +select statements are as follow: + +A) select storelocation,order_number from custacct where referrer = 1365 + and orderdate between '2004-12-07' and '2004-12-07 12:00:00' order by +custacctid; + +B) select storelocation,order_number from custacct where referrer = 1365 + and orderdate between '2004-12-07' and '2004-12-07 12:00:00' order by +custacctid limit 10; + +So the only difference is the use of the Limit, which, in theory, should +be quicker after custacctid is ordered. + +Now the analyze results: + +A) explain select storelocation,order_number from custacct where +referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +12:00:00' order by custacctid; + + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=904420.55..904468.11 rows=19025 width=44) + Sort Key: custacctid + -> Index Scan using orderdate_idx on custacct +(cost=0.00..903068.29 rows=19025 width=44) + Index Cond: ((orderdate >= '2004-12-07 00:00:00'::timestamp +without time zone) AND (orderdate <= '2004-12-07 12:00:00'::timestamp +without time zone)) + Filter: (referrer = 1365) +(5 rows) + +************************ + +B) explain select storelocation,order_number from custacct where +referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +12:00:00' order by custacctid limit 10; + + QUERY PLAN + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..33796.50 rows=10 width=44) + -> Index Scan using custacct2_pkey on custacct +(cost=0.00..64297840.86 rows=19025 width=44) + Filter: ((referrer = 1365) AND (orderdate >= '2004-12-07 +00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-07 +12:00:00'::timestamp without time zone)) +(3 rows) + +******************* + +Notice the huge cost difference in the two plans: 904468 in the one +without LIMIT versus 64297840.86 for the index scan on custacct index. +Why would the planner switch from using the orderdate index to the +custacct index (which is a BIGSERIAL, btw)? + +I can change that behavior (and speed up the resultant query) by using +the following subquery: + +explain select foo.storelocation, foo.order_number from (select +storelocation,order_number from custacct where referrer = 1365 and +orderdate between '2004-12-07' and '2004-12-07 12:00:00' order by +custacctid) as foo limit 10; + + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=904420.55..904420.67 rows=10 width=100) + -> Subquery Scan foo (cost=904420.55..904658.36 rows=19025 width=100) + -> Sort (cost=904420.55..904468.11 rows=19025 width=44) + Sort Key: custacctid + -> Index Scan using orderdate_idx on custacct +(cost=0.00..903068.29 rows=19025 width=44) + Index Cond: ((orderdate >= '2004-12-07 +00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-07 +12:00:00'::timestamp without time zone)) + Filter: (referrer = 1365) +(7 rows) + +As a side note, when running query A, the query takes 1772.523 ms, when +running the subselect version to get the limit, it takes 1415.615 ms. +Running option B (with the other index being scanned) takes several +minutes (close to 10 minutes!). What am I missing about how the planner +views the LIMIT statement? + +Sven + +From pgsql-performance-owner@postgresql.org Mon Dec 13 09:56:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 810E83A3B8C + for ; + Mon, 13 Dec 2004 09:56:47 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42888-08 + for ; + Mon, 13 Dec 2004 09:56:35 +0000 (GMT) +Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B0213A5FB4 + for ; + Mon, 13 Dec 2004 09:56:35 +0000 (GMT) +Received: from 222-152-92-145.jetstream.xtra.co.nz ([222.152.92.145] + helo=lamb.mcmillan.net.nz) by mail1.catalyst.net.nz with asmtp + (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) + id 1CdmwR-0006Eh-16; Mon, 13 Dec 2004 22:56:31 +1300 +Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) + by lamb.mcmillan.net.nz (Postfix) with ESMTP id AE76FAD98588; + Mon, 13 Dec 2004 22:56:30 +1300 (NZDT) +Subject: Re: Using LIMIT changes index used by planner +From: Andrew McMillan +To: Sven Willenberger +Cc: pgsql-performance@postgresql.org +In-Reply-To: <41BD3317.9090507@dmv.com> +References: <41BD3317.9090507@dmv.com> +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="=-hh0EoM0MFMK+Mnz9idhX" +Date: Mon, 13 Dec 2004 22:56:29 +1300 +Message-Id: <1102931789.11712.9.camel@lamb.mcmillan.net.nz> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/156 +X-Sequence-Number: 9531 + + +--=-hh0EoM0MFMK+Mnz9idhX +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +On Mon, 2004-12-13 at 01:13 -0500, Sven Willenberger wrote: +> I have a question regarding a serious performance hit taken when using a=20 +> LIMIT clause. I am using version 7.4.6 on FreeBSD 4.10-STABLE with 2GB=20 +> of memory. The table in question contains some 25 million rows with a=20 +> bigserial primary key, orderdate index and a referrer index. The 2=20 +> select statements are as follow: + +It's an interesting question, but to be able to get answers from this +list you will need to provide "EXPLAIN ANALYZE ..." rather than just +"EXPLAIN ...". + +AFAICS the bad plan on LIMIT is because it optimistically thinks the +odds are around the 0.00 end, rather than the 64297840.86 end, and +indeed that is what the "Limit ..." estimate is showing. A bad plan (in +your case) is encouraged here by the combination of "LIMIT" and "ORDER +BY". + +For real background on this, and calculated recommendations, we'd need +that more detailed output though. + +As a quick hack, it's possible that you could improve things by +increasing the samples on relevant columns with some judicious "ALTER +TABLE ... ALTER COLUMN ... SET STATISTICS ..." commands. + +Cheers, + Andrew McMillan. + +------------------------------------------------------------------------- +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)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 + Planning an election? Call us! +------------------------------------------------------------------------- + + +--=-hh0EoM0MFMK+Mnz9idhX +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) + +iD8DBQBBvWdMjJA0f48GgBIRAgF8AJ4hR07mtCDXnpCy0Bh05ZdzfEtxxwCfTW05 +KRnt/3WuxuwnSl4V270Ajg0= +=flF1 +-----END PGP SIGNATURE----- + +--=-hh0EoM0MFMK+Mnz9idhX-- + + +From pgsql-novice-owner@postgresql.org Mon Dec 13 16:29:17 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7BCE73A62D1 + for ; + Mon, 13 Dec 2004 16:28:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79078-05 + for ; + Mon, 13 Dec 2004 16:28:41 +0000 (GMT) +Received: from web51303.mail.yahoo.com (web51303.mail.yahoo.com + [206.190.38.169]) + by svr1.postgresql.org (Postfix) with SMTP id 8E5D23A61BA + for ; Mon, 13 Dec 2004 16:28:40 +0000 (GMT) +Received: (qmail 60933 invoked by uid 60001); 13 Dec 2004 16:28:39 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=sa3UjX0HvmuSD2G72swKnJertM+gamt+bWqqThQjXgwTgMsRlT/VXiQRM0EMFpdH6it44yOFOal6J1MuZBd7GhZ2Kh4C7vJnK9SfpaxKQZB+5hCieUQ5as8h+/lIeLhIlAQbWFyA8x50dnXCY1HxbLYlcO/dIqkXott5Hnqpkng= + ; +Message-ID: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +Received: from [65.218.182.242] by web51303.mail.yahoo.com via HTTP; + Mon, 13 Dec 2004 08:28:39 PST +Date: Mon, 13 Dec 2004 08:28:39 -0800 (PST) +From: sarlav kumar +Subject: INSERT question +To: pgsqlperform , + pgsql-novice@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-644985442-1102955319=:58520" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.378 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/81 +X-Sequence-Number: 11658 + +--0-644985442-1102955319=:58520 +Content-Type: text/plain; charset=us-ascii + +Hi All, + +I have a question regarding multiple inserts. +The following function inserts for each country found in country table, values into merchant_buyer_country. + +---------------------------------------------------------------------------------------------------------------------------------------- + CSQLStatement st( sql ); + CSQLStatement st1( sql ); + SQLINTEGER rows; + long num_codes = 0; + rows = st.Select( "SELECT * FROM merchant_buyer_country where merchant_id = %lu ",merchant_id ); + if ( rows ) + return 0; + char code[4]; + rows = st.Select( "SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL" ); + SQLBindCol( st.hstmt, 1, SQL_C_CHAR, code, sizeof(code), 0 ); + long i; + for (i = 0; i < rows; i++ ) + { + st.Fetch(); + st1.Command("INSERT INTO merchant_buyer_country (merchant_id,country,enabled,group_id) VALUES(%lu ,'%s', true, %lu )", merchant_id, + code,group_id); + } + st.CloseCursor(); + st1.CloseCursor(); + return 1; +---------------------------------------------------------------------------------------------------------------------------------------- + +On looking at the log file, I saw separate inserts being performed, and each insert takes about 1 second. + +insert into merchant_buyer_country (merchant_id,country,enabled,group_id) values(1203,'IN','true',1); +insert into merchant_buyer_country merchant_id,country,enabled,group_id) values(1203,'US','true',1); +insert into merchant_buyer_country merchant_id,country,enabled,group_id) values (1203,'AR','true',1); +insert into merchant_buyer_country (merchant_id,country,enabled,group_id) values(1203,'AZ','true',1); +insert into merchant_buyer_country merchant_id,country,enabled,group_id) values (1203,'BG','true',1); +insert into merchant_buyer_country merchant_id,country,enabled,group_id) values(1203,'SP','true',1); +..... + + + + + + +There are more than 100 countries and this takes a lot of time for the inserts to complete. +Is there a way to write the INSERT as follows? + +INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +(SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); + +I tried this, but I get the following problem: +ERROR: More than one tuple returned by a subselect used as an expression. + +I know there is a way to this, but I am not sure where I am going wrong. Can someone please help me figure this out. + +Thanks, +Saranya + + + +--------------------------------- +Do you Yahoo!? + Meet the all-new My Yahoo! � Try it today! +--0-644985442-1102955319=:58520 +Content-Type: text/html; charset=us-ascii + +
Hi All,
+
 
+
I have a question regarding multiple inserts.
+
The following function inserts for each country found in country table, values into merchant_buyer_country.
+
 
+
+
----------------------------------------------------------------------------------------------------------------------------------------
+
        CSQLStatement st( sql );
        CSQLStatement st1( sql );
        SQLINTEGER rows;
        long num_codes = 0;
+
        rows = st.Select( "SELECT * FROM merchant_buyer_country where merchant_id = %lu ",merchant_id );
+
        if  ( rows )
                return 0;
+
    char code[4];
        rows = st.Select( "SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL" );
    SQLBindCol( st.hstmt, 1, SQL_C_CHAR, code, sizeof(code), 0 );
   long i;
+
   for (i = 0; i < rows; i++ )
   {
+
          st.Fetch();
          st1.Command("INSERT INTO merchant_buyer_country (merchant_id,country,enabled,group_id)  VALUES(%lu ,'%s', true, %lu )", merchant_id,
 code,group_id);
   }
+
        st.CloseCursor();
    st1.CloseCursor();
+
        return 1;
----------------------------------------------------------------------------------------------------------------------------------------
+
On looking at the log file, I saw separate inserts being performed, and each insert takes about 1 second.
+
 
+
insert into merchant_buyer_country (merchant_id,country,enabled,group_id) values(1203,'IN','true',1);
+
+
insert into merchant_buyer_country merchant_id,country,enabled,group_id)  values(1203,'US','true',1);
+
+
insert into merchant_buyer_country merchant_id,country,enabled,group_id) values (1203,'AR','true',1);
+
+
insert into merchant_buyer_country (merchant_id,country,enabled,group_id) values(1203,'AZ','true',1);
+
+
insert into merchant_buyer_country merchant_id,country,enabled,group_id) values (1203,'BG','true',1);
+
+
insert into merchant_buyer_country merchant_id,country,enabled,group_id) values(1203,'SP','true',1);
+
.....
+
 
+
There are more than 100 countries and this takes a lot of time for the inserts to complete.
+
Is there a way to write the INSERT as follows?
+
 
+
INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id)  values (1203,
+
(SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1);
+
 
+
I tried this, but I get the following problem:
+
ERROR:  More than one tuple returned by a subselect used as an expression.
+
 
+
I know there is a way to this, but I am not sure where I am going wrong. Can someone please help me figure this out.
+
 
+
Thanks,
+
Saranya
+
 

+


Do you Yahoo!?
+Meet the all-new My Yahoo! � Try it today! +--0-644985442-1102955319=:58520-- + +From pgsql-performance-owner@postgresql.org Mon Dec 13 16:34:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0614C3A6015 + for ; + Mon, 13 Dec 2004 16:34:06 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80069-05 + for ; + Mon, 13 Dec 2004 16:33:58 +0000 (GMT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id B82A33A62AC + for ; + Mon, 13 Dec 2004 16:33:51 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id CC9413E44 + for ; + Mon, 13 Dec 2004 11:33:49 -0500 (EST) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 55914-02 for ; + Mon, 13 Dec 2004 11:33:48 -0500 (EST) +Received: by lorax.kcilink.com (Postfix, from userid 8) + id EE0C03E47; Mon, 13 Dec 2004 11:33:47 -0500 (EST) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: Hardware purchase question +Date: Mon, 13 Dec 2004 11:33:47 -0500 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 37 +Message-ID: +References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1102955627 23890 65.205.34.180 (13 Dec 2004 + 16:33:47 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Mon, 13 Dec 2004 16:33:47 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through + Obscurity, berkeley-unix) +Cancel-Lock: sha1:H4JsMIjVhgmVivTm48+qep5fTOM= +X-Virus-Scanned: amavisd-new at kcilink.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/158 +X-Sequence-Number: 9533 + +>>>>> "BS" == Bo Stewart writes: + +BS> The servers listed above are the dell 2650's which have perc 3 +BS> controllers. I have seen on this list where they are know for not +BS> performing well. So any suggestions for an attached scsi device would +BS> be greatly appreciated. Also, any thoughts on fibre channel storage +BS> devices? + +I have a 2450 and a 2650 both of which are totally sucking IO wise. + +The 2650 has a PERC3 card (LSI based) and has one channel holding a +mirrored pair for the pg_xlog and OS, and the other channel has 14 +U320 disks in a RAID5. If I'm lucky, I'll get 30MB/s out of the +disks. Normally it hovers at 5 or 6MB/s on the big RAID. + +I'm currently shopping for non-Dell hardware to replace it :-( + +However, I keep getting conflicting advice. My choices are along +these lines: + +Dual Xeon 64bit with built-in 6-disk RAID10 or RAID5 (LSI RAID card) +Dual Opteron 64bit with built-in 6-disk RAID10 or RAID5 (LSI RAID card) +Dual Opteron 64bit with external RAID via fibre channel (eg, nstor) + +I'm sure any of these will whip the bottom off the Dell 2650, but +which will be the fastest overall? No way to know without spending +lots of money to test. :-( + +Dell claims their new 2750 will be faster, but they've lost the battle +already, and won't commit to any performance numbers. Won't even give +me a ballpark number. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Mon Dec 13 16:37:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8671B3A604E + for ; + Mon, 13 Dec 2004 16:37:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81766-08 + for ; + Mon, 13 Dec 2004 16:37:30 +0000 (GMT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 65CE13A62C1 + for ; + Mon, 13 Dec 2004 16:37:30 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id E21983E44 + for ; + Mon, 13 Dec 2004 11:37:29 -0500 (EST) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 34386-04-3 for ; + Mon, 13 Dec 2004 11:37:28 -0500 (EST) +Received: by lorax.kcilink.com (Postfix, from userid 8) + id 3B4E73E42; Mon, 13 Dec 2004 11:37:28 -0500 (EST) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: pg_restore taking 4 hours! +Date: Mon, 13 Dec 2004 11:37:28 -0500 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 25 +Message-ID: +References: <41ADA82A.7070405@carvalhaes.net> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1102955848 23890 65.205.34.180 (13 Dec 2004 + 16:37:28 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Mon, 13 Dec 2004 16:37:28 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through + Obscurity, berkeley-unix) +Cancel-Lock: sha1:WElxwPPo+t3rfVDgripWtA4nV8M= +X-Virus-Scanned: amavisd-new at kcilink.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/160 +X-Sequence-Number: 9535 + +>>>>> "RC" == Rodrigo Carvalhaes writes: + +RC> Hi! +RC> I am using PostgreSQL with a proprietary ERP software in Brazil. The +RC> database have around 1.600 tables (each one with +/- 50 columns). +RC> My problem now is the time that takes to restore a dump. My customer +RC> database have arount 500mb (on the disk, not the dump file) and I am +RC> making the dump with pg_dump -Fc, my dumped file have 30mb. To make +RC> the dump, it's taking +/- 1,5 hours BUT to restore (using pg_restore ) +RC> it it takes 4 - 5 hours!!! + +I regularly dump a db that is compressed at over 2Gb. Last time I did +a restore on the production box it took about 3 hours. Restoring it +into a development box with a SATA RAID0 config takes like 7 hours or +so. + +The biggest improvement in speed to restore time I have discovered is +to increase the checkpoint segments. I bump mine to about 50. And +moving the pg_xlog to a separate physical disk helps a lot there, too. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Mon Dec 13 16:47:55 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B5B633A6015 + for ; + Mon, 13 Dec 2004 16:47:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84735-09 + for ; + Mon, 13 Dec 2004 16:47:38 +0000 (GMT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D3113A6259 + for ; + Mon, 13 Dec 2004 16:47:38 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id 5D6473E48 + for ; + Mon, 13 Dec 2004 11:47:38 -0500 (EST) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 63477-06 for ; + Mon, 13 Dec 2004 11:47:34 -0500 (EST) +Received: by lorax.kcilink.com (Postfix, from userid 8) + id A14BC3E42; Mon, 13 Dec 2004 11:47:34 -0500 (EST) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: Alternatives to Dell? +Date: Mon, 13 Dec 2004 11:47:34 -0500 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 30 +Message-ID: +References: <200412011424.12137.josh@agliodbs.com> + <20041201164130.4337518a.frank@wiles.org> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1102956454 23890 65.205.34.180 (13 Dec 2004 + 16:47:34 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Mon, 13 Dec 2004 16:47:34 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through + Obscurity, berkeley-unix) +Cancel-Lock: sha1:ZNYrJiruopinbL3BWsRr18ELz/w= +X-Virus-Scanned: amavisd-new at kcilink.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/161 +X-Sequence-Number: 9536 + +>>>>> "FW" == Frank Wiles writes: + +FW> I believe I had expressed some problems with Dell in the past, but +FW> it really isn't a quality control issue that I have seen. It is more +FW> of a Linux support issue. Lately I've been running into problems with + +Ditto that experience, but with FreeBSD. + +FW> getting particular parts of system working under Linux (raid cards, +FW> SATA drives, Ethernet cards) or I can get it working, but it +FW> performs badly ( PERC cards vs say a Mylex card ). + +Drivers for their devices are not problems, but performance is. + +Their RAID cards are either Adaptec or LSI, but people who use the +"real" branded versions of those cards always seem to get better +performance. Way better. + +I'm considering FreeBSD systems and a custom built configuration right +now. Very hard decision to make. + +For desktops and web/office servers, I still like the Dells. Just not +for the DB servers anymore. + + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-novice-owner@postgresql.org Mon Dec 13 16:48:22 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C92B3A6066 + for ; + Mon, 13 Dec 2004 16:48:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85661-05 + for ; + Mon, 13 Dec 2004 16:48:16 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 7DBFB3A6015 + for ; Mon, 13 Dec 2004 16:48:15 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBDGmFeK025642; + Mon, 13 Dec 2004 11:48:15 -0500 (EST) +To: sarlav kumar +Cc: pgsql-novice@postgresql.org +Subject: Re: INSERT question +In-reply-to: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +References: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +Comments: In-reply-to sarlav kumar + message dated "Mon, 13 Dec 2004 08:28:39 -0800" +Date: Mon, 13 Dec 2004 11:48:14 -0500 +Message-ID: <25641.1102956494@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/83 +X-Sequence-Number: 11660 + +sarlav kumar writes: +> Is there a way to write the INSERT as follows? + +> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); + +> I tried this, but I get the following problem: +> ERROR: More than one tuple returned by a subselect used as an expression. + +INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) + SELECT 1203, code, 'true', 1 FROM country + WHERE send IS NOT NULL OR receive IS NOT NULL; + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Mon Dec 13 16:38:21 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 90FFA3A62A7 + for ; + Mon, 13 Dec 2004 16:37:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81295-10 + for ; + Mon, 13 Dec 2004 16:37:13 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 6B18A3A6174 + for ; Mon, 13 Dec 2004 16:37:12 +0000 (GMT) +Received: (qmail 1831 invoked by uid 500); 13 Dec 2004 16:49:52 -0000 +Date: Mon, 13 Dec 2004 10:49:52 -0600 +From: Bruno Wolff III +To: sarlav kumar +Cc: pgsqlperform , + pgsql-novice@postgresql.org +Subject: Re: INSERT question +Message-ID: <20041213164952.GC546@wolff.to> +Mail-Followup-To: sarlav kumar , + pgsqlperform , + pgsql-novice@postgresql.org +References: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.106 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200412/82 +X-Sequence-Number: 11659 + +On Mon, Dec 13, 2004 at 08:28:39 -0800, + sarlav kumar wrote: +> +> Is there a way to write the INSERT as follows? +> +> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); +> + +You have to use a SELECT instead of the VAlues clause. Something like the +following should work: +INSERT INTO merchant_buyer_country (merchant_id, country, enabled, group_id) + SELECT 1203, code, TRUE, 1 FROM country + WHERE send IS NOT NULL OR receive IS NOT NULL +; + +From pgsql-sql-owner@postgresql.org Mon Dec 13 17:18:07 2004 +X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2FBD13A6162 + for ; + Mon, 13 Dec 2004 17:17:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96369-07 + for ; + Mon, 13 Dec 2004 17:17:53 +0000 (GMT) +Received: from mail.atua.com.br (unknown [200.248.138.61]) + by svr1.postgresql.org (Postfix) with ESMTP id 96FC93A614D + for ; Mon, 13 Dec 2004 17:17:52 +0000 (GMT) +Received: from [10.0.0.171] (ns2.atua.com.br [200.248.138.60]) + by mail.atua.com.br (Postfix) with ESMTP id 37ADA1EC2F8 + for ; Mon, 13 Dec 2004 15:17:50 -0200 (BRST) +Subject: Similar tables, different indexes performance +From: Alvaro Nunes Melo +To: PostgreSQL - SQL +Content-Type: multipart/mixed; boundary="=-o0rvqQVuwEhz3JTO+wAj" +Message-Id: <1102958269.5855.29.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Mon, 13 Dec 2004 15:17:49 -0200 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/87 +X-Sequence-Number: 19707 + + +--=-o0rvqQVuwEhz3JTO+wAj +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +Hi, + +I know that it's not very polite thing re-send a question, but I don't +have any idea about why can this be happening. I have two almost +identical tables, with equivalent indexes, but their performances are +very different. In this case, I'm sending the queries, explains, +tables'structures and record counts. I think this is the place where I +can most probably get help about performance issues. + +Thanks in advance, + +-- ++---------------------------------------------------+ +| Alvaro Nunes Melo Atua Sistemas de Informacao | +| al_nunes@atua.com.br www.atua.com.br | +| UIN - 42722678 (54) 327-1044 | ++---------------------------------------------------+ + +--=-o0rvqQVuwEhz3JTO+wAj +Content-Disposition: attachment; filename=mail +Content-Type: text/plain; name=mail; charset=ISO-8859-1 +Content-Transfer-Encoding: 8bit + +db=> SELECT COUNT(*) FROM titulo WHERE cd_pessoa = 1; + count +------- + 220 +(1 record) + +Time: 48,762 ms +db=> SELECT COUNT(*) FROM movimento WHERE cd_pessoa = 1; + count +------- + 221 +(1 record) + +Time: 1158,463 ms +db=> EXPLAIN ANALYZE SELECT COUNT(*) FROM movimento WHERE cd_pessoa = 1; + QUERY PLAN + +---------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=279.99..279.99 rows=1 width=0) (actual time=1.263..1.264 rows=1 loops=1) + -> Index Scan using idx_movimento_cd_pessoa on movimento (cost=0.00..279.80 rows=74 width=0) (actual time=0.043..0.984 rows=221 loops=1) + Index Cond: (cd_pessoa = 1) + Total runtime: 1.388 ms +(4 records) + +Time: 6,279 ms +db=> EXPLAIN ANALYZE SELECT COUNT(*) FROM titulo WHERE cd_pessoa = 1; + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=6.02..6.02 rows=1 width=0) (actual time=1.105..1.105 rows=1 loops=1) + -> Index Scan using idx_titulo_cd_pessoa_id_tipo_dt_vencimento on titulo (cost=0.00..6.01 rows=1 width=0) + (actual time=0.040..0.828 rows=220 loops=1) + Index Cond: (cd_pessoa = 1) + Total runtime: 1.209 ms +(4 records) + +Time: 6,993 ms +db=> SELECT COUNT(*) FROM movimento; + count +-------- + 347355 +(1 record) + +Time: 640,686 ms +db=> SELECT COUNT(*) FROM titulo; + count +-------- + 347354 +(1 record) + +Time: 3274,281 ms +db=> \d movimento + Table "public.movimento" + Column | Type | Modifiers +-------------------+---------------+--------------------------------------------------------------------- + cd_movimento | integer | not null default nextval('public.movimento_cd_movimento_seq'::text) + cd_pessoa | integer | not null + cd_pessoa_usuario | integer | not null + cd_pessoa_matriz | integer | not null + cd_pessoa_filial | integer | not null + dt_movimento | date | not null + vl_movimento | numeric(15,2) | not null + id_origem | smallint | not null default 0 + id_tipo | smallint | not null + nr_nota_fiscal | text | +�ndices: + "pk_movimento"chave prim�ria, btree (cd_movimento) + "idx_movimento_cd_pessoa" btree (cd_pessoa) + "idx_movimento_cd_pessoa_id_tipo" btree (cd_pessoa, id_tipo) +Restri��es de checagem: + "ckc_id_tipo_moviment" CHECK (id_tipo = 1 OR id_tipo = 2) + "ckc_id_origem_moviment" CHECK (id_origem = 0 OR id_origem = 1 OR id_origem = 2) +Restri��es de chave estrangeira: + "fk_movimento_filial" FOREIGN KEY (cd_pessoa_matriz, cd_pessoa_filial) REFERENCES filial(cd_pessoa, cd_pessoa_filial) ON UPDATE RESTRICT ON DELETE RESTRICT + "fk_movimento_usuario" FOREIGN KEY (cd_pessoa_usuario) REFERENCES usuario(cd_pessoa) ON UPDATE RESTRICT ON DELETE RESTRICT + "fk_movimento_pessoa" FOREIGN KEY (cd_pessoa) REFERENCES pessoa(cd_pessoa) ON UPDATE RESTRICT ON DELETE RESTRICT + +db=> \d titulo + Table "public.titulo" + Column | Type | Modifiers +----------------+---------------+--------------------------------------------------------------- + cd_titulo | integer | not null default nextval('public.titulo_cd_titulo_seq'::text) + cd_portador | integer | + cd_movimento | integer | not null + nr_lote | integer | + cd_lote_titulo | integer | + vl_titulo | numeric(15,2) | not null + vl_acrescimo | numeric(15,2) | + vl_desconto | numeric(15,2) | + vl_multa | numeric(15,2) | + vl_juro | numeric(15,2) | + vl_emolumento | numeric(15,2) | + vl_pago | numeric(15,2) | + dt_vencimento | date | not null + ds_observacao | text | + nr_banco | text | + dt_quitacao | date | + id_tipo | smallint | + cd_pessoa | integer | +�ndices: + "pk_titulo"chave prim�ria, btree (cd_titulo) + "idx_titulo_cd_movimento" btree (cd_movimento) + "idx_titulo_cd_pessoa_id_tipo_dt_vencimento" btree (cd_pessoa, id_tipo, dt_vencimento) + "idx_titulo_nr_lote" btree (nr_lote) +Restri��es de chave estrangeira: + "fk_titulo_pessoa" FOREIGN KEY (cd_pessoa) REFERENCES pessoa(cd_pessoa) + "fk_titulo_lote" FOREIGN KEY (nr_lote) REFERENCES lote(nr_lote) ON UPDATE RESTRICT ON DELETE RESTRICT + "fk_titulo_portador" FOREIGN KEY (cd_portador) REFERENCES portador(cd_portador) ON UPDATE RESTRICT ON DELETE RESTRICT + "fk_titulo_lote_titulo" FOREIGN KEY (cd_lote_titulo) REFERENCES lote_titulo(cd_lote_titulo) ON UPDATE RESTRICT ON DELETE RESTRICT + + +--=-o0rvqQVuwEhz3JTO+wAj-- + + +From pgsql-performance-owner@postgresql.org Mon Dec 13 17:19:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B9DA93A628B + for ; + Mon, 13 Dec 2004 17:19:31 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98216-04 + for ; + Mon, 13 Dec 2004 17:19:27 +0000 (GMT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 11A693A62FA + for ; + Mon, 13 Dec 2004 17:19:27 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id 551DC3E42 + for ; + Mon, 13 Dec 2004 12:19:26 -0500 (EST) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 34386-06-2 for ; + Mon, 13 Dec 2004 12:19:24 -0500 (EST) +Received: by lorax.kcilink.com (Postfix, from userid 8) + id 8D1023E4A; Mon, 13 Dec 2004 12:19:24 -0500 (EST) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: Off-list Re: Alternatives to Dell? +Date: Mon, 13 Dec 2004 12:19:24 -0500 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 38 +Message-ID: +References: <200412011424.12137.josh@agliodbs.com> + + <200412011535.24003.josh@agliodbs.com> +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1102958364 59895 65.205.34.180 (13 Dec 2004 + 17:19:24 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Mon, 13 Dec 2004 17:19:24 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through + Obscurity, berkeley-unix) +Cancel-Lock: sha1:DA1xd7fqG62K8bLQoHCDWJfJ1R8= +X-Virus-Scanned: amavisd-new at kcilink.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/162 +X-Sequence-Number: 9537 + +>>>>> "JB" == Josh Berkus writes: + + +>> FYI ... the 750s, 1850s and 2850s use Intel chipsets (E7520 on 1850s +>> and 2850s, 7210 on 750s), Intel NICs, and come only with LSI Logic +>> RAID controllers. It looks like Dell has dropped the +>> Broadcom/ServerWorks and Adaptec junk. + +JB> I don't know if Vivek is on this list; I think he just had a +JB> critical failure with one of the new Dells with LSI. + +I'm here, but time delayed :-) + +No critical failures on the Dell, just performance failure. It can't +keep up. You'd think with a box like this: + +4GB RAM +Dual Xeon (32 bit) +PERC3 (LSI based controller) dual channel +chan0: RAID1 two disks for OS + pg_xlog +chan1: RAID5 14 disks U320 18Gb +FreeBSD 4.10 +PG 7.4.6 + +I should get better than a sustained 6MB/s I/O throughput with peaks +to 30MB/s and about 30% the tracks/sec others report with name-brand +LSI controllers with Opteron systems. + +The computer is wicked fast, but the I/O can't hold up, and I can't +get a straight answer as to why. + +I'm no closer to solving the vendor problem than anyone else here. + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Mon Dec 13 17:23:41 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7336A3A1D4C + for ; + Mon, 13 Dec 2004 17:23:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99233-06 + for ; + Mon, 13 Dec 2004 17:23:27 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id 337C53A6321 + for ; + Mon, 13 Dec 2004 17:23:26 +0000 (GMT) +Received: from [192.168.1.51] (dsl093-038-087.pdx1.dsl.speakeasy.net + [66.93.38.87]) (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iBDHNO3g019757; Mon, 13 Dec 2004 09:23:25 -0800 +Message-ID: <41BDD001.8070701@commandprompt.com> +Date: Mon, 13 Dec 2004 09:23:13 -0800 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Mozilla Thunderbird 1.0RC1 (X11/20041201) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: Hardware purchase question +References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> + +In-Reply-To: +Content-Type: multipart/mixed; boundary="------------000402080005090007050602" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.047 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/163 +X-Sequence-Number: 9538 + +This is a multi-part message in MIME format. +--------------000402080005090007050602 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + + +> However, I keep getting conflicting advice. My choices are along +> these lines: +> +> Dual Xeon 64bit with built-in 6-disk RAID10 or RAID5 (LSI RAID card) +> Dual Opteron 64bit with built-in 6-disk RAID10 or RAID5 (LSI RAID card) +> Dual Opteron 64bit with external RAID via fibre channel (eg, nstor) + +An Opteron, properly tuned with PostgreSQL will always beat a Xeon +in terms of raw cpu. + +RAID 10 will typically always outperform RAID 5 with the same HD config. + +Fibre channel in general will always beat a normal (especially an LSI) raid. + +Dell's suck for PostgreSQL. + +Sincerely, + +Joshua D. Drake + + + + +> +> I'm sure any of these will whip the bottom off the Dell 2650, but +> which will be the fastest overall? No way to know without spending +> lots of money to test. :-( +> +> Dell claims their new 2750 will be faster, but they've lost the battle +> already, and won't commit to any performance numbers. Won't even give +> me a ballpark number. +> + + +-- +Command Prompt, Inc., home of PostgreSQL Replication, and plPHP. +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL + +--------------000402080005090007050602 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua D. Drake +n:Drake;Joshua D. +org:Command Prompt, Inc. +adr:;;PO Box 215;Cascade Locks;Oregon;97014;USA +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +note:Command Prompt, Inc. is the largest and oldest US based commercial PostgreSQL support provider. We provide the only commercially viable integrated PostgreSQL replication solution, but also custom programming, and support. We authored the book Practical PostgreSQL, the procedural language plPHP, and adding trigger capability to plPerl. +x-mozilla-html:FALSE +url:http://www.commandprompt.com/ +version:2.1 +end:vcard + + +--------------000402080005090007050602-- + +From pgsql-sql-owner@postgresql.org Mon Dec 13 17:50:37 2004 +X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 142853A62C2 + for ; + Mon, 13 Dec 2004 17:50:36 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08593-02 + for ; + Mon, 13 Dec 2004 17:50:25 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 730DA3A630B + for ; Mon, 13 Dec 2004 17:50:23 +0000 (GMT) +Received: (qmail 9451 invoked by uid 500); 13 Dec 2004 18:03:03 -0000 +Date: Mon, 13 Dec 2004 12:03:03 -0600 +From: Bruno Wolff III +To: Alvaro Nunes Melo +Cc: PostgreSQL - SQL +Subject: Re: Similar tables, different indexes performance +Message-ID: <20041213180303.GA8830@wolff.to> +Mail-Followup-To: Alvaro Nunes Melo , + PostgreSQL - SQL +References: <1102958269.5855.29.camel@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1102958269.5855.29.camel@localhost> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/88 +X-Sequence-Number: 19708 + +On Mon, Dec 13, 2004 at 15:17:49 -0200, + Alvaro Nunes Melo wrote: +> db=> SELECT COUNT(*) FROM titulo WHERE cd_pessoa = 1; +> count +> ------- +> 220 +> (1 record) +> +> Time: 48,762 ms +> db=> SELECT COUNT(*) FROM movimento WHERE cd_pessoa = 1; +> count +> ------- +> 221 +> (1 record) +> +> Time: 1158,463 ms + +I suspect you have a lot of dead tuples in those tables. +Have you vacuumed them recently? +Was there enough FSM space when you did so? + +You might try doing VACUUM FULL on each table now and see if that +fixes the problem. + +From pgsql-performance-owner@postgresql.org Mon Dec 13 18:23:26 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E11B63A640A + for ; + Mon, 13 Dec 2004 18:20:28 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15973-09 + for ; + Mon, 13 Dec 2004 18:20:17 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 85D2F3A642C + for ; + Mon, 13 Dec 2004 18:20:16 +0000 (GMT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id iBDIKEq28082; + Mon, 13 Dec 2004 13:20:14 -0500 (EST) +From: Bruce Momjian +Message-Id: <200412131820.iBDIKEq28082@candle.pha.pa.us> +Subject: Re: Alternatives to Dell? +In-Reply-To: +To: Vivek Khera +Date: Mon, 13 Dec 2004 13:20:14 -0500 (EST) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL108 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/164 +X-Sequence-Number: 9539 + +Vivek Khera wrote: +> >>>>> "FW" == Frank Wiles writes: +> +> FW> I believe I had expressed some problems with Dell in the past, but +> FW> it really isn't a quality control issue that I have seen. It is more +> FW> of a Linux support issue. Lately I've been running into problems with +> +> Ditto that experience, but with FreeBSD. +> +> FW> getting particular parts of system working under Linux (raid cards, +> FW> SATA drives, Ethernet cards) or I can get it working, but it +> FW> performs badly ( PERC cards vs say a Mylex card ). +> +> Drivers for their devices are not problems, but performance is. +> +> Their RAID cards are either Adaptec or LSI, but people who use the +> "real" branded versions of those cards always seem to get better +> performance. Way better. +> +> I'm considering FreeBSD systems and a custom built configuration right +> now. Very hard decision to make. +> +> For desktops and web/office servers, I still like the Dells. Just not +> for the DB servers anymore. + +Way off topic, but Dell regularly advertises included hardware that is +"almost" the same as the name brand hardware if purchased individually. + +My brother bought a Dell and needed to upgrade his video driver and the +Dell tech said he has to use Dell's drivers rather than the +manufacturers driver because the video card isn't identical to the +manufacturers. Of course the manufacturer had an updated driver that +fixed the problem while Dell had only the broken one. He upgraded the +driver anyway and it worked. + +Do you want to purchase hardware from a vendor that tries to shave every +dollar off the hardware cost, even if compatibility or performance +suffers? I don't. + +-- + 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 Dec 13 18:26:42 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 397B73A62FE + for ; + Mon, 13 Dec 2004 18:26:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19677-09 + for ; + Mon, 13 Dec 2004 18:26:24 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 691B53A63DC + for ; + Mon, 13 Dec 2004 18:26:24 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6781599; Mon, 13 Dec 2004 10:27:59 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: pg_restore taking 4 hours! +Date: Mon, 13 Dec 2004 10:25:54 -0800 +User-Agent: KMail/1.6.2 +Cc: Vivek Khera +References: <41ADA82A.7070405@carvalhaes.net> + +In-Reply-To: +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Message-Id: <200412131025.54587.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/165 +X-Sequence-Number: 9540 + +Vivek, + +> The biggest improvement in speed to restore time I have discovered is +> to increase the checkpoint segments. =A0I bump mine to about 50. =A0And +> moving the pg_xlog to a separate physical disk helps a lot there, too. + +Don't leave it at 50; if you have the space on your log array, bump it up t= +o=20 +256. + +=2D-=20 +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-novice-owner@postgresql.org Mon Dec 13 18:31:29 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AD68A3A63A5 + for ; + Mon, 13 Dec 2004 18:31:26 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21278-08 + for ; + Mon, 13 Dec 2004 18:31:17 +0000 (GMT) +Received: from web51310.mail.yahoo.com (web51310.mail.yahoo.com + [206.190.38.176]) + by svr1.postgresql.org (Postfix) with SMTP id 597D93A6377 + for ; Mon, 13 Dec 2004 18:31:17 +0000 (GMT) +Received: (qmail 58581 invoked by uid 60001); 13 Dec 2004 18:31:14 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=EhVckTIXplKW1b6RspqQ9fscUuDveTQVGQzsqp02sH/c3wN4am2HJpKPhZFEm4ETrtPa/Sn0NSRP0dZSrjM6gyx3Q6i4V1ut3/v7s62usQO3ypZ3lPfuUJB0/RoPfseqrqi8tFN1YZo45kXVDidMAEoMBchqZGZiz1TSflg/YX4= + ; +Message-ID: <20041213183113.58578.qmail@web51310.mail.yahoo.com> +Received: from [65.218.182.242] by web51310.mail.yahoo.com via HTTP; + Mon, 13 Dec 2004 10:31:13 PST +Date: Mon, 13 Dec 2004 10:31:13 -0800 (PST) +From: sarlav kumar +Subject: Re: INSERT question +To: pgsql-novice@postgresql.org +In-Reply-To: <25641.1102956494@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-740725963-1102962673=:56488" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.586 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/85 +X-Sequence-Number: 11662 + +--0-740725963-1102962673=:56488 +Content-Type: text/plain; charset=us-ascii + +Thanks!! that worked!:) + +Tom Lane wrote:sarlav kumar writes: +> Is there a way to write the INSERT as follows? + +> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); + +> I tried this, but I get the following problem: +> ERROR: More than one tuple returned by a subselect used as an expression. + +INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) +SELECT 1203, code, 'true', 1 FROM country +WHERE send IS NOT NULL OR receive IS NOT NULL; + +regards, tom lane + + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com +--0-740725963-1102962673=:56488 +Content-Type: text/html; charset=us-ascii + +
Thanks!! that worked!:)

Tom Lane <tgl@sss.pgh.pa.us> wrote: +
sarlav kumar writes:
> Is there a way to write the INSERT as follows?

> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203,
> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1);

> I tried this, but I get the following problem:
> ERROR: More than one tuple returned by a subselect used as an expression.

INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id)
SELECT 1203, code, 'true', 1 FROM country
WHERE send IS NOT NULL OR receive IS NOT NULL;

regards, tom lane

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com +--0-740725963-1102962673=:56488-- + +From pgsql-performance-owner@postgresql.org Mon Dec 13 18:32:23 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E9ABA3A6377 + for ; + Mon, 13 Dec 2004 18:32:17 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21567-07 + for ; + Mon, 13 Dec 2004 18:32:10 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 36CEF3A6437 + for ; + Mon, 13 Dec 2004 18:32:10 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6781624; Mon, 13 Dec 2004 10:33:45 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Hardware purchase question +Date: Mon, 13 Dec 2004 10:31:40 -0800 +User-Agent: KMail/1.6.2 +Cc: Vivek Khera +References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> + +In-Reply-To: +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412131031.40303.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/166 +X-Sequence-Number: 9541 + +Vivek, + +> Dual Xeon 64bit with built-in 6-disk RAID10 or RAID5 (LSI RAID card) +> Dual Opteron 64bit with built-in 6-disk RAID10 or RAID5 (LSI RAID card) +> Dual Opteron 64bit with external RAID via fibre channel (eg, nstor) + +Opteron over Xeon, no question. Not only are the Opterons +real-world-faster, they are less severely affected by the CS bug. + +> I'm sure any of these will whip the bottom off the Dell 2650, but +> which will be the fastest overall? No way to know without spending +> lots of money to test. :-( + +The SAN is going to be faster with a good SAN. That being said, I understand +that "a good SAN" is something like a $30,000 NetApp; the less expensive +SANs/NASes don't seem to be more than an external drive enclosure with a raid +chip (e.g. Apple XRaid). But we saw even a less expensive/slower EMC +machine improve performance just moving the pg_xlog off of the local PERC +RAID 5 and onto the SAN. So this is probably a good way to go if you can +afford it. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Dec 13 18:33:29 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5653E3A6476 + for ; + Mon, 13 Dec 2004 18:33:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 21496-09 + for ; + Mon, 13 Dec 2004 18:33:15 +0000 (GMT) +Received: from web51307.mail.yahoo.com (web51307.mail.yahoo.com + [206.190.38.173]) + by svr1.postgresql.org (Postfix) with SMTP id 4597B3A638C + for ; + Mon, 13 Dec 2004 18:33:13 +0000 (GMT) +Received: (qmail 68584 invoked by uid 60001); 13 Dec 2004 18:33:08 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=hGA03m5zO0KRjqvUgGEuWhoUqsUVMc1QfTBYhkK7rhscgx1CLK5N225LkvyG4t7Ttz9/ap3Kh/8SwD0+EczczY0t5cOskknsh3jSz5TsNAyoCKenf5n2XD1cJHSB5KNhRdoKuQKZCVDtz3S5Q+iZiB31KMBekrqqbmxhA1QEL+s= + ; +Message-ID: <20041213183308.68580.qmail@web51307.mail.yahoo.com> +Received: from [65.218.182.242] by web51307.mail.yahoo.com via HTTP; + Mon, 13 Dec 2004 10:33:08 PST +Date: Mon, 13 Dec 2004 10:33:08 -0800 (PST) +From: sarlav kumar +Subject: Re: INSERT question +To: pgsqlperform +In-Reply-To: <20041213164952.GC546@wolff.to> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1073146567-1102962788=:67060" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.613 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/167 +X-Sequence-Number: 9542 + +--0-1073146567-1102962788=:67060 +Content-Type: text/plain; charset=us-ascii + +Thanks guys!! that worked!:) + +Michael Adler wrote: +On Mon, Dec 13, 2004 at 08:28:39AM -0800, sarlav kumar wrote: +> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); +> +> I tried this, but I get the following problem: +> ERROR: More than one tuple returned by a subselect used as an expression. + +INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) +SELECT 1203, code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL; + +-Mike Adler + +Bruno Wolff III wrote: +On Mon, Dec 13, 2004 at 08:28:39 -0800, +sarlav kumar wrote: +> +> Is there a way to write the INSERT as follows? +> +> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); +> + +You have to use a SELECT instead of the VAlues clause. Something like the +following should work: +INSERT INTO merchant_buyer_country (merchant_id, country, enabled, group_id) +SELECT 1203, code, TRUE, 1 FROM country +WHERE send IS NOT NULL OR receive IS NOT NULL +; + +---------------------------(end of broadcast)--------------------------- +TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org + + +--------------------------------- +Do you Yahoo!? + All your favorites on one personal page � Try My Yahoo! +--0-1073146567-1102962788=:67060 +Content-Type: text/html; charset=us-ascii + +

Thanks guys!! that worked!:)
+

Michael Adler <adler@pobox.com> wrote:
+
+
On Mon, Dec 13, 2004 at 08:28:39AM -0800, sarlav kumar wrote:
> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203,
> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1);
>
> I tried this, but I get the following problem:
> ERROR: More than one tuple returned by a subselect used as an expression.

INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id)
SELECT 1203, code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL;

-Mike Adler

Bruno Wolff III <bruno@wolff.to> wrote:
+
On Mon, Dec 13, 2004 at 08:28:39 -0800,
sarlav kumar wrote:
>
> Is there a way to write the INSERT as follows?
>
> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203,
> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1);
>

You have to use a SELECT instead of the VAlues clause. Something like the
following should work:
INSERT INTO merchant_buyer_country (merchant_id, country, enabled, group_id)
SELECT 1203, code, TRUE, 1 FROM country
WHERE send IS NOT NULL OR receive IS NOT NULL
;

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

+


Do you Yahoo!?
+All your favorites on one personal page � Try My Yahoo! +--0-1073146567-1102962788=:67060-- + +From pgsql-performance-owner@postgresql.org Mon Dec 13 18:44:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A77633A6564 + for ; + Mon, 13 Dec 2004 18:44:03 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26042-02 + for ; + Mon, 13 Dec 2004 18:43:58 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 7FC403A6490 + for ; + Mon, 13 Dec 2004 18:43:58 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6781685; Mon, 13 Dec 2004 10:45:32 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: pg_restore taking 4 hours! +Date: Mon, 13 Dec 2004 10:43:28 -0800 +User-Agent: KMail/1.6.2 +Cc: Vivek Khera +References: <41ADA82A.7070405@carvalhaes.net> + <200412131025.54587.josh@agliodbs.com> + <83210A57-4D35-11D9-9C22-000A9578CFCC@kcilink.com> +In-Reply-To: <83210A57-4D35-11D9-9C22-000A9578CFCC@kcilink.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412131043.28465.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/168 +X-Sequence-Number: 9543 + +Vivek, + +> Do I need a correspondingly large checkpoint timeout then? Or does +> that matter much? + +Yes, you do. + +> And does this advice apply if the pg_xlog is on the same RAID partition +> (mine currently is not, but perhaps will be in the future) + +Not as much, but it's still a good idea to serialize the load. With too few +segments, you get a pattern like: + +Fill up segments +Write to database +Recycle segments +Fill up segments +Write to database +Recycle segments +etc. + +Compared to doing it in one long run of a single cycle, considerble efficiency +is lost. With a proper 2-array setup, the segments become like a write +buffer for the database, and you want that buffer as large as you can afford +in order to prevent buffer cycling from interrupting database writes. + +BTW, for members of the studio audience, checkpoint_segments of 256 is about +8GB. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Mon Dec 13 19:21:23 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 52FAA3A4BB6 + for ; + Mon, 13 Dec 2004 19:21:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 37373-07 + for ; + Mon, 13 Dec 2004 19:21:09 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E304D3A637D + for ; + Mon, 13 Dec 2004 19:21:09 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBDJL4HK027281; + Mon, 13 Dec 2004 14:21:04 -0500 (EST) +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, Vivek Khera +Subject: Re: pg_restore taking 4 hours! +In-reply-to: <200412131043.28465.josh@agliodbs.com> +References: <41ADA82A.7070405@carvalhaes.net> + <200412131025.54587.josh@agliodbs.com> + <83210A57-4D35-11D9-9C22-000A9578CFCC@kcilink.com> + <200412131043.28465.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Mon, 13 Dec 2004 10:43:28 -0800" +Date: Mon, 13 Dec 2004 14:21:04 -0500 +Message-ID: <27280.1102965664@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/169 +X-Sequence-Number: 9544 + +Josh Berkus writes: +> Not as much, but it's still a good idea to serialize the load. With too few +> segments, you get a pattern like: + +> Fill up segments +> Write to database +> Recycle segments +> Fill up segments +> Write to database +> Recycle segments +> etc. + +Actually I think the problem is specifically that you get checkpoints +too often if either checkpoint_timeout or checkpoint_segments is too +small. A checkpoint is expensive both directly (the I/O it causes) +and indirectly (because the first update of a particular data page +after a checkpoint causes the whole page to be logged in WAL). So +keeping them spread well apart is a Good Thing, as long as you +understand that a wider checkpoint spacing implies a longer time to +recover if you do suffer a crash. + +I think 8.0's bgwriter will considerably reduce the direct cost of +a checkpoint (since not so many pages will be dirty when the checkpoint +happens) but it won't do a thing for the indirect cost. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Dec 13 19:32:19 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 573633A65AB + for ; + Mon, 13 Dec 2004 19:32:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42778-01 + for ; + Mon, 13 Dec 2004 19:32:07 +0000 (GMT) +Received: from mail.atua.com.br (unknown [200.248.138.61]) + by svr1.postgresql.org (Postfix) with ESMTP id DDA883A646D + for ; + Mon, 13 Dec 2004 19:32:04 +0000 (GMT) +Received: from [10.0.0.171] (ns2.atua.com.br [200.248.138.60]) + by mail.atua.com.br (Postfix) with ESMTP id 5D3EF1EC29E + for ; + Mon, 13 Dec 2004 17:32:02 -0200 (BRST) +Subject: Re: Similar tables, different indexes performance +From: Alvaro Nunes Melo +To: Pgsql-Performance +In-Reply-To: <20041213180303.GA8830@wolff.to> +References: <1102958269.5855.29.camel@localhost> + <20041213180303.GA8830@wolff.to> +Content-Type: text/plain; charset=ISO-8859-1 +Message-Id: <1102966322.6870.4.camel@localhost> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 +Date: Mon, 13 Dec 2004 17:32:02 -0200 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/170 +X-Sequence-Number: 9545 + +Em Seg, 2004-12-13 �s 16:03, Bruno Wolff III escreveu: +> On Mon, Dec 13, 2004 at 15:17:49 -0200, +> Alvaro Nunes Melo wrote: +> > db=> SELECT COUNT(*) FROM titulo WHERE cd_pessoa = 1; +> > count +> > ------- +> > 220 +> > (1 record) +> > +> > Time: 48,762 ms +> > db=> SELECT COUNT(*) FROM movimento WHERE cd_pessoa = 1; +> > count +> > ------- +> > 221 +> > (1 record) +> > +> > Time: 1158,463 ms +> +> I suspect you have a lot of dead tuples in those tables. +> Have you vacuumed them recently? +> Was there enough FSM space when you did so? +> +> You might try doing VACUUM FULL on each table now and see if that +> fixes the problem. +The table had not too many tuples delete, but I runned a VACUUM FULL +VERBOSE ANALYZE and the query's cost and execution time are stil the +same. The output was: +INFO: vacuuming "public.movimento" +INFO: "movimento": found 13 removable, 347355 nonremovable row versions +in 3251 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 68 to 74 bytes long. +There were 0 unused item pointers. +Total free space (including removable row versions) is 131440 bytes. +0 pages are or will become empty, including 0 at the end of the table. +90 pages containing 14824 free bytes are potential move destinations. +CPU 0.06s/0.03u sec elapsed 0.81 sec. +INFO: index "idx_movimento_cd_pessoa" now contains 347355 row versions +in 764 pages +DETAIL: 13 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.01s/0.02u sec elapsed 0.18 sec. +INFO: index "pk_movimento" now contains 347355 row versions in 764 +pages +DETAIL: 13 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.02s/0.02u sec elapsed 0.39 sec. +INFO: index "idx_movimento_cd_pessoa_id_tipo" now contains 347355 row +versions in 956 pages +DETAIL: 0 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.02s/0.03u sec elapsed 0.27 sec. +INFO: "movimento": moved 9 row versions, truncated 3251 to 3250 pages +DETAIL: CPU 0.00s/0.00u sec elapsed 0.37 sec. +INFO: index "idx_movimento_cd_pessoa" now contains 347355 row versions +in 764 pages +DETAIL: 9 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.02s/0.02u sec elapsed 0.08 sec. +INFO: index "pk_movimento" now contains 347355 row versions in 764 +pages +DETAIL: 9 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.02s/0.02u sec elapsed 0.04 sec. +INFO: index "idx_movimento_cd_pessoa_id_tipo" now contains 347355 row +versions in 956 pages +DETAIL: 9 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.02s/0.02u sec elapsed 0.07 sec. +INFO: vacuuming "pg_toast.pg_toast_31462037" +INFO: "pg_toast_31462037": found 0 removable, 0 nonremovable row +versions in 0 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 0 to 0 bytes long. +There were 0 unused item pointers. +Total free space (including removable row versions) is 0 bytes. +0 pages are or will become empty, including 0 at the end of the table. +0 pages containing 0 free bytes are potential move destinations. +CPU 0.00s/0.00u sec elapsed 0.00 sec. +INFO: index "pg_toast_31462037_index" now contains 0 row versions in 1 +pages +DETAIL: 0 index pages have been deleted, 0 are currently reusable. +CPU 0.00s/0.00u sec elapsed 0.01 sec. +INFO: analyzing "public.movimento" +INFO: "movimento": 3250 pages, 3000 rows sampled, 347170 estimated +total rows + + +-- ++---------------------------------------------------+ +| Alvaro Nunes Melo Atua Sistemas de Informacao | +| al_nunes@atua.com.br www.atua.com.br | +| UIN - 42722678 (54) 327-1044 | ++---------------------------------------------------+ + + +From pgsql-performance-owner@postgresql.org Mon Dec 13 22:08:31 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 587C53A62C8 + for ; + Mon, 13 Dec 2004 22:08:30 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 00707-04 + for ; + Mon, 13 Dec 2004 22:08:18 +0000 (GMT) +Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) + by svr1.postgresql.org (Postfix) with ESMTP id D3CE23A6655 + for ; + Mon, 13 Dec 2004 22:08:18 +0000 (GMT) +Received: from mail-gw-cl-b.dmv.com (mail-gw-cl-b.dmv.com [216.240.97.39]) + by smtp-gw-cl-d.dmv.com (8.12.10/8.12.10) with ESMTP id iBDMFUWa080491; + Mon, 13 Dec 2004 17:15:31 -0500 (EST) (envelope-from sven@dmv.com) +Received: from [64.45.134.154] (dogpound.dyndns.org [64.45.134.154]) + by mail-gw-cl-b.dmv.com (8.12.9/8.12.9) with ESMTP id iBDM87eE055424; + Mon, 13 Dec 2004 17:08:08 -0500 (EST) (envelope-from sven@dmv.com) +Message-ID: <41BE1270.7060908@dmv.com> +Date: Mon, 13 Dec 2004 17:06:40 -0500 +From: Sven Willenberger +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: andrew@catalyst.net.nz +Subject: Re: Using LIMIT changes index used by planner +References: <41BD3317.9090507@dmv.com> + <1102931789.11712.9.camel@lamb.mcmillan.net.nz> +In-Reply-To: <1102931789.11712.9.camel@lamb.mcmillan.net.nz> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.48 on 216.240.97.42 +X-Scanned-By: MIMEDefang 2.48 on 216.240.97.39 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/171 +X-Sequence-Number: 9546 + + + +Andrew McMillan wrote: +> On Mon, 2004-12-13 at 01:13 -0500, Sven Willenberger wrote: +> +>>I have a question regarding a serious performance hit taken when using a +>>LIMIT clause. I am using version 7.4.6 on FreeBSD 4.10-STABLE with 2GB +>>of memory. The table in question contains some 25 million rows with a +>>bigserial primary key, orderdate index and a referrer index. The 2 +>>select statements are as follow: +> +> +> It's an interesting question, but to be able to get answers from this +> list you will need to provide "EXPLAIN ANALYZE ..." rather than just +> "EXPLAIN ...". +> + +A) Query without limit clause: +explain analyze select storelocation,order_number from custacct where +referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +12:00:00' order by custacctid; + + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=1226485.32..1226538.78 rows=21382 width=43) (actual +time=30340.322..30426.274 rows=21432 loops=1) + Sort Key: custacctid + -> Index Scan using orderdate_idx on custacct +(cost=0.00..1224947.52 rows=21382 width=43) (actual +time=159.218..30196.686 rows=21432 loops=1) + Index Cond: ((orderdate >= '2004-12-07 00:00:00'::timestamp +without time zone) AND (orderdate <= '2004-12-07 12:00:00'::timestamp +without time zone)) + Filter: (referrer = 1365) + Total runtime: 30529.151 ms +(6 rows) + +************************************ + +A2) Same query run again, to see effect of caching: +explain analyze select storelocation,order_number from custacct where +referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +12:00:00' order by custacctid; + + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=1226485.32..1226538.78 rows=21382 width=43) (actual +time=1402.410..1488.395 rows=21432 loops=1) + Sort Key: custacctid + -> Index Scan using orderdate_idx on custacct +(cost=0.00..1224947.52 rows=21382 width=43) (actual time=0.736..1259.964 +rows=21432 loops=1) + Index Cond: ((orderdate >= '2004-12-07 00:00:00'::timestamp +without time zone) AND (orderdate <= '2004-12-07 12:00:00'::timestamp +without time zone)) + Filter: (referrer = 1365) + Total runtime: 1590.675 ms +(6 rows) + +*********************************** + +B) Query run with LIMIT + +explain analyze select storelocation,order_number from custacct where +referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +12:00:00' order by custacctid limit 10; + + QUERY PLAN + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=0.00..43065.76 rows=10 width=43) (actual +time=1306957.216..1307072.111 rows=10 loops=1) + -> Index Scan using custacct2_pkey on custacct +(cost=0.00..92083209.38 rows=21382 width=43) (actual +time=1306957.205..1307072.017 rows=10 loops=1) + Filter: ((referrer = 1365) AND (orderdate >= '2004-12-07 +00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-07 +12:00:00'::timestamp without time zone)) + Total runtime: 1307072.231 ms +(4 rows) + +************************************ + +C) Query using the subselect variation + +explain analyze select foo.storelocation, foo.order_number from (select +storelocation,order_number from custacct where referrer = 1365 and +orderdate between '2004-12-07' and '2004-12-07 12:00:00' order by +custacctid) as foo limit 10; + + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=1226485.32..1226485.45 rows=10 width=100) (actual +time=1413.829..1414.024 rows=10 loops=1) + -> Subquery Scan foo (cost=1226485.32..1226752.60 rows=21382 +width=100) (actual time=1413.818..1413.933 rows=10 loops=1) + -> Sort (cost=1226485.32..1226538.78 rows=21382 width=43) +(actual time=1413.798..1413.834 rows=10 loops=1) + Sort Key: custacctid + -> Index Scan using orderdate_idx on custacct +(cost=0.00..1224947.52 rows=21382 width=43) (actual time=0.740..1272.380 +rows=21432 loops=1) + Index Cond: ((orderdate >= '2004-12-07 +00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-07 +12:00:00'::timestamp without time zone)) + Filter: (referrer = 1365) + Total runtime: 1418.964 ms +(8 rows) + + +Thanks, +Sven + +From pgsql-performance-owner@postgresql.org Mon Dec 13 22:44:35 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A19F73A4BB6 + for ; + Mon, 13 Dec 2004 22:44:31 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09317-10 + for ; + Mon, 13 Dec 2004 22:44:25 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 86E6B3A622E + for ; + Mon, 13 Dec 2004 22:44:26 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBDMh777028821; + Mon, 13 Dec 2004 17:43:07 -0500 (EST) +To: Sven Willenberger +Cc: pgsql-performance@postgresql.org, andrew@catalyst.net.nz +Subject: Re: Using LIMIT changes index used by planner +In-reply-to: <41BE1270.7060908@dmv.com> +References: <41BD3317.9090507@dmv.com> + <1102931789.11712.9.camel@lamb.mcmillan.net.nz> + <41BE1270.7060908@dmv.com> +Comments: In-reply-to Sven Willenberger + message dated "Mon, 13 Dec 2004 17:06:40 -0500" +Date: Mon, 13 Dec 2004 17:43:07 -0500 +Message-ID: <28820.1102977787@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/172 +X-Sequence-Number: 9547 + +Sven Willenberger writes: +> explain analyze select storelocation,order_number from custacct where +> referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +> 12:00:00' order by custacctid limit 10; + +> QUERY PLAN + +> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +> Limit (cost=0.00..43065.76 rows=10 width=43) (actual +> time=1306957.216..1307072.111 rows=10 loops=1) +> -> Index Scan using custacct2_pkey on custacct +> (cost=0.00..92083209.38 rows=21382 width=43) (actual +> time=1306957.205..1307072.017 rows=10 loops=1) +> Filter: ((referrer = 1365) AND (orderdate >= '2004-12-07 +> 00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-07 +> 12:00:00'::timestamp without time zone)) +> Total runtime: 1307072.231 ms +> (4 rows) + +I think this is the well-known issue of lack of cross-column correlation +statistics. The planner is well aware that this indexscan will be +horridly expensive if run to completion --- but it's assuming that +stopping after 10 rows, or 10/21382 of the total scan, will cost only +about 10/21382 as much as the whole scan would. This amounts to +assuming that the rows matching the filter condition are randomly +distributed among all the rows taken in custacctid order. I suspect +that your test case actually has a great deal of correlation between +custacctid and referrer/orderdate, such that the indexscan in custacctid +order ends up fetching many more rows that fail the filter condition +than random chance would suggest, before it finally comes across 10 that +pass the filter. + +There isn't any near-term fix in the wind for this, since storing +cross-column statistics is an expensive proposition that we haven't +decided how to handle. Your workaround with separating the ORDER BY +from the LIMIT is a good one. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Dec 14 01:46:14 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A658D3A68DD + for ; + Tue, 14 Dec 2004 01:45:45 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56715-07 + for ; + Tue, 14 Dec 2004 01:45:29 +0000 (GMT) +Received: from ew.mimos.my (unknown [192.228.129.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 0015A3A4309 + for ; + Tue, 14 Dec 2004 01:45:30 +0000 (GMT) +Received: from mimos.my (mcg189.nat.mimos.my [10.1.18.189]) + by ew.mimos.my (8.12.9p2/8.12.9) with ESMTP id iBE1it90042273 + for ; + Tue, 14 Dec 2004 09:44:55 +0800 (MYT) + (envelope-from hasnulfadhly.h@mimos.my) +Message-ID: <41BE4598.2040708@mimos.my> +Date: Tue, 14 Dec 2004 09:44:56 +0800 +From: Hasnul Fadhly bin Hasan +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: pgsql-performance@postgresql.org +Subject: Trying to create multi db query in one large queries +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.073 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/173 +X-Sequence-Number: 9548 + +Hi, + +I am not sure if this is the place to ask this question, but since the +question is trying to improve the performance.. i guess i am not that +far off. + +My question is if there is a query design that would query multiple +server simultaneously.. would that improve the performance? + +To make it clear.. let's say we have 3 db servers. 1 server is just +designed to take the queries while the other 2 server is the ones that +actually +holds the data. let's say we have a query of 'select * from +customer_data' and we change it to +select * from +( +dblink('db1','select * from customer_data where timestamp between +timestamp \'01-01-2004\' and timestamp \'06-30-2004\'') +union +dblink('db2','select * from customer_data where timestamp between +timestamp \'01-07-2004\' and timestamp \'12-31-2004\'') +) + +Would the subquery above be done simultaneously by postgres before doing +the end query? or would it just execute one at a time? + +If it does execute simultaneously.. it's possible to create code to +convert normal queries to distributed queries and requesting data from +multiple +database to improve performance. This would be advantageous for large +amount of data. + +Thanks, + +Hasnul + + + +From pgsql-performance-owner@postgresql.org Tue Dec 14 01:53:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 65B783A6666 + for ; + Tue, 14 Dec 2004 01:53:13 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57843-08 + for ; + Tue, 14 Dec 2004 01:52:59 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id BEC333A693F + for ; + Tue, 14 Dec 2004 01:53:00 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBE1qrZ23707; + Tue, 14 Dec 2004 10:52:53 +0900 +Message-ID: <00ee01c4e17f$d54f59a0$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: +Cc: +References: <41ADA82A.7070405@carvalhaes.net> + <200412131025.54587.josh@agliodbs.com> + <83210A57-4D35-11D9-9C22-000A9578CFCC@kcilink.com> + <200412131043.28465.josh@agliodbs.com> + <27280.1102965664@sss.pgh.pa.us> +Subject: Re: pg_restore taking 4 hours! +Date: Tue, 14 Dec 2004 10:54:17 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="iso-2022-jp"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/174 +X-Sequence-Number: 9549 + +Hi, + +Sorry, I didn't catch the original message, so I'm not sure if the original +poster mentioned the postgres version that he's using. + +I just thought that I'd contribute this observation. + +I have a DB that takes several hours to restore under 7,1 but completes in +around 10 minutes on 7.4. The main reason for this is that by default the +7.4 restore delays creation of PKs and indexes until after the data load, +whereas 7.1 doesn't. + +I noticed that 7.1 has a re-arrange option that reportedly delays the pks +and indexes, so presumably this would have alleviated the problem. + +I also noticed that a dumpfile created under 7.1 took hours to restore using +7.4 to load it as the order remained in the default of 7.1. + +I don'tknow when the default behaviour changed, but I get the feeling it may +have been with 7.4. + +HTH +Iain + + +From pgsql-performance-owner@postgresql.org Tue Dec 14 06:19:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 940303A69C5 + for ; + Tue, 14 Dec 2004 06:19:46 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 15119-06 + for ; + Tue, 14 Dec 2004 06:19:30 +0000 (GMT) +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by svr1.postgresql.org (Postfix) with ESMTP id 7214A3A6981 + for ; + Tue, 14 Dec 2004 06:19:24 +0000 (GMT) +Received: from COLSWEEPER.cranel.com (newmail.cranel.com [66.192.200.227]) + by svr4.postgresql.org (Postfix) with ESMTP id 77CCE5AF7BB + for ; + Tue, 14 Dec 2004 04:09:13 +0000 (GMT) +Received: from colmail01.cranel.local (colmail01.cranel.local) by + COLSWEEPER.cranel.com + (Content Technologies SMTPRS 4.3.14) with ESMTP id + ; + Mon, 13 Dec 2004 23:09:10 -0500 +Received: by colmail01.cranel.local with Internet Mail Service (5.5.2657.72) + id ; Mon, 13 Dec 2004 23:07:27 -0500 +Message-ID: <387C22290D3FD71195D300508BF7DB5238AFB6@colmail01.cranel.local> +From: "Spiegelberg, Greg" +To: 'Hasnul Fadhly bin Hasan ' , + "'pgsql-performance@postgresql.org '" +Subject: Re: Trying to create multi db query in one large querie +Date: Mon, 13 Dec 2004 23:07:27 -0500 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: text/plain; + charset="iso-8859-1" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/176 +X-Sequence-Number: 9551 + +Hello, + +My experience with dblink() is that each dblink() is executed serially, in +part I would guess, due to the plan for the query. To have each query run +in parallel you would need to execute both dblink()'s simultaneously saving +each result into a table. I'm not sure if the same table could be +specified. Would depend on the constaint's I suppose. + +#!/bin/sh +# Query 1 +psql -d mydb -c "select * into mytable from dblink('db1','select * from +customer_data where timestamp between timestamp \'01-01-2004\' and timestamp +\'06-30-2004\'') as t1(c1 int, c2 text, ...);" & PID1=$! +# Query 2 +psql -d mydb -c "select * into mytable from dblink('db2','select * from +customer_data where timestamp between timestamp \'01-07-2004\' and timestamp +\'12-31-2004\'') as t2(c1 int, c2 text, ...);" & PID2=$! +# wait +wait $PID1 +wait $PID2 +# Do more on mydb.mytable +... + +Something like that so no guaranties. I do remember testing with this a +while back and it is useful for JOIN's. + +Greg + + +-----Original Message----- +From: Hasnul Fadhly bin Hasan +To: pgsql-performance@postgresql.org +Sent: 12/13/04 8:44 PM +Subject: [PERFORM] Trying to create multi db query in one large queries + +Hi, + +I am not sure if this is the place to ask this question, but since the +question is trying to improve the performance.. i guess i am not that +far off. + +My question is if there is a query design that would query multiple +server simultaneously.. would that improve the performance? + +To make it clear.. let's say we have 3 db servers. 1 server is just +designed to take the queries while the other 2 server is the ones that +actually +holds the data. let's say we have a query of 'select * from +customer_data' and we change it to +select * from +( +dblink('db1','select * from customer_data where timestamp between +timestamp \'01-01-2004\' and timestamp \'06-30-2004\'') +union +dblink('db2','select * from customer_data where timestamp between +timestamp \'01-07-2004\' and timestamp \'12-31-2004\'') +) + +Would the subquery above be done simultaneously by postgres before doing + +the end query? or would it just execute one at a time? + +If it does execute simultaneously.. it's possible to create code to +convert normal queries to distributed queries and requesting data from +multiple +database to improve performance. This would be advantageous for large +amount of data. + +Thanks, + +Hasnul + + + +---------------------------(end of broadcast)--------------------------- +TIP 4: Don't 'kill -9' the postmaster + +From pgsql-performance-owner@postgresql.org Tue Dec 14 05:12:30 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 073B73A6963 + for ; + Tue, 14 Dec 2004 05:11:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94443-03 + for ; + Tue, 14 Dec 2004 05:11:33 +0000 (GMT) +Received: from www.postgresql.com (unknown [200.46.204.209]) + by svr1.postgresql.org (Postfix) with ESMTP id 323303A6A1A + for ; + Tue, 14 Dec 2004 05:11:30 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by www.postgresql.com (Postfix) with SMTP id 49278738716 + for ; + Tue, 14 Dec 2004 05:11:25 +0000 (GMT) +Received: (qmail 8272 invoked by uid 500); 14 Dec 2004 05:22:50 -0000 +Date: Mon, 13 Dec 2004 23:22:50 -0600 +From: Bruno Wolff III +To: Alvaro Nunes Melo +Cc: Pgsql-Performance +Subject: Re: Similar tables, different indexes performance +Message-ID: <20041214052250.GA8082@wolff.to> +Mail-Followup-To: Alvaro Nunes Melo , + Pgsql-Performance +References: <1102958269.5855.29.camel@localhost> + <20041213180303.GA8830@wolff.to> + <1102966322.6870.4.camel@localhost> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <1102966322.6870.4.camel@localhost> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/175 +X-Sequence-Number: 9550 + +On Mon, Dec 13, 2004 at 17:32:02 -0200, + Alvaro Nunes Melo wrote: +> Em Seg, 2004-12-13 �s 16:03, Bruno Wolff III escreveu: +> > On Mon, Dec 13, 2004 at 15:17:49 -0200, +> > Alvaro Nunes Melo wrote: +> > > db=> SELECT COUNT(*) FROM titulo WHERE cd_pessoa = 1; +> > > count +> > > ------- +> > > 220 +> > > (1 record) +> > > +> > > Time: 48,762 ms +> > > db=> SELECT COUNT(*) FROM movimento WHERE cd_pessoa = 1; +> > > count +> > > ------- +> > > 221 +> > > (1 record) +> > > +> > > Time: 1158,463 ms +> > +> > I suspect you have a lot of dead tuples in those tables. +> > Have you vacuumed them recently? +> > Was there enough FSM space when you did so? +> > +> > You might try doing VACUUM FULL on each table now and see if that +> > fixes the problem. +> The table had not too many tuples delete, but I runned a VACUUM FULL +> VERBOSE ANALYZE and the query's cost and execution time are stil the +> same. The output was: +> INFO: vacuuming "public.movimento" +> INFO: "movimento": found 13 removable, 347355 nonremovable row versions +> in 3251 pages + +If the table really has 300K rows, then something else is wrong. One likely +candidate is if cd_pessoa is int8 there is a quirk in postgres (which is +fixed in 8.0) where comparing that column to an int4 constant won't use +an index scan. This can be worked around by either casting the constant +(e.g. 1::int8) or quoting it (e.g. '1') to delay fixing the type so that +it will be taken to be an int8 constant. + +From pgsql-performance-owner@postgresql.org Tue Dec 14 06:59:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F06A3A699B + for ; + Tue, 14 Dec 2004 06:59:40 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 56007-05 + for ; + Tue, 14 Dec 2004 06:59:32 +0000 (GMT) +Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net + [24.249.201.67]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B3D93A6987 + for ; + Tue, 14 Dec 2004 06:59:36 +0000 (GMT) +Received: from [192.168.4.1] (account jconway [192.168.4.1] verified) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 2403437; Mon, 13 Dec 2004 22:48:33 -0800 +Message-ID: <41BE8F59.9040707@joeconway.com> +Date: Mon, 13 Dec 2004 22:59:37 -0800 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: "Spiegelberg, Greg" +Cc: 'Hasnul Fadhly bin Hasan ' , + "'pgsql-performance@postgresql.org '" +Subject: Re: Trying to create multi db query in one large querie +References: <387C22290D3FD71195D300508BF7DB5238AFB6@colmail01.cranel.local> +In-Reply-To: <387C22290D3FD71195D300508BF7DB5238AFB6@colmail01.cranel.local> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/177 +X-Sequence-Number: 9552 + +Spiegelberg, Greg wrote: +> +> My experience with dblink() is that each dblink() is executed serially + +Correct. + +If you really want to do multiple queries simultaneously, you would need +to write a function very similar to dblink_record, but using asynchonous +libpq calls to both remote hosts. See: + http://www.postgresql.org/docs/current/static/libpq-async.html + +HTH, + +Joe + +From pgsql-performance-owner@postgresql.org Tue Dec 14 07:19:03 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1D9AD3A692E + for ; + Tue, 14 Dec 2004 07:19:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 59430-10 + for ; + Tue, 14 Dec 2004 07:18:51 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 475B53A4E19 + for ; + Tue, 14 Dec 2004 07:18:56 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6783847 for pgsql-performance@postgresql.org; + Mon, 13 Dec 2004 23:20:32 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Trying to create multi db query in one large queries +Date: Mon, 13 Dec 2004 23:18:24 -0800 +User-Agent: KMail/1.6.2 +References: <41BE4598.2040708@mimos.my> +In-Reply-To: <41BE4598.2040708@mimos.my> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412132318.24052.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/178 +X-Sequence-Number: 9553 + +Hasnul, + +> My question is if there is a query design that would query multiple +> server simultaneously.. would that improve the performance? + +Not without a vast amounts of infrastructure coding. You're basically +talking about what Oracle has spent the last 3 years and $100 million working +on. + +Would be nice, though. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Tue Dec 14 09:34:11 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 59D7B3A601F + for ; + Tue, 14 Dec 2004 09:34:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97565-04 + for ; + Tue, 14 Dec 2004 09:33:51 +0000 (GMT) +Received: from safari.agim.co.uk (safari.agim.co.uk [212.20.234.186]) + by svr1.postgresql.org (Postfix) with SMTP id 0A60F3A654D + for ; + Tue, 14 Dec 2004 09:33:55 +0000 (GMT) +Received: (qmail 2035 invoked from network); 14 Dec 2004 09:33:56 -0000 +Received: from gorilla.edi.agim.co.uk (HELO ?192.168.0.24?) (192.168.0.24) + by safari.agim.co.uk with SMTP; 14 Dec 2004 09:33:56 -0000 +Message-ID: <41BEB383.6050300@ambergreen.co.uk> +Date: Tue, 14 Dec 2004 09:33:55 +0000 +From: Andrew Hood +User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Hardware purchase question +References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> + + <41BDD001.8070701@commandprompt.com> +In-Reply-To: <41BDD001.8070701@commandprompt.com> +X-Enigmail-Version: 0.85.0.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/179 +X-Sequence-Number: 9554 + +Joshua D. Drake wrote: +> +> An Opteron, properly tuned with PostgreSQL will always beat a Xeon +> in terms of raw cpu. +> +> RAID 10 will typically always outperform RAID 5 with the same HD config. +> +> Fibre channel in general will always beat a normal (especially an LSI) +> raid. +> +> Dell's suck for PostgreSQL. + +Does anyone have any OS recommendations/experiences for PostgreSQL on +Opteron? + +Thanks, +Andrew + +From pgsql-performance-owner@postgresql.org Tue Dec 14 17:36:54 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43D213AA081 + for ; + Tue, 14 Dec 2004 17:36:48 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76116-08 + for ; + Tue, 14 Dec 2004 17:36:41 +0000 (GMT) +Received: from tht.net (vista.tht.net [216.126.88.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A1333AA08C + for ; + Tue, 14 Dec 2004 17:36:38 +0000 (GMT) +Received: from dyn-68-143.tor.dsl.tht.net (dyn-68-143.tor.dsl.tht.net + [134.22.68.143]) by tht.net (Postfix) with ESMTP id 6277376AC1 + for ; + Tue, 14 Dec 2004 12:36:37 -0500 (EST) +Subject: Speeding up pg_dump +From: Rod Taylor +To: Postgresql Performance +Content-Type: text/plain +Date: Tue, 14 Dec 2004 12:36:46 -0500 +Message-Id: <1103045806.25186.153.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/180 +X-Sequence-Number: 9555 + +Are there any tricks to speeding up pg_dump aside from doing them from a +replicated machine? + +I'm using -Fc with no compression. + +-- + + +From pgsql-performance-owner@postgresql.org Tue Dec 14 18:20:24 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C63A83AA262 + for ; + Tue, 14 Dec 2004 18:20:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94323-03 + for ; + Tue, 14 Dec 2004 18:20:12 +0000 (GMT) +Received: from mail.logi-track.com (www.logi-track.com [213.239.193.212]) + by svr1.postgresql.org (Postfix) with ESMTP id 10EF13AA22E + for ; + Tue, 14 Dec 2004 18:20:12 +0000 (GMT) +Received: from kingfisher.intern.logi-track.com (J2f7a.j.pppool.de + [85.74.47.122]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logi-track.com (Postfix) with ESMTP id C985C301A6; + Tue, 14 Dec 2004 19:20:12 +0100 (CET) +Received: from kingfisher.intern.logi-track.com (localhost [127.0.0.1]) + by kingfisher.intern.logi-track.com (Postfix) with SMTP id 3B8ECAB0EC; + Tue, 14 Dec 2004 19:20:06 +0100 (CET) +Date: Tue, 14 Dec 2004 19:20:06 +0100 +From: Markus Schaber +To: PostgreSQL Performance List +Subject: Re: Anything to be gained from a 'Postgres Filesystem'? +Message-ID: <20041214192006.7be1a56d@kingfisher.intern.logi-track.com> +In-Reply-To: +References: + + <20041104120047.62810c8f@kingfisher.intern.logi-track.com> + +Organization: logi-track ag, =?ISO-8859-15?Q?z=FCrich?= +X-Mailer: Sylpheed-Claws 0.9.12b (GTK+ 1.2.10; i386-pc-linux-gnu) +X-Face: Nx5T&>Nj$VrVPv}sC3IL&)TqHHOKCz/|)R$i"*r@w0{*I6w; + UNU_hdl1J4NI_m{IMztq=>cmM}1gCLbAF+9\#CGkG8}Y{x%SuQ>1#t:; + Z(|\qdd[i]HStki~#w1$TPF}:0w-7"S\Ev|_a$K wrote: + +> In an attempt to throw the authorities off his trail, schabios@logi-track= +.com (Markus Schaber) transmitted: +> > We should create a list of those needs, and then communicate those +> > to the kernel/fs developers. Then we (as well as other apps) can +> > make use of those features where they are available, and use the old +> > way everywhere else. +>=20 +> Which kernel/fs developers did you have in mind? The ones working on +> Linux? Or FreeBSD? Or DragonflyBSD? Or Solaris? Or AIX? + +All of them, and others (e. G. Windows). + +Once we have a list of those needs, the advocates can talk to the OS +developers. Some OS developers will follow, others not. + +Then the postgres folks (and other application developers that benefit +from this capabilities) can point interested users to our benchmarks and +tell them that Foox performs 3 times as fast as BaarOs because they +provide better support for database needs. + +> Please keep in mind that many of the PostgreSQL developers are BSD +> folk that aren't particularly interested in creating bleeding edge +> Linux capabilities. + +Then this should be motivation to add those things to BSD, maybe as a +patch or loadable module so it does not bloat mainstream. I personally +would prefer it to appear in BSD first, because in case it really pays +of, it won't be long until it appears in Linux as well :-) + +> Jumping into a customized filesystem that neither hardware nor +> software vendors would remotely consider supporting just doesn't look +> like a viable strategy to me. + +I did not vote for a custom filesystem, as the OP did. I did vote for +isolating a set of useful capabilities PostgreSQL could exploit, and +then try to confince the kernel developers to include this capabilities, +so they are likely to be included in the main distributions. + +I don't know about the BSD market, but I know that Redhat and SuSE often +ship their patched versions of the kernels (so then they officially +support the extensions), and most of this is likely to be included in +main stream later. + +> > Maybe Reiser4 is a step into the right way, and maybe even a +> > postgres plugin for Reiser4 will be worth the effort. Maybe XFS/JFS +> > etc. already have such capabilities. Maybe that's completely wrong. +>=20 +> The capabilities tend to be redundant. They tend to implement vaguely +> similar transactional capabilities to what databases have to +> implement. The similarities are not close enough to eliminate either +> variety of "commit" as redundant. + +But a speed gain may be possible by coordinating DB and FS tansactions. + +Thanks, +Markus + +--=20 +markus schaber | dipl. informatiker +logi-track ag | rennweg 14-16 | ch 8001 z=FCrich +phone +41-43-888 62 52 | fax +41-43-888 62 53 +mailto:schabios@logi-track.com | www.logi-track.com + +From pgsql-performance-owner@postgresql.org Tue Dec 14 18:27:54 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D5293AA2AD + for ; + Tue, 14 Dec 2004 18:27:52 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 96510-10 + for ; + Tue, 14 Dec 2004 18:27:32 +0000 (GMT) +Received: from smtp-gw-cl-d.dmv.com (smtp-gw-cl-d.dmv.com [216.240.97.42]) + by svr1.postgresql.org (Postfix) with ESMTP id BA3DE3AA225 + for ; + Tue, 14 Dec 2004 18:27:31 +0000 (GMT) +Received: from lanshark.dmv.com (lanshark.dmv.com [216.240.97.46]) + by smtp-gw-cl-d.dmv.com (8.12.10/8.12.10) with ESMTP id iBEIYmWa022450; + Tue, 14 Dec 2004 13:34:48 -0500 (EST) (envelope-from sven@dmv.com) +Subject: Re: Using LIMIT changes index used by planner +From: Sven Willenberger +To: Tom Lane +Cc: pgsql-performance@postgresql.org, andrew@catalyst.net.nz +In-Reply-To: <28820.1102977787@sss.pgh.pa.us> +References: <41BD3317.9090507@dmv.com> + <1102931789.11712.9.camel@lamb.mcmillan.net.nz> + <41BE1270.7060908@dmv.com> <28820.1102977787@sss.pgh.pa.us> +Content-Type: text/plain +Date: Tue, 14 Dec 2004 13:28:52 -0500 +Message-Id: <1103048932.5534.22.camel@lanshark.dmv.com> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Scanned-By: MIMEDefang 2.48 on 216.240.97.42 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/182 +X-Sequence-Number: 9557 + +On Mon, 2004-12-13 at 17:43 -0500, Tom Lane wrote: +> Sven Willenberger writes: +> > explain analyze select storelocation,order_number from custacct where +> > referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +> > 12:00:00' order by custacctid limit 10; +> +> > QUERY PLAN +> +> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +> > Limit (cost=0.00..43065.76 rows=10 width=43) (actual +> > time=1306957.216..1307072.111 rows=10 loops=1) +> > -> Index Scan using custacct2_pkey on custacct +> > (cost=0.00..92083209.38 rows=21382 width=43) (actual +> > time=1306957.205..1307072.017 rows=10 loops=1) +> > Filter: ((referrer = 1365) AND (orderdate >= '2004-12-07 +> > 00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-07 +> > 12:00:00'::timestamp without time zone)) +> > Total runtime: 1307072.231 ms +> > (4 rows) +> +> I think this is the well-known issue of lack of cross-column correlation +> statistics. The planner is well aware that this indexscan will be +> horridly expensive if run to completion --- +> +> There isn't any near-term fix in the wind for this, since storing +> cross-column statistics is an expensive proposition that we haven't +> decided how to handle. Your workaround with separating the ORDER BY +> from the LIMIT is a good one. +> + +You are correct in that there is a high degree of correlation between +the custacctid (which is a serial key) and the orderdate as the orders +generally get entered in the order that they arrive. I will go with the +workaround subselect query plan then. + +On a related note, is there a way (other than set enable_seqscan=off) to +give a hint to the planner that it is cheaper to use and index scan +versus seq scan? Using the "workaround" query on any time period greater +than 12 hours results in the planner using a seq scan. Disabling the seq +scan and running the query on a full day period for example shows: + +explain analyze select foo.storelocaion, foo.order_number from (select +storelocation,order_number from custacct where referrer = 1365 and +ordertdate between '2004-12-09' and '2004-12-10' order by custacctid) as +foo limit 10 offset 100; + +QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=2661326.22..2661326.35 rows=10 width=100) (actual +time=28446.605..28446.796 rows=10 loops=1) + -> Subquery Scan foo (cost=2661324.97..2661866.19 rows=43297 +width=100) (actual time=28444.916..28446.298 rows=110 loops=1) + -> Sort (cost=2661324.97..2661433.22 rows=43297 width=41) +(actual time=28444.895..28445.334 rows=110 loops=1) + Sort Key: custacctid + -> Index Scan using orderdate_idx on custacct +(cost=0.00..2657990.68 rows=43297 width=41) (actual +time=4.432..28145.212 rows=44333 loops=1) + Index Cond: ((orderdate >= '2004-12-09 +00:00:00'::timestamp without time zone) AND (orderdate <= '2004-12-10 +00:00:00'::timestamp without time zone)) + Filter: (referrer = 1365) + Total runtime: 28456.893 ms +(8 rows) + + +If I interpret the above correctly, the planner guestimates a cost of +2661326 but the actual cost is much less (assuming time is equivalent to +cost). Would the set statistics command be of any benefit here in +"training" the planner? + +Sven + + + + +From pgsql-performance-owner@postgresql.org Tue Dec 14 19:35:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4BBCE3AA535 + for ; + Tue, 14 Dec 2004 19:35:42 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25590-09 + for ; + Tue, 14 Dec 2004 19:35:30 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 8969E3AA04B + for ; + Tue, 14 Dec 2004 19:35:28 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBEJZHe3016697; + Tue, 14 Dec 2004 14:35:17 -0500 (EST) +To: Sven Willenberger +Cc: pgsql-performance@postgresql.org, andrew@catalyst.net.nz +Subject: Re: Using LIMIT changes index used by planner +In-reply-to: <1103048932.5534.22.camel@lanshark.dmv.com> +References: <41BD3317.9090507@dmv.com> + <1102931789.11712.9.camel@lamb.mcmillan.net.nz> + <41BE1270.7060908@dmv.com> <28820.1102977787@sss.pgh.pa.us> + <1103048932.5534.22.camel@lanshark.dmv.com> +Comments: In-reply-to Sven Willenberger + message dated "Tue, 14 Dec 2004 13:28:52 -0500" +Date: Tue, 14 Dec 2004 14:35:17 -0500 +Message-ID: <16696.1103052917@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/183 +X-Sequence-Number: 9558 + +Sven Willenberger writes: +> On a related note, is there a way (other than set enable_seqscan=off) to +> give a hint to the planner that it is cheaper to use and index scan +> versus seq scan? + +There are basically two things you can do. One: if the planner's +rowcount estimates are badly off, you can try increasing the stats +targets for relevant columns in hopes of making the estimates better. +A too-large rowcount estimate will improperly bias the decision towards +seqscan. Two: if the rowcounts are in the right ballpark but the +estimated costs have nothing to do with reality, you can try tuning +the planner's cost parameters to make the model match local reality +a bit better. random_page_cost is the grossest knob here; +effective_cache_size is also worth looking at. See the +pgsql-performance archives for more discussion. + +> -> Index Scan using orderdate_idx on custacct +> (cost=0.00..2657990.68 rows=43297 width=41) (actual +> time=4.432..28145.212 rows=44333 loops=1) + +In this case there's already a pretty good match between actual and +estimated rowcount, so increasing the stats targets isn't likely to +improve the plan choice; especially since a more accurate estimate would +shift the costs in the "wrong" direction anyway. Look to the cost +parameters, instead. + +Standard disclaimer: don't twiddle the cost parameters on the basis +of only one test case. + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Tue Dec 14 21:34:26 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E68E83A66A4 + for ; + Tue, 14 Dec 2004 21:34:13 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68480-03 + for ; + Tue, 14 Dec 2004 21:34:07 +0000 (GMT) +Received: from web51307.mail.yahoo.com (web51307.mail.yahoo.com + [206.190.38.173]) + by svr1.postgresql.org (Postfix) with SMTP id 1BC8C3AA765 + for ; Tue, 14 Dec 2004 21:34:08 +0000 (GMT) +Received: (qmail 84235 invoked by uid 60001); 14 Dec 2004 21:34:07 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=Jyampjj8c/dj7tkQSRliJINiuHQorT2kilXSO00xFB+cEhNn392t7DGlYYfto92p5OA5RomtiMdTiOGk9s7kQsj2yA8VHX2uzL+SAR3DWfiQsUqgU/apddb4oWILgo4rwX3xYB17ZDu1bPx3JuhEYdeAWZqshMWSPJrcKARtrcM= + ; +Message-ID: <20041214213407.84233.qmail@web51307.mail.yahoo.com> +Received: from [65.218.182.242] by web51307.mail.yahoo.com via HTTP; + Tue, 14 Dec 2004 13:34:07 PST +Date: Tue, 14 Dec 2004 13:34:07 -0800 (PST) +From: sarlav kumar +Subject: Query Optimization +To: pgsqlperform , + pgsql-novice@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-162377963-1103060047=:84228" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.603 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_50_60, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/92 +X-Sequence-Number: 11669 + +--0-162377963-1103060047=:84228 +Content-Type: text/plain; charset=us-ascii + +Hi all, + +Can someone please help me optimize this query? Is there a better way to write this query? I am generating a report of transactions ordered by time and with details of the sender and receiver etc. + +SELECT distinct a.time::date ||'
'||substring(a.time::time::text,1,8) as Time, +CASE WHEN a.what = 0 THEN 'Money Transfer' WHEN a.what = 15 THEN 'Purchase' WHEN a.what = 26 THEN 'Merchant Streamline' WHEN a.what = 13 THEN 'Reversal' END as Transaction_Type , +c1.account_no as SenderAccount, c2.account_no as RecieverAccount, +b.country as SenderCountry, d.country as RecieverCountry, +b.firstname as SenderFirstName, b.lastname as SenderLastName, +d.firstname as ReceiverFirstName, d.lastname as ReceiverLastName, +a.status as status, +(select sum(td.amount * 0.01) from transaction_data td where td.data_id = a2.id and td.dir = 1 and td.uid = a.target_uid) as ReversedAmount, +(select sum(td.amount * 0.01) from transaction_data td where td.data_id = a2.id and td.dir = 0 and td.uid = a.uid ) as DepositedAmount, a.flags, (a.amount * 0.01) as Amount, +(a.fee * 0.01) as Fee +FROM data a, customerdata b, customerdata d, customer c1, customer c2, participant p, data a2 +WHERE p.id = a.partner_id AND (a.uid = c1.id) AND (a.target_uid = c2.id) and c1.id=b.uid and c2.id=d.uid +and a.confirmation is not null AND (a2.ref_id = a.id) and +((a2.what = 13) or (a2.what = 17) ) ORDER BY time desc ; + + + QUERY PLAN + +------------------------------------------------------------------------------------------------------------- + Unique (cost=2978.27..2981.54 rows=8 width=150) (actual time=502.29..506.75 rows=382 loops=1) + -> Sort (cost=2978.27..2978.46 rows=77 width=150) (actual time=502.29..502.61 rows=461 loops=1) + Sort Key: ((((a."time")::date)::text || '
'::text) || "substring"(((a."time")::time without time zone)::text, 1, 8)), CASE WHEN (a +.what = 0) THEN 'Money Transfer'::text WHEN (a.what = 15) THEN 'Purchase'::text WHEN (a.what = 26) THEN 'Merchant Streamline'::text WHEN (a.wh +at = 13) THEN 'Reversal'::text ELSE NULL::text END, c1.account_no, c2.account_no, b.country, d.country, b.firstname, b.lastname, d.firstname, +d.lastname, a.status, (subplan), (subplan), a.flags, ((a.amount)::numeric * 0.01), ((a.fee)::numeric * 0.01) + -> Hash Join (cost=2687.00..2975.86 rows=77 width=150) (actual time=423.91..493.48 rows=461 loops=1) + Hash Cond: ("outer".partner_id = "inner".id) + -> Nested Loop (cost=2494.67..2781.99 rows=77 width=146) (actual time=413.19..441.61 rows=472 loops=1) + -> Merge Join (cost=2494.67..2526.04 rows=77 width=116) (actual time=413.09..429.86 rows=472 loops=1) + Merge Cond: ("outer".id = "inner".ref_id) + -> Sort (cost=1443.39..1458.57 rows=6069 width=108) (actual time=370.14..377.72 rows=5604 loops=1) + Sort Key: a.id + -> Hash Join (cost=203.50..1062.01 rows=6069 width=108) (actual time=20.35..335.44 rows=5604 loops=1) + Hash Cond: ("outer".uid = "inner".id) + -> Merge Join (cost=0.00..676.43 rows=6069 width=91) (actual time=0.42..255.33 rows=5611 loops=1) + Merge Cond: ("outer".target_uid = "inner".uid) + -> Merge Join (cost=0.00..1224.05 rows=6069 width=61) (actual time=0.34..156.74 rows=5611 loops +=1) + Merge Cond: ("outer".target_uid = "inner".id) + -> Index Scan using data_target_uid on data a (cost=0.00..2263.05 rows=6069 width=44) (ac +tual time=0.23..63.87 rows=5630 loops=1) + Filter: (confirmation IS NOT NULL) + -> Index Scan using customer_pkey on customer c2 (cost=0.00..631.03 rows=6120 width=17) ( +actual time=0.05..50.97 rows=10862 loops=1) + -> Index Scan using customerdata_uid_idx on customerdata d (cost=0.00..312.36 rows=6085 width=3 +0) (actual time=0.06..48.95 rows=10822 loops=1) + -> Hash (cost=188.20..188.20 rows=6120 width=17) (actual time=19.81..19.81 rows=0 loops=1) + -> Seq Scan on customer c1 (cost=0.00..188.20 rows=6120 width=17) (actual time=0.03..12.30 rows +=6157 loops=1) + -> Sort (cost=1051.28..1052.52 rows=497 width=8) (actual time=42.05..42.51 rows=542 loops=1) + Sort Key: a2.ref_id + -> Seq Scan on data a2 (cost=0.00..1029.00 rows=497 width=8) (actual time=0.21..41.14 rows=545 loops=1) + Filter: ((what = 13) OR (what = 17)) + -> Index Scan using customerdata_uid_idx on customerdata b (cost=0.00..3.31 rows=1 width=30) (actual time=0.01..0.01 ro +ws=1 loops=472) + Index Cond: (b.uid = "outer".uid) + -> Hash (cost=192.26..192.26 rows=26 width=4) (actual time=10.50..10.50 rows=0 loops=1) + -> Seq Scan on participant p (cost=0.00..192.26 rows=26 width=4) (actual time=10.42..10.46 rows=26 loops=1) + SubPlan + -> Aggregate (cost=6.08..6.08 rows=1 width=4) (actual time=0.03..0.03 rows=1 loops=461) + -> Index Scan using td_data_id_idx on transaction_data td (cost=0.00..6.08 rows=1 width=4) (actual time=0.02..0.02 ro +ws=1 loops=461) + Index Cond: (data_id = $0) + Filter: ((dir = 1) AND (uid = $1)) + -> Aggregate (cost=6.08..6.08 rows=1 width=4) (actual time=0.02..0.02 rows=1 loops=461) + -> Index Scan using td_data_id_idx on transaction_data td (cost=0.00..6.08 rows=1 width=4) (actual time=0.01..0.01 ro +ws=1 loops=461) + Index Cond: (data_id = $0) + Filter: ((dir = 0) AND (uid = $2)) + Total runtime: 508.27 msec +(40 rows) +Time: 528.13 ms + +Please help me out. +Thanks in advance! +Saranya + + + +--------------------------------- +Do you Yahoo!? + Yahoo! Mail - Find what you need with new enhanced search. Learn more. +--0-162377963-1103060047=:84228 +Content-Type: text/html; charset=us-ascii + +
Hi all,
+
 
+
Can someone please help me optimize this query? Is there a better way to write this query? I am generating a report of transactions ordered by time and with details of the sender and receiver etc.
+
 
+
SELECT distinct a.time::date ||'<br>'||substring(a.time::time::text,1,8) as Time,
CASE WHEN a.what = 0 THEN 'Money Transfer' WHEN a.what = 15 THEN 'Purchase' WHEN a.what = 26 THEN 'Merchant Streamline' WHEN a.what = 13 THEN 'Reversal' END  as Transaction_Type ,
c1.account_no as SenderAccount, c2.account_no as RecieverAccount,
b.country as SenderCountry, d.country as RecieverCountry,
b.firstname as SenderFirstName, b.lastname as SenderLastName,
d.firstname as ReceiverFirstName, d.lastname as ReceiverLastName,
a.status as status,
(select sum(td.amount * 0.01) from transaction_data td where td.data_id = a2.id and td.dir = 1 and td.uid = a.target_uid) as ReversedAmount,
(select sum(td.amount * 0.01) from transaction_data td where td.data_id = a2.id and td.dir = 0 and td.uid = a.uid ) as DepositedAmount, a.flags, (a.amount * 0.01) as Amount,
(a.fee * 0.01) as Fee
FROM data a, customerdata b, customerdata d, customer c1, customer c2 + , + participant p, data a2
WHERE p.id = a.partner_id AND (a.uid = c1.id) AND (a.target_uid = c2.id) and c1.id=b.uid and c2.id=d.uid
and a.confirmation is not null AND (a2.ref_id = a.id) and
((a2.what = 13) or (a2.what = 17) ) ORDER BY time desc ;
+
 
+
 
+
 QUERY PLAN            
       
-------------------------------------------------------------------------------------------------------------
 Unique  (cost=2978.27..2981.54 rows=8 width=150) (actual time=502.29..506.75 rows=382 loops=1)
   ->  Sort  (cost=2978.27..2978.46 rows=77 width=150) (actual time=502.29..502.61 rows=461 loops=1)
         Sort Key: ((((a."time")::date)::text || '<br>'::text) || "substring"(((a."time")::time without time zone)::text, 1, 8)), CASE WHEN (a
.what = 0) THEN 'Money Transfer'::text WHEN (a.what = 15) THEN 'Purchase'::text WHEN (a.what = 26) THEN 'Merchant Streamline'::text WHEN (a.wh
at = 13) THEN 'Reversal'::text ELSE NULL::text END, c1.account_no, c2.account_no, b.country, d.country, b.firstname, b.lastname, d.firstname,
d.lastname, a. + status, + (subplan), (subplan), a.flags, ((a.amount)::numeric * 0.01), ((a.fee)::numeric * 0.01)
         ->  Hash Join  (cost=2687.00..2975.86 rows=77 width=150) (actual time=423.91..493.48 rows=461 loops=1)
               Hash Cond: ("outer".partner_id = "inner".id)
               ->  Nested Loop  (cost=2494.67..2781.99 rows=77 width=146) (actual time=413.19..441.61 rows=472 loops=1)
                     ->  Merge Join  (cost=2494.67..2526.04 rows=77 width=116) (actual time=413.09..429.86 rows=472 loops=1)
                         & + nbsp; + Merge Cond: ("outer".id = "inner".ref_id)
                           ->  Sort  (cost=1443.39..1458.57 rows=6069 width=108) (actual time=370.14..377.72 rows=5604 loops=1)
                                 Sort Key: a.id
                                 ->  Hash Join  (cost=203.50..1062.01 rows=6069 width=108) (actual time=20.35..335.44 rows=5604 + loops=1)
                                       Hash Cond: ("outer".uid = "inner".id)
                                       ->  Merge Join  (cost=0.00..676.43 rows=6069 width=91) (actual time=0.42..255.33 rows=5611 loops=1)
                                             Merge Cond: ("outer".target_uid = + "inner".uid)
                                             ->  Merge Join  (cost=0.00..1224.05 rows=6069 width=61) (actual time=0.34..156.74 rows=5611 loops
=1)
                                                   Merge Cond: ("outer".target_uid = + "inner".id)
                                                   ->  Index Scan using data_target_uid on data a  (cost=0.00..2263.05 rows=6069 width=44) (ac
tual time=0.23..63.87 rows=5630 loops=1)
                                                         Filter: (confirmation IS NOT + NULL)
                                                   ->  Index Scan using customer_pkey on customer c2  (cost=0.00..631.03 rows=6120 width=17) (
actual time=0.05..50.97 rows=10862 loops=1)
                                             ->  Index Scan using customerdata_uid_idx on customerdata d  (cost=0.00..312.36 rows=6085 width=3
0) (actual time=0.06..48.95 rows=10822 + loops=1)
                                       ->  Hash  (cost=188.20..188.20 rows=6120 width=17) (actual time=19.81..19.81 rows=0 loops=1)
                                             ->  Seq Scan on customer c1  (cost=0.00..188.20 rows=6120 width=17) (actual time=0.03..12.30 rows
=6157 loops=1)
                           ->  Sort  (cost=1051.28..1052.52 rows=497 width=8) (actual time=42.05..4 + 2.51 + rows=542 loops=1)
                                 Sort Key: a2.ref_id
                                 ->  Seq Scan on data a2  (cost=0.00..1029.00 rows=497 width=8) (actual time=0.21..41.14 rows=545 loops=1)
                                       Filter: ((what = 13) OR (what = 17))
                     ->  Index Scan using customerdata_uid_i + dx on + customerdata b  (cost=0.00..3.31 rows=1 width=30) (actual time=0.01..0.01 ro
ws=1 loops=472)
                           Index Cond: (b.uid = "outer".uid)
               ->  Hash  (cost=192.26..192.26 rows=26 width=4) (actual time=10.50..10.50 rows=0 loops=1)
                     ->  Seq Scan on participant p  (cost=0.00..192.26 rows=26 width=4) (actual time=10.42..10.46 rows=26 loops=1)
               SubPlan
                 ->  Aggregate  (cost=6.08..6.08 rows=1 width=4) + (actual + time=0.03..0.03 rows=1 loops=461)
                       ->  Index Scan using td_data_id_idx on transaction_data td  (cost=0.00..6.08 rows=1 width=4) (actual time=0.02..0.02 ro
ws=1 loops=461)
                             Index Cond: (data_id = $0)
                             Filter: ((dir = 1) AND (uid = $1))
                 ->  Aggregate  (cost=6.08..6.08 rows=1 width=4) (actual time=0.02..0.02 rows=1 + loops=461)
                       ->  Index Scan using td_data_id_idx on transaction_data td  (cost=0.00..6.08 rows=1 width=4) (actual time=0.01..0.01 ro
ws=1 loops=461)
                             Index Cond: (data_id = $0)
                             Filter: ((dir = 0) AND (uid = $2))
 Total runtime: 508.27 msec
(40 rows)
+
Time: 528.13 ms
+
Please help me out.
+
Thanks in advance!
+
Saranya
+
 

+


Do you Yahoo!?
+Yahoo! Mail - Find what you need with new enhanced search. Learn more. +--0-162377963-1103060047=:84228-- + +From pgsql-performance-owner@postgresql.org Tue Dec 14 23:15:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DE1483AAABA + for ; + Tue, 14 Dec 2004 23:15:32 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05735-04 + for ; + Tue, 14 Dec 2004 23:15:20 +0000 (GMT) +Received: from cmailm2.svr.pol.co.uk (cmailm2.svr.pol.co.uk [195.92.193.210]) + by svr1.postgresql.org (Postfix) with ESMTP id CBD3D3AAADE + for ; + Tue, 14 Dec 2004 23:15:21 +0000 (GMT) +Received: from modem-3156.lynx.dialup.pol.co.uk ([217.135.204.84] + helo=[192.168.0.102]) by cmailm2.svr.pol.co.uk with esmtp (Exim 4.41) + id 1CeLt0-0005NA-JZ; Tue, 14 Dec 2004 23:15:18 +0000 +Subject: Re: Speeding up pg_dump +From: Simon Riggs +To: Rod Taylor +Cc: Postgresql Performance +In-Reply-To: <1103045806.25186.153.camel@home> +References: <1103045806.25186.153.camel@home> +Content-Type: text/plain +Organization: 2nd Quadrant +Message-Id: <1103065887.4037.3762.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 14 Dec 2004 23:11:27 +0000 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/185 +X-Sequence-Number: 9560 + +On Tue, 2004-12-14 at 17:36, Rod Taylor wrote: +> Are there any tricks to speeding up pg_dump aside from doing them from a +> replicated machine? +> +> I'm using -Fc with no compression. + +Run a separate pg_dump for larger tables and run them concurrently so +you use more cpu and disk resources. + +The lower compression levels are fast and nearly as good (in my testing) +as full compression. Using compression tends to use up the CPU that +would otherwise be wasted since the pg_dump is disk intensive, and then +saves further I/O by reducing the output file size. + +-- +Best Regards, Simon Riggs + + +From pgsql-performance-owner@postgresql.org Wed Dec 15 06:08:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 67AB03AB9A3 + for ; + Wed, 15 Dec 2004 06:08:18 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35619-07 + for ; + Wed, 15 Dec 2004 06:08:09 +0000 (GMT) +Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) + by svr1.postgresql.org (Postfix) with ESMTP id EB6FE3AB9D3 + for ; + Wed, 15 Dec 2004 06:08:08 +0000 (GMT) +Received: from grownups (c-24-21-166-228.client.comcast.net[24.21.166.228]) + by comcast.net (rwcrmhc11) with SMTP + id <2004121506080501300jos47e>; Wed, 15 Dec 2004 06:08:05 +0000 +Message-ID: <001f01c4e26c$99719680$0200a8c0@grownups> +From: "Stacy White" +To: +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412051506.41025.josh@agliodbs.com> + <001b01c4dcde$fc27be50$0200a8c0@grownups> + <200412102152.40442.josh@agliodbs.com> +Subject: Re: Partitioned table performance +Date: Tue, 14 Dec 2004 22:09:12 -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.1409 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.075 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/186 +X-Sequence-Number: 9561 + +Josh, + +You're absolutely correct that the overhead becomes less significant as the +partitioning prunes more rows. I can even see a two-partition table being +useful in some situations (e.g., a table divided into a relatively small +"recent data" partition and a much larger "historical data" partition). The +break-even point is when your partitioning scheme prunes 20% of the rows +(assuming you're using the inheritance based scheme). + +Thanks again for the reply. So it sounds like the answer to my original +question is that it's expected that the pseudo-partitioning would introduce +a fairly significant amount of overhead. Correct? + + + +----- Original Message ----- +From: "Josh Berkus" +To: +Cc: "Stacy White" +Sent: Friday, December 10, 2004 9:52 PM +Subject: Re: [PERFORM] Partitioned table performance + + +Stacy, + +> Each set of test tables holds 1,000,000 tuples with a partition value of +> '1', and 1,000,000 with a partition value of '2'. The bar* columns are all +> set to non-null values. The 'one_big_foo' table stores all 2M rows in one +> table. 'super_foo' and 'union_foo' split the data into two tables, and use +> inheritance and union views (respectively) to tie them together, as +> described in my previous message. +> +> Query timings and 'EXPLAIN ANALYZE' results for full table scans and for +> partition scans follow: + +Hmmm .... interesting. I think you've demonstrated that +pseudo-partitioning +doesn't pay for having only 2 partitions. Examine this: + +-> Index Scan using idx_sub_foo2_partition on sub_foo2 +super_foo (cost=0.00..2.01 rows=1 width=4) (actual time=0.221..0.221 +rows=0 loops=1) +Index Cond: (partition = 1::numeric) +Total runtime: 15670.463 ms + +As you see, even though the aggregate operation requires a seq scan, the +planner is still able to scan, and discard, sub_foo2, using its index in 0.2 +seconds. Unfortunately, super_foo still needs to contend with: + +-> Append (cost=0.00..28376.79 rows=1000064 width=4) (actual +time=6.699..12072.483 rows=1000000 loops=1) + +Right there, in the Append, you lose 6 seconds. This means that +pseudo-partitioning via inheritance will become a speed gain once you can +"make up" that 6 seconds by being able to discard more partitions. If you +want, do a test with 6 partitions instead of 2 and let us know how it comes +out. + +Also, keep in mind that there are other reasons to do pseudo-partitioning +than +your example. Data write performance, expiring partitions, and vacuum are +big reasons that can motivate partitioning even in cases when selects are +slower. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +---------------------------(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 Wed Dec 15 14:38:29 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 327213B357F + for ; + Wed, 15 Dec 2004 14:38:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 41571-06 + for ; + Wed, 15 Dec 2004 14:38:19 +0000 (GMT) +Received: from web51304.mail.yahoo.com (web51304.mail.yahoo.com + [206.190.38.170]) + by svr1.postgresql.org (Postfix) with SMTP id 20BC03B3458 + for ; Wed, 15 Dec 2004 14:38:22 +0000 (GMT) +Received: (qmail 37536 invoked by uid 60001); 15 Dec 2004 14:38:22 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=yjOJ4ExKUpnrn8II9OfmhaSjoXqC+yBfDCVqRf/4GKrPWYFSrGeOGoKu17B3hrT93/jK9mk3eqYOmB5eybSr+jPRrZHqKvj5wlkraVEyFtrOZP83SqAuJyGICmA2A1n0CrnUCScNW3d2VV9I0KAFe05fTZ8HZPGYQUtORkiPrrI= + ; +Message-ID: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +Received: from [65.218.182.242] by web51304.mail.yahoo.com via HTTP; + Wed, 15 Dec 2004 06:38:22 PST +Date: Wed, 15 Dec 2004 06:38:22 -0800 (PST) +From: sarlav kumar +Subject: \d output to a file +To: pgsqlnovice , + pgsqlperform +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-973111891-1103121502=:36535" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.66 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_10_20, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/105 +X-Sequence-Number: 11682 + +--0-973111891-1103121502=:36535 +Content-Type: text/plain; charset=us-ascii + +Hi All, + +I would like to write the output of the \d command on all tables in a database to an output file. There are more than 200 tables in the database. I am aware of \o command to write the output to a file. But, it will be tough to do the \d for each table manually and write the output to a file. Is there a command/ way in which I can achieve this without having to do it for each table? +Any help in this regard would be really appreciated. + +Thanks, +Saranya + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com +--0-973111891-1103121502=:36535 +Content-Type: text/html; charset=us-ascii + +
Hi All,
+
 
+
I would like to write the output of the \d command on all tables in a database to an output file. There are more than 200 tables in the database. I am aware of \o command to write the output to a file. But, it will be tough to do the \d for each table manually and write the output to a file. Is there a command/ way in which I can achieve this without having to do it for each table?
+
Any help in this regard would be really appreciated.
+
 
+
Thanks,
+
Saranya

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com +--0-973111891-1103121502=:36535-- + +From pgsql-novice-owner@postgresql.org Wed Dec 15 15:04:29 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B7B73B4631 + for ; + Wed, 15 Dec 2004 15:04:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54130-08 + for ; + Wed, 15 Dec 2004 15:04:15 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.184]) + by svr1.postgresql.org (Postfix) with ESMTP id 4DC3E3B4628 + for ; Wed, 15 Dec 2004 15:04:16 +0000 (GMT) +Received: from [212.227.126.162] (helo=mrelayng.kundenserver.de) + by moutng.kundenserver.de with esmtp (Exim 3.35 #1) + id 1CeahM-0002EF-00 + for pgsql-novice@postgresql.org; Wed, 15 Dec 2004 16:04:16 +0100 +Received: from [194.25.154.138] (helo=pinguin.schollglas.com) + by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) + id 1CeahM-00088n-00 + for pgsql-novice@postgresql.org; Wed, 15 Dec 2004 16:04:16 +0100 +Received: from kretschmer by pinguin.schollglas.com with local (Exim 3.33 #6) + id 1CeahE-0002yB-00 + for pgsql-novice@postgresql.org; Wed, 15 Dec 2004 16:04:08 +0100 +Date: Wed, 15 Dec 2004 16:04:08 +0100 +From: Andreas Kretschmer +To: pgsqlnovice +Subject: Re: [despammed] \d output to a file +Message-ID: <20041215150408.GA11184@Pinguin.wug-glas.de> +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +User-Agent: Mutt/1.4i +X-DEST: 208 +X-MSMail-Priority: High +X-MSMail-Virus: X5O!P%@AP[4PZX54(P^)7CC)7}-STANDARD-ANTIVIRUS-TEST-FILE!+H* +X-Message-Flag: My name is root. Just root. And I am licensed to kill -9 +X-PrivatMail: kretschmer@kaufbach.delug.de +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +X-LUG: http://lug-dd.schlittermann.de +X-Handy: 0160 / 8256486 (privat) +X-Fax: 035204 / 40505 (privat) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + auth:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.676 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_WHOIS, MISSING_MIMEOLE, X_MSMAIL_PRIORITY_HIGH +X-Spam-Level: +X-Archive-Number: 200412/106 +X-Sequence-Number: 11683 + +am 15.12.2004, um 6:38:22 -0800 mailte sarlav kumar folgendes: +> Hi All, +> +> I would like to write the output of the \d command on all tables in a database to an output file. There are more than 200 tables in the database. I am aware of \o command to write the output to a file. But, it will be tough to do the \d for each table manually and write the output to a file. Is there a command/ way in which I can achieve this without having to do it for each table? +> Any help in this regard would be really appreciated. + +You can write a little shell-script to list all tables via \d and parse +the output to generate for each table a '\d table'. + + +Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) + Tel. NL Heynitz: 035242/47212 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-novice-owner@postgresql.org Sat Dec 18 07:20:30 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D3713B4683 + for ; + Wed, 15 Dec 2004 15:12:33 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57840-10 + for ; + Wed, 15 Dec 2004 15:12:14 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) + by svr1.postgresql.org (Postfix) with ESMTP id D39073B464B + for ; Wed, 15 Dec 2004 15:12:17 +0000 (GMT) +Received: by wproxy.gmail.com with SMTP id 55so120111wri + for ; Wed, 15 Dec 2004 07:12:17 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; + b=A5Ywv9pwnkT75JxAisaVlb4K3RALG9OmEd8/i2W15d7lqe1pIEwA6U88GYill4x8D1kpYSgJactcG8uamKHorQzRe7EqoRiUTmFiGOCwmx9OS83LwjmLveuK2ZtnTYuB4LGSrdceuMx+lh5qitX54L77LI+FjhC42xv79/a7z+U= +Received: by 10.54.4.40 with SMTP id 40mr2066427wrd; + Wed, 15 Dec 2004 07:12:17 -0800 (PST) +Received: by 10.54.11.12 with HTTP; Wed, 15 Dec 2004 07:12:17 -0800 (PST) +Message-ID: +Date: Wed, 15 Dec 2004 15:12:17 +0000 +From: Gary Cowell +Reply-To: Gary Cowell +To: pgsqlnovice , + pgsqlperform +Subject: Re: [PERFORM] \d output to a file +In-Reply-To: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.809 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/153 +X-Sequence-Number: 11730 + +On Wed, 15 Dec 2004 06:38:22 -0800 (PST), sarlav kumar + wrote: +> Hi All, +> +> I would like to write the output of the \d command on all tables in a +> database to an output file. There are more than 200 tables in the database. +> I am aware of \o command to write the output to a file. But, it will be +> tough to do the \d for each table manually and write the output to a file. +> Is there a command/ way in which I can achieve this without having to do it +> for each table? +> Any help in this regard would be really appreciated. +> +> Thanks, +> Saranya +> +> + +Try something like: + +psql -c "\d *" >listing.txt + +From pgsql-novice-owner@postgresql.org Wed Dec 15 15:17:24 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B7043B2E4B; + Wed, 15 Dec 2004 15:17:22 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62887-01; Wed, 15 Dec 2004 15:17:08 +0000 (GMT) +Received: from 3times25.net (duck.3times25.net [66.23.211.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 097843AC008; + Wed, 15 Dec 2004 15:17:10 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP + id AA4AF746D3; Wed, 15 Dec 2004 10:17:10 -0500 (EST) +Message-ID: <41C05576.7030703@3times25.net> +Date: Wed, 15 Dec 2004 10:17:10 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsqlnovice , + pgsqlperform +Subject: Re: \d output to a file +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +In-Reply-To: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/108 +X-Sequence-Number: 11685 + +sarlav kumar wrote: +> Hi All, +> +> I would like to write the output of the \d command on all tables in a +> database to an output file. There are more than 200 tables in the +> database. I am aware of \o command to write the output to a file. +> But, it will be tough to do the \d for each table manually and write +> the output to a file. Is there a command/ way in which I can achieve +> this without having to do it for each table? Any help in this regard +> would be really appreciated. + +What is the OS? On any UNIX variant you can do: + +echo '\d' | psql > outputfile + +But this will get you the system tables as well I think. + +Alternately you could do something like: + +for table in $( outputfile + +-- +Until later, Geoffrey + +From pgsql-novice-owner@postgresql.org Wed Dec 15 15:24:10 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 791F33B46FB + for ; + Wed, 15 Dec 2004 15:24:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65285-06 + for ; + Wed, 15 Dec 2004 15:23:50 +0000 (GMT) +Received: from 3times25.net (66-23-211-34.clients.speedfactory.net + [66.23.211.34]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D6703B46CE + for ; Wed, 15 Dec 2004 15:23:54 +0000 (GMT) +Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) + by 3times25.net (Postfix) with ESMTP id 927B5746D3 + for ; Wed, 15 Dec 2004 10:23:54 -0500 (EST) +Message-ID: <41C0570A.7010505@3times25.net> +Date: Wed, 15 Dec 2004 10:23:54 -0500 +From: Geoffrey +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsqlnovice +Subject: Re: [despammed] \d output to a file +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> + <20041215150408.GA11184@Pinguin.wug-glas.de> +In-Reply-To: <20041215150408.GA11184@Pinguin.wug-glas.de> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/109 +X-Sequence-Number: 11686 + +Andreas Kretschmer wrote: +> am 15.12.2004, um 6:38:22 -0800 mailte sarlav kumar folgendes: +> +>>Hi All, +>> +>>I would like to write the output of the \d command on all tables in a database to an output file. There are more than 200 tables in the database. I am aware of \o command to write the output to a file. But, it will be tough to do the \d for each table manually and write the output to a file. Is there a command/ way in which I can achieve this without having to do it for each table? +>>Any help in this regard would be really appreciated. +> +> +> You can write a little shell-script to list all tables via \d and parse +> the output to generate for each table a '\d table'. + +Or: + +for table in $( ${table}.out +done + +-- +Until later, Geoffrey + +From pgsql-novice-owner@postgresql.org Sat Dec 18 07:32:32 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4B80C3B474D; + Wed, 15 Dec 2004 15:36:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69940-10; Wed, 15 Dec 2004 15:35:58 +0000 (GMT) +Received: from svarog.thaico.si (p0f.net [193.77.154.190]) + by svr1.postgresql.org (Postfix) with ESMTP id AD9F73B46AC; + Wed, 15 Dec 2004 15:35:59 +0000 (GMT) +Received: from lunik.p0f.net ([192.168.50.128]) + by svarog.thaico.si with esmtp (Exim 3.32 #1 (Debian)) + id 1CebBq-0004xR-00; Wed, 15 Dec 2004 16:35:46 +0100 +Received: from lunik.p0f.net (localhost [127.0.0.1]) + by lunik.p0f.net (8.12.10/8.12.10) with ESMTP id iBFFZwSw007471; + Wed, 15 Dec 2004 16:35:58 +0100 +Received: (from gregab@localhost) + by lunik.p0f.net (8.12.10/8.12.10/Submit) id iBFFZw1Z007470; + Wed, 15 Dec 2004 16:35:58 +0100 +Date: Wed, 15 Dec 2004 16:35:58 +0100 +From: Grega Bremec +To: sarlav kumar +Cc: pgsqlnovice , + pgsqlperform +Subject: Re: [PERFORM] \d output to a file +Message-ID: <20041215153558.GA7419@lunik.p0f.net> +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" +Content-Disposition: inline +In-Reply-To: <20041215143822.37534.qmail@web51304.mail.yahoo.com> +User-Agent: Mutt/1.4.1i +Organization: p0f +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.705 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL +X-Spam-Level: * +X-Archive-Number: 200412/158 +X-Sequence-Number: 11735 + + +--0OAP2g/MAC+5xKAE +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +=2E..and on Wed, Dec 15, 2004 at 06:38:22AM -0800, sarlav kumar used the ke= +yboard: +> Hi All, +> =20 +> I would like to write the output of the \d command on all tables in a dat= +abase to an output file. There are more than 200 tables in the database. I = +am aware of \o command to write the output to a file. But, it will be tough= + to do the \d for each table manually and write the output to a file. Is th= +ere a command/ way in which I can achieve this without having to do it for = +each table? +> Any help in this regard would be really appreciated. +> =20 + +Hello Sarlav. + +You don't say which platform you're doing this on. If it's Windows, someone +else will have to advise you; if it's a UNIX-like platform though, the +following simple shell script should be helpful in achieving what you want: + +---CUT-HERE--- +#!/bin/bash +if [ -z "$1" ]; then + echo "Please specify a database to query." + exit 1 +fi +DATABASE=3D$1 +MYTABLES=3D"`echo '\t\a\dt' | psql -q ${DATABASE} | cut -f 2 -d '|'`" + +for table in ${MYTABLES}; do + echo '\d '${table} +done | psql ${DATABASE} +---CUT-HERE--- + +You can store this script into a file called, for example, describe.sh and +invoke it like so: + + $ ./describe.sh mydatabase > description.txt + +It should then do what you want. + +Should you have additional arguments to specify to psql, such as a host, +a username, a password and so on, it is easy to modify the script to do +that. Just supply those arguments in places where the "psql" command is +used. + +Hope this helped, +--=20 + Grega Bremec + gregab at p0f dot net + +--0OAP2g/MAC+5xKAE +Content-Type: application/pgp-signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (GNU/Linux) + +iD8DBQFBwFnefu4IwuB3+XoRAvaxAJ0YdErCui8t2ak6NxyCxiQpxdOYeACfSz3y +eznxq1PM4fn0tm1XkkJ9kck= +=NgiN +-----END PGP SIGNATURE----- + +--0OAP2g/MAC+5xKAE-- + +From pgsql-novice-owner@postgresql.org Wed Dec 15 16:23:04 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 177893B497E + for ; + Wed, 15 Dec 2004 16:22:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93444-06 + for ; + Wed, 15 Dec 2004 16:22:10 +0000 (GMT) +Received: from md1.psixpress.com (md1.psixpress.com [154.32.105.205]) + by svr1.postgresql.org (Postfix) with ESMTP id A9A1E3B4954 + for ; Wed, 15 Dec 2004 16:22:06 +0000 (GMT) +Received: from kaufbach.delug.de (128.pool1.dialup.cybernet-ag.de + [195.143.124.128]) by md1.psixpress.com (MOS 3.5.6-GR) + with ESMTP id CGA06148 (AUTH via LOGINBEFORESMTP); + Wed, 15 Dec 2004 16:22:00 GMT +Received: from kretschmer by kaufbach.delug.de with local (Exim 3.35 #1) + id 1CebuX-0001b2-00 + for pgsql-novice@postgresql.org; Wed, 15 Dec 2004 17:21:57 +0100 +Date: Wed, 15 Dec 2004 17:21:57 +0100 +From: Kretschmer Andreas +To: pgsqlnovice +Subject: Re: [despammed] \d output to a file +Message-ID: <20041215162157.GA6127@kaufbach.delug.de> +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> + <20041215150408.GA11184@Pinguin.wug-glas.de> + <41C0570A.7010505@3times25.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <41C0570A.7010505@3times25.net> +User-Agent: Mutt/1.3.28i +X-OS: Debian/GNU Linux - weil ich es mir Wert bin! +X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA +X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the + answer is "no"! +X-Lugdd: Gerd Kube +X-Info: My name is root. Just root. And I am licensed to kill -9 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.087 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/110 +X-Sequence-Number: 11687 + +am Wed, dem 15.12.2004, um 10:23:54 -0500 mailte Geoffrey folgendes: +> >>I would like to write the output of the \d command on all tables in a +> >>database to an output file. There are more than 200 tables in the +> >>database. I am aware of \o command to write the output to a file. But, it +> >>will be tough to do the \d for each table manually and write the output +> >>to a file. Is there a command/ way in which I can achieve this without +> >>having to do it for each table? +> > +> >You can write a little shell-script to list all tables via \d and parse +> >the output to generate for each table a '\d table'. +> +> Or: +> +> for table in $( +Cc: pgsqlnovice , + pgsqlperform +Subject: Re: \d output to a file +In-reply-to: <41C05576.7030703@3times25.net> +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> + <41C05576.7030703@3times25.net> +Comments: In-reply-to Geoffrey + message dated "Wed, 15 Dec 2004 10:17:10 -0500" +Date: Wed, 15 Dec 2004 11:50:58 -0500 +Message-ID: <2441.1103129458@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/111 +X-Sequence-Number: 11688 + +Geoffrey writes: +> sarlav kumar wrote: +>> I would like to write the output of the \d command on all tables in a +>> database to an output file. + +> What is the OS? On any UNIX variant you can do: +> echo '\d' | psql > outputfile + +Or use \o: + +regression=# \o zzz1 +regression=# \d +regression=# \o +regression=# \d + List of relations + Schema | Name | Type | Owner +--------+---------------+-------+---------- + public | pg_ts_cfg | table | postgres + public | pg_ts_cfgmap | table | postgres + public | pg_ts_dict | table | postgres + public | pg_ts_parser | table | postgres + public | t_test | table | postgres + public | test_tsvector | table | postgres +(6 rows) + +regression=# \q +$ cat zzz1 + List of relations + Schema | Name | Type | Owner +--------+---------------+-------+---------- + public | pg_ts_cfg | table | postgres + public | pg_ts_cfgmap | table | postgres + public | pg_ts_dict | table | postgres + public | pg_ts_parser | table | postgres + public | t_test | table | postgres + public | test_tsvector | table | postgres +(6 rows) + +$ + + regards, tom lane + +From pgsql-novice-owner@postgresql.org Wed Dec 15 18:16:31 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 860693B457F + for ; + Wed, 15 Dec 2004 18:15:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 53242-03 + for ; + Wed, 15 Dec 2004 18:15:53 +0000 (GMT) +Received: from md1.psixpress.com (md1.psixpress.com [154.32.105.205]) + by svr1.postgresql.org (Postfix) with ESMTP id CCA013ABE26 + for ; Wed, 15 Dec 2004 18:15:52 +0000 (GMT) +Received: from kaufbach.delug.de (226.pool1.dialup.cybernet-ag.de + [195.143.124.226]) by md1.psixpress.com (MOS 3.5.6-GR) + with ESMTP id CGA33083; Wed, 15 Dec 2004 18:15:49 GMT +Received: from kretschmer by kaufbach.delug.de with local (Exim 3.35 #1) + id 1CedVZ-0001sw-00 + for pgsql-novice@postgresql.org; Wed, 15 Dec 2004 19:04:17 +0100 +Date: Wed, 15 Dec 2004 19:04:17 +0100 +From: Kretschmer Andreas +To: pgsqlnovice +Subject: Re: \d output to a file +Message-ID: <20041215180417.GA7206@kaufbach.delug.de> +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> + <41C05576.7030703@3times25.net> <2441.1103129458@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <2441.1103129458@sss.pgh.pa.us> +User-Agent: Mutt/1.3.28i +X-OS: Debian/GNU Linux - weil ich es mir Wert bin! +X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA +X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the + answer is "no"! +X-Lugdd: Gerd Kube +X-Info: My name is root. Just root. And I am licensed to kill -9 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.075 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/113 +X-Sequence-Number: 11690 + +am Wed, dem 15.12.2004, um 11:50:58 -0500 mailte Tom Lane folgendes: +> Geoffrey writes: +> > sarlav kumar wrote: +> >> I would like to write the output of the \d command on all tables in a +> >> database to an output file. + +I remember: '\d command on all tables' + + +And you wrote: + +> +> regression=# \q +> $ cat zzz1 +> List of relations +> Schema | Name | Type | Owner +> --------+---------------+-------+---------- +> public | pg_ts_cfg | table | postgres +> public | pg_ts_cfgmap | table | postgres + +Sorry, but i think, this isn't the correct answer... + + +Andreas, leaning PostgreSQL and english... +-- +Diese Message wurde erstellt mit freundlicher Unterst�tzung eines freilau- +fenden Pinguins aus artgerechter Freilandhaltung. Er ist garantiert frei +von Micro$oft'schen Viren. (#97922 http://counter.li.org) GPG 7F4584DA +Was, Sie wissen nicht, wo Kaufbach ist? Hier: N 51.05082�, E 13.56889� ;-) + +From pgsql-novice-owner@postgresql.org Sat Dec 18 07:19:08 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 69A083AC4D6; + Wed, 15 Dec 2004 18:00:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44834-04; Wed, 15 Dec 2004 18:00:03 +0000 (GMT) +Received: from pillette.com (adsl-67-119-5-202.dsl.snfc21.pacbell.net + [67.119.5.202]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C74F3B4BEC; + Wed, 15 Dec 2004 17:59:59 +0000 (GMT) +Received: from [192.168.1.200] (dhcp200.pillette.com [192.168.1.200]) + by pillette.com (8.11.6/8.11.6) with ESMTP id iBFHxtx18988; + Wed, 15 Dec 2004 09:59:55 -0800 +Message-ID: <41C07CFD.4020703@pillette.com> +Date: Wed, 15 Dec 2004 10:05:49 -0800 +From: Andrew Lazarus +Reply-To: andrew@pillette.com +Organization: Pillette Investment Management +User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: sarlav kumar +Cc: pgsqlperform , + pgsql-novice@postgresql.org +Subject: Re: [PERFORM] Query Optimization +References: <20041214213407.84233.qmail@web51307.mail.yahoo.com> +In-Reply-To: <20041214213407.84233.qmail@web51307.mail.yahoo.com> +Content-Type: multipart/mixed; boundary="------------060800090608030806010903" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/152 +X-Sequence-Number: 11729 + +This is a multi-part message in MIME format. +--------------060800090608030806010903 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +sarlav kumar wrote: +> Hi all, +> +> Can someone please help me optimize this query? Is there a better way to +> write this query? I am generating a report of transactions ordered by +> time and with details of the sender and receiver etc. +> +> SELECT distinct a.time::date ||'
'||substring(a.time::time::text,1,8) +> as Time, +> CASE WHEN a.what = 0 THEN 'Money Transfer' WHEN a.what = 15 THEN +> 'Purchase' WHEN a.what = 26 THEN 'Merchant Streamline' WHEN a.what = 13 +> THEN 'Reversal' END as Transaction_Type , +> c1.account_no as SenderAccount, c2.account_no as RecieverAccount, +> b.country as SenderCountry, d.country as RecieverCountry, +> b.firstname as SenderFirstName, b.lastname as SenderLastName, +> d.firstname as ReceiverFirstName, d.lastname as ReceiverLastName, +> a.status as status, +> (select sum(td.amount * 0.01) from transaction_data td where td.data_id +> = a2.id and td.dir = 1 and td.uid = a.target_uid) as ReversedAmount, +> (select sum(td.amount * 0.01) from transaction_data td where td.data_id +> = a2.id and td.dir = 0 and td.uid = a.uid ) as DepositedAmount, a.flags, +> (a.amount * 0.01) as Amount, +> (a.fee * 0.01) as Fee +> FROM data a, customerdata b, customerdata d, customer c1, customer c2 , +> participant p, data a2 +> WHERE p.id = a.partner_id AND (a.uid = c1.id) AND (a.target_uid = c2.id) +> and c1.id=b.uid and c2.id=d.uid +> and a.confirmation is not null AND (a2.ref_id = a.id) and +> ((a2.what = 13) or (a2.what = 17) ) ORDER BY time desc ; +(query plan followed) + +The expensive operation is the UNIQUE. Are you sure, in terms of +business logic, that this is necessary? Is it actually possible to have +duplicate transactions at the exact same time, and if so, would you +really want to eliminate them? + +As an aside, I prefer to have numeric constants like the 'what' field in +a small lookup table of two columns (what_code, what_description); it's +easier to extend and to document. + +--------------060800090608030806010903 +Content-Type: text/x-vcard; charset=utf-8; + name="andrew.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="andrew.vcf" + +begin:vcard +fn:Andrew Lazarus +n:Lazarus;Andrew +org:Pillette Investment Management;Research and Development +adr;dom:;;3028 Fillmore;San Francisco;CA;94123 +email;internet:andrew@pillette.com +title:Director +tel;work:800-366-0688 +tel;fax:415-440-4093 +url:http://www.pillette.com +version:2.1 +end:vcard + + +--------------060800090608030806010903-- + +From pgsql-novice-owner@postgresql.org Sat Dec 18 07:23:52 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 53DDA3B4022; + Wed, 15 Dec 2004 18:23:47 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55838-08; Wed, 15 Dec 2004 18:23:43 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 997A63B352D; + Wed, 15 Dec 2004 18:23:42 +0000 (GMT) +Received: from gnari ([157.157.184.21] [157.157.184.21]) by quasar.skima.is + with ESMTP; Wed, 15 Dec 2004 18:23:40 Z +Subject: Re: [PERFORM] \d output to a file +From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= +To: sarlav kumar +Cc: pgsqlnovice , + pgsqlperform +In-Reply-To: <2441.1103129458@sss.pgh.pa.us> +References: <20041215143822.37534.qmail@web51304.mail.yahoo.com> + <41C05576.7030703@3times25.net> <2441.1103129458@sss.pgh.pa.us> +Content-Type: text/plain +Date: Wed, 15 Dec 2004 18:23:43 +0000 +Message-Id: <1103135023.4086.8.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/155 +X-Sequence-Number: 11732 + +On Wed, 2004-12-15 at 11:50 -0500, Tom Lane wrote: +> Geoffrey writes: +> > sarlav kumar wrote: +> >> I would like to write the output of the \d command on all tables in a +> >> database to an output file. +> +> > What is the OS? On any UNIX variant you can do: +> > echo '\d' | psql > outputfile +> +> Or use \o: +> +> regression=# \o zzz1 +> regression=# \d +or: + =# \d * +to get all tables as th OP wanted + +> regression=# \o + +gnari + + + +From pgsql-performance-owner@postgresql.org Wed Dec 15 18:23:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0DD253B49A6 + for ; + Wed, 15 Dec 2004 18:22:03 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54648-09 + for ; + Wed, 15 Dec 2004 18:21:53 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 7EFF23B3CC3 + for ; + Wed, 15 Dec 2004 18:21:48 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6790218; Wed, 15 Dec 2004 10:23:24 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: "Stacy White" +Subject: Re: Partitioned table performance +Date: Wed, 15 Dec 2004 10:25:02 -0800 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412102152.40442.josh@agliodbs.com> + <001f01c4e26c$99719680$0200a8c0@grownups> +In-Reply-To: <001f01c4e26c$99719680$0200a8c0@grownups> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200412151025.02262.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/193 +X-Sequence-Number: 9568 + +Stacy, + +> Thanks again for the reply. =A0So it sounds like the answer to my original +> question is that it's expected that the pseudo-partitioning would introdu= +ce +> a fairly significant amount of overhead. =A0Correct? + +Correct. For that matter, Oracle table partitioning introduces significan= +t=20 +overhead, from what I've seen. I don't think there's a way not to. + +Generally, I counsel people that they only want to consider=20 +pseudo-partitioning if they have one axis on the table which is used in 90%= +=20 +or more of the queries against that table. + +What would improve the situation significantly, and the utility of=20 +pseudo-partitioning, is the ability to have a single index span multiple=20 +partitions. This would allow you to have a segmented index for the=20 +partitioned axis, yet still use an unsegmented index for the other columns.= + =20 +However, there's a *lot* of work to do to make that happen. + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Dec 15 19:37:33 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id ECB1D3B4826 + for ; + Wed, 15 Dec 2004 19:34:34 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87338-09 + for ; + Wed, 15 Dec 2004 19:34:30 +0000 (GMT) +Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) + by svr1.postgresql.org (Postfix) with ESMTP id D1BE93B4732 + for ; + Wed, 15 Dec 2004 19:34:29 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Ceeup-0005MI-00; Wed, 15 Dec 2004 14:34:27 -0500 +To: josh@agliodbs.com +Cc: "Stacy White" , + pgsql-performance@postgresql.org +Subject: Re: Partitioned table performance +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412102152.40442.josh@agliodbs.com> + <001f01c4e26c$99719680$0200a8c0@grownups> + <200412151025.02262.josh@agliodbs.com> +In-Reply-To: <200412151025.02262.josh@agliodbs.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 15 Dec 2004 14:34:26 -0500 +Message-ID: <87oegvqrst.fsf@stark.xeocode.com> +Lines: 49 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/195 +X-Sequence-Number: 9570 + +Josh Berkus writes: + +> Stacy, +> +> > Thanks again for the reply. �So it sounds like the answer to my original +> > question is that it's expected that the pseudo-partitioning would introduce +> > a fairly significant amount of overhead. �Correct? +> +> Correct. For that matter, Oracle table partitioning introduces significant +> overhead, from what I've seen. I don't think there's a way not to. + +Well Oracle has lots of partitioning intelligence pushed up to the planner to +avoid overhead. + +If you have a query with something like "WHERE date = '2004-01-01'" and date +is your partition key (even if it's a range) then Oracle will figure out which +partition it will need at planning time. + +Even if your query is something like "WHERE date = ?" then Oracle will still +recognize that it will only need a single partition at planning time, though +it has to decide which partition at execution time. + +We didn't notice any run-time performance degradation when we went to +partitioned tables. Maybe we were so blinded by the joy they brought us on the +maintenance side though. I don't think we specifically checked for run-time +consequences. + +But I'm a bit puzzled. Why would Append have any significant cost? It's just +taking the tuples from one plan node and returning them until they run out, +then taking the tuples from another plan node. It should have no i/o cost and +hardly any cpu cost. Where is the time going? + +> What would improve the situation significantly, and the utility of +> pseudo-partitioning, is the ability to have a single index span multiple +> partitions. This would allow you to have a segmented index for the +> partitioned axis, yet still use an unsegmented index for the other columns. +> However, there's a *lot* of work to do to make that happen. + +In my experience "global indexes" defeat the whole purpose of having the +partitions. They make dropping and adding partitions expensive which was +always the reason we wanted to partition something anyways. + +It is handy having a higher level interface to deal with partitioned tables. +You can create a single "local" or "segmented" index and not have to manually +deal with all the partitions as separate tables. But that's just syntactic +sugar. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Dec 15 19:57:35 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3BD8A3B4C4F + for ; + Wed, 15 Dec 2004 19:57:29 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98523-01 + for ; + Wed, 15 Dec 2004 19:57:24 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id EB7CC3B4D1D + for ; + Wed, 15 Dec 2004 19:57:24 +0000 (GMT) +Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6790605; Wed, 15 Dec 2004 11:58:58 -0800 +From: Josh Berkus +Organization: Aglio Database Solutions +To: pgsql-performance@postgresql.org +Subject: Re: Partitioned table performance +Date: Wed, 15 Dec 2004 11:56:40 -0800 +User-Agent: KMail/1.6.2 +Cc: Greg Stark , "Stacy White" +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412151025.02262.josh@agliodbs.com> + <87oegvqrst.fsf@stark.xeocode.com> +In-Reply-To: <87oegvqrst.fsf@stark.xeocode.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Message-Id: <200412151156.40908.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/196 +X-Sequence-Number: 9571 + +Greg, + +> Well Oracle has lots of partitioning intelligence pushed up to the planner +> to avoid overhead. +> +> If you have a query with something like "WHERE date = '2004-01-01'" and +> date is your partition key (even if it's a range) then Oracle will figure +> out which partition it will need at planning time. + +Hmmm ... well, we're looking at making a spec for Postgres Table Partitioning. +Maybe you could help? + +> But I'm a bit puzzled. Why would Append have any significant cost? It's +> just taking the tuples from one plan node and returning them until they run +> out, then taking the tuples from another plan node. It should have no i/o +> cost and hardly any cpu cost. Where is the time going? + +Beats me. Tom? + +> In my experience "global indexes" defeat the whole purpose of having the +> partitions. They make dropping and adding partitions expensive which was +> always the reason we wanted to partition something anyways. + +Hmmm. Possibly, I was just thinking about the cost to partitioned tables +when you do a selection *not* on the partitioned axis. Also that currently +we can't enforce UNIQUE constraints across partitions. + +But maybe reducing the cost of Append is the answer to this. + +> It is handy having a higher level interface to deal with partitioned +> tables. You can create a single "local" or "segmented" index and not have +> to manually deal with all the partitions as separate tables. But that's +> just syntactic sugar. + +Right, and the easy part. + +-- +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Wed Dec 15 22:54:15 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 771D83B517D + for ; + Wed, 15 Dec 2004 22:53:31 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65680-02 + for ; + Wed, 15 Dec 2004 22:53:26 +0000 (GMT) +Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) + by svr1.postgresql.org (Postfix) with ESMTP id 940563B51B6 + for ; + Wed, 15 Dec 2004 22:53:25 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Cei1H-00062Z-00; Wed, 15 Dec 2004 17:53:19 -0500 +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, Greg Stark , + "Stacy White" +Subject: Re: Partitioned table performance +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412151025.02262.josh@agliodbs.com> + <87oegvqrst.fsf@stark.xeocode.com> + <200412151156.40908.josh@agliodbs.com> +In-Reply-To: <200412151156.40908.josh@agliodbs.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 15 Dec 2004 17:53:19 -0500 +Message-ID: <87vfb3p40w.fsf@stark.xeocode.com> +Lines: 56 +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 hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/197 +X-Sequence-Number: 9572 + + +Josh Berkus writes: + +> > But I'm a bit puzzled. Why would Append have any significant cost? It's +> > just taking the tuples from one plan node and returning them until they run +> > out, then taking the tuples from another plan node. It should have no i/o +> > cost and hardly any cpu cost. Where is the time going? +> +> Beats me. Tom? +> +> > In my experience "global indexes" defeat the whole purpose of having the +> > partitions. They make dropping and adding partitions expensive which was +> > always the reason we wanted to partition something anyways. +> +> Hmmm. Possibly, I was just thinking about the cost to partitioned tables +> when you do a selection *not* on the partitioned axis. Also that currently +> we can't enforce UNIQUE constraints across partitions. + +Like I said though, we found "global indexes" defeated the whole purpose. That +meant no global UNIQUE constraints for us when we went to partitioned tables. +It gave the DBAs the willies but it really wasn't a big deal. + +You can still do unique local indexes on a specific partition. So as long as +your partition key is in the primary key you can have a trustworthy primary +key. + +And even if not, you usually find you're only loading data into only one +partition. In most applications it's pretty hard to get a record from two +different partitions with conflicting IDs and not hard to check for. You could +easily put a constraint saying that all PO numbers in the new fiscal year have +to be greater than the last PO number from last year, for example. + +> But maybe reducing the cost of Append is the answer to this. + +The problem with global indexes is that adding or removing an entire partition +becomes a large job. [Actually with Postgres MVCC I suppose removing might +not. But cleaning up would eventually be a large job, and the point remains +for adding a partition.] + +Ideally adding and removing a partition should be a O(1) operation. No data +modification at all, purely catalog changes. + +> > It is handy having a higher level interface to deal with partitioned +> > tables. You can create a single "local" or "segmented" index and not have +> > to manually deal with all the partitions as separate tables. But that's +> > just syntactic sugar. +> +> Right, and the easy part. + +I think the hard part lies in the optimizer actually. The semantics of the +operations to manipulate partitions might be tricky to get right but the +coding should be straightforward. Having the optimizer be able to recognize +when it can prune partitions will be a lot of work. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Wed Dec 15 23:53:08 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E7D2E3B5436 + for ; + Wed, 15 Dec 2004 23:53:02 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 82967-05 + for ; + Wed, 15 Dec 2004 23:52:57 +0000 (GMT) +Received: from angel.lonelyplanet.com.au (sweep.lonelyplanet.com.au + [202.147.44.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 03F343B542D + for ; + Wed, 15 Dec 2004 23:52:57 +0000 (GMT) +Received: from Ganesh.au.lpint.net ([192.168.61.44]) by sweep with InterScan + Messaging Security Suite; Thu, 16 Dec 2004 10:48:06 +1100 +Received: by ganesh.au.lpint.net with Internet Mail Service (5.5.2657.72) + id ; Thu, 16 Dec 2004 10:48:07 +1100 +Message-ID: <16C0CF355FA04944A69E5A4F5299D30B110E9C@ganesh.au.lpint.net> +From: Theo Galanakis +To: pgsql-performance@postgresql.org +Subject: indentifying the database in a Postgres log file. +Date: Thu, 16 Dec 2004 10:48:06 +1100 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C4E300.8655EDA0" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.413 tagged_above=0 required=5 tests=HTML_30_40, + HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML +X-Spam-Level: +X-Archive-Number: 200412/198 +X-Sequence-Number: 9573 + +This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +------_=_NextPart_001_01C4E300.8655EDA0 +Content-Type: text/plain + + +I have written a program that parses a syslog file, reading all the postgres +transactions. I would like to know if there is a way for postgres to log +also the specific database the sql statement originated from. + +The only options available in the postgresql.conf are: +#log_connections = false +#log_duration = false +#log_pid = false +#log_statement = false +#log_timestamp = false +#log_hostname = false +#log_source_port = false + +Is this possible? Or is there a smart work around. + +Regards, + Theo + + + + + +______________________________________________________________________ +This email, including attachments, is intended only for the addressee +and may be confidential, privileged and subject to copyright. If you +have received this email in error, please advise the sender and delete +it. If you are not the intended recipient of this email, you must not +use, copy or disclose its content to anyone. You must not copy or +communicate to others content that is confidential or subject to +copyright, unless you have the consent of the content owner. +------_=_NextPart_001_01C4E300.8655EDA0 +Content-Type: text/html +Content-Transfer-Encoding: quoted-printable + + + + + + +indentifying the database in a Postgres log file. + + + +

I have written a program that parses a= + syslog file, reading all the postgres transactions. I would like to know= + if there is a way for postgres to log also the specific database the sql= + statement originated from.

+ +

The only options available in the= + postgresql.conf are: +
#log_connections =3D false
+#log_duration =3D false
+#log_pid =3D false
+#log_statement =3D false
+#log_timestamp =3D false
+#log_hostname =3D false
+#log_source_port =3D false
+
+
Is this possible? Or is there a smart= + work around. +

+ +

Regards, +
        Theo +

+
+
+ + + +
________________________________________________________________= +______
+This email, including attachments, is intended only for the addressee
+and may be confidential, privileged and subject to copyright. If you
+have received this email in error, please advise the sender and delete
+it. If you are not the intended recipient of this email, you must not
+use, copy or disclose its content to anyone. You must not copy or
+communicate to others content that is confidential or subject to
+copyright, unless you have the consent of the content owner.
+
+------_=_NextPart_001_01C4E300.8655EDA0-- + +From pgsql-performance-owner@postgresql.org Thu Dec 16 00:09:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 715BA3B545C + for ; + Thu, 16 Dec 2004 00:09:17 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88676-04 + for ; + Thu, 16 Dec 2004 00:09:08 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id C275E3B5513 + for ; + Thu, 16 Dec 2004 00:09:10 +0000 (GMT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id iBG099v07993; + Wed, 15 Dec 2004 19:09:09 -0500 (EST) +From: Bruce Momjian +Message-Id: <200412160009.iBG099v07993@candle.pha.pa.us> +Subject: Re: indentifying the database in a Postgres log file. +In-Reply-To: <16C0CF355FA04944A69E5A4F5299D30B110E9C@ganesh.au.lpint.net> +To: Theo Galanakis +Date: Wed, 15 Dec 2004 19:09:09 -0500 (EST) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL108 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/199 +X-Sequence-Number: 9574 + +Theo Galanakis wrote: +> +> I have written a program that parses a syslog file, reading all the postgres +> transactions. I would like to know if there is a way for postgres to log +> also the specific database the sql statement originated from. +> +> The only options available in the postgresql.conf are: +> #log_connections = false +> #log_duration = false +> #log_pid = false +> #log_statement = false +> #log_timestamp = false +> #log_hostname = false +> #log_source_port = false +> +> Is this possible? Or is there a smart work around. + +In pre-8.0 the only way to do it is to log connections, grab the +database from there, and add the pid to join all log rows back to the +server row. In 8.0 we have log_line_prefix that can display all +information. + +-- + 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 Dec 16 01:30:48 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 254C53B5887 + for ; + Thu, 16 Dec 2004 01:30:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 13194-04 + for ; + Thu, 16 Dec 2004 01:30:17 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0173C3B5885 + for ; + Thu, 16 Dec 2004 01:30:19 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBG1U8l2018422; + Wed, 15 Dec 2004 20:30:08 -0500 (EST) +To: Greg Stark +Cc: josh@agliodbs.com, "Stacy White" , + pgsql-performance@postgresql.org +Subject: Re: Partitioned table performance +In-reply-to: <87oegvqrst.fsf@stark.xeocode.com> +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412102152.40442.josh@agliodbs.com> + <001f01c4e26c$99719680$0200a8c0@grownups> + <200412151025.02262.josh@agliodbs.com> + <87oegvqrst.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "15 Dec 2004 14:34:26 -0500" +Date: Wed, 15 Dec 2004 20:30:08 -0500 +Message-ID: <18421.1103160608@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/200 +X-Sequence-Number: 9575 + +Greg Stark writes: +> But I'm a bit puzzled. Why would Append have any significant cost? It's just +> taking the tuples from one plan node and returning them until they run out, +> then taking the tuples from another plan node. It should have no i/o cost and +> hardly any cpu cost. Where is the time going? + +As best I can tell by profiling, the cost of the Append node per se is +indeed negligible --- no more than a couple percent of the runtime in +CVS tip for a test case similar to Stacy White's example. + +It looks bad in EXPLAIN ANALYZE, but you have to realize that passing +the tuples up through the Append node doubles the instrumentation +overhead of EXPLAIN ANALYZE, which is pretty sizable already. (If you +turn on \timing in psql and try the query itself vs. EXPLAIN ANALYZE, +the actual elapsed time is about double, at least for me.) + +The other effect, which I hadn't expected, is that the seqscans +themselves actually slow down. I get + +regression=# explain analyze SELECT COUNT(*), MAX(bar1) FROM super_foo ; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=16414.32..16414.32 rows=1 width=4) (actual time=32313.980..32313.988 rows=1 loops=1) + -> Append (cost=0.00..13631.54 rows=556555 width=4) (actual time=0.232..21848.401 rows=524289 loops=1) + -> Seq Scan on super_foo (cost=0.00..0.00 rows=1 width=4) (actual time=0.020..0.020 rows=0 loops=1) + -> Seq Scan on sub_foo1 super_foo (cost=0.00..6815.77 rows=278277 width=4) (actual time=0.187..6926.395 rows=262144 loops=1) + -> Seq Scan on sub_foo2 super_foo (cost=0.00..6815.77 rows=278277 width=4) (actual time=0.168..7026.953 rows=262145 loops=1) + Total runtime: 32314.993 ms +(6 rows) + +regression=# explain analyze SELECT COUNT(*), MAX(bar1) FROM sub_foo1; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------ + Aggregate (cost=8207.16..8207.16 rows=1 width=4) (actual time=9850.420..9850.428 rows=1 loops=1) + -> Seq Scan on sub_foo1 (cost=0.00..6815.77 rows=278277 width=4) (actual time=0.202..4642.401 rows=262144 loops=1) + Total runtime: 9851.423 ms +(3 rows) + +Notice the actual times for the sub_foo1 seqscans. That increase (when +counted for both input tables) almost exactly accounts for the +difference in non-EXPLAIN ANALYZE runtime. + +After digging around, I find that the reason for the difference is that +the optimization to avoid a projection step (ExecProject) isn't applied +for scans of inheritance unions: + + /* + * Can't do it with inheritance cases either (mainly because Append + * doesn't project). + */ + if (rel->reloptkind != RELOPT_BASEREL) + return false; + +So if you were to try the example in a pre-7.4 PG, which didn't have +that optimization, you'd probably find that the speeds were just about +the same. (I'm too lazy to verify this though.) + +I looked briefly at what it would take to cover this case, and decided +that it's a nontrivial change, so it's too late to do something about it +for 8.0. I think it's probably possible to fix it though, at least for +cases where the child tables have rowtypes identical to the parent. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 16 04:50:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 63E023B57FC + for ; + Thu, 16 Dec 2004 04:50:22 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 75107-07 + for ; + Thu, 16 Dec 2004 04:50:06 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 3C6BA3B5890 + for ; + Thu, 16 Dec 2004 04:50:05 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 4CA693195C; Thu, 16 Dec 2004 05:50:04 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Trying to create multi db query in one large queries +Date: Wed, 15 Dec 2004 23:22:15 -0500 +Organization: cbbrowne Computing Inc +Lines: 30 +Message-ID: +References: <41BE4598.2040708@mimos.my> <200412132318.24052.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:VanubhAjd6dS3Vm+sB1v8r4r0tE= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.092 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/201 +X-Sequence-Number: 9576 + +The world rejoiced as josh@agliodbs.com (Josh Berkus) wrote: +> Hasnul, +> +>> My question is if there is a query design that would query multiple +>> server simultaneously.. would that improve the performance? +> +> Not without a vast amounts of infrastructure coding. You're +> basically talking about what Oracle has spent the last 3 years and +> $100 million working on. + +I recall a presentation from folks from Empress Software + back in about '94 or '95 offering this very +feature as part of the "base functionality" of their product. + +I'm not sure it's quite fair to assess things as "more or less +preposterous" simply because they prove ludicrously expensive to +develop on a particular platform that happens to be targeted by even +more ludicrous quantities of development dollars... + +On the other hand, it seems unlikely that "improved performance" would +be one of the merits of this approach... +-- +let name="cbbrowne" and tld="gmail.com" in String.concat "@" [name;tld];; +http://www3.sympatico.ca/cbbrowne/ +Rules of the Evil Overlord #92. "If I ever talk to the hero on the +phone, I will not taunt him. Instead I will say that his dogged +perseverance has given me new insight on the futility of my evil ways +and that if he leaves me alone for a few months of quiet contemplation +I will likely return to the path of righteousness. (Heroes are +incredibly gullible in this regard.) + +From pgsql-performance-owner@postgresql.org Thu Dec 16 16:11:18 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CE3063CAFEB + for ; + Thu, 16 Dec 2004 16:11:16 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30239-10 + for ; + Thu, 16 Dec 2004 16:11:12 +0000 (GMT) +Received: from www.bowmansystems.com (ns1.bowmansystems.com [65.166.193.2]) + by svr1.postgresql.org (Postfix) with ESMTP id E0F913B6808 + for ; + Thu, 16 Dec 2004 16:11:10 +0000 (GMT) +Received: from ads2.ucomics.com (unknown [65.166.193.11]) + by www.bowmansystems.com (Postfix) with ESMTP id F106DCF13 + for ; + Thu, 16 Dec 2004 09:58:39 -0600 (CST) +Subject: Improve performance of query +From: Richard Rowell +To: pgsql-performance@postgresql.org +Content-Type: multipart/mixed; boundary="=-mkxYs3UaZx5NlZtSqwtX" +Date: Thu, 16 Dec 2004 10:11:07 -0600 +Message-Id: <1103213467.9908.65.camel@richard> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.429 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST +X-Spam-Level: * +X-Archive-Number: 200412/202 +X-Sequence-Number: 9577 + + +--=-mkxYs3UaZx5NlZtSqwtX +Content-Type: text/plain +Content-Transfer-Encoding: 7bit + +I'm trying to port our application from MS-SQL to Postgres. We have +implemented all of our rather complicated application security in the +database. The query that follows takes a half of a second or less on +MS-SQL server and around 5 seconds on Postgres. My concern is that this +data set is rather "small" by our applications standards. It is not +unusual for the da_answer table to have 2-4 million records. I'm +worried that if this very small data set is taking 5 seconds, then a +"regular sized" data set will take far too long. + +I originally thought the NOT EXISTS on the +"da_data_restrict_except_open" table was killing performance, but the +query took the exact same amount of time after I deleted all rows from +this table. Note that the hard-coded 999999999.0, and 4000 parameters, +as well as the parameter to svp_getparentproviders are the three +variables that change from one run of this query to the next. + +I'm using Postgres 7.4.5 as packaged in Debian. shared_buffers is set +to 57344 and sort_mem=4096. + +The machine has an AMD 1.8+ and ` gig of RAM. Here are some relevant +performance statistics: +richard:/usr/share/cups/model# cat /proc/sys/kernel/shmmax +536870912 +richard:/usr/share/cups/model# cat /proc/sys/kernel/shmall +536870912 +richard:/home/richard# hdparm -tT /dev/hda + Timing cached reads: 1112 MB in 2.00 seconds = 556.00 MB/sec + Timing buffered disk reads: 176 MB in 3.02 seconds = 58.28 MB/sec + +I have included an EXPLAIN ANALYZE, relevant table counts, and relevant +indexing information. If anyone has any suggestions on how to improve +performance.... TIA! + +SELECT tab.answer_id, client_id, question_id, recordset_id, +date_effective, virt_field_name +FROM +( + SELECT a.uid AS answer_id, a.client_id, a.question_id, recordset_id, +date_effective + FROM da_answer a + WHERE a.date_effective <= 9999999999.0 + AND a.inactive != 1 + AND + ( + 5000 = 4000 + OR + (EXISTS (SELECT * FROM svp_getparentproviderids(1) WHERE +svp_getparentproviderids = a.provider_id)) + ) + UNION + SELECT a.uid AS answer_id, a.client_id, a.question_id, recordset_id, +date_effective + FROM da_answer a, + ( + SELECT main_id + FROM da_data_restrict + WHERE type_id = 2 + AND (provider_id IN (SELECT * FROM svp_getparentproviderids(1))) + + UNION + + SELECT sa.uid AS main_id + FROM da_answer sa + JOIN da_data_restrict_except_closed dr ON dr.main_id = +sa.uid AND dr.type_id = 2 AND dr.except_provider_id = 1 + WHERE (restricted = 1) + AND (restricted_closed_except = 1) + AND sa.covered_by_roi = 1 + UNION + SELECT sa.uid AS main_id + FROM da_answer sa + WHERE (restricted = 0) + AND (restricted_open_except = 1) + AND (NOT EXISTS (SELECT dr.main_id FROM +da_data_restrict_except_open dr WHERE (dr.main_id = sa.uid) AND +(dr.type_id = 2) AND (dr.except_provider_id in (select * from +svp_getparentproviderids(1))))) + AND sa.covered_by_roi = 1 + UNION + SELECT sa.uid AS main_id FROM da_answer sa WHERE (restricted += 0) AND (restricted_open_except = 0) + AND sa.covered_by_roi = 1 + ) sec + WHERE a.covered_by_roi = 1 + AND a.date_effective <= 9999999999.0 + AND a.inactive != 1 + AND a.uid = sec.main_id + AND 5000 > 4000 +) tab, da_question q +WHERE tab.question_id = q.uid AND (min_access_level <= 4000 OR +min_access_level IS NULL) + +Table counts from relevant tables +da_question 1095 +da_answer 21117 +da_question 1095 +da_data_restrict_except_closed 3087 +da_data_restrict_except_open 13391 +svp_getparentproviderids(1) 1 + +Relevant Index +create index in_da_data_restrict_provider_id on +da_data_restrict(provider_id); +create index in_da_data_restrict_main_id on da_data_restrict(main_id); +create index in_da_data_restrict_type_id on da_data_restrict(type_id); +create index in_da_data_restrict_client_id on +da_data_restrict(client_id); +create index in_da_dr_type_provider on +da_data_restrict(type_id,provider_id); + +create index in_da_data_rec_provider_id ON +da_data_restrict_except_closed(provider_id); +create index in_da_data_rec_type_id ON +da_data_restrict_except_closed(type_id); +create index in_da_data_rec_main_id ON +da_data_restrict_except_closed(main_id); +create index in_da_data_rec_except_provider_id ON +da_data_restrict_except_closed(except_provider_id); + +create index in_da_data_reo_provider_id ON +da_data_restrict_except_open(provider_id); +create index in_da_data_reo_type_id ON +da_data_restrict_except_open(type_id); +create index in_da_data_reo_main_id ON +da_data_restrict_except_open(main_id); +create index in_da_data_reo_except_provider_id ON +da_data_restrict_except_open(except_provider_id); + +create index in_da_answer_client_id ON da_answer(client_id); +create index in_da_answer_provider_id ON da_answer(provider_id); +create index in_da_answer_question_id ON da_answer(question_id); +create index in_da_answer_recordset_id ON da_answer(recordset_id); +create index in_da_answer_restricted ON da_answer(restricted); +create index in_da_answer_restricted_open_except ON +da_answer(restricted_open_except); +create index in_da_answer_restricted_closed_except ON +da_answer(restricted_closed_except); +create index in_da_answer_date_effective ON da_answer(date_effective); +create index in_da_answer_inactive ON da_answer(inactive); +create index in_da_answer_covered_by_roi ON da_answer(covered_by_roi); + +create index in_da_ed_inactive_roi ON da_answer(date_effective,inactive, +covered_by_roi); + +create index in_da_question_mal ON da_question(min_access_level); + + +--=-mkxYs3UaZx5NlZtSqwtX +Content-Disposition: attachment; filename=explain.txt +Content-Type: text/plain; name=explain.txt; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit + + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Hash Join (cost=1054186.23..1054631.36 rows=4496 width=67) (actual time=4902.250..4979.060 rows=7653 loops=1) + Hash Cond: ("outer".question_id = "inner".uid) + -> Subquery Scan tab (cost=1054123.62..1054457.09 rows=13339 width=24) (actual time=4896.963..4933.896 rows=7657 loops=1) + -> Unique (cost=1054123.62..1054323.70 rows=13339 width=24) (actual time=4896.948..4915.498 rows=7657 loops=1) + -> Sort (cost=1054123.62..1054156.96 rows=13339 width=24) (actual time=4896.944..4903.402 rows=7717 loops=1) + Sort Key: answer_id, client_id, question_id, recordset_id, date_effective + -> Append (cost=0.00..1053209.67 rows=13339 width=24) (actual time=279.091..4841.605 rows=7717 loops=1) + -> Subquery Scan "*SELECT* 1" (cost=0.00..64034.15 rows=10540 width=24) (actual time=279.089..4419.371 rows=161 loops=1) + -> Seq Scan on da_answer a (cost=0.00..63928.75 rows=10540 width=24) (actual time=279.080..4418.808 rows=161 loops=1) + Filter: ((date_effective <= 9999999999::double precision) AND (inactive <> 1) AND (subplan)) + SubPlan + -> Function Scan on svp_getparentproviderids (cost=0.00..15.00 rows=5 width=4) (actual time=0.203..0.203 rows=0 loops=21089) + Filter: (svp_getparentproviderids = $1) + -> Subquery Scan "*SELECT* 2" (cost=988627.58..989175.52 rows=2799 width=24) (actual time=290.730..417.720 rows=7556 loops=1) + -> Hash Join (cost=988627.58..989147.53 rows=2799 width=24) (actual time=290.722..395.739 rows=7556 loops=1) + Hash Cond: ("outer".main_id = "inner".uid) + -> Subquery Scan sec (cost=987913.23..988002.59 rows=5957 width=4) (actual time=203.862..225.462 rows=7567 loops=1) + -> Unique (cost=987913.23..987943.02 rows=5957 width=4) (actual time=203.851..215.834 rows=7567 loops=1) + -> Sort (cost=987913.23..987928.12 rows=5957 width=4) (actual time=203.843..207.273 rows=7567 loops=1) + Sort Key: main_id + -> Append (cost=160.61..987539.72 rows=5957 width=4) (actual time=35.798..187.293 rows=7567 loops=1) + -> Subquery Scan "*SELECT* 1" (cost=160.61..164.53 rows=46 width=4) (actual time=35.796..35.923 rows=35 loops=1) + -> Hash Join (cost=160.61..164.07 rows=46 width=4) (actual time=35.791..35.868 rows=35 loops=1) + Hash Cond: ("outer".svp_getparentproviderids = "inner".provider_id) + -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual time=0.491..0.492 rows=1 loops=1) + -> Function Scan on svp_getparentproviderids (cost=0.00..12.50 rows=1000 width=4) (actual time=0.473..0.474 rows=1 loops=1) + -> Hash (cost=145.50..145.50 rows=46 width=8) (actual time=35.256..35.256 rows=0 loops=1) + -> Index Scan using in_da_dr_type_provider on da_data_restrict (cost=0.00..145.50 rows=46 width=8) (actual time=0.041..26.627 rows=7280 loops=1) + Index Cond: (type_id = 2) + -> Subquery Scan "*SELECT* 2" (cost=0.00..53.69 rows=1 width=4) (actual time=0.030..0.030 rows=0 loops=1) + -> Nested Loop (cost=0.00..53.68 rows=1 width=4) (actual time=0.028..0.028 rows=0 loops=1) + -> Index Scan using in_da_data_rec_except_provider_id on da_data_restrict_except_closed dr (cost=0.00..50.65 rows=1 width=4) (actual time=0.026..0.026 rows=0 loops=1) + Index Cond: (except_provider_id = 1) + Filter: (type_id = 2) + -> Index Scan using da_answer_pkey on da_answer sa (cost=0.00..3.02 rows=1 width=4) (never executed) + Index Cond: ("outer".main_id = sa.uid) + Filter: ((restricted = 1) AND (restricted_closed_except = 1) AND (covered_by_roi = 1)) + -> Subquery Scan "*SELECT* 3" (cost=0.00..986638.62 rows=678 width=4) (actual time=0.346..77.393 rows=1841 loops=1) + -> Index Scan using in_da_answer_restricted_open_except on da_answer sa (cost=0.00..986631.84 rows=678 width=4) (actual time=0.342..74.614 rows=1841 loops=1) + Index Cond: (restricted_open_except = 1) + Filter: ((restricted = 0) AND (covered_by_roi = 1) AND (NOT (subplan))) + SubPlan + -> Nested Loop IN Join (cost=0.00..227.09 rows=1 width=4) (actual time=0.026..0.026 rows=0 loops=1841) + Join Filter: ("outer".except_provider_id = "inner".svp_getparentproviderids) + -> Index Scan using in_da_data_reo_main_id on da_data_restrict_except_open dr (cost=0.00..212.09 rows=1 width=8) (actual time=0.009..0.014 rows=2 loops=1841) + Index Cond: (main_id = $0) + Filter: (type_id = 2) + -> Function Scan on svp_getparentproviderids (cost=0.00..12.50 rows=1000 width=4) (actual time=0.002..0.003 rows=1 loops=3793) + -> Subquery Scan "*SELECT* 4" (cost=0.00..682.87 rows=5232 width=4) (actual time=0.064..69.107 rows=5691 loops=1) + -> Seq Scan on da_answer sa (cost=0.00..630.55 rows=5232 width=4) (actual time=0.059..61.052 rows=5691 loops=1) + Filter: ((restricted = 0) AND (restricted_open_except = 0) AND (covered_by_roi = 1)) + -> Hash (cost=630.55..630.55 rows=9922 width=24) (actual time=86.699..86.699 rows=0 loops=1) + -> Seq Scan on da_answer a (cost=0.00..630.55 rows=9922 width=24) (actual time=0.043..73.232 rows=10062 loops=1) + Filter: ((covered_by_roi = 1) AND (date_effective <= 9999999999::double precision) AND (inactive <> 1)) + -> Hash (cost=61.69..61.69 rows=369 width=47) (actual time=5.241..5.241 rows=0 loops=1) + -> Seq Scan on da_question q (cost=0.00..61.69 rows=369 width=47) (actual time=0.026..4.071 rows=1087 loops=1) + Filter: ((min_access_level <= 4000) OR (min_access_level IS NULL)) + Total runtime: 4986.508 ms +(58 rows) + + count +------- + 21117 +(1 row) + + +--=-mkxYs3UaZx5NlZtSqwtX-- + + +From pgsql-performance-owner@postgresql.org Sat Dec 18 07:24:08 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 945473B6E05 + for ; + Thu, 16 Dec 2004 16:59:36 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51846-03 + for ; + Thu, 16 Dec 2004 16:59:26 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id 8C8163B6D3E + for ; + Thu, 16 Dec 2004 16:59:25 +0000 (GMT) +Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id iBGGxC320477; + Thu, 16 Dec 2004 10:59:12 -0600 +Message-ID: <41C1BED9.2050206@arbash-meinel.com> +Date: Thu, 16 Dec 2004 10:59:05 -0600 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard Rowell +Cc: pgsql-performance@postgresql.org +Subject: Re: Improve performance of query +References: <1103213467.9908.65.camel@richard> +In-Reply-To: <1103213467.9908.65.camel@richard> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigB805556CFEF48331061997A8" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/238 +X-Sequence-Number: 9613 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigB805556CFEF48331061997A8 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +The first thing to check... Did you do a recent VACUUM ANALYZE? This +updates all the statistics. There are a number of places where it says +"rows=1000" which is usually the "I have no idea, let me guess 1000". +Also, there are a number of places where the estimates are pretty far +off. For instance: + +Richard Rowell wrote: + +>-> Subquery Scan "*SELECT* 1" (cost=0.00..64034.15 rows=10540 width=24) (actual time=279.089..4419.371 rows=161 loops=1) +> +> +estimating 10,000 when only 161 is a little bit different. + +> -> Seq Scan on da_answer a (cost=0.00..63928.75 rows=10540 width=24) (actual time=279.080..4418.808 rows=161 loops=1) +> Filter: ((date_effective <= 9999999999::double precision) AND (inactive <> 1) AND (subplan)) +> +> +Though this could be a lack of cross-column statistics. If 2 columns are +correlated, the planner isn't as accurate as it could be. Also, +date_effective <= 9999999999 doesn't seem very restrictive, could you +use a between statement? (date between 0 and 9999999). I know for +timestamps usually giving a between is better than a single sided query. + +This one was underestimated. + +>-> Subquery Scan "*SELECT* 2" (cost=988627.58..989175.52 rows=2799 width=24) (actual time=290.730..417.720 rows=7556 loops=1) +> -> Hash Join (cost=988627.58..989147.53 rows=2799 width=24) (actual time=290.722..395.739 rows=7556 loops=1) +> Hash Cond: ("outer".main_id = "inner".uid) +> +> +This is one of the ones that looks like it didn't have any ideas. It +could be because of the function. You might consider adding a function +index, though I think there are some caveats there. + +>-> Function Scan on svp_getparentproviderids (cost=0.00..12.50 rows=1000 width=4) (actual time=0.473..0.474 rows=1 loops=1) +> +> +Another very poor estimation. It might be a need to increase the +statistics for this column (ALTER TABLE, ALTER COLUMN, SET STATISTICS). +IIRC, compared with other db's postgres defaults to a much lower +statistics value. Try changing it from 10 (?) to 100 or so. There was a +discussion that every column with an index should use higher statistics. + +>-> Index Scan using in_da_dr_type_provider on da_data_restrict (cost=0.00..145.50 rows=46 width=8) (actual time=0.041..26.627 rows=7280 loops=1) +> +> +I'm not a great optimizer, these are just some first things to look at. +Your sort mem seems pretty low to me (considering you have 1GB of RAM). +Perhaps you could bump that up to 40MB instead of 4MB. Also, if you run +this query twice in a row, is it still slow? (Sometimes it takes a bit +of work to get the right indexes loaded into ram, but then it is faster.) + +Just some guesses, +John +=:-> + + +--------------enigB805556CFEF48331061997A8 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFBwb7bJdeBCYSNAAMRArmYAKCQ8N27hjN+eSBXTmH2kB70NL0Y9gCfT3kU +vnwYgtnYTtrh0l7ZVeOoQi0= +=sD8c +-----END PGP SIGNATURE----- + +--------------enigB805556CFEF48331061997A8-- + +From pgsql-performance-owner@postgresql.org Thu Dec 16 17:05:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EA9A73B6BA9 + for ; + Thu, 16 Dec 2004 17:02:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51762-05 + for ; + Thu, 16 Dec 2004 17:02:23 +0000 (GMT) +Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) + by svr1.postgresql.org (Postfix) with ESMTP id D8F463B6F4F + for ; + Thu, 16 Dec 2004 17:02:23 +0000 (GMT) +Received: from ns.snowman.net (ns.snowman.net [10.10.0.2]) + by relay.snowman.net (8.13.1/8.13.1/Debian-19) with ESMTP id + iBGH2Afu027039 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); + Thu, 16 Dec 2004 12:02:11 -0500 +Received: from ns.snowman.net (localhost [127.0.0.1]) + by ns.snowman.net (8.13.1/8.13.1/Debian-19) with ESMTP id + iBGH2KcH010365 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); + Thu, 16 Dec 2004 12:02:20 -0500 +Received: (from sfrost@localhost) + by ns.snowman.net (8.13.1/8.13.1/Submit) id iBGH2Klm010363; + Thu, 16 Dec 2004 12:02:20 -0500 +Date: Thu, 16 Dec 2004 12:02:20 -0500 +From: Stephen Frost +To: Richard Rowell +Cc: pgsql-performance@postgresql.org +Subject: Re: Improve performance of query +Message-ID: <20041216170220.GK10437@ns.snowman.net> +Mail-Followup-To: Richard Rowell , + pgsql-performance@postgresql.org +References: <1103213467.9908.65.camel@richard> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="NVZ4M1l8awdqSrjc" +Content-Disposition: inline +In-Reply-To: <1103213467.9908.65.camel@richard> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.4.24ns.3.0 (i686) +X-Uptime: 12:01:24 up 320 days, 11:58, 9 users, load average: 0.19, 0.23, 0.15 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/203 +X-Sequence-Number: 9578 + + +--NVZ4M1l8awdqSrjc +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +* Richard Rowell (richard@bowmansystems.com) wrote: +> I have included an EXPLAIN ANALYZE, relevant table counts, and relevant +> indexing information. If anyone has any suggestions on how to improve +> performance.... TIA! + +Just a thought- do the UNION's actually have to be union's or would +having them be 'UNION ALL's work? + + Stephen + +--NVZ4M1l8awdqSrjc +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.5 (GNU/Linux) + +iD8DBQFBwb+arzgMPqB3kigRAjmVAJ9HOb0yZZ8L8hmL4JVurBr7ZC4yQwCeL32M +9rb52sFyjs5Ij3+K9ILXBE8= +=SNzJ +-----END PGP SIGNATURE----- + +--NVZ4M1l8awdqSrjc-- + +From pgsql-performance-owner@postgresql.org Thu Dec 16 17:08:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 00A5D3B6A19 + for ; + Thu, 16 Dec 2004 17:08:33 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54692-04 + for ; + Thu, 16 Dec 2004 17:08:21 +0000 (GMT) +Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.192]) + by svr1.postgresql.org (Postfix) with ESMTP id B10DA3B70AE + for ; + Thu, 16 Dec 2004 17:08:21 +0000 (GMT) +Received: by rproxy.gmail.com with SMTP id q1so790023rnf + for ; + Thu, 16 Dec 2004 09:08:20 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; + b=REguJH6XR1Qkqit2AZIpzol+TeRb8L4u6hDB8ACKaWwP1+IHho7yZ8JbXjXW1Lcrij6xo80NP/wi/K1XdOwizwJo4RwqhC3QHvWt06kZGIGoV1jtEkYSqASTQ6IMm3a5P60GpZRfetmnOuQcr9tJbzTGOEcimDIfDUdGSD0RbRk= +Received: by 10.38.150.47 with SMTP id x47mr1922848rnd; + Thu, 16 Dec 2004 09:08:20 -0800 (PST) +Received: by 10.38.97.37 with HTTP; Thu, 16 Dec 2004 09:08:20 -0800 (PST) +Message-ID: <9c7da1c904121609081705d8cc@mail.gmail.com> +Date: Thu, 16 Dec 2004 11:08:20 -0600 +From: Jon Anderson +Reply-To: Jon Anderson +To: pgsql-performance@postgresql.org +Subject: Seqscan rather than Index +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/204 +X-Sequence-Number: 9579 + +I have a table 'Alias' with 541162 rows. It's created as follows: + +CREATE TABLE alias +( + id int4 NOT NULL, + person_id int4 NOT NULL, + last_name varchar(30), + first_name varchar(30), + middle_name varchar(30), + questioned_identity_flag varchar, + CONSTRAINT alias_pkey PRIMARY KEY (id) +) + +After populating the data, (I can provide a data file if necessary) + I created 2 indexes as follows: +CREATE INDEX "PX_Alias" ON alias USING btree (id); +ALTER TABLE alias CLUSTER ON "PX_Alias"; +CREATE INDEX "IX_Alias_Last_Name" ON alias USING btree (last_name); +VACUUM FULL ANALYSE Alias + +Then I run a query: +SELECT * FROM Alias WHERE last_name = 'ANDERSON' +This results in a seqscan, rather than an index scan: + {SEQSCAN + :startup_cost 0.00 + :total_cost 11970.53 + :plan_rows 3608 + :plan_width 41 + :targetlist ( + {TARGETENTRY + :resdom + {RESDOM + :resno 1 + :restype 23 + :restypmod -1 + :resname id + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 1 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 1 + :vartype 23 + :vartypmod -1 + :varlevelsup 0 + :varnoold 1 + :varoattno 1 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 2 + :restype 23 + :restypmod -1 + :resname person_id + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 2 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 2 + :vartype 23 + :vartypmod -1 + :varlevelsup 0 + :varnoold 1 + :varoattno 2 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 3 + :restype 1043 + :restypmod 34 + :resname last_name + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 3 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 3 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 3 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 4 + :restype 1043 + :restypmod 34 + :resname first_name + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 4 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 4 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 4 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 5 + :restype 1043 + :restypmod 34 + :resname middle_name + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 5 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 5 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 5 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 6 + :restype 1043 + :restypmod -1 + :resname questioned_identity_flag + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 6 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 6 + :vartype 1043 + :vartypmod -1 + :varlevelsup 0 + :varnoold 1 + :varoattno 6 + } + } + ) + :qual ( + {OPEXPR + :opno 98 + :opfuncid 67 + :opresulttype 16 + :opretset false + :args ( + {RELABELTYPE + :arg + {VAR + :varno 1 + :varattno 3 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 3 + } + :resulttype 25 + :resulttypmod -1 + :relabelformat 0 + } + {CONST + :consttype 25 + :constlen -1 + :constbyval false + :constisnull false + :constvalue 12 [ 12 0 0 0 65 78 68 69 82 83 79 78 ] + } + ) + } + ) + :lefttree <> + :righttree <> + :initPlan <> + :extParam (b) + :allParam (b) + :nParamExec 0 + :scanrelid 1 + } + +Seq Scan on alias (cost=0.00..11970.53 rows=3608 width=41) (actual +time=0.000..2103.000 rows=4443 loops=1) + Filter: ((last_name)::text = 'ANDERSON'::text) +Total runtime: 2153.000 ms + + +If I: +SET enable_seqscan TO off; + +Then the query takes about 300 milliseconds, and uses the index scan. +It seems that the cost estimate is slightly higher for the index scan, +but in reality, it is much faster: + + + {INDEXSCAN + :startup_cost 0.00 + :total_cost 12148.18 + :plan_rows 3608 + :plan_width 41 + :targetlist ( + {TARGETENTRY + :resdom + {RESDOM + :resno 1 + :restype 23 + :restypmod -1 + :resname id + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 1 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 1 + :vartype 23 + :vartypmod -1 + :varlevelsup 0 + :varnoold 1 + :varoattno 1 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 2 + :restype 23 + :restypmod -1 + :resname person_id + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 2 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 2 + :vartype 23 + :vartypmod -1 + :varlevelsup 0 + :varnoold 1 + :varoattno 2 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 3 + :restype 1043 + :restypmod 34 + :resname last_name + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 3 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 3 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 3 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 4 + :restype 1043 + :restypmod 34 + :resname first_name + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 4 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 4 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 4 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 5 + :restype 1043 + :restypmod 34 + :resname middle_name + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 5 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 5 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 5 + } + } + {TARGETENTRY + :resdom + {RESDOM + :resno 6 + :restype 1043 + :restypmod -1 + :resname questioned_identity_flag + :ressortgroupref 0 + :resorigtbl 2780815 + :resorigcol 6 + :resjunk false + } + :expr + {VAR + :varno 1 + :varattno 6 + :vartype 1043 + :vartypmod -1 + :varlevelsup 0 + :varnoold 1 + :varoattno 6 + } + } + ) + :qual <> + :lefttree <> + :righttree <> + :initPlan <> + :extParam (b) + :allParam (b) + :nParamExec 0 + :scanrelid 1 + :indxid (o 5117678) + :indxqual (( + {OPEXPR + :opno 98 + :opfuncid 67 + :opresulttype 16 + :opretset false + :args ( + {VAR + :varno 1 + :varattno 1 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 3 + } + {CONST + :consttype 25 + :constlen -1 + :constbyval false + :constisnull false + :constvalue 12 [ 12 0 0 0 65 78 68 69 82 83 79 78 ] + } + ) + } + )) + :indxqualorig (( + {OPEXPR + :opno 98 + :opfuncid 67 + :opresulttype 16 + :opretset false + :args ( + {RELABELTYPE + :arg + {VAR + :varno 1 + :varattno 3 + :vartype 1043 + :vartypmod 34 + :varlevelsup 0 + :varnoold 1 + :varoattno 3 + } + :resulttype 25 + :resulttypmod -1 + :relabelformat 0 + } + {CONST + :consttype 25 + :constlen -1 + :constbyval false + :constisnull false + :constvalue 12 [ 12 0 0 0 65 78 68 69 82 83 79 78 ] + } + ) + } + )) + :indxstrategy ((i 3)) + :indxsubtype ((o 0)) + :indxlossy ((i 0)) + :indxorderdir 1 + } + +Index Scan using "IX_Alias_Last_Name" on alias (cost=0.00..12148.18 +rows=3608 width=41) (actual time=0.000..200.000 rows=4443 loops=1) + Index Cond: ((last_name)::text = 'ANDERSON'::text) +Total runtime: 220.000 ms + +Dropping the index and cluster on the id doesn't make any difference. + +According to the pg_stats table, 'ANDERSON' is one of the most +frequent values; howerver, querying by another 'JACKSON', will use the +index scan. + +Any hints on what to do to make PostgreSQL use the index? This seems +like a fairly simple case, isn't it? (I'm using 8.0-rc1 on windows.) + +From pgsql-performance-owner@postgresql.org Thu Dec 16 17:15:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A842E3B6C5A + for ; + Thu, 16 Dec 2004 17:15:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 57893-05 + for ; + Thu, 16 Dec 2004 17:15:41 +0000 (GMT) +Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net + [194.217.242.88]) + by svr1.postgresql.org (Postfix) with ESMTP id DA4B33B674F + for ; + Thu, 16 Dec 2004 17:15:40 +0000 (GMT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-30.mail.demon.net with esmtp (Exim 4.42) + id 1CezE1-0009We-0F; Thu, 16 Dec 2004 17:15:39 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 590A616BC4; Thu, 16 Dec 2004 17:15:29 +0000 (GMT) +Message-ID: <41C1C2B1.90000@archonet.com> +Date: Thu, 16 Dec 2004 17:15:29 +0000 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Richard Rowell +Cc: pgsql-performance@postgresql.org +Subject: Re: Improve performance of query +References: <1103213467.9908.65.camel@richard> +In-Reply-To: <1103213467.9908.65.camel@richard> +Content-Type: text/plain; charset=ISO-8859-15; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.091 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/205 +X-Sequence-Number: 9580 + +Richard Rowell wrote: +> I'm trying to port our application from MS-SQL to Postgres. We have +> implemented all of our rather complicated application security in the +> database. The query that follows takes a half of a second or less on +> MS-SQL server and around 5 seconds on Postgres. My concern is that this +> data set is rather "small" by our applications standards. It is not +> unusual for the da_answer table to have 2-4 million records. I'm +> worried that if this very small data set is taking 5 seconds, then a +> "regular sized" data set will take far too long. +> +> I originally thought the NOT EXISTS on the +> "da_data_restrict_except_open" table was killing performance, but the +> query took the exact same amount of time after I deleted all rows from +> this table. Note that the hard-coded 999999999.0, and 4000 parameters, +> as well as the parameter to svp_getparentproviders are the three +> variables that change from one run of this query to the next. +> +> I'm using Postgres 7.4.5 as packaged in Debian. shared_buffers is set +> to 57344 and sort_mem=4096. + +That shared_buffers value sounds too large for 1GB RAM - rewind to 10000 +say. Also make sure you've read the "performance tuning" article at: + http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php + +> I have included an EXPLAIN ANALYZE, relevant table counts, and relevant +> indexing information. If anyone has any suggestions on how to improve +> performance.... TIA! + +I think it's the function call(s). + +> SELECT tab.answer_id, client_id, question_id, recordset_id, +> date_effective, virt_field_name +> FROM +> ( +> SELECT a.uid AS answer_id, a.client_id, a.question_id, recordset_id, +> date_effective +> FROM da_answer a +> WHERE a.date_effective <= 9999999999.0 +> AND a.inactive != 1 +> AND +> ( +> 5000 = 4000 +> OR +> (EXISTS (SELECT * FROM svp_getparentproviderids(1) WHERE +> svp_getparentproviderids = a.provider_id)) +> ) +... +>SubPlan +> -> Function Scan on svp_getparentproviderids (cost=0.00..15.00 rows=5 width=4) (actual time=0.203..0.203 rows=0 loops=21089) +> Filter: (svp_getparentproviderids = $1) + +Here it's running 21,089 loops around your function. Each one isn't +costing much, but it's the total that's killing you I think. It might be +possible to mark the function STABLE or such, depending on what it does +- see http://www.postgresql.org/docs/7.4/static/sql-createfunction.html + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Thu Dec 16 17:19:37 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D284E3B2547 + for ; + Thu, 16 Dec 2004 17:19:34 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 60263-07 + for ; + Thu, 16 Dec 2004 17:19:24 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 468173B6630 + for ; + Thu, 16 Dec 2004 17:19:23 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBGHJCwY025885; + Thu, 16 Dec 2004 12:19:12 -0500 (EST) +To: Richard Rowell +Cc: pgsql-performance@postgresql.org +Subject: Re: Improve performance of query +In-reply-to: <1103213467.9908.65.camel@richard> +References: <1103213467.9908.65.camel@richard> +Comments: In-reply-to Richard Rowell + message dated "Thu, 16 Dec 2004 10:11:07 -0600" +Date: Thu, 16 Dec 2004 12:19:11 -0500 +Message-ID: <25884.1103217551@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/206 +X-Sequence-Number: 9581 + +Richard Rowell writes: +> I'm trying to port our application from MS-SQL to Postgres. We have +> implemented all of our rather complicated application security in the +> database. The query that follows takes a half of a second or less on +> MS-SQL server and around 5 seconds on Postgres. + +The EXPLAIN shows that most of the time is going into repeated +executions of svp_getparentproviderids() in the first UNION arm: + +> -> Seq Scan on da_answer a (cost=0.00..63928.75 rows=10540 width=24) (actual time=279.080..4418.808 rows=161 loops=1) +> Filter: ((date_effective <= 9999999999::double precision) AND (inactive <> 1) AND (subplan)) +> SubPlan +> -> Function Scan on svp_getparentproviderids (cost=0.00..15.00 rows=5 width=4) (actual time=0.203..0.203 rows=0 loops=21089) +> Filter: (svp_getparentproviderids = $1) + +I'd suggest replacing the EXISTS coding by IN: + (EXISTS (SELECT * FROM svp_getparentproviderids(1) WHERE svp_getparentproviderids = a.provider_id)) +to + (a.provider_id IN (SELECT * FROM svp_getparentproviderids(1))) +The latter form is likely to be significantly faster in PG 7.4. + +It's also possible that the speed loss compared to MSSQL is really +inside the svp_getparentproviderids function; you should look into +that rather than assuming this query per se is at fault. + +Also, do you actually need UNION as opposed to UNION ALL? The +duplicate-elimination behavior of UNION is a bit expensive if not +needed. It looks from the EXPLAIN output that some of the unions +aren't actually eliminating any rows. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 16 17:24:45 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 59A623B6682 + for ; + Thu, 16 Dec 2004 17:24:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 62043-05 + for ; + Thu, 16 Dec 2004 17:24:31 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id E8A9D3B64B7 + for ; + Thu, 16 Dec 2004 17:24:31 +0000 (GMT) +Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id iBGHOV320789 + for ; Thu, 16 Dec 2004 11:24:31 -0600 +Message-ID: <41C1C4CA.4080607@arbash-meinel.com> +Date: Thu, 16 Dec 2004 11:24:26 -0600 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +Cc: pgsql-performance@postgresql.org +Subject: Re: Improve performance of query +References: <1103213467.9908.65.camel@richard> +In-Reply-To: <1103213467.9908.65.camel@richard> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigF1660BBFAFEA877450028FAA" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/207 +X-Sequence-Number: 9582 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigF1660BBFAFEA877450028FAA +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +The first thing to check... Did you do a recent VACUUM ANALYZE? This +updates all the statistics. There are a number of places where it says +"rows=1000" which is usually the "I have no idea, let me guess 1000". +Also, there are a number of places where the estimates are pretty far +off. For instance: + +Richard Rowell wrote: + +>-> Subquery Scan "*SELECT* 1" (cost=0.00..64034.15 rows=10540 width=24) (actual time=279.089..4419.371 rows=161 loops=1) +> +> +estimating 10,000 when only 161 is a little bit different. + +> -> Seq Scan on da_answer a (cost=0.00..63928.75 rows=10540 width=24) (actual time=279.080..4418.808 rows=161 loops=1) +> Filter: ((date_effective <= 9999999999::double precision) AND (inactive <> 1) AND (subplan)) +> +> +Though this could be a lack of cross-column statistics. If 2 columns are +correlated, the planner isn't as accurate as it could be. Also, +date_effective <= 9999999999 doesn't seem very restrictive, could you +use a between statement? (date between 0 and 9999999). I know for +timestamps usually giving a between is better than a single sided query. + +This one was underestimated. + +>-> Subquery Scan "*SELECT* 2" (cost=988627.58..989175.52 rows=2799 width=24) (actual time=290.730..417.720 rows=7556 loops=1) +> -> Hash Join (cost=988627.58..989147.53 rows=2799 width=24) (actual time=290.722..395.739 rows=7556 loops=1) +> Hash Cond: ("outer".main_id = "inner".uid) +> +> +This is one of the ones that looks like it didn't have any ideas. It +could be because of the function. You might consider adding a function +index, though I think there are some caveats there. + +>-> Function Scan on svp_getparentproviderids (cost=0.00..12.50 rows=1000 width=4) (actual time=0.473..0.474 rows=1 loops=1) +> +> +Another very poor estimation. It might be a need to increase the +statistics for this column (ALTER TABLE, ALTER COLUMN, SET STATISTICS). +IIRC, compared with other db's postgres defaults to a much lower +statistics value. Try changing it from 10 (?) to 100 or so. There was a +discussion that every column with an index should use higher statistics. + +>-> Index Scan using in_da_dr_type_provider on da_data_restrict (cost=0.00..145.50 rows=46 width=8) (actual time=0.041..26.627 rows=7280 loops=1) +> +> +I'm not a great optimizer, these are just some first things to look at. +Your sort mem seems pretty low to me (considering you have 1GB of RAM). +Perhaps you could bump that up to 40MB instead of 4MB. Also, if you run +this query twice in a row, is it still slow? (Sometimes it takes a bit +of work to get the right indexes loaded into ram, but then it is faster.) + +Just some guesses, +John +=:-> + + + +--------------enigF1660BBFAFEA877450028FAA +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.4 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFBwcTKJdeBCYSNAAMRAkmEAKClhpUHULd2IENkFdzSStbdPH0bxQCdE34l +nieGHqeczah1CFyhitKbydw= +=08oE +-----END PGP SIGNATURE----- + +--------------enigF1660BBFAFEA877450028FAA-- + +From pgsql-performance-owner@postgresql.org Thu Dec 16 17:32:08 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE7CB3B681E + for ; + Thu, 16 Dec 2004 17:32:05 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 79045-08 + for ; + Thu, 16 Dec 2004 17:32:01 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id EE6CD3B662E + for ; + Thu, 16 Dec 2004 17:32:01 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBGHVrSC026004; + Thu, 16 Dec 2004 12:31:53 -0500 (EST) +To: Jon Anderson +Cc: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +In-reply-to: <9c7da1c904121609081705d8cc@mail.gmail.com> +References: <9c7da1c904121609081705d8cc@mail.gmail.com> +Comments: In-reply-to Jon Anderson + message dated "Thu, 16 Dec 2004 11:08:20 -0600" +Date: Thu, 16 Dec 2004 12:31:53 -0500 +Message-ID: <26003.1103218313@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/208 +X-Sequence-Number: 9583 + +Jon Anderson writes: +> Any hints on what to do to make PostgreSQL use the index? + +You might want to reduce random_page_cost a little. + +Keep in mind that your test case is small enough to fit in RAM and is +probably not reflective of what will happen with larger tables. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 16 20:07:06 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E31403CAE12; + Thu, 16 Dec 2004 20:06:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 55705-02; Thu, 16 Dec 2004 20:06:55 +0000 (GMT) +Received: from internalmx.vasoftware.com (internalmx1.vasoftware.com + [12.152.184.149]) + by svr1.postgresql.org (Postfix) with ESMTP id 237323B6ACF; + Thu, 16 Dec 2004 20:06:54 +0000 (GMT) +Received: from c-67-169-111-163.client.comcast.net ([67.169.111.163]:44761 + helo=[192.168.1.3]) by internalmx.vasoftware.com with asmtp + (Cipher TLSv1:RC4-SHA:128) (Exim 4.22 #1 (Debian)) + id 1Cf1ti-0007Vc-3N by VAauthid with fixed_plain; + Thu, 16 Dec 2004 12:06:51 -0800 +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net> +Content-Transfer-Encoding: 7bit +Cc: pgsql-hackers@postgresql.org +From: Adi Alurkar +Subject: UNION ALL vs INHERITANCE +Date: Thu, 16 Dec 2004 12:06:46 -0800 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619) +X-Spam-Score-Int: -1000 +X-EA-Verified: internalmx.vasoftware.com 1Cf1ti-0007Vc-3N + c77d7b6b26866ced000b1a180cd4a80c +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/209 +X-Sequence-Number: 9584 + +Greetings, + +Why does the append resulting from a inheritance take longer than one +resulting from UNION ALL? + +summary: +Append resulting from inheritance: +-> Append (cost=0.00..17.43 rows=2 width=72) (actual +time=3.876..245.320 rows=28 loops=1) +Append resulting from UNION ALL: +-> Append (cost=0.00..17.45 rows=2 width=72) (actual +time=3.730..81.465 rows=28 loops=1) + +in the case below both f_f_all_base and for_f_all_new are clustered on +the index based (group_id, group_forum_id) they were vacuum analyzed +before the test below. + +perftestdb=# \d f_f_all_base + Table "public.f_f_all_base" + Column | Type | Modifiers +----------------+----------+--------------------------- + msg_id | integer | not null + group_id | integer | default 0 + group_forum_id | integer | not null default 0 + subject | text | not null default ''::text + date | integer | not null default 0 + user_name | text | not null default ''::text + all_tidx | tsvector | not null +Indexes: + "forftiallb_pk_1102715767" primary key, btree (msg_id) + "fftiallbgfid_1102715649" btree (group_forum_id) + "fftiallbgrgfid_1102715649" btree (group_id, group_forum_id) + +perftestdb=# \d for_f_all_new + Table "public.for_f_all_new" + Column | Type | Modifiers +----------------+----------+--------------------------- + msg_id | integer | not null + group_id | integer | default 0 + group_forum_id | integer | not null default 0 + subject | text | not null default ''::text + date | integer | not null default 0 + user_name | text | not null default ''::text + all_tidx | tsvector | not null +Indexes: + "forfallnew_pk_ts" primary key, btree (msg_id) + "forfallnewgrgfid" btree (group_id, group_forum_id) + "forfallnewgrid" btree (group_forum_id) +Inherits: f_f_all_base + +perftestdb=# explain analyze (SELECT f_f_all_base.msg_id, +f_f_all_base.subject, f_f_all_base.date, f_f_all_base.user_name, '' as +fromemail FROM f_f_all_base WHERE (all_tidx @@ to_tsquery('MMcache') ) +AND f_f_all_base.group_id = 78745) ORDER BY msg_id DESC LIMIT 26 OFFSET +0; + + QUERY PLAN +------------------------------------------------------------------------ +------------------------------------------------------------------------ +----------------------- + Limit (cost=17.44..17.44 rows=2 width=72) (actual +time=245.726..245.827 rows=26 loops=1) + -> Sort (cost=17.44..17.44 rows=2 width=72) (actual +time=245.719..245.755 rows=26 loops=1) + Sort Key: public.f_f_all_base.msg_id + -> Result (cost=0.00..17.43 rows=2 width=72) (actual +time=3.885..245.564 rows=28 loops=1) + -> Append (cost=0.00..17.43 rows=2 width=72) (actual +time=3.876..245.320 rows=28 loops=1) + -> Index Scan using fftiallbgrgfid_1102715649 on +f_f_all_base (cost=0.00..3.52 rows=1 width=51) (actual +time=3.871..244.356 rows=28 loops=1) + Index Cond: (group_id = 78745) + Filter: (all_tidx @@ '\'mmcach\''::tsquery) + -> Index Scan using forfallnewgrgfid on +for_f_all_new f_f_all_base (cost=0.00..13.91 rows=1 width=72) (actual +time=0.816..0.816 rows=0 loops=1) + Index Cond: (group_id = 78745) + Filter: (all_tidx @@ '\'mmcach\''::tsquery) + Total runtime: 246.022 ms +(12 rows) + +perftestdb=# explain analyze (SELECT f_f_all_base.msg_id, +f_f_all_base.subject, f_f_all_base.date, f_f_all_base.user_name, '' as +fromemail FROM ONLY f_f_all_base WHERE (all_tidx @@ +to_tsquery('MMcache') ) AND f_f_all_base.group_id = 78745) UNION ALL +(SELECT f_f_all_new.msg_id, f_f_all_new.subject, f_f_all_new.date, +f_f_all_new.user_name, '' as fromemail FROM for_f_all_new f_f_all_new +WHERE (all_tidx @@ to_tsquery('MMcache') ) AND f_f_all_new.group_id = +78745) ORDER BY msg_id DESC LIMIT 26 OFFSET 0; + + QUERY PLAN +------------------------------------------------------------------------ +------------------------------------------------------------------------ +---------------------- + Limit (cost=17.46..17.46 rows=2 width=72) (actual time=81.703..81.833 +rows=26 loops=1) + -> Sort (cost=17.46..17.46 rows=2 width=72) (actual +time=81.695..81.737 rows=26 loops=1) + Sort Key: msg_id + -> Append (cost=0.00..17.45 rows=2 width=72) (actual +time=3.730..81.465 rows=28 loops=1) + -> Subquery Scan "*SELECT* 1" (cost=0.00..3.53 rows=1 +width=51) (actual time=3.726..80.213 rows=28 loops=1) + -> Index Scan using fftiallbgrgfid_1102715649 on +f_f_all_base (cost=0.00..3.52 rows=1 width=51) (actual +time=3.714..79.996 rows=28 loops=1) + Index Cond: (group_id = 78745) + Filter: (all_tidx @@ '\'mmcach\''::tsquery) + -> Subquery Scan "*SELECT* 2" (cost=0.00..13.92 rows=1 +width=72) (actual time=1.146..1.146 rows=0 loops=1) + -> Index Scan using forfallnewgrgfid on +for_f_all_new f_f_all_new (cost=0.00..13.91 rows=1 width=72) (actual +time=1.135..1.135 rows=0 loops=1) + Index Cond: (group_id = 78745) + Filter: (all_tidx @@ '\'mmcach\''::tsquery) + Total runtime: 82.108 ms +(13 rows) +-- +Adi Alurkar (DBA sf.NET) +1024D/79730470 A491 5724 74DE 956D 06CB D844 6DF1 B972 7973 0470 + + +From pgsql-performance-owner@postgresql.org Thu Dec 16 22:13:29 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 35A433CB2CB; + Thu, 16 Dec 2004 22:13:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24441-04; Thu, 16 Dec 2004 22:13:13 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 3859A3CB284; + Thu, 16 Dec 2004 22:13:14 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBGMDEBv001870; + Thu, 16 Dec 2004 17:13:15 -0500 (EST) +To: Adi Alurkar +Cc: pgsql-performance@postgresql.org, pgsql-hackers@postgresql.org +Subject: Re: UNION ALL vs INHERITANCE +In-reply-to: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net> +References: <0393D590-4F9E-11D9-A3E8-000A95C4BD7A@sf.net> +Comments: In-reply-to Adi Alurkar + message dated "Thu, 16 Dec 2004 12:06:46 -0800" +Date: Thu, 16 Dec 2004 17:13:14 -0500 +Message-ID: <1869.1103235194@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/210 +X-Sequence-Number: 9585 + +Adi Alurkar writes: +> Why does the append resulting from a inheritance take longer than one +> resulting from UNION ALL? + +The index scan is where the time difference is: + +> -> Index Scan using fftiallbgrgfid_1102715649 on +> f_f_all_base (cost=0.00..3.52 rows=1 width=51) (actual +> time=3.871..244.356 rows=28 loops=1) +> Index Cond: (group_id = 78745) +> Filter: (all_tidx @@ '\'mmcach\''::tsquery) + +> -> Index Scan using fftiallbgrgfid_1102715649 on +> f_f_all_base (cost=0.00..3.52 rows=1 width=51) (actual +> time=3.714..79.996 rows=28 loops=1) +> Index Cond: (group_id = 78745) +> Filter: (all_tidx @@ '\'mmcach\''::tsquery) + +One would have to suppose this is a caching effect, ie, the data is +already in RAM on the second try and doesn't have to be read from disk +again. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Dec 17 01:19:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D5B153CB7E6 + for ; + Fri, 17 Dec 2004 01:19:08 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 86128-04 + for ; + Fri, 17 Dec 2004 01:18:55 +0000 (GMT) +Received: from gizmo09ps.bigpond.com (gizmo09ps.bigpond.com [144.140.71.19]) + by svr1.postgresql.org (Postfix) with SMTP id 9E8FF3CADB0 + for ; + Fri, 17 Dec 2004 01:18:53 +0000 (GMT) +Received: (qmail 26041 invoked from network); 17 Dec 2004 01:18:49 -0000 +Received: from unknown (HELO psmam09.bigpond.com) (144.135.25.94) + by gizmo09ps.bigpond.com with SMTP; 17 Dec 2004 01:18:49 -0000 +Received: from cpe-203-45-184-181.qld.bigpond.net.au ([203.45.184.181]) by + psmam09.bigpond.com(MAM REL_3_4_2a 162/6255816) with SMTP id + 6255816; Fri, 17 Dec 2004 11:18:49 +1000 +Date: Fri, 17 Dec 2004 11:18:36 +0000 +From: David Brown +To: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +X-Mailer: David Brown's registered AK-Mail 3.2 [eng] +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +Message-Id: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=3.772 tagged_above=0 required=5 + tests=DATE_IN_FUTURE_06_12, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS, + MSGID_FROM_MTA_ID +X-Spam-Level: *** +X-Archive-Number: 200412/211 +X-Sequence-Number: 9586 + +> You might want to reduce random_page_cost a little. + +> Keep in mind that your test case is small enough to fit in RAM and is +> probably not reflective of what will happen with larger tables. + +I am also running 8.0 rc1 for Windows. Despite many hours spent tweaking v= +arious planner cost constants, I found little effect on cost estimates. Ev= +en reducing random_page_cost from 4.0 to 0.1 had negligible impact and fai= +led to significantly influence the planner. + +Increasing the statistics target for the last_name column to 250 or so *ma= +y* help, at least if you're only selecting one name at a time. That's the = +standard advice around here and the only thing I've found useful. Half the= + threads in this forum are about under-utilized indexes. It would be great= + if someone could admit the planner is broken and talk about actually fixi= +ng it! + +I'm unconvinced that the planner only favours sequential scans as table si= +ze decreases. In my experience so far, larger tables have the same problem= + only it's more noticeable. + +The issue hits PostgreSQL harder than others because of its awful sequenti= +al scan speed, which is two to five times slower than other DBMS. The arch= +ives show there has been talk for years about this, but it seems, no solut= +ion. The obvious thing to consider is the block size, but people have trie= +d increasing this in the past with only marginal success. + +Regards + +David + +From pgsql-performance-owner@postgresql.org Fri Dec 17 13:04:03 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 59F063CC9A3 + for ; + Fri, 17 Dec 2004 13:04:01 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52421-04 + for ; + Fri, 17 Dec 2004 13:03:55 +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 66F2F3CC982 + for ; + Fri, 17 Dec 2004 13:03:57 +0000 (GMT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-35.mail.demon.net with esmtp (Exim 4.42) + id 1CfHlI-000N7e-Gh; Fri, 17 Dec 2004 13:03:13 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id B80DF162E6; Fri, 17 Dec 2004 13:03:55 +0000 (GMT) +Message-ID: <41C2D936.3060901@archonet.com> +Date: Fri, 17 Dec 2004 13:03:50 +0000 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: David Brown +Cc: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> +In-Reply-To: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.087 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/212 +X-Sequence-Number: 9587 + +David Brown wrote: +>> You might want to reduce random_page_cost a little. +> +> +>> Keep in mind that your test case is small enough to fit in RAM and +>> is probably not reflective of what will happen with larger tables. +> +> +> I am also running 8.0 rc1 for Windows. Despite many hours spent +> tweaking various planner cost constants, I found little effect on +> cost estimates. Even reducing random_page_cost from 4.0 to 0.1 had +> negligible impact and failed to significantly influence the planner. + +I'm not sure setting random_page_cost below 1.0 makes much sense. + +> Increasing the statistics target for the last_name column to 250 or +> so *may* help, at least if you're only selecting one name at a time. + +Not going to do anything in this case. The planner is roughly right +about how many rows will be returned, it's just not expecting everything +to be in RAM. + +> That's the standard advice around here and the only thing I've found +> useful. Half the threads in this forum are about under-utilized +> indexes. It would be great if someone could admit the planner is +> broken and talk about actually fixing it! + +Not sure I agree here - when the stats are accurate, you can get the +planner to make near-optimal choices most of the time. Is there any +particular pattern you've seen? + +> I'm unconvinced that the planner only favours sequential scans as +> table size decreases. In my experience so far, larger tables have the +> same problem only it's more noticeable. + +Hmm - assuming your statistics are good, this would suggest the other +cost settings just aren't right for your hardware. + +> The issue hits PostgreSQL harder than others because of its awful +> sequential scan speed, which is two to five times slower than other +> DBMS. The archives show there has been talk for years about this, but +> it seems, no solution. The obvious thing to consider is the block +> size, but people have tried increasing this in the past with only +> marginal success. + +Must admit this puzzles me. Are you saying you can't saturate your disk +I/O? Or are you saying other DBMS store records in 0.5 to 0.2 times less +space than PG? + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Fri Dec 17 15:48:45 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 17FC13CCE1D + for ; + Fri, 17 Dec 2004 15:48:44 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23864-02 + for ; + Fri, 17 Dec 2004 15:48:32 +0000 (GMT) +Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) + by svr1.postgresql.org (Postfix) with ESMTP id A43413CC64C + for ; + Fri, 17 Dec 2004 15:48:33 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1CfKKj-00067I-00; Fri, 17 Dec 2004 10:47:57 -0500 +To: Richard Huxton +Cc: David Brown , + pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> +In-Reply-To: <41C2D936.3060901@archonet.com> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 17 Dec 2004 10:47:57 -0500 +Message-ID: <87acsdkjte.fsf@stark.xeocode.com> +Lines: 46 +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 hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/213 +X-Sequence-Number: 9588 + +Richard Huxton writes: + +> Not going to do anything in this case. The planner is roughly right about how +> many rows will be returned, it's just not expecting everything to be in RAM. + +That doesn't make sense or else it would switch to the index at +random_page_cost = 1.0. If it was still using a sequential scan at +random_page_cost < 1 then perhaps he had some problem with his query like +mismatched data types that forced it to use a full scan. + +> > That's the standard advice around here and the only thing I've found +> > useful. Half the threads in this forum are about under-utilized +> > indexes. It would be great if someone could admit the planner is +> > broken and talk about actually fixing it! +> +> Not sure I agree here - when the stats are accurate, you can get the planner to +> make near-optimal choices most of the time. Is there any particular pattern +> you've seen? + +The most common cause I've seen here is that Postgres makes very pessimistic +assumptions about selectivity when it doesn't know better. Every other +database I've tested assumes 'col > ?' is about 5% selectivity . Postgres +assumes 33%. + +Postgres is also more pessimistic about the efficiency of index scans. It's +willing to use a sequential scan down to well below 5% selectivity when other +databases use the more traditional rule of thumb of 10%. + +In combination these effects do seem to cause an _awful_ lot of complaints. + + +> > The issue hits PostgreSQL harder than others because of its awful +> > sequential scan speed, which is two to five times slower than other +> > DBMS. The archives show there has been talk for years about this, but +> > it seems, no solution. The obvious thing to consider is the block +> > size, but people have tried increasing this in the past with only +> > marginal success. +> +> Must admit this puzzles me. Are you saying you can't saturate your disk I/O? Or +> are you saying other DBMS store records in 0.5 to 0.2 times less space than PG? + +I don't know what he's talking about either. Perhaps he's thinking of people +who haven't been running vacuum enough? + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 17:45:15 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 44FC73CCF06 + for ; + Fri, 17 Dec 2004 17:45:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83121-09 + for ; + Fri, 17 Dec 2004 17:45:06 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 74F1B3CCF1E + for ; + Fri, 17 Dec 2004 17:45:05 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBHHifxt021111; + Fri, 17 Dec 2004 12:44:41 -0500 (EST) +To: Greg Stark +Cc: Richard Huxton , + David Brown , pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +In-reply-to: <87acsdkjte.fsf@stark.xeocode.com> +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "17 Dec 2004 10:47:57 -0500" +Date: Fri, 17 Dec 2004 12:44:41 -0500 +Message-ID: <21110.1103305481@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/214 +X-Sequence-Number: 9589 + +Greg Stark writes: +> Postgres is also more pessimistic about the efficiency of index scans. It's +> willing to use a sequential scan down to well below 5% selectivity when other +> databases use the more traditional rule of thumb of 10%. + +However, other databases are probably basing their analysis on a +different execution model. Since we have to visit both heap and index +in all cases, we do indeed have a larger penalty for index use. + +I've looked pretty closely at the cost model for index access, believe me. +It's not pessimistic; if anything it is undercharging for index access. +(For one thing it treats the index's internal fetches as sequential +access, when in reality they are probably random.) + +I think the one effect that's not being modeled is amortization of index +fetches across successive queries. The cost model is pretty much based +on the assumption that each query starts from ground zero, whereas in +reality a heavily used index will certainly have all its upper levels in +RAM, and if it's not too large the leaf pages might all be cached too. +I wouldn't want to switch the planner over to making that assumption +exclusively, but we could talk about having a cost parameter that dials +the assumption up or down. + +Awhile back I tried rewriting btcostestimate to charge zero for +accessing the metapage and the upper index levels, but charge +random_page_cost for fetching leaf pages. For small indexes this came +out with worse (larger) numbers than we have now, which is not the +direction we want to go in :-(. So I think that we have to somehow +honestly model caching of index pages across queries. + +Of course, to be completely fair such a modification should account for +caching of heap pages as well, so it would also bring down the estimates +for seqscans. But I'd be willing to accept a model that considers only +caching of index pages as a zero-order approximation. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Dec 17 17:58:38 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6EBBD3CCF1C + for ; + Fri, 17 Dec 2004 17:58:35 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 91216-05 + for ; + Fri, 17 Dec 2004 17:58:25 +0000 (GMT) +Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) + by svr1.postgresql.org (Postfix) with ESMTP id 217973CCF2A + for ; + Fri, 17 Dec 2004 17:58:24 +0000 (GMT) +Received: from [82.234.66.131] (imac.rilk.com [82.234.66.131]) + by postfix3-2.free.fr (Postfix) with ESMTP id 048BAC3F8 + for ; + Fri, 17 Dec 2004 18:58:22 +0100 (CET) +Mime-Version: 1.0 (Apple Message framework v619) +Content-Transfer-Encoding: quoted-printable +Message-Id: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +To: pgsql-performance@postgresql.org +From: Pailloncy Jean-Gerard +Subject: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 18:58:21 +0100 +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/215 +X-Sequence-Number: 9590 + +I have a table with an tsearch2 full text index on PG 7.4.2. And a=20 +query against the index is really slow. +I try to do a "VACUUM FULL VERBOSE ANALYZE pkpoai.metadata" and I got=20 +an error. +I monitor memory usage with top, and pg backend uses more and more=20 +memory and hits the limit of 1GB of RAM use. + +What can I do ? + +Cordialement, +Jean-G=E9rard Pailloncy + +# top (just before the error) + PID UID PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND +20461 503 -5 0 765M 824M sleep biowai 4:26 33.20% postgres + +# VACUUM FULL VERBOSE ANALYZE pkpoai.metadata; +INFO: vacuuming "pkpoai.metadata" +INFO: "metadata": found 167405 removable, 3133397 nonremovable row=20 +versions in 344179 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 168 to 2032 bytes long. +There were 13368 unused item pointers. +Total free space (including removable row versions) is 174825268 bytes. +9362 pages are or will become empty, including 0 at the end of the=20 +table. +150433 pages containing 166581084 free bytes are potential move=20 +destinations. +CPU 6.28s/1.42u sec elapsed 51.87 sec. +INFO: index "metadata_pkey" now contains 3133397 row versions in 10501=20= + +pages +DETAIL: 88443 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.39s/1.35u sec elapsed 26.12 sec. +INFO: index "metadata_archive_key" now contains 3133397 row versions=20 +in 45268 pages +DETAIL: 88443 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.44s/1.65u sec elapsed 355.32 sec. +INFO: index "metadata_oai_identifier" now contains 3133397 row=20 +versions in 36336 pages +DETAIL: 88443 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.67s/1.69u sec elapsed 258.86 sec. +INFO: index "test_metadata_all" now contains 3133397 row versions in=20 +97707 pages +DETAIL: 88442 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.88s/3.98u sec elapsed 230.70 sec. +ERROR: out of memory +DETAIL: Failed on request of size 168. + + +EXPLAIN SELECT id, title, author, add_authors, identifier, date FROM=20 +pkpoai.metadata WHERE to_tsvector('default_english',=20 +coalesce(author,'') ||' '|| coalesce(affiliation,'') ||' '||=20 +coalesce(add_authors,'') ||' '|| coalesce(add_affiliations,'') ||' '||=20= + +coalesce(title,'') ||' '|| coalesce(abstract,'') ||' '||=20 +coalesce(discipline,'') ||' '|| coalesce(topic,'') ||' '||=20 +coalesce(publisher,'') ||' '|| coalesce(contributors,'') ||' '||=20 +coalesce(approach,'') ||' '|| coalesce(format,'') ||' '||=20 +coalesce(source,'') ||' '|| coalesce(language,'') ||' '||=20 +coalesce(relation,'') ||' '|| coalesce(coverage,'') ) @@=20 +to_tsquery('default_english','pailloncy') LIMIT 100 + +Limit (cost=3D0.00..310.80 rows=3D100 width=3D176) + -> Index Scan using test_metadata_all on metadata =20 +(cost=3D0.00..9706.34 rows=3D3123 width=3D176) + Index Cond: (to_tsvector('default_english'::text,=20 +((((((((((((((((((((((((((((((COALESCE(author, ''::text) || ' '::text)=20= + +|| COALESCE(affiliation, ''::text)) || ' '::text) ||=20 +COALESCE(add_authors, ''::text)) || ' '::text) ||=20 +COALESCE(add_affiliations, ''::text)) || ' '::text) || COALESCE(title,=20= + +''::text)) || ' '::text) || COALESCE(abstract, ''::text)) || ' '::text)=20= + +|| COALESCE(discipline, ''::text)) || ' '::text) || COALESCE(topic,=20 +''::text)) || ' '::text) || COALESCE(publisher, ''::text)) || '=20 +'::text) || COALESCE(contributors, ''::text)) || ' '::text) ||=20 +COALESCE(approach, ''::text)) || ' '::text) || COALESCE(format,=20 +''::text)) || ' '::text) || COALESCE(source, ''::text)) || ' '::text)=20 +|| (COALESCE("language", ''::character varying))::text) || ' '::text)=20 +|| COALESCE(relation, ''::text)) || ' '::text) || COALESCE(coverage,=20 +''::text))) @@ '\'paillonci\''::tsquery) + Filter: (to_tsvector('default_english'::text,=20 +((((((((((((((((((((((((((((((COALESCE(author, ''::text) || ' '::text)=20= + +|| COALESCE(affiliation, ''::text)) || ' '::text) ||=20 +COALESCE(add_authors, ''::text)) || ' '::text) ||=20 +COALESCE(add_affiliations, ''::text)) || ' '::text) || COALESCE(title,=20= + +''::text)) || ' '::text) || COALESCE(abstract, ''::text)) || ' '::text)=20= + +|| COALESCE(discipline, ''::text)) || ' '::text) || COALESCE(topic,=20 +''::text)) || ' '::text) || COALESCE(publisher, ''::text)) || '=20 +'::text) || COALESCE(contributors, ''::text)) || ' '::text) ||=20 +COALESCE(approach, ''::text)) || ' '::text) || COALESCE(format,=20 +''::text)) || ' '::text) || COALESCE(source, ''::text)) || ' '::text)=20 +|| (COALESCE("language", ''::character varying))::text) || ' '::text)=20 +|| COALESCE(relation, ''::text)) || ' '::text) || COALESCE(coverage,=20 +''::text))) @@ '\'paillonci\''::tsquery) +Total runtime: 148.567 ms + + +EXPLAIN ANALYZE SELECT id, title, author, add_authors, identifier, date=20= + +FROM pkpoai.metadata WHERE to_tsvector('default_english',=20 +coalesce(author,'') ||' '|| coalesce(affiliation,'') ||' '||=20 +coalesce(add_authors,'') ||' '|| coalesce(add_affiliations,'') ||' '||=20= + +coalesce(title,'') ||' '|| coalesce(abstract,'') ||' '||=20 +coalesce(discipline,'') ||' '|| coalesce(topic,'') ||' '||=20 +coalesce(publisher,'') ||' '|| coalesce(contributors,'') ||' '||=20 +coalesce(approach,'') ||' '|| coalesce(format,'') ||' '||=20 +coalesce(source,'') ||' '|| coalesce(language,'') ||' '||=20 +coalesce(relation,'') ||' '|| coalesce(coverage,'') ) @@=20 +to_tsquery('default_english','pailloncy') LIMIT 100 + +Limit (cost=3D0.00..310.80 rows=3D100 width=3D176) (actual=20 +time=3D168751.929..168751.929 rows=3D0 loops=3D1) + -> Index Scan using test_metadata_all on metadata =20 +(cost=3D0.00..9706.34 rows=3D3123 width=3D176) (actual=20 +time=3D168751.921..168751.921 rows=3D0 loops=3D1) + Index Cond: (to_tsvector('default_english'::text,=20 +((((((((((((((((((((((((((((((COALESCE(author, ''::text) || ' '::text)=20= + +|| COALESCE(affiliation, ''::text)) || ' '::text) ||=20 +COALESCE(add_authors, ''::text)) || ' '::text) ||=20 +COALESCE(add_affiliations, ''::text)) || ' '::text) || COALESCE(title,=20= + +''::text)) || ' '::text) || COALESCE(abstract, ''::text)) || ' '::text)=20= + +|| COALESCE(discipline, ''::text)) || ' '::text) || COALESCE(topic,=20 +''::text)) || ' '::text) || COALESCE(publisher, ''::text)) || '=20 +'::text) || COALESCE(contributors, ''::text)) || ' '::text) ||=20 +COALESCE(approach, ''::text)) || ' '::text) || COALESCE(format,=20 +''::text)) || ' '::text) || COALESCE(source, ''::text)) || ' '::text)=20 +|| (COALESCE("language", ''::character varying))::text) || ' '::text)=20 +|| COALESCE(relation, ''::text)) || ' '::text) || COALESCE(coverage,=20 +''::text))) @@ '\'paillonci\''::tsquery) + Filter: (to_tsvector('default_english'::text,=20 +((((((((((((((((((((((((((((((COALESCE(author, ''::text) || ' '::text)=20= + +|| COALESCE(affiliation, ''::text)) || ' '::text) ||=20 +COALESCE(add_authors, ''::text)) || ' '::text) ||=20 +COALESCE(add_affiliations, ''::text)) || ' '::text) || COALESCE(title,=20= + +''::text)) || ' '::text) || COALESCE(abstract, ''::text)) || ' '::text)=20= + +|| COALESCE(discipline, ''::text)) || ' '::text) || COALESCE(topic,=20 +''::text)) || ' '::text) || COALESCE(publisher, ''::text)) || '=20 +'::text) || COALESCE(contributors, ''::text)) || ' '::text) ||=20 +COALESCE(approach, ''::text)) || ' '::text) || COALESCE(format,=20 +''::text)) || ' '::text) || COALESCE(source, ''::text)) || ' '::text)=20 +|| (COALESCE("language", ''::character varying))::text) || ' '::text)=20 +|| COALESCE(relation, ''::text)) || ' '::text) || COALESCE(coverage,=20 +''::text))) @@ '\'paillonci\''::tsquery) +Total runtime: 168752.362 ms + +Information from phpPgAdmin 3.5.1 +PostgreSQL seems to suffer from the TOAST. +Sequential Index Enregistrements +Scan Read Scan Fetch INSERT UPDATE DELETE + 0 0 2 19080 0 0 0 + +I/O Performance +Heap Index TOAST TOAST Index +Disk Buffer % Disk Buffer % Disk Buffer % Disk Buffer=20= + +% +17157 1953 (10%) 46945 66047 (58%) 11781 7177 (38%) 2089 44853=20= + +(96%) + +Performance Index +Index Scan Read Fetch +metadata_archive_key 0 0 0 +metadata_oai_identifier 0 0 0 +metadata_pkey 0 0 0 +test_metadata_all 2 19080 19080 + +I/O Performance Index +Index Disk Buffer % +metadata_archive_key 0 0 (0%) +metadata_oai_identifie 0 0 (0%) +metadata_pkey 0 0 (0%) +test_metadata_all 46945 66047 (58%) + + +Structure of the Table pkpoai.metatda +I use only text field because I import data from the web and I do not=20 +know an upper limit of the fields. +id integer NOT NULL=20 +nextval('pkpoai.metadata_id_seq'::text) +archive integer NOT NULL 0 +oai_identifier character varying(255) NOT NULL +identifier text NOT NULL +datestamp timestamp without time zone NOT NULL +author text NOT NULL +email text NOT NULL +affiliation text NOT NULL +add_authors text NOT NULL +add_emails text NOT NULL +add_affiliations text NOT NULL +title text NOT NULL +abstract text NOT NULL +discipline text NOT NULL +topic text NOT NULL +publisher text NOT NULL +contributors text NOT NULL +date character varying(255) +type text NOT NULL +approach text NOT NULL +format text NOT NULL +source text NOT NULL +language character varying(255) NOT NULL +relation text NOT NULL +coverage text NOT NULL +rights text NOT NULL= + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:12:55 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6E95E3CCEFF + for ; + Fri, 17 Dec 2004 18:12:52 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 97816-06 + for ; + Fri, 17 Dec 2004 18:12:42 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id 80D583CCEB6 + for ; + Fri, 17 Dec 2004 18:12:39 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6798943; Fri, 17 Dec 2004 10:14:13 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Pailloncy Jean-Gerard +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 10:15:54 -0800 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> +In-Reply-To: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200412171015.54670.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.041 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/216 +X-Sequence-Number: 9591 + +Jean-Gerard, + +> I have a table with an tsearch2 full text index on PG 7.4.2. And a +> query against the index is really slow. +> I try to do a "VACUUM FULL VERBOSE ANALYZE pkpoai.metadata" and I got +> an error. +> I monitor memory usage with top, and pg backend uses more and more +> memory and hits the limit of 1GB of RAM use. + +What is your VACUUM_MEM set to in postgresql.conf? + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:25:07 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E1D7C3CCE8B + for ; + Fri, 17 Dec 2004 18:25:05 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01986-03 + for ; + Fri, 17 Dec 2004 18:25:01 +0000 (GMT) +Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) + by svr1.postgresql.org (Postfix) with ESMTP id 3FBCD3CC9B9 + for ; + Fri, 17 Dec 2004 18:24:59 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1CfMmH-0006wU-00; Fri, 17 Dec 2004 13:24:33 -0500 +To: Tom Lane +Cc: Greg Stark , Richard Huxton , + David Brown , pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <21110.1103305481@sss.pgh.pa.us> +In-Reply-To: <21110.1103305481@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 17 Dec 2004 13:24:33 -0500 +Message-ID: <87zn0cixzy.fsf@stark.xeocode.com> +Lines: 38 +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 hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/217 +X-Sequence-Number: 9592 + +Tom Lane writes: + +> Greg Stark writes: +> > Postgres is also more pessimistic about the efficiency of index scans. It's +> > willing to use a sequential scan down to well below 5% selectivity when other +> > databases use the more traditional rule of thumb of 10%. +> +> However, other databases are probably basing their analysis on a +> different execution model. Since we have to visit both heap and index +> in all cases, we do indeed have a larger penalty for index use. + +It's only in special cases that other databases do not have to look at the +heap. For simple queries like "select * from x where foo > ?" they still have +to look at the heap. I never looked into how much of a bonus Oracle gives for +the index-only case, I'm not sure it even takes it into account. + +> I've looked pretty closely at the cost model for index access, believe me. +> It's not pessimistic; if anything it is undercharging for index access. + +I think there's another effect here beyond the physical arithmetic. There's a +kind of teleological reasoning that goes something like "If the user created +the index chances are it's because he wanted it to be used". + +I guess that argues more for more aggressive selectivity estimates than for +biased index costing though. If I'm doing "where foo > ?" then if there's an +index on foo I probably put it there for a reason and want it to be used even +if postgres doesn't really have a clue how selective the query will be. + +> I think the one effect that's not being modeled is amortization of index +> fetches across successive queries. + +And across multiple fetches in a single query, such as with a nested loop. + +It seems like the effective_cache_size parameter should be having some +influence here. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:25:46 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B3723CCEF6 + for ; + Fri, 17 Dec 2004 18:25:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 01839-07 + for ; + Fri, 17 Dec 2004 18:25:31 +0000 (GMT) +Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) + by svr1.postgresql.org (Postfix) with ESMTP id 738643CCF31 + for ; + Fri, 17 Dec 2004 18:25:31 +0000 (GMT) +Received: from [82.234.66.131] (imac.rilk.com [82.234.66.131]) + by postfix3-2.free.fr (Postfix) with ESMTP id 8BDBCC1FB; + Fri, 17 Dec 2004 19:25:30 +0100 (CET) +In-Reply-To: <200412171015.54670.josh@agliodbs.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <200412171015.54670.josh@agliodbs.com> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Message-Id: <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> +Content-Transfer-Encoding: quoted-printable +Cc: pgsql-performance@postgresql.org +From: Pailloncy Jean-Gerard +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 19:25:29 +0100 +To: josh@agliodbs.com +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.28 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/218 +X-Sequence-Number: 9593 + +>> I have a table with an tsearch2 full text index on PG 7.4.2. And a +>> query against the index is really slow. +>> I try to do a "VACUUM FULL VERBOSE ANALYZE pkpoai.metadata" and I got +>> an error. +>> I monitor memory usage with top, and pg backend uses more and more +>> memory and hits the limit of 1GB of RAM use. +> +> What is your VACUUM_MEM set to in postgresql.conf? +vacuum_mem =3D 131072 +I have 1 GB of RAM. +There was only one running backend. + +Cordialement, +Jean-G=E9rard Pailloncy + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:34:06 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1F9913CCEE2 + for ; + Fri, 17 Dec 2004 18:33:57 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06332-04 + for ; + Fri, 17 Dec 2004 18:33:51 +0000 (GMT) +Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E35D13CCE4C + for ; + Fri, 17 Dec 2004 18:33:50 +0000 (GMT) +Received: from [82.234.66.131] (imac.rilk.com [82.234.66.131]) + (authenticated bits=0) + by mail.rilk.com (8.13.0/8.13.0) with ESMTP id iBHIWP7T011628 + (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO); + Fri, 17 Dec 2004 19:33:44 +0100 (CET) +In-Reply-To: <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <200412171015.54670.josh@agliodbs.com> + <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +Cc: Josh Berkus +From: Pailloncy Jean-Gerard +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 19:32:24 +0100 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619) +X-DCC-sgs_public_dcc_server-Metrics: mail.rilk.com 1199; Body=2 Fuz1=2 Fuz2=2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.103 tagged_above=0 required=5 tests=AWL, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200412/219 +X-Sequence-Number: 9594 + +The classic output from top (during all other index vacuum): + PID UID PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND +20461 503 14 0 13M 75M sleep semwai 5:27 2.05% postgres + +When backend hits the tsearch2 index, SIZE/RES grows until it reachs=20 +1GB, where I got the error. + PID UID PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND +20461 503 -5 0 765M 824M sleep biowai 4:26 33.20% postgres + +Cordialement, +Jean-G=E9rard Pailloncy + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:37:22 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1198F3CCE4C + for ; + Fri, 17 Dec 2004 18:37:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08007-03 + for ; + Fri, 17 Dec 2004 18:37:10 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id DECDA3CCDF0 + for ; + Fri, 17 Dec 2004 18:37:10 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBHIarjX021611; + Fri, 17 Dec 2004 13:36:53 -0500 (EST) +To: Greg Stark +Cc: Richard Huxton , + David Brown , pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +In-reply-to: <87zn0cixzy.fsf@stark.xeocode.com> +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <21110.1103305481@sss.pgh.pa.us> <87zn0cixzy.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "17 Dec 2004 13:24:33 -0500" +Date: Fri, 17 Dec 2004 13:36:52 -0500 +Message-ID: <21610.1103308612@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/220 +X-Sequence-Number: 9595 + +Greg Stark writes: +> Tom Lane writes: +>> I think the one effect that's not being modeled is amortization of index +>> fetches across successive queries. + +> And across multiple fetches in a single query, such as with a nested loop. + +Right, that's effectively the same problem. You could imagine making a +special-purpose solution for nestloop queries but I think the issue is +more general than that. + +> It seems like the effective_cache_size parameter should be having some +> influence here. + +But it doesn't :-(. e_c_s is currently only used to estimate +amortization of repeated heap-page fetches within a single indexscan. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:44:47 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 70ABE3CCE19 + for ; + Fri, 17 Dec 2004 18:44:45 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11026-01 + for ; + Fri, 17 Dec 2004 18:44:34 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id E5F2A3B77BD + for ; + Fri, 17 Dec 2004 18:44:34 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6799073; Fri, 17 Dec 2004 10:46:08 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Pailloncy Jean-Gerard +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 10:47:49 -0800 +User-Agent: KMail/1.7.1 +Cc: pgsql-performance@postgresql.org +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> + +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200412171047.49250.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.144 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200412/221 +X-Sequence-Number: 9596 + +Jean-Gerard, + +> The classic output from top (during all other index vacuum): +> PID UID PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND +> 20461 503 14 0 13M 75M sleep semwai 5:27 2.05% postgres +> +> When backend hits the tsearch2 index, SIZE/RES grows until it reachs +> 1GB, where I got the error. +> PID UID PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND +> 20461 503 -5 0 765M 824M sleep biowai 4:26 33.20% postgres + +OK, next thing to try is upgrading to 7.4.7. Since you have 7.4.2, this +should be a straightforward binary replacement. + +-- +--Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Dec 17 18:52:25 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 28E793CCD9F + for ; + Fri, 17 Dec 2004 18:52:14 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11556-10 + for ; + Fri, 17 Dec 2004 18:52:08 +0000 (GMT) +Received: from rwcrmhc11.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) + by svr1.postgresql.org (Postfix) with ESMTP id D72563CC495 + for ; + Fri, 17 Dec 2004 18:52:07 +0000 (GMT) +Received: from localhost.localdomain + (c-67-167-246-79.client.comcast.net[67.167.246.79]) + by comcast.net (rwcrmhc13) with ESMTP + id <200412171852030150091qn5e>; Fri, 17 Dec 2004 18:52:04 +0000 +Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) + by localhost.localdomain (8.12.11/8.12.11) with ESMTP id iBHIq2pg013436 + for ; Fri, 17 Dec 2004 12:52:03 -0600 +Received: (from spike@localhost) + by localhost.localdomain (8.12.11/8.12.11/Submit) id iBHIq25R013435 + for pgsql-performance@postgresql.org; Fri, 17 Dec 2004 12:52:02 -0600 +X-Authentication-Warning: localhost.localdomain: spike set sender to + mike@thegodshalls.com using -f +Date: Fri, 17 Dec 2004 12:52:01 -0600 +From: "Mike G." +To: pgsql-performance@postgresql.org +Subject: Which is more efficient? +Message-ID: <20041217185201.GA13389@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: ClamAV 0.80/615/Sat Dec 4 18:05:12 2004 + clamav-milter version 0.80j on localhost +X-Virus-Status: Clean +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/222 +X-Sequence-Number: 9597 + +Hi, + +I have data that I am taking from 2 tables, pulling out specific columns and inserting into one table. + +Is it more efficient to do: +a) insert into x + select z from y; + insert into x + select z from a; + +b) insert into x + select z from y + union all + select z from a; + +I have run both through explain. +a) 650ms +b) 741.57ms + +According to the planner option a, select z from y takes 545.93 ms +Under option b select z from y takes 553.34 ms + +Shouldn't the time predicted for the select z from y be the same? + +I would believe b would be more efficient as the inserts could be done in a batch rather than individual transactions but the planner doesn't recognize that. When I run option a through the planner I have to highlight each insert separately since the planner stops executing after the first ; it comes across. + +Mike + +From pgsql-performance-owner@postgresql.org Fri Dec 17 19:47:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 64C453CC746 + for ; + Fri, 17 Dec 2004 19:47:10 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34928-03 + for ; + Fri, 17 Dec 2004 19:46:59 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 0C8AD3CC616 + for ; + Fri, 17 Dec 2004 19:46:59 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBHJkvla022122; + Fri, 17 Dec 2004 14:46:57 -0500 (EST) +To: josh@agliodbs.com +Cc: Pailloncy Jean-Gerard , + pgsql-performance@postgresql.org +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +In-reply-to: <200412171047.49250.josh@agliodbs.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> + + <200412171047.49250.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Fri, 17 Dec 2004 10:47:49 -0800" +Date: Fri, 17 Dec 2004 14:46:57 -0500 +Message-ID: <22121.1103312817@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/223 +X-Sequence-Number: 9598 + +Josh Berkus writes: +> Jean-Gerard, +>> When backend hits the tsearch2 index, SIZE/RES grows until it reachs +>> 1GB, where I got the error. +>> PID UID PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND +>> 20461 503 -5 0 765M 824M sleep biowai 4:26 33.20% postgres + +> OK, next thing to try is upgrading to 7.4.7. Since you have 7.4.2, this +> should be a straightforward binary replacement. + +This looks like it must be a memory leak in the gist indexing code +(either gist itself or tsearch2). I don't see any post-release fixes in +the 7.4 branch that look like they fixed any such thing :-(, so it's +probably still there in 7.4.7, and likely 8.0 too. + +Jean-Gerard, can you put together a self-contained test case? I suspect +it need only look like "put some data in a table, make a tsearch2 index, +delete half the rows in the table, VACUUM FULL". But I don't have time +to try to cons up a test case right now, and especially not to figure +out what to do to duplicate your problem if it doesn't happen on the +first try. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Dec 17 19:49:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 57A683CC99A + for ; + Fri, 17 Dec 2004 19:49:13 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34615-08 + for ; + Fri, 17 Dec 2004 19:49:01 +0000 (GMT) +Received: from davinci.ethosmedia.com (server226.ethosmedia.com + [209.128.84.226]) + by svr1.postgresql.org (Postfix) with ESMTP id BC9813CC65F + for ; + Fri, 17 Dec 2004 19:49:01 +0000 (GMT) +Received: from [64.81.245.111] (account josh@agliodbs.com HELO + temoku.sf.agliodbs.com) + by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP id 6799320; Fri, 17 Dec 2004 11:50:35 -0800 +From: Josh Berkus +Reply-To: josh@agliodbs.com +Organization: Aglio Database Solutions +To: Tom Lane +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 11:52:15 -0800 +User-Agent: KMail/1.7.1 +Cc: Pailloncy Jean-Gerard , + pgsql-performance@postgresql.org +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <200412171047.49250.josh@agliodbs.com> + <22121.1103312817@sss.pgh.pa.us> +In-Reply-To: <22121.1103312817@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline +Message-Id: <200412171152.16130.josh@agliodbs.com> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.043 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/224 +X-Sequence-Number: 9599 + +Tom, + +> Jean-Gerard, can you put together a self-contained test case? =C2=A0I sus= +pect +> it need only look like "put some data in a table, make a tsearch2 index, +> delete half the rows in the table, VACUUM FULL". =C2=A0But I don't have t= +ime +> to try to cons up a test case right now, and especially not to figure +> out what to do to duplicate your problem if it doesn't happen on the +> first try. + +Might be hard. I have 2 databases with Tsearch2 on 7.4, and haven't seen a= +ny=20 +such problem. Including one that blows away about 3000 rows a day. + +=2D-=20 +=2D-Josh + +Josh Berkus +Aglio Database Solutions +San Francisco + +From pgsql-performance-owner@postgresql.org Fri Dec 17 19:59:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BCA0A3CC92E + for ; + Fri, 17 Dec 2004 19:59:17 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39266-04 + for ; + Fri, 17 Dec 2004 19:59:12 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 060EB3CCA78 + for ; + Fri, 17 Dec 2004 19:59:13 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBHJxB71022247; + Fri, 17 Dec 2004 14:59:11 -0500 (EST) +To: josh@agliodbs.com +Cc: Pailloncy Jean-Gerard , + pgsql-performance@postgresql.org +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +In-reply-to: <200412171152.16130.josh@agliodbs.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <200412171047.49250.josh@agliodbs.com> + <22121.1103312817@sss.pgh.pa.us> + <200412171152.16130.josh@agliodbs.com> +Comments: In-reply-to Josh Berkus + message dated "Fri, 17 Dec 2004 11:52:15 -0800" +Date: Fri, 17 Dec 2004 14:59:11 -0500 +Message-ID: <22246.1103313551@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/225 +X-Sequence-Number: 9600 + +Josh Berkus writes: +>> Jean-Gerard, can you put together a self-contained test case? I suspect +>> it need only look like "put some data in a table, make a tsearch2 index, +>> delete half the rows in the table, VACUUM FULL". But I don't have time +>> to try to cons up a test case right now, and especially not to figure +>> out what to do to duplicate your problem if it doesn't happen on the +>> first try. + +> Might be hard. I have 2 databases with Tsearch2 on 7.4, and haven't seen any +> such problem. Including one that blows away about 3000 rows a day. + +Yeah, I'm sure there is some particular thing Jean-Gerard is doing that +is triggering the problem. He can probably boil his existing table down +to a test case faster than we can guess what the trigger condition is. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Dec 18 07:25:31 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B19D63CCA8A + for ; + Fri, 17 Dec 2004 21:10:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67180-02 + for ; + Fri, 17 Dec 2004 21:10:50 +0000 (GMT) +Received: from web53709.mail.yahoo.com (web53709.mail.yahoo.com + [206.190.37.30]) + by svr1.postgresql.org (Postfix) with SMTP id 921EE3CC780 + for ; + Fri, 17 Dec 2004 21:10:47 +0000 (GMT) +Received: (qmail 33462 invoked by uid 60001); 17 Dec 2004 21:10:46 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=Ai7eBKvSVz+tfZ/3fgoyzw4J8RB2IWNQoIjVaKPaU1+ei9shEGt369wOMDteCpLqjF4kcqcEhsZV0A3qMZ4JUTjWtpkgIUJHejaAFz9XLepBSHV3KDg/fpNVqMfN8iRsdxyIR0qWkV2DEAgygd2Hmqrddgyz3szJgsJbuzV+wkk= + ; +Message-ID: <20041217211046.33460.qmail@web53709.mail.yahoo.com> +Received: from [140.252.3.127] by web53709.mail.yahoo.com via HTTP; + Fri, 17 Dec 2004 13:10:46 PST +Date: Fri, 17 Dec 2004 13:10:46 -0800 (PST) +From: Stan Y +Subject: Monitor CPU time per transaction? +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.04 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: * +X-Archive-Number: 200412/239 +X-Sequence-Number: 9614 + +Hi All, +I notice that most stat Postgres provides are per table or per process. + Is it possible to monitor CPU time per transaction and IO per +transaction? If can't, is there any commercial capacity planning tools +available? +Thanks! + + + +__________________________________ +Do you Yahoo!? +The all-new My Yahoo! - Get yours free! +http://my.yahoo.com + + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 21:14:33 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4268B3CCA2B + for ; + Fri, 17 Dec 2004 21:14:31 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 68535-02 + for ; + Fri, 17 Dec 2004 21:14:23 +0000 (GMT) +Received: from web53704.mail.yahoo.com (web53704.mail.yahoo.com + [206.190.37.25]) + by svr1.postgresql.org (Postfix) with SMTP id EF0D93CC9A0 + for ; + Fri, 17 Dec 2004 21:14:22 +0000 (GMT) +Received: (qmail 47720 invoked by uid 60001); 17 Dec 2004 21:14:21 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=fwvFQYQfekUJuXYUKY1sbwC7C7IeujJ/J989yAETLf5/g7nCblNKMhxfVG+eqz6UyLGAlewGWS2jo6+dscXmTeMMDjXMYelFl5MzVbjRLDu8oElR+eL/WHWaPbAV5Q5FeEbyE8+HwHKY9dlOfGMixRf0HtEd2mL51Kd9GCG2ldw= + ; +Message-ID: <20041217211421.47718.qmail@web53704.mail.yahoo.com> +Received: from [140.252.3.127] by web53704.mail.yahoo.com via HTTP; + Fri, 17 Dec 2004 13:14:21 PST +Date: Fri, 17 Dec 2004 13:14:21 -0800 (PST) +From: Stan Y +Subject: Monitor CPU time per transaction? +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.01 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS +X-Spam-Level: * +X-Archive-Number: 200412/227 +X-Sequence-Number: 9602 + +Hi All, +I notice that most stat Postgres provides are per table or per process. + Is it possible to monitor CPU time per transaction and IO per +transaction? If can't, is there any commercial capacity planning tools +available? +Thanks! + + + + +__________________________________ +Do you Yahoo!? +Yahoo! Mail - Find what you need with new enhanced search. +http://info.mail.yahoo.com/mail_250 + +From pgsql-performance-owner@postgresql.org Fri Dec 17 21:21:15 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BA5A3CC2E0 + for ; + Fri, 17 Dec 2004 21:17:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 69799-02 + for ; + Fri, 17 Dec 2004 21:17:28 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 456CE3CC869 + for ; + Fri, 17 Dec 2004 21:17:29 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBHLHTZA024107; + Fri, 17 Dec 2004 16:17:29 -0500 (EST) +To: Bruno Wolff III +Cc: josh@agliodbs.com, Pailloncy Jean-Gerard , + pgsql-performance@postgresql.org +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +In-reply-to: <20041217212345.GC2119@wolff.to> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> + + <200412171047.49250.josh@agliodbs.com> + <22121.1103312817@sss.pgh.pa.us> <20041217212345.GC2119@wolff.to> +Comments: In-reply-to Bruno Wolff III + message dated "Fri, 17 Dec 2004 15:23:45 -0600" +Date: Fri, 17 Dec 2004 16:17:29 -0500 +Message-ID: <24106.1103318249@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/228 +X-Sequence-Number: 9603 + +Bruno Wolff III writes: +> Tom Lane wrote: +>> This looks like it must be a memory leak in the gist indexing code +>> (either gist itself or tsearch2). I don't see any post-release fixes in +>> the 7.4 branch that look like they fixed any such thing :-(, so it's +>> probably still there in 7.4.7, and likely 8.0 too. + +> Shouldn't that be 7.4.6? + +Right ... I copied Josh's mistake without thinking about it... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Dec 17 21:11:38 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EC65C3CCB03 + for ; + Fri, 17 Dec 2004 21:10:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66435-05 + for ; + Fri, 17 Dec 2004 21:10:54 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 9C05B3CCA2B + for ; + Fri, 17 Dec 2004 21:10:55 +0000 (GMT) +Received: (qmail 3004 invoked by uid 500); 17 Dec 2004 21:23:45 -0000 +Date: Fri, 17 Dec 2004 15:23:45 -0600 +From: Bruno Wolff III +To: Tom Lane +Cc: josh@agliodbs.com, Pailloncy Jean-Gerard , + pgsql-performance@postgresql.org +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Message-ID: <20041217212345.GC2119@wolff.to> +Mail-Followup-To: Tom Lane , josh@agliodbs.com, + Pailloncy Jean-Gerard , pgsql-performance@postgresql.org +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + <07F4E72A-5059-11D9-96E2-000A95DE2550@ifrance.com> + + <200412171047.49250.josh@agliodbs.com> + <22121.1103312817@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <22121.1103312817@sss.pgh.pa.us> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/226 +X-Sequence-Number: 9601 + +On Fri, Dec 17, 2004 at 14:46:57 -0500, + Tom Lane wrote: +> +> This looks like it must be a memory leak in the gist indexing code +> (either gist itself or tsearch2). I don't see any post-release fixes in +> the 7.4 branch that look like they fixed any such thing :-(, so it's +> probably still there in 7.4.7, and likely 8.0 too. + +Shouldn't that be 7.4.6? I am expecting there to be an eventual 7.4.7 +because of some post 7.4.6 fixes that have gone in, but I haven't seen +any other indications that this has already happened. + +From pgsql-performance-owner@postgresql.org Fri Dec 17 21:57:36 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 52F993CC0D8 + for ; + Fri, 17 Dec 2004 21:57:33 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81815-08 + for ; + Fri, 17 Dec 2004 21:57:21 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id E4C083B4CC4 + for ; + Fri, 17 Dec 2004 21:57:20 +0000 (GMT) +Received: from [2001:700:300:dc03:20e:cff:fe36:a766] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CfQ5d-00032h-Tr + for pgsql-performance@postgresql.org; Fri, 17 Dec 2004 22:57:18 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CfQ5L-0002Yl-00 + for ; Fri, 17 Dec 2004 22:56:27 +0100 +Date: Fri, 17 Dec 2004 22:56:27 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-ID: <20041217215627.GC8281@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <87acsdkjte.fsf@stark.xeocode.com> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/229 +X-Sequence-Number: 9604 + +On Fri, Dec 17, 2004 at 10:47:57AM -0500, Greg Stark wrote: +>> Must admit this puzzles me. Are you saying you can't saturate your disk I/O? Or +>> are you saying other DBMS store records in 0.5 to 0.2 times less space than PG? +> I don't know what he's talking about either. Perhaps he's thinking of people +> who haven't been running vacuum enough? + +I'm a bit unsure -- should counting ~3 million rows (no OIDs, PG 7.4, +everything in cache, 32-byte rows) take ~3500ms on an Athlon 64 2800+? + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Fri Dec 17 22:02:05 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D0EF3CC056 + for ; + Fri, 17 Dec 2004 22:01:58 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84602-02 + for ; + Fri, 17 Dec 2004 22:01:41 +0000 (GMT) +Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B04543CC0A3 + for ; + Fri, 17 Dec 2004 22:01:41 +0000 (GMT) +Received: from [82.234.66.131] (imac.rilk.com [82.234.66.131]) + (authenticated bits=0) + by mail.rilk.com (8.13.0/8.13.0) with ESMTP id iBHLx9ov028429 + (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) + for ; + Fri, 17 Dec 2004 23:01:40 +0100 (CET) +Mime-Version: 1.0 (Apple Message framework v619) +In-Reply-To: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +From: Pailloncy Jean-Gerard +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +Date: Fri, 17 Dec 2004 22:59:07 +0100 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619) +X-DCC--Metrics: mail.rilk.com 1074; Body=1 Fuz1=1 Fuz2=1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.026 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/230 +X-Sequence-Number: 9605 + +Update to my case: +I drop and recreate the index and there was no problem this time. +Strange... + +# DROP INDEX pkpoai.test_metadata_all; +DROP INDEX +# VACUUM FULL VERBOSE ANALYZE pkpoai.metadata; +INFO: vacuuming "pkpoai.metadata" +INFO: "metadata": found 167381 removable, 3133397 nonremovable row=20 +versions in 344179 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 168 to 2032 bytes long. +There were 13392 unused item pointers. +Total free space (including removable row versions) is 174825268 bytes. +9362 pages are or will become empty, including 0 at the end of the=20 +table. +150433 pages containing 166581084 free bytes are potential move=20 +destinations. +CPU 7.07s/1.50u sec elapsed 209.46 sec. +INFO: index "metadata_pkey" now contains 3133397 row versions in 10501=20= + +pages +DETAIL: 88246 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.68s/1.21u sec elapsed 81.89 sec. +INFO: index "metadata_archive_key" now contains 3133397 row versions=20 +in 45268 pages +DETAIL: 88246 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.28s/1.66u sec elapsed 364.19 sec. +INFO: index "metadata_oai_identifier" now contains 3133397 row=20 +versions in 36336 pages +DETAIL: 88246 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.85s/1.81u sec elapsed 260.82 sec. +INFO: "metadata": moved 188118 row versions, truncated 344179 to=20 +327345 pages +DETAIL: CPU 9.21s/108.65u sec elapsed 1890.56 sec. +INFO: index "metadata_pkey" now contains 3133397 row versions in 10633=20= + +pages +DETAIL: 188118 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.64s/0.60u sec elapsed 52.24 sec. +INFO: index "metadata_archive_key" now contains 3133397 row versions=20 +in 45597 pages +DETAIL: 188118 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.40s/1.12u sec elapsed 359.17 sec. +INFO: index "metadata_oai_identifier" now contains 3133397 row=20 +versions in 36624 pages +DETAIL: 188118 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.82s/0.97u sec elapsed 277.56 sec. +INFO: vacuuming "pg_toast.pg_toast_27007136" +INFO: "pg_toast_27007136": found 1894 removable, 134515 nonremovable=20 +row versions in 25921 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 37 to 2034 bytes long. +There were 460 unused item pointers. +Total free space (including removable row versions) is 17460524 bytes. +217 pages are or will become empty, including 0 at the end of the table. +22612 pages containing 17416360 free bytes are potential move=20 +destinations. +CPU 0.51s/0.10u sec elapsed 16.05 sec. +INFO: index "pg_toast_27007136_index" now contains 134515 row versions=20= + +in 561 pages +DETAIL: 1894 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.00s/0.01u sec elapsed 1.22 sec. +INFO: "pg_toast_27007136": moved 1806 row versions, truncated 25921 to=20= + +25554 pages +DETAIL: CPU 0.03s/0.21u sec elapsed 9.83 sec. +INFO: index "pg_toast_27007136_index" now contains 134515 row versions=20= + +in 569 pages +DETAIL: 1806 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.00s/0.00u sec elapsed 0.01 sec. +INFO: analyzing "pkpoai.metadata" +INFO: "metadata": 327345 pages, 90000 rows sampled, 3620548 estimated=20= + +total rows +VACUUM +# CREATE INDEX test_metadata_all ON pkpoai.metadata USING gist=20 +(to_tsvector('default_english', coalesce(author,'') ||' '||=20 +coalesce(affiliation,'') ||' '|| coalesce(add_authors,'') ||' '||=20 +coalesce(add_affiliations,'') ||' '|| coalesce(title,'') ||' '||=20 +coalesce(abstract,'') ||' '|| coalesce(discipline,'') ||' '||=20 +coalesce(topic,'') ||' '|| coalesce(publisher,'') ||' '||=20 +coalesce(contributors,'') ||' '|| coalesce(approach,'') ||' '||=20 +coalesce(format,'') ||' '|| coalesce(source,'') ||' '||=20 +coalesce(language,'') ||' '|| coalesce(relation,'') ||' '||=20 +coalesce(coverage,'') )); +NOTICE: word is too long +NOTICE: word is too long +NOTICE: word is too long +CREATE INDEX +# VACUUM FULL VERBOSE ANALYZE pkpoai.metadata;INFO: vacuuming=20 +"pkpoai.metadata"INFO: "metadata": found 0 removable, 3133397=20 +nonremovable row versions in 327345 pagesDETAIL: 0 dead row versions=20 +cannot be removed yet.Nonremovable row versions range from 168 to 2032=20= + +bytes long.There were 29889 unused item pointers.Total free space=20 +(including removable row versions) is 37861356 bytes. +0 pages are or will become empty, including 0 at the end of the table. +93935 pages containing 28461956 free bytes are potential move=20 +destinations. +CPU 5.81s/1.09u sec elapsed 56.18 sec. +INFO: index "metadata_pkey" now contains 3133397 row versions in 10633=20= + +pages +DETAIL: 0 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.53s/0.94u sec elapsed 20.25 sec. +INFO: index "metadata_archive_key" now contains 3133397 row versions=20 +in 45597 pages +DETAIL: 0 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.46s/1.35u sec elapsed 338.74 sec. +INFO: index "metadata_oai_identifier" now contains 3133397 row=20 +versions in 36624 pages +DETAIL: 0 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.78s/1.33u sec elapsed 237.07 sec. +INFO: index "test_metadata_all" now contains 3133397 row versions in=20 +93136 pages +DETAIL: 0 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.65s/3.47u sec elapsed 167.03 sec. +INFO: "metadata": moved 0 row versions, truncated 327345 to 327345=20 +pages +DETAIL: CPU 0.35s/0.41u sec elapsed 82.11 sec. +INFO: vacuuming "pg_toast.pg_toast_27007136" +INFO: "pg_toast_27007136": found 0 removable, 134515 nonremovable row=20= + +versions in 25554 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 37 to 2034 bytes long. +There were 665 unused item pointers. +Total free space (including removable row versions) is 14468156 bytes. +0 pages are or will become empty, including 0 at the end of the table. +22041 pages containing 14421368 free bytes are potential move=20 +destinations. +CPU 0.52s/0.03u sec elapsed 16.14 sec. +INFO: index "pg_toast_27007136_index" now contains 134515 row versions=20= + +in 569 pages +DETAIL: 0 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.01s/0.04u sec elapsed 0.54 sec. +INFO: "pg_toast_27007136": moved 0 row versions, truncated 25554 to=20 +25554 pages +DETAIL: CPU 0.00s/0.03u sec elapsed 2.56 sec. +INFO: analyzing "pkpoai.metadata" +INFO: "metadata": 327345 pages, 90000 rows sampled, 3620548 estimated=20= + +total rows +VACUUM + +Cordialement, +Jean-G=E9rard Pailloncy + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 22:09:17 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BEE0F3CC056 + for ; + Fri, 17 Dec 2004 22:09:13 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87250-04 + for ; + Fri, 17 Dec 2004 22:09:08 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C3C03CB189 + for ; + Fri, 17 Dec 2004 22:09:09 +0000 (GMT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CfQHc-00037U-AR + for pgsql-performance@postgresql.org; Fri, 17 Dec 2004 23:09:09 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CfQHb-0002nW-00 + for ; Fri, 17 Dec 2004 23:09:07 +0100 +Date: Fri, 17 Dec 2004 23:09:07 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-ID: <20041217220907.GA10313@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041217215627.GC8281@uio.no> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/231 +X-Sequence-Number: 9606 + +On Fri, Dec 17, 2004 at 10:56:27PM +0100, Steinar H. Gunderson wrote: +> I'm a bit unsure -- should counting ~3 million rows (no OIDs, PG 7.4, +> everything in cache, 32-byte rows) take ~3500ms on an Athlon 64 2800+? + +(I realize I was a bit unclear here. This is a completely separate case, not +related to the original poster -- I was just wondering if what I'm seeing is +normal or not.) + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Fri Dec 17 22:21:08 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 542653CC4ED + for ; + Fri, 17 Dec 2004 22:20:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93384-08 + for ; + Fri, 17 Dec 2004 22:20:46 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 4F2543CC491 + for ; + Fri, 17 Dec 2004 22:20:47 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBHMKl8T024693; + Fri, 17 Dec 2004 17:20:47 -0500 (EST) +To: Pailloncy Jean-Gerard +Cc: pgsql-performance@postgresql.org +Subject: Re: Error in VACUUM FULL VERBOSE ANALYZE (not enough memory) +In-reply-to: +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + +Comments: In-reply-to Pailloncy Jean-Gerard + message dated "Fri, 17 Dec 2004 22:59:07 +0100" +Date: Fri, 17 Dec 2004 17:20:47 -0500 +Message-ID: <24692.1103322047@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/232 +X-Sequence-Number: 9607 + +Pailloncy Jean-Gerard writes: +> Update to my case: +> I drop and recreate the index and there was no problem this time. +> Strange... + +Well, that time there wasn't actually any work for VACUUM FULL to do. +I think the bloat is probably driven by having to move a lot of rows +in order to shrink the table. That means creating and deleting a lot +of index entries. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Dec 17 23:02:28 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C309D3CC0A3 + for ; + Fri, 17 Dec 2004 23:01:51 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10394-05 + for ; + Fri, 17 Dec 2004 23:01:40 +0000 (GMT) +Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) + by svr1.postgresql.org (Postfix) with ESMTP id 3D4DA3CC586 + for ; + Fri, 17 Dec 2004 23:01:41 +0000 (GMT) +Received: from kungfu (frank.wiles.org [24.124.39.75]) + by frank.wiles.org (8.12.11/8.12.11) with SMTP id iBI06LDD010427; + Fri, 17 Dec 2004 18:06:21 -0600 +Date: Fri, 17 Dec 2004 17:02:29 -0600 +From: Frank Wiles +To: "Steinar H. Gunderson" +Cc: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-Id: <20041217170229.4de276a7.frank@wiles.org> +In-Reply-To: <20041217220907.GA10313@uio.no> +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> <20041217220907.GA10313@uio.no> +X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i386-redhat-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/233 +X-Sequence-Number: 9608 + +On Fri, 17 Dec 2004 23:09:07 +0100 +"Steinar H. Gunderson" wrote: + +> On Fri, Dec 17, 2004 at 10:56:27PM +0100, Steinar H. Gunderson wrote: +> > I'm a bit unsure -- should counting ~3 million rows (no OIDs, PG +> > 7.4, everything in cache, 32-byte rows) take ~3500ms on an Athlon 64 +> > 2800+? +> +> (I realize I was a bit unclear here. This is a completely separate +> case, not related to the original poster -- I was just wondering if +> what I'm seeing is normal or not.) + + It depends more on your disk IO than the processor. Counting isn't + processor intensive, but reading through the entire table on disk + is. I've also seen a huge difference between select count(*) and + select count(1) in older versions, haven't tried it on a recent + version however. + + --------------------------------- + Frank Wiles + http://www.wiles.org + --------------------------------- + + +From pgsql-performance-owner@postgresql.org Fri Dec 17 23:56:19 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2B8F53CC2F4 + for ; + Fri, 17 Dec 2004 23:55:54 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 26414-04 + for ; + Fri, 17 Dec 2004 23:55:48 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id ACA393CC2A9 + for ; + Fri, 17 Dec 2004 23:55:49 +0000 (GMT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CfRwq-0003iy-Qn + for pgsql-performance@postgresql.org; Sat, 18 Dec 2004 00:55:49 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1CfRwq-0004ke-00 + for ; Sat, 18 Dec 2004 00:55:48 +0100 +Date: Sat, 18 Dec 2004 00:55:48 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-ID: <20041217235548.GD16149@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> <20041217220907.GA10313@uio.no> + <20041217170229.4de276a7.frank@wiles.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041217170229.4de276a7.frank@wiles.org> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/234 +X-Sequence-Number: 9609 + +On Fri, Dec 17, 2004 at 05:02:29PM -0600, Frank Wiles wrote: +> It depends more on your disk IO than the processor. Counting isn't +> processor intensive, but reading through the entire table on disk +> is. I've also seen a huge difference between select count(*) and +> select count(1) in older versions, haven't tried it on a recent +> version however. + +Like I said, all in cache, so no disk IO. count(*) and count(1) give me +identical results. (BTW, I don't think this is a count problem, it's a +"sequential scan" problem -- I'm just trying to find out if this is natural +or not, ie. if this is just something I have to expect in a relational +database, even with no I/O.) + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sat Dec 18 03:51:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id BAAE43CC1A6 + for ; + Sat, 18 Dec 2004 03:50:19 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93215-08 + for ; + Sat, 18 Dec 2004 03:50:05 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id E5FB73CC52C + for ; + Sat, 18 Dec 2004 03:50:04 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 8588531961; Sat, 18 Dec 2004 04:50:04 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.performance +Subject: Re: Which is more efficient? +Date: Fri, 17 Dec 2004 21:55:27 -0500 +Organization: cbbrowne Computing Inc +Lines: 53 +Message-ID: +References: <20041217185201.GA13389@localhost.localdomain> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@news.hub.org +X-message-flag: Outlook is rather hackable, isn't it? +X-Home-Page: http://www.cbbrowne.com/info/ +X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne +User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:2dnF7NJWPXchMz4/U6VeONo3UR4= +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.093 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/235 +X-Sequence-Number: 9610 + +A long time ago, in a galaxy far, far away, mike@thegodshalls.com ("Mike G.") wrote: +> Hi, +> +> I have data that I am taking from 2 tables, pulling out specific columns and inserting into one table. +> +> Is it more efficient to do: +> a) insert into x +> select z from y; +> insert into x +> select z from a; +> +> b) insert into x +> select z from y +> union all +> select z from a; +> +> I have run both through explain. +> a) 650ms +> b) 741.57ms +> +> According to the planner option a, select z from y takes 545.93 ms +> Under option b select z from y takes 553.34 ms +> +> Shouldn't the time predicted for the select z from y be the same? + +No, these are approximations. They can't be expected to be identical, +and as you can see there's no material difference, as 545.93 only +differs from 553.34 by 1.34%. + +The point of EXPLAIN is to show the query _plans_ so you can evaluate +how sane they seem. They're pretty well identical, so EXPLAIN's doing +what might be expected. + +> I would believe b would be more efficient as the inserts could be +> done in a batch rather than individual transactions but the planner +> doesn't recognize that. When I run option a through the planner I +> have to highlight each insert separately since the planner stops +> executing after the first ; it comes across. + +The case where there would be a _material_ difference would be where +there were hardly any rows in either of the tables you're adding in, +and in that case, query planning becomes a significant cost, at which +point simpler is probably better. + +If you do the queries in separate transactions, there's some addition +of cost of COMMIT involved, but if they can be kept in a single +transaction, the approaches oughtn't be materially different in cost, +and that's what you're finding. +-- +select 'cbbrowne' || '@' || 'gmail.com'; +http://www3.sympatico.ca/cbbrowne/x.html +MICROS~1: Where do you want to go today? Linux: Been there, done +that. + +From pgsql-performance-owner@postgresql.org Sat Dec 18 04:40:56 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5C28C3B7756 + for ; + Sat, 18 Dec 2004 04:37:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10260-03 + for ; + Sat, 18 Dec 2004 04:37:43 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 2163F3CC3E3 + for ; + Sat, 18 Dec 2004 04:37:41 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBI4bbEL027634; + Fri, 17 Dec 2004 23:37:37 -0500 (EST) +To: Frank Wiles +Cc: "Steinar H. Gunderson" , + pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +In-reply-to: <20041217170229.4de276a7.frank@wiles.org> +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> <20041217220907.GA10313@uio.no> + <20041217170229.4de276a7.frank@wiles.org> +Comments: In-reply-to Frank Wiles + message dated "Fri, 17 Dec 2004 17:02:29 -0600" +Date: Fri, 17 Dec 2004 23:37:37 -0500 +Message-ID: <27633.1103344657@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/237 +X-Sequence-Number: 9612 + +Frank Wiles writes: +> I've also seen a huge difference between select count(*) and +> select count(1) in older versions, + +That must have been before my time, ie, pre-6.4 or so. There is +certainly zero difference now. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Dec 18 04:31:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 667903B68B0 + for ; + Sat, 18 Dec 2004 04:26:34 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07083-01 + for ; + Sat, 18 Dec 2004 04:26:31 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id 2C2893A8A6E + for ; + Sat, 18 Dec 2004 04:26:28 +0000 (GMT) +Received: (qmail 21042 invoked by uid 500); 18 Dec 2004 04:39:18 -0000 +Date: Fri, 17 Dec 2004 22:39:18 -0600 +From: Bruno Wolff III +To: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-ID: <20041218043918.GA20619@wolff.to> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041217215627.GC8281@uio.no> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/236 +X-Sequence-Number: 9611 + +On Fri, Dec 17, 2004 at 22:56:27 +0100, + "Steinar H. Gunderson" wrote: +> +> I'm a bit unsure -- should counting ~3 million rows (no OIDs, PG 7.4, +> everything in cache, 32-byte rows) take ~3500ms on an Athlon 64 2800+? + +It doesn't seem totally out of wack. You will be limited by the memory +bandwidth and it looks like you get something on the order of a few +hundred references to memory per row. That may be a little high, but +it doesn't seem ridiculously high. + +From pgsql-performance-owner@postgresql.org Tue Dec 21 05:45:17 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7C8C53B736C + for ; + Sat, 18 Dec 2004 07:53:23 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71940-07 + for ; + Sat, 18 Dec 2004 07:53:19 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 335DE3CC5F0 + for ; + Sat, 18 Dec 2004 07:53:19 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 4B64B31961; Sat, 18 Dec 2004 08:53:19 +0100 (MET) +From: Ron Mayer +X-Newsgroups: pgsql.performance +Subject: Tips for a system with _extremely_ slow IO? +Date: Fri, 17 Dec 2004 23:51:12 -0800 +Organization: Hub.Org Networking Services +Lines: 64 +Message-ID: +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/259 +X-Sequence-Number: 9634 + + +Any advice for settings for extremely IO constrained systems? + +A demo I've set up for sales seems to be spending much of it's time in +disk wait states. + + +The particular system I'm working with is: + Ext3 on Debian inside Microsoft VirtualPC on NTFS + on WindowsXP on laptops of our sales team. +Somewhat surprisingly, CPU performance is close to native; but disk IO +is much worse - probably orders of magnitude worse - since there are +so many layers of filesystems involved. Unfortunately, no, I don't +think the sales guys will upgrade to BSD. :) + +The database is too large to fit entirely in memory (3GB of spatial data +using PostGIS); and has relative large updates (people can add "layers" +consisting of perhaps 10000 points, lines, and polygons out of a million +or so possibilities - they do this by doing 10K inserts into tables with +postgis geometry columns). + + +Steps I've already done: + + * Gave virtual PC as much memory as possible (1/2 gig) + + * Tuned postgresql.conf; setting + increased effective_cache_size to 10000 + (tested a few values with this workload) + reduced cpu_index_tuple_cost to 0.0005 + (encourages indexes which may reduce disk hits) + decreased random_page_cost to 2 + (seems the fragmented NTFS means many sequential + access are probably a random access anyway) + increased work_mem to 15000 + (sorting on disk was very VERY amazingly slow) + increased shared_buffers to 3000 + (guess) + + * Tuned ext3 (yeah, I'll try JFS or XFS next) + Journal_data_writeback == minimize journaling? + commit=600,noatime in fstab + * tuned the VM + echo 60000 > /proc/sys/vm/dirty_expire_centisecs + echo 70 > /proc/sys/vm/dirty_ratio + +It seems for this workload, the two biggest benefits were + "commit=600" and writeback for ext3 +and + "echo 60000 > /proc/sys/vm/dirty_expire_centisecs" + +If I understand right, this combination says that dirty pages can sit in +memory far longer than the defaults -- and I guess this delays my bad IO +times to the point in the salesguys presentation when he's playing with +powerpoint:). + +Much of this tuning was guesswork; but it did make the demo go from +"unacceptable" to "reasonable". Were any of my guesses particularly +bad, and may be doing more harm than good? + +Any more ideas on how to deal with a pathologically slow IO system? + + Ron + + +From pgsql-performance-owner@postgresql.org Sat Dec 18 13:47:01 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 254A23CC835 + for ; + Sat, 18 Dec 2004 13:46:49 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 72952-03 + for ; + Sat, 18 Dec 2004 13:46:37 +0000 (GMT) +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by svr1.postgresql.org (Postfix) with ESMTP id 67DE83CC6D6 + for ; + Sat, 18 Dec 2004 13:46:39 +0000 (GMT) +Received: from [2001:700:300:dc03:20e:cff:fe36:a766] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CfeuE-0007hp-Li + for pgsql-performance@postgresql.org; Sat, 18 Dec 2004 14:46:38 +0100 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1Cfetw-0006ZB-00 + for ; Sat, 18 Dec 2004 14:45:40 +0100 +Date: Sat, 18 Dec 2004 14:45:40 +0100 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-ID: <20041218134540.GA25107@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> <20041218043918.GA20619@wolff.to> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041218043918.GA20619@wolff.to> +X-Operating-System: Linux 2.6.8.1 on a i686 +User-Agent: Mutt/1.5.6+20040907i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/240 +X-Sequence-Number: 9615 + +On Fri, Dec 17, 2004 at 10:39:18PM -0600, Bruno Wolff III wrote: +> It doesn't seem totally out of wack. You will be limited by the memory +> bandwidth and it looks like you get something on the order of a few +> hundred references to memory per row. That may be a little high, but +> it doesn't seem ridiculously high. + +I just tested 8.0.0rc1 -- I got a _50%_ speedup on this operation... + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Mon Dec 20 04:19:38 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DF5A3A1D0F + for ; + Mon, 20 Dec 2004 04:19:30 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 80263-08 + for ; + Mon, 20 Dec 2004 04:19:27 +0000 (GMT) +Received: from angel.lonelyplanet.com.au (sweep.lonelyplanet.com.au + [202.147.44.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 399B93A1D04 + for ; + Mon, 20 Dec 2004 04:19:24 +0000 (GMT) +Received: from Ganesh.au.lpint.net ([192.168.61.44]) by sweep with InterScan + Messaging Security Suite; Mon, 20 Dec 2004 15:14:09 +1100 +Received: by ganesh.au.lpint.net with Internet Mail Service (5.5.2657.72) + id ; Mon, 20 Dec 2004 15:17:11 +1100 +Message-ID: <16C0CF355FA04944A69E5A4F5299D30B110EAA@ganesh.au.lpint.net> +From: Theo Galanakis +To: pgsql-performance@postgresql.org +Subject: PG Logging is Slow +Date: Mon, 20 Dec 2004 15:17:11 +1100 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C4E64A.C6FC7A20" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.337 tagged_above=0 required=5 tests=AWL, HTML_60_70, + HTML_MESSAGE, HTML_TAG_EXIST_TBODY +X-Spam-Level: +X-Archive-Number: 200412/241 +X-Sequence-Number: 9616 + +This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +------_=_NextPart_001_01C4E64A.C6FC7A20 +Content-Type: text/plain + +Under postgres 7.3 logging is incredibly slow! + +I have applied the following settings: + +syslog = 2 +syslog_facility = 'LOCAL0' +syslog_ident = 'postgres' + + log_connections = true +log_duration = true +log_pid = true +log_statement = true +log_timestamp = true + +This severely impacted the performance of our production system, a search +page which took 1-3 seconds now takes over 30, is this normal? + +I need to get some performance indicators from our production db, however I +cant turn on logging with such performance degradation. + +Theo + + + + + +______________________________________________________________________ +This email, including attachments, is intended only for the addressee +and may be confidential, privileged and subject to copyright. If you +have received this email in error, please advise the sender and delete +it. If you are not the intended recipient of this email, you must not +use, copy or disclose its content to anyone. You must not copy or +communicate to others content that is confidential or subject to +copyright, unless you have the consent of the content owner. + + + +------_=_NextPart_001_01C4E64A.C6FC7A20 +Content-Type: text/html + + + + +Message + + + +

Under postgres 7.3 logging is incredibly +slow!

+

I have +applied the following settings:

+
syslog += 2
+
syslog_facility = 'LOCAL0'
+
syslog_ident = 'postgres'
+
 
+
 log_connections =  true 
log_duration =  true 
log_pid =  true 
log_statement =  true 
log_timestamp =  true 
+
 
+
This +severely impacted the performance of our production system, a search page which +took 1-3 seconds now takes over 30, is this normal?
+
 
+
I need to get some +performance indicators from our production db, however I cant turn on +logging with such performance degradation.
+
 
+
Theo
+



+

+ + + +
______________________________________________________________________
This + email, including attachments, is intended only for the addressee
and + may be confidential, privileged and subject to copyright. If you
have + received this email in error, please advise the sender and delete
it. + If you are not the intended recipient of this email, you must not
use, + copy or disclose its content to anyone. You must not copy or +
communicate to others content that is confidential or subject to +
copyright, unless you have the consent of the content + owner.

+ +------_=_NextPart_001_01C4E64A.C6FC7A20-- + +From pgsql-performance-owner@postgresql.org Mon Dec 20 04:31:29 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3CA1F3A1A72 + for ; + Mon, 20 Dec 2004 04:31:27 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 84607-03 + for ; + Mon, 20 Dec 2004 04:31:23 +0000 (GMT) +Received: from candle.pha.pa.us (candle.pha.pa.us [207.106.42.251]) + by svr1.postgresql.org (Postfix) with ESMTP id 7A02F3A1AE7 + for ; + Mon, 20 Dec 2004 04:31:21 +0000 (GMT) +Received: (from pgman@localhost) + by candle.pha.pa.us (8.11.6/8.11.6) id iBK4VOd03148; + Sun, 19 Dec 2004 23:31:24 -0500 (EST) +From: Bruce Momjian +Message-Id: <200412200431.iBK4VOd03148@candle.pha.pa.us> +Subject: Re: PG Logging is Slow +In-Reply-To: <16C0CF355FA04944A69E5A4F5299D30B110EAA@ganesh.au.lpint.net> +To: Theo Galanakis +Date: Sun, 19 Dec 2004 23:31:24 -0500 (EST) +Cc: pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL108 (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=US-ASCII +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/242 +X-Sequence-Number: 9617 + +Theo Galanakis wrote: +> Under postgres 7.3 logging is incredibly slow! +> +> I have applied the following settings: +> +> syslog = 2 +> syslog_facility = 'LOCAL0' +> syslog_ident = 'postgres' +> +> log_connections = true +> log_duration = true +> log_pid = true +> log_statement = true +> log_timestamp = true +> +> This severely impacted the performance of our production system, a search +> page which took 1-3 seconds now takes over 30, is this normal? +> +> I need to get some performance indicators from our production db, however I +> cant turn on logging with such performance degradation. + +Linux syslog has this bad behavior of fsync'ing all log writes. See the +syslog manual page for a way to turn off the fsync. + +-- + 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 Dec 21 05:45:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A54883A1D0C + for ; + Mon, 20 Dec 2004 04:45:26 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88846-01 + for ; + Mon, 20 Dec 2004 04:45:22 +0000 (GMT) +Received: from r163ip.btv.lv (r163ip.btv.lv [217.198.224.163]) + by svr1.postgresql.org (Postfix) with ESMTP id C74CB3A1ADC + for ; + Mon, 20 Dec 2004 04:45:20 +0000 (GMT) +Received: from p4 (pIV.homenet [192.168.88.4]) + by r163ip.btv.lv (8.12.9/8.12.6) with ESMTP id iBK4jFoh050055 + for ; + Mon, 20 Dec 2004 06:45:18 +0200 (EET) + (envelope-from postgres@bilteks.com) +From: "Alexander Kirpa" +To: pgsql-performance@postgresql.org +Date: Mon, 20 Dec 2004 06:45:11 +0200 +MIME-Version: 1.0 +Content-type: text/plain; charset=US-ASCII +Content-transfer-encoding: 7BIT +Subject: Re: Processor optimization compile options? +Message-ID: <41C674F7.11670.6A82BE2@localhost> +X-mailer: Pegasus Mail for Win32 (v3.12c) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/258 +X-Sequence-Number: 9633 + +Starting from 7.4.1 on P4 and FreeBSD 5.x (exclude 5.0 - gcc in this +edition have optimization error) +I use next configure command +---------------------------------- +./configure --prefix=/opt/postgres-7.4.1 --with-pgport=5432 + --with-pam --enable-syslog --enable-depend + 'CFLAGS= -O3 -pipe -mfpmath=sse -msse2 -msse + -mmmx -march=pentium4 -mcpu=pentium4' +--------------------------------- +w/o any problem. +As I remember improvement as always task depended and +have 30-100%. + +Best regards, + Alexander Kirpa + + +From pgsql-performance-owner@postgresql.org Mon Dec 20 04:47:58 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 05DB53A1CF0 + for ; + Mon, 20 Dec 2004 04:47:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88943-02 + for ; + Mon, 20 Dec 2004 04:47:48 +0000 (GMT) +Received: from svarog.thaico.si (p0f.net [193.77.154.190]) + by svr1.postgresql.org (Postfix) with ESMTP id E31EC3A1CEE + for ; + Mon, 20 Dec 2004 04:47:47 +0000 (GMT) +Received: from lunik.p0f.net ([192.168.50.128]) + by svarog.thaico.si with esmtp (Exim 3.32 #1 (Debian)) + id 1CgFSH-00068l-00; Mon, 20 Dec 2004 05:47:33 +0100 +Received: from lunik.p0f.net (localhost [127.0.0.1]) + by lunik.p0f.net (8.12.10/8.12.10) with ESMTP id iBK4mZSw025214; + Mon, 20 Dec 2004 05:48:35 +0100 +Received: (from gregab@localhost) + by lunik.p0f.net (8.12.10/8.12.10/Submit) id iBK4mZO7025213; + Mon, 20 Dec 2004 05:48:35 +0100 +Date: Mon, 20 Dec 2004 05:48:35 +0100 +From: Grega Bremec +To: Theo Galanakis +Cc: pgsql-performance@postgresql.org +Subject: Re: PG Logging is Slow +Message-ID: <20041220044835.GA24979@lunik.p0f.net> +References: <16C0CF355FA04944A69E5A4F5299D30B110EAA@ganesh.au.lpint.net> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" +Content-Disposition: inline +In-Reply-To: <16C0CF355FA04944A69E5A4F5299D30B110EAA@ganesh.au.lpint.net> +User-Agent: Mutt/1.4.1i +Organization: p0f +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.153 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL +X-Spam-Level: * +X-Archive-Number: 200412/243 +X-Sequence-Number: 9618 + + +--d6Gm4EdcadzBjdND +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +=2E..and on Mon, Dec 20, 2004 at 03:17:11PM +1100, Theo Galanakis used the = +keyboard: +> Under postgres 7.3 logging is incredibly slow! +>=20 +> I have applied the following settings: +>=20 +> syslog =3D 2 +> syslog_facility =3D 'LOCAL0' +> syslog_ident =3D 'postgres' +> =20 +> log_connections =3D true=20 +> log_duration =3D true=20 +> log_pid =3D true=20 +> log_statement =3D true=20 +> log_timestamp =3D true=20 +> =20 +> This severely impacted the performance of our production system, a search +> page which took 1-3 seconds now takes over 30, is this normal? +> =20 +> I need to get some performance indicators from our production db, however= + I +> cant turn on logging with such performance degradation. +> =20 + +Hi Theo, + +One thing you should be sure about is that whichever logfile you have +configured for the local0 facility is being written to asynchronously. +Synchronous logging is REALLY expensive. + +If you're using the standard syslogd, you can achieve that by prefixing +the filename in syslogd.conf with a dash. For example, + + local0.* /var/log/postgresql.log + +would become + + local0.* -/var/log/postgresql.log + +One other option would be to turn off syslog logging completely and let +postmaster take care of the log on its own, which may or may not be +possible for you, depending on the policy in effect (remote logging, etc.). + +Hope this helped, +--=20 + Grega Bremec + gregab at p0f dot net + +--d6Gm4EdcadzBjdND +Content-Type: application/pgp-signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.3 (GNU/Linux) + +iD8DBQFBxlmifu4IwuB3+XoRAjgzAJ9lfCTvp0gTnaP7v93GBECPACCU7ACffJZp +Xk5D4GaUvLXq1g9zkA5Tt5A= +=YRXU +-----END PGP SIGNATURE----- + +--d6Gm4EdcadzBjdND-- + +From pgsql-performance-owner@postgresql.org Mon Dec 20 14:08:03 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 232FE3A6F4F + for ; + Mon, 20 Dec 2004 14:08:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 98261-01 + for ; + Mon, 20 Dec 2004 14:07:50 +0000 (GMT) +Received: from mail1.panix.com (mail1.panix.com [166.84.1.72]) + by svr1.postgresql.org (Postfix) with ESMTP id BE7103A6F47 + for ; + Mon, 20 Dec 2004 14:07:52 +0000 (GMT) +Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) + by mail1.panix.com (Postfix) with ESMTP id C5A4E595A6; + Mon, 20 Dec 2004 09:07:51 -0500 (EST) +Received: (from adler@localhost) + by panix2.panix.com (8.11.6p3/8.8.8/PanixN1.1) id iBKE7pH18640; + Mon, 20 Dec 2004 09:07:51 -0500 (EST) +Date: Mon, 20 Dec 2004 09:07:51 -0500 +From: Michael Adler +To: Theo Galanakis +Cc: pgsql-performance@postgresql.org +Subject: Re: PG Logging is Slow +Message-ID: <20041220140751.GA20943@pobox.com> +References: <16C0CF355FA04944A69E5A4F5299D30B110EAA@ganesh.au.lpint.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <16C0CF355FA04944A69E5A4F5299D30B110EAA@ganesh.au.lpint.net> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/244 +X-Sequence-Number: 9619 + + +On Mon, Dec 20, 2004 at 03:17:11PM +1100, Theo Galanakis wrote: +> Under postgres 7.3 logging is incredibly slow! +> +> I have applied the following settings: +> +> syslog = 2 +> syslog_facility = 'LOCAL0' +> syslog_ident = 'postgres' +> +> log_connections = true +> log_duration = true +> log_pid = true +> log_statement = true +> log_timestamp = true +> +> This severely impacted the performance of our production system, a search +> page which took 1-3 seconds now takes over 30, is this normal? +> +> I need to get some performance indicators from our production db, however I +> cant turn on logging with such performance degradation. + + +I've experienced this problem many times due to hanging dns +lookups. /etc/resolv.conf may point to a nonexistent +nameserver. Comment it out and restart syslogd. Or use a syslog +implementation that allows you to disable dns lookups. Or just give +the nameserver a kick. + + -Mike Adler + +From pgsql-novice-owner@postgresql.org Mon Dec 20 14:40:47 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 172993A7146 + for ; + Mon, 20 Dec 2004 14:40:43 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 12923-04 + for ; + Mon, 20 Dec 2004 14:40:32 +0000 (GMT) +Received: from web51306.mail.yahoo.com (web51306.mail.yahoo.com + [206.190.38.172]) + by svr1.postgresql.org (Postfix) with SMTP id C67A53A713F + for ; Mon, 20 Dec 2004 14:40:34 +0000 (GMT) +Received: (qmail 93252 invoked by uid 60001); 20 Dec 2004 14:40:34 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=myApsLvB3m798r3E6sJ+W8DhEYeCRgaeXItHIrQQ67yL8RIK2VuucnyFxlVZq2fSSPIARPQY5/95lx7Yq+IM/Kf5ZOTf5Ak33KtiQi9rcOGrDNjYKhqXKpbYNJNzcBe9Jf5sdaCwXl8zkveE49mirYmI/YL7hS+sEdaabcC5Jzg= + ; +Message-ID: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +Received: from [65.218.182.242] by web51306.mail.yahoo.com via HTTP; + Mon, 20 Dec 2004 06:40:34 PST +Date: Mon, 20 Dec 2004 06:40:34 -0800 (PST) +From: sarlav kumar +Subject: Postgres version change - pg_dump +To: pgsqlnovice , + pgsqlperform +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-82885129-1103553634=:90526" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.542 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/178 +X-Sequence-Number: 11755 + +--0-82885129-1103553634=:90526 +Content-Type: text/plain; charset=us-ascii + +Hi All, + +Thanks to everyone for helping with my previous questions. + +I have a test database running on Postgres 7.3.2. + + version +------------------------------------------------------------- + PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96 + +I have another server where a newer version of postgres that came with the Fedora Core 3 package installed. + +version +------------------------------------------------------------------------------------------------------------------------- + PostgreSQL 7.4.6 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6) + +I would like to do a pg_dump on the test database, and restore it in the new database on Postgres 7.4.6. I would like to know if there would be any problem due to the postgres version/OS change. If so, could someone tell me what precautions I can take to avoid any problems? + +Thanks in advance, +Saranya + + + + + +--------------------------------- +Do you Yahoo!? + Yahoo! Mail - Find what you need with new enhanced search. Learn more. +--0-82885129-1103553634=:90526 +Content-Type: text/html; charset=us-ascii + +
Hi All,
+
 
+
Thanks to everyone for helping with my previous questions.
+
 
+
I have a test database running on Postgres 7.3.2.
+
 
+
 version                          
-------------------------------------------------------------
 PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96
+
I have another server where a newer version of postgres that came with the Fedora Core 3 package installed.
+
 
+
version                                                        
-------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 7.4.6 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6)
+
 
+
I would like to do a pg_dump on the test database, and restore it in the new database on Postgres 7.4.6. I would like to know if there would be any problem due to the postgres version/OS change. If so, could someone tell me what precautions I can take to avoid any problems?
+
 
+
Thanks in advance,
+
Saranya
+
 
+
 
+
 

+


Do you Yahoo!?
+Yahoo! Mail - Find what you need with new enhanced search. Learn more. +--0-82885129-1103553634=:90526-- + +From pgsql-novice-owner@postgresql.org Mon Dec 20 14:54:38 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D0F8A3A7157 + for ; + Mon, 20 Dec 2004 14:54:36 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20035-09 + for ; + Mon, 20 Dec 2004 14:54:26 +0000 (GMT) +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.191]) + by svr1.postgresql.org (Postfix) with ESMTP id 28AD73A71C3 + for ; Mon, 20 Dec 2004 14:54:29 +0000 (GMT) +Received: from [212.227.126.179] (helo=mrelayng.kundenserver.de) + by moutng.kundenserver.de with esmtp (Exim 3.35 #1) + id 1CgOvd-0007aD-00 + for pgsql-novice@postgresql.org; Mon, 20 Dec 2004 15:54:29 +0100 +Received: from [194.25.154.138] (helo=pinguin.schollglas.com) + by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) + id 1CgOvc-0006Ds-00 + for pgsql-novice@postgresql.org; Mon, 20 Dec 2004 15:54:28 +0100 +Received: from kretschmer by pinguin.schollglas.com with local (Exim 3.33 #6) + id 1CgOvR-0005sO-00 + for pgsql-novice@postgresql.org; Mon, 20 Dec 2004 15:54:17 +0100 +Date: Mon, 20 Dec 2004 15:54:16 +0100 +From: Andreas Kretschmer +To: pgsqlnovice +Subject: Re: [despammed] Postgres version change - pg_dump +Message-ID: <20041220145416.GA22533@Pinguin.wug-glas.de> +References: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +User-Agent: Mutt/1.4i +X-DEST: 208 +X-MSMail-Priority: High +X-MSMail-Virus: X5O!P%@AP[4PZX54(P^)7CC)7}-STANDARD-ANTIVIRUS-TEST-FILE!+H* +X-Message-Flag: The Windows platform is not just insecure - it's patently, + blatantly, and unashamedly insecure by design. +X-PrivatMail: kretschmer@kaufbach.delug.de +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +X-LUG: http://lug-dd.schlittermann.de +X-Handy: 0160 / 8256486 (privat) +X-Fax: 035204 / 40505 (privat) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + auth:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.646 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_WHOIS, MISSING_MIMEOLE, X_MSMAIL_PRIORITY_HIGH +X-Spam-Level: +X-Archive-Number: 200412/179 +X-Sequence-Number: 11756 + +am 20.12.2004, um 6:40:34 -0800 mailte sarlav kumar folgendes: +> I would like to do a pg_dump on the test database, and restore it in +> the new database on Postgres 7.4.6. I would like to know if there +> would be any problem due to the postgres version/OS change. If so, + +No. This is the usual way to upgrade the database. + + +> could someone tell me what precautions I can take to avoid any +> problems? + +You can hold the old database ;-) + + +Regards, +-- +Andreas Kretschmer (Kontakt: siehe Header) + Tel. NL Heynitz: 035242/47212 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-novice-owner@postgresql.org Mon Dec 20 15:35:16 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 58EA73A7B5F + for ; + Mon, 20 Dec 2004 15:35:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44391-01 + for ; + Mon, 20 Dec 2004 15:34:54 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id B50463A79F8 + for ; Mon, 20 Dec 2004 15:34:53 +0000 (GMT) +Received: (qmail 2782 invoked by uid 500); 20 Dec 2004 15:47:49 -0000 +Date: Mon, 20 Dec 2004 09:47:49 -0600 +From: Bruno Wolff III +To: sarlav kumar +Cc: pgsqlnovice , + pgsqlperform +Subject: Re: Postgres version change - pg_dump +Message-ID: <20041220154749.GA1603@wolff.to> +Mail-Followup-To: sarlav kumar , + pgsqlnovice , + pgsqlperform +References: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/187 +X-Sequence-Number: 11764 + +On Mon, Dec 20, 2004 at 06:40:34 -0800, + sarlav kumar wrote: +> +> I would like to do a pg_dump on the test database, and restore it in the new database on Postgres 7.4.6. I would like to know if there would be any problem due to the postgres version/OS change. If so, could someone tell me what precautions I can take to avoid any problems? + +You should use the 7.4.6 version of pg_dump to dump the old database. Note +you still need to be running the 7.3.2 server for the old database. +pg_dump will be just acting like a client connecting over the network +and will work with older versions of the server. + +From pgsql-novice-owner@postgresql.org Tue Dec 21 05:43:51 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9656E3A9FBA + for ; + Mon, 20 Dec 2004 17:08:22 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94103-02 + for ; + Mon, 20 Dec 2004 17:08:12 +0000 (GMT) +Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) + by svr1.postgresql.org (Postfix) with ESMTP id 781A43A6CEE + for ; Mon, 20 Dec 2004 17:08:11 +0000 (GMT) +Received: (qmail-ldap/ctrl 39961 invoked from network); + 20 Dec 2004 17:08:06 -0000 +Received: from unknown (HELO bazaar.foomatic.at) ([213.129.239.202]) + (envelope-sender ) + by mx-00.sil.at (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP + for ; 20 Dec 2004 17:08:06 -0000 +Received: from localhost (bazaar.foomatic.lan [127.0.0.1]) + by bazaar.foomatic.at (Postfix) with ESMTP id 339BBDF204; + Mon, 20 Dec 2004 18:08:08 +0100 (CET) +Received: from bazaar.foomatic.at ([127.0.0.1]) + by localhost (bazaar.foomatic.at [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 25609-06; Mon, 20 Dec 2004 18:08:06 +0100 (CET) +Received: from [192.168.15.239] (Weyoun.foomatic.lan [192.168.15.239]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by bazaar.foomatic.at (Postfix) with ESMTP id 0B6E4DF203; + Mon, 20 Dec 2004 18:08:05 +0100 (CET) +Message-ID: <41C706E3.5040302@foo.at> +Date: Mon, 20 Dec 2004 18:07:47 +0100 +From: Stefan Weiss +Organization: Foo Orbital Operations +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.5) Gecko/20041206 Thunderbird/1.0 Mnenhy/0.7 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: sarlav kumar +Cc: pgsqlnovice , + pgsqlperform +Subject: Re: [PERFORM] Postgres version change - pg_dump +References: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +In-Reply-To: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at foomatic.at +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/207 +X-Sequence-Number: 11784 + +sarlav kumar wrote, On 2004-12-20 15:40: +> I would like to do a pg_dump on the test database, and restore it in +> the new database on Postgres 7.4.6. I would like to know if there +> would be any problem due to the postgres version/OS change. If so, +> could someone tell me what precautions I can take to avoid any +> problems? + +Apart from using the pg_dump from 7.4.6 (see Bruno's answer), you should +take care to use the same locale in the new database cluster. I have had +problems in the past with unique constraints that could not be restored +due to different locale settings. See here: + + http://www.spinics.net/lists/pgsql/msg05363.html + +In my case it was not enough to create the database with a different +encoding, I had to re-initdb the whole cluster :-/ + + +cheers, +stefan + +From pgsql-performance-owner@postgresql.org Mon Dec 20 17:30:50 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F13513AA0B4 + for ; + Mon, 20 Dec 2004 17:30:44 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05665-04 + for ; + Mon, 20 Dec 2004 17:30:35 +0000 (GMT) +Received: from web51307.mail.yahoo.com (web51307.mail.yahoo.com + [206.190.38.173]) + by svr1.postgresql.org (Postfix) with SMTP id 908AA3AA096 + for ; + Mon, 20 Dec 2004 17:30:34 +0000 (GMT) +Received: (qmail 40700 invoked by uid 60001); 20 Dec 2004 17:30:33 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=leEu6/ZeCErl2h9Xf6dQRhDoFzSSOclh92uvmlRJm6JyaCnXLZpTH+PeX5fAnG4rprk4s5N9mRBBp94gzQMFGhE+E5DgD1YKZz2DQ1GZsQg5zT/6NdNLwlcgQ+m42y+rHowwGYpKiPCoadWqj5EO2Vp/MiTiuKIhJ1eh8N9Ngy8= + ; +Message-ID: <20041220173033.40698.qmail@web51307.mail.yahoo.com> +Received: from [65.218.182.242] by web51307.mail.yahoo.com via HTTP; + Mon, 20 Dec 2004 09:30:33 PST +Date: Mon, 20 Dec 2004 09:30:33 -0800 (PST) +From: sarlav kumar +Subject: Re: Postgres version change - pg_dump +To: pgsqlperform +In-Reply-To: <41C706E3.5040302@foo.at> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1398071374-1103563833=:36058" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.708 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/248 +X-Sequence-Number: 9623 + +--0-1398071374-1103563833=:36058 +Content-Type: text/plain; charset=us-ascii + +Hi, + +I think I miscommunicated something. I am doing a pg_dump from Postgres 7.3.2. I am restoring it on Postgres 7.4.6 on Fedora Core 3 on a different server. + +I tried doing the dump and restoring it on the new DB. I did not have any problem with the UNIQUE contraint so far. But I got an error message saying table "session" does not exist, though it does exist in the old database(from where I did the dump). + +I also got another error saying "user abc does not exist". On the old DB I have different set of users, with different privileges granted to each of them on the tables. I guess I need to create these set of users in the new DB before doing the dump. Am I right? + +I am new to postgres administration. So I am not sure what you mean by "same locale in the new database cluster". Could you please explain or point me to a source where I can learn from? + +Thanks a lot for the help, +Saranya + + + + + + +--------------------------------- +Do you Yahoo!? + Jazz up your holiday email with celebrity designs. Learn more. +--0-1398071374-1103563833=:36058 +Content-Type: text/html; charset=us-ascii + +
+
Hi,
+
 
+
I think I miscommunicated something. I am doing a pg_dump from Postgres 7.3.2. I am restoring it on Postgres 7.4.6 on Fedora Core 3 on a different server.
+
 
+
I tried doing the dump and restoring it on the new DB. I did not have any problem with the UNIQUE contraint so far. But I got an error message saying table "session" does not exist, though it does exist in the old database(from where I did the dump).
+
 
+
I also got another error saying "user abc does not exist". On the old DB I have different set of users, with different privileges granted to each of them on the tables. I guess I need to create these set of users in the new DB before doing the dump. Am I right?
+

I am new to postgres administration. So I am not sure what you mean by "same locale in the new database cluster". Could you please explain or point me to a source where I can learn from?
+
 
+
Thanks a lot for the help,
+
Saranya
+
 
+

 

+


Do you Yahoo!?
+Jazz up your holiday email with celebrity designs. Learn more. +--0-1398071374-1103563833=:36058-- + +From pgsql-novice-owner@postgresql.org Mon Dec 20 17:34:24 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1B9663AA0E7 + for ; + Mon, 20 Dec 2004 17:34:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 07028-05 + for ; + Mon, 20 Dec 2004 17:34:08 +0000 (GMT) +Received: from web51305.mail.yahoo.com (web51305.mail.yahoo.com + [206.190.38.171]) + by svr1.postgresql.org (Postfix) with SMTP id CA00B3AA0CE + for ; Mon, 20 Dec 2004 17:34:08 +0000 (GMT) +Received: (qmail 95611 invoked by uid 60001); 20 Dec 2004 17:34:06 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=kdCTtXOw0zlrJvF6YTEiQ3YNR9xblXERp1ORoBlL9B8AWHIz3iPrZ9evmckna8Ne1GDaSEmAd/Tja7i+fmRNOARJDYdzYzzkXp8WytMemDfymJrRj5dK17VBRIWphRgdfPwlwTCXojSCK/GWTOd6rjJZWj8a41PBjUjnHwyUr6w= + ; +Message-ID: <20041220173406.95609.qmail@web51305.mail.yahoo.com> +Received: from [65.218.182.242] by web51305.mail.yahoo.com via HTTP; + Mon, 20 Dec 2004 09:34:06 PST +Date: Mon, 20 Dec 2004 09:34:06 -0800 (PST) +From: sarlav kumar +Subject: Re: Postgres version change - pg_dump +To: Bruno Wolff III +Cc: pgsqlnovice , + pgsqlperform +In-Reply-To: <20041220154749.GA1603@wolff.to> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-148938350-1103564046=:95481" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.713 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/189 +X-Sequence-Number: 11766 + +--0-148938350-1103564046=:95481 +Content-Type: text/plain; charset=us-ascii + +Hi, + +>From what I understand, I need to execute the pg_dump command from the new server( so that it will use the 7.4.6 version), but connect to the old DB. Am I right? + +Thanks, +Saranya + +Bruno Wolff III wrote: +On Mon, Dec 20, 2004 at 06:40:34 -0800, +sarlav kumar wrote: +> +> I would like to do a pg_dump on the test database, and restore it in the new database on Postgres 7.4.6. I would like to know if there would be any problem due to the postgres version/OS change. If so, could someone tell me what precautions I can take to avoid any problems? + +You should use the 7.4.6 version of pg_dump to dump the old database. Note +you still need to be running the 7.3.2 server for the old database. +pg_dump will be just acting like a client connecting over the network +and will work with older versions of the server. + + +--------------------------------- +Do you Yahoo!? + Jazz up your holiday email with celebrity designs. Learn more. +--0-148938350-1103564046=:95481 +Content-Type: text/html; charset=us-ascii + +
Hi,
+
 
+
From what I understand, I need to execute the pg_dump command from the new server( so that it will use the 7.4.6 version), but connect to the old DB. Am I right?
+
 
+
Thanks,
+
Saranya

Bruno Wolff III <bruno@wolff.to> wrote:
+
On Mon, Dec 20, 2004 at 06:40:34 -0800,
sarlav kumar wrote:
>
> I would like to do a pg_dump on the test database, and restore it in the new database on Postgres 7.4.6. I would like to know if there would be any problem due to the postgres version/OS change. If so, could someone tell me what precautions I can take to avoid any problems?

You should use the 7.4.6 version of pg_dump to dump the old database. Note
you still need to be running the 7.3.2 server for the old database.
pg_dump will be just acting like a client connecting over the network
and will work with older versions of the server.

+


Do you Yahoo!?
+Jazz up your holiday email with celebrity designs. Learn more. +--0-148938350-1103564046=:95481-- + +From pgsql-novice-owner@postgresql.org Mon Dec 20 18:32:58 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BA2A3AA394 + for ; + Mon, 20 Dec 2004 18:32:55 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 65892-02 + for ; + Mon, 20 Dec 2004 18:32:51 +0000 (GMT) +Received: from md1.psixpress.com (md1.psixpress.com [154.32.105.205]) + by svr1.postgresql.org (Postfix) with ESMTP id A8EC33AA37C + for ; Mon, 20 Dec 2004 18:32:50 +0000 (GMT) +Received: from kaufbach.delug.de (213.pool1.dialup.cybernet-ag.de + [195.143.124.213]) by md1.psixpress.com (MOS 3.5.6-GR) + with ESMTP id CGV03335; Mon, 20 Dec 2004 18:32:46 GMT +Received: from kretschmer by kaufbach.delug.de with local (Exim 3.35 #1) + id 1CgSFl-0000UO-00 + for pgsql-novice@postgresql.org; Mon, 20 Dec 2004 19:27:29 +0100 +Date: Mon, 20 Dec 2004 19:27:29 +0100 +From: Kretschmer Andreas +To: pgsqlnovice +Subject: Re: Postgres version change - pg_dump +Message-ID: <20041220182729.GA1698@kaufbach.delug.de> +References: <20041220154749.GA1603@wolff.to> + <20041220173406.95609.qmail@web51305.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <20041220173406.95609.qmail@web51305.mail.yahoo.com> +User-Agent: Mutt/1.3.28i +X-OS: Debian/GNU Linux - weil ich es mir Wert bin! +X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA +X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the + answer is "no"! +X-Lugdd: Gerd Kube +X-Info: My name is root. Just root. And I am licensed to kill -9 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/192 +X-Sequence-Number: 11769 + +am Mon, dem 20.12.2004, um 9:34:06 -0800 mailte sarlav kumar folgendes: +> Hi, +> +> From what I understand, I need to execute the pg_dump command from the new +> server( so that it will use the 7.4.6 version), but connect to the old DB. Am I +> right? + +Yes. Call from the new server pg_dump with the credentials for the old +server, in other words, use the new version of pg_dump to generate a +dump from the old server. + +> +> Thanks, +> Saranya +> +> Bruno Wolff III wrote: + +Please, read http://www.netmeister.org/news/learn2quote.html + + +Regards, Andreas +-- +Diese Message wurde erstellt mit freundlicher Unterst�tzung eines freilau- +fenden Pinguins aus artgerechter Freilandhaltung. Er ist garantiert frei +von Micro$oft'schen Viren. (#97922 http://counter.li.org) GPG 7F4584DA +Was, Sie wissen nicht, wo Kaufbach ist? Hier: N 51.05082�, E 13.56889� ;-) + +From pgsql-performance-owner@postgresql.org Mon Dec 20 19:40:19 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2D9FB3AA69E + for ; + Mon, 20 Dec 2004 19:40:17 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 24100-04 + for ; + Mon, 20 Dec 2004 19:40:12 +0000 (GMT) +Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) + by svr1.postgresql.org (Postfix) with ESMTP id E83D43AA693 + for ; + Mon, 20 Dec 2004 19:40:09 +0000 (GMT) +Received: from kungfu (frank.wiles.org [24.124.39.75]) + by frank.wiles.org (8.12.11/8.12.11) with SMTP id iBKJe5Zp012617; + Mon, 20 Dec 2004 13:40:05 -0600 +Date: Mon, 20 Dec 2004 13:40:59 -0600 +From: Frank Wiles +To: Tom Lane +Cc: sgunderson@bigfoot.com, pgsql-performance@postgresql.org +Subject: Re: Seqscan rather than Index +Message-Id: <20041220134059.215cf049.frank@wiles.org> +In-Reply-To: <27633.1103344657@sss.pgh.pa.us> +References: <20041217011853.9E8FF3CADB0@svr1.postgresql.org> + <41C2D936.3060901@archonet.com> <87acsdkjte.fsf@stark.xeocode.com> + <20041217215627.GC8281@uio.no> <20041217220907.GA10313@uio.no> + <20041217170229.4de276a7.frank@wiles.org> + <27633.1103344657@sss.pgh.pa.us> +X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i386-redhat-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/250 +X-Sequence-Number: 9625 + +On Fri, 17 Dec 2004 23:37:37 -0500 +Tom Lane wrote: + +> Frank Wiles writes: +> > I've also seen a huge difference between select count(*) and +> > select count(1) in older versions, +> +> That must have been before my time, ie, pre-6.4 or so. There is +> certainly zero difference now. + + Yeah now that I think about it that sounds about the right time + frame I last benchmarked it. + + --------------------------------- + Frank Wiles + http://www.wiles.org + --------------------------------- + + +From pgsql-novice-owner@postgresql.org Mon Dec 20 22:26:29 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B77AE3AADB3 + for ; + Mon, 20 Dec 2004 22:25:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 02003-06 + for ; + Mon, 20 Dec 2004 22:25:26 +0000 (GMT) +Received: from web51308.mail.yahoo.com (web51308.mail.yahoo.com + [206.190.38.174]) + by svr1.postgresql.org (Postfix) with SMTP id A9FED3AADD9 + for ; Mon, 20 Dec 2004 22:25:26 +0000 (GMT) +Received: (qmail 74534 invoked by uid 60001); 20 Dec 2004 22:25:26 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=pDK/h2zpVk3GrReGA5yve9qNrgzgKqWztybM3XKmdDm8zxuxvbcbDL62NHQUtQcolWD46fmcH/gTpjyha/SwbLPxM2GQnK675nbzo2y7SzTA++vB+tbG/d2QUfCVicFj7aHY0kAIa5K1oQ3rfeeHqyIj6hXfztbJZKVmWf2kw7A= + ; +Message-ID: <20041220222526.74532.qmail@web51308.mail.yahoo.com> +Received: from [65.218.182.242] by web51308.mail.yahoo.com via HTTP; + Mon, 20 Dec 2004 14:25:26 PST +Date: Mon, 20 Dec 2004 14:25:26 -0800 (PST) +From: sarlav kumar +Subject: slony replication +To: pgsqlnovice , + pgsqlperform +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1017136136-1103581526=:72359" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.72 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/195 +X-Sequence-Number: 11772 + +--0-1017136136-1103581526=:72359 +Content-Type: text/plain; charset=us-ascii + +Hi All, + +I installed slony1.0.5 and tried the example replication of pgbench database. That seemed to work. Now I need to replicate a DB running on a different server. slony1.0.5 is installed on the Fedora core 3 machine where Postgres 7.4.6 is installed. I have to replicate the 'test' database installed on a different machine using Postgres 7.3.2. + +In the instructions to replicate the pgbench example, there is script file to create the initial configuration for the master-slave setup of the pgbench database. Is this the script file that has to be modified accordingly, to replicate my 'test' DB. And ofcourse, the shell variables have to be changed to indicate the correct location of the master and slave DBs. Am I right? + +Also, in the script, the following lines are used to create sets of tables: +# Slony-I organizes tables into sets. The smallest unit a node can + # subscribe is a set. The following commands create one set containing + # all 4 pgbench tables. The master or origin of the set is node 1. + #-- + create set (id=1, origin=1, comment='All pgbench tables'); + set add table (set id=1, origin=1, id=1, fully qualified name = 'public.accounts', comment='accounts table'); + set add table (set id=1, origin=1, id=2, fully qualified name = 'public.branches', comment='branches table'); + set add table (set id=1, origin=1, id=3, fully qualified name = 'public.tellers', comment='tellers table'); + set add table (set id=1, origin=1, id=4, fully qualified name = 'public.history', comment='history table', key = serial); + + #-- + +Can this be skipped? I have over 200 tables, and I am not sure if I have to list each of them in the "set add table" part of the scripts file. + +Do I need to change any of the other scripts file in the example? + +Thanks in advance, +Saranya + + + + + + + + +--------------------------------- +Do you Yahoo!? + Send a seasonal email greeting and help others. Do good. +--0-1017136136-1103581526=:72359 +Content-Type: text/html; charset=us-ascii + +
Hi All,
+
 
+
I installed slony1.0.5 and tried the example replication of pgbench database. That seemed to work. Now I need to replicate a DB running on a different server. slony1.0.5 is installed on the Fedora core 3 machine where Postgres 7.4.6 is installed. I have to replicate the 'test' database installed on a different machine using Postgres 7.3.2.
+
 
+
In the instructions to replicate the pgbench example, there is script file to create the initial configuration for the master-slave setup of the pgbench database. Is this the script file that has to be modified accordingly, to replicate my 'test' DB. And ofcourse, the shell variables have to be changed to indicate the correct location of the master and slave DBs. Am I right?
+
 
+
Also, in the script, the following lines are used to create sets of tables:
+
# Slony-I organizes tables into sets.  The smallest unit a node can
    # subscribe is a set.  The following commands create one set containing
    # all 4 pgbench tables.  The master or origin of the set is node 1.
#--
create set (id=1, origin=1, comment='All pgbench tables');
set add table (set id=1, origin=1, id=1, fully qualified name = 'public.accounts', comment='accounts table');
set add table (set id=1, origin=1, id=2, fully qualified name = 'public.branches', comment='branches table');
set add table (set id=1, origin=1, id=3, fully qualified name = 'public.tellers', comment='tellers table');
set add table (set id=1, origin=1, id=4, fully qualified name = 'public.history', comment='history table', key = serial);

#--
+
Can this be skipped? I have over 200 tables, and I am not sure if I have to list each of them in the "set add table" part of the scripts file.
+
 
+
Do I need to change any of the other scripts file in the example?
+
 
+
Thanks in advance,
+
Saranya
+
 
+
 
+
 
+
 
+
 
+
 

+


Do you Yahoo!?
+Send a seasonal email greeting and help others. Do good. +--0-1017136136-1103581526=:72359-- + +From pgsql-performance-owner@postgresql.org Mon Dec 20 22:43:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A8F6F3AAE5B + for ; + Mon, 20 Dec 2004 22:43:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08960-08 + for ; + Mon, 20 Dec 2004 22:43:30 +0000 (GMT) +Received: from angel.lonelyplanet.com.au (sweep.lonelyplanet.com.au + [202.147.44.192]) + by svr1.postgresql.org (Postfix) with ESMTP id 50F793AAE63 + for ; + Mon, 20 Dec 2004 22:43:31 +0000 (GMT) +Received: from Ganesh.au.lpint.net ([192.168.61.44]) by sweep with InterScan + Messaging Security Suite; Tue, 21 Dec 2004 09:37:40 +1100 +Received: by ganesh.au.lpint.net with Internet Mail Service (5.5.2657.72) + id ; Tue, 21 Dec 2004 09:40:37 +1100 +Message-ID: <16C0CF355FA04944A69E5A4F5299D30B110EAC@ganesh.au.lpint.net> +From: Theo Galanakis +To: 'Grega Bremec' +Cc: "'pgsql-performance@postgresql.org'" +Subject: Re: PG Logging is Slow +Date: Tue, 21 Dec 2004 09:40:35 +1100 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C4E6E4.EC03CAE0" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.39 tagged_above=0 required=5 tests=AWL, HTML_40_50, + HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML +X-Spam-Level: +X-Archive-Number: 200412/252 +X-Sequence-Number: 9627 + +This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +------_=_NextPart_001_01C4E6E4.EC03CAE0 +Content-Type: text/plain + + +Thank-you Grega, + + I ended up using the pg_ctl -l parameter to write the output to a +specified file. Much quicker to do so. + + I tried the -/var/log/postgresql.log option however I noticed no +performance improvement. May be the fact that we use redhad linux and +syslog, I'm no sys-admin, so I'm not sure if there is a difference between +syslogd and syslog. + +Theo + +-----Original Message----- +From: Grega Bremec [mailto:gregab@p0f.net] +Sent: Monday, 20 December 2004 3:49 PM +To: Theo Galanakis +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] PG Logging is Slow + + +...and on Mon, Dec 20, 2004 at 03:17:11PM +1100, Theo Galanakis used the +keyboard: +> Under postgres 7.3 logging is incredibly slow! +> +> I have applied the following settings: +> +> syslog = 2 +> syslog_facility = 'LOCAL0' +> syslog_ident = 'postgres' +> +> log_connections = true +> log_duration = true +> log_pid = true +> log_statement = true +> log_timestamp = true +> +> This severely impacted the performance of our production system, a +> search page which took 1-3 seconds now takes over 30, is this normal? +> +> I need to get some performance indicators from our production db, +> however I cant turn on logging with such performance degradation. +> + +Hi Theo, + +One thing you should be sure about is that whichever logfile you have +configured for the local0 facility is being written to asynchronously. +Synchronous logging is REALLY expensive. + +If you're using the standard syslogd, you can achieve that by prefixing the +filename in syslogd.conf with a dash. For example, + + local0.* /var/log/postgresql.log + +would become + + local0.* -/var/log/postgresql.log + +One other option would be to turn off syslog logging completely and let +postmaster take care of the log on its own, which may or may not be possible +for you, depending on the policy in effect (remote logging, etc.). + +Hope this helped, +-- + Grega Bremec + gregab at p0f dot net + + +______________________________________________________________________ +This email, including attachments, is intended only for the addressee +and may be confidential, privileged and subject to copyright. If you +have received this email in error, please advise the sender and delete +it. If you are not the intended recipient of this email, you must not +use, copy or disclose its content to anyone. You must not copy or +communicate to others content that is confidential or subject to +copyright, unless you have the consent of the content owner. +------_=_NextPart_001_01C4E6E4.EC03CAE0 +Content-Type: text/html +Content-Transfer-Encoding: quoted-printable + + + + + + +RE: [PERFORM] PG Logging is Slow + + + +

Thank-you Grega, +

+ +

        I ended up= + using the pg_ctl -l parameter to write the output to a specified file.= + Much quicker to do so. +

+ +

        I tried the= + -/var/log/postgresql.log option however I noticed no performance= + improvement. May be the fact that we use redhad linux and syslog, I'm no= + sys-admin, so I'm not sure if there is a difference between syslogd and= + syslog.

+ +

Theo +

+ +

-----Original Message----- +
From: Grega Bremec [mailto:gregab@p0f.net] +
Sent: Monday, 20 December 2004 3:49 PM +
To: Theo Galanakis +
Cc: pgsql-performance@postgresql.org +
Subject: Re: [PERFORM] PG Logging is Slow +

+
+ +

...and on Mon, Dec 20, 2004 at 03:17:11PM +1100, Theo= + Galanakis used the keyboard: +
> Under postgres 7.3 logging is incredibly= + slow! +
> +
> I have applied the following settings: +
> +
> syslog =3D 2 +
> syslog_facility =3D 'LOCAL0' +
> syslog_ident =3D 'postgres' +
+
>  log_connections =3D  true +
> log_duration =3D  true +
> log_pid =3D  true +
> log_statement =3D  true +
> log_timestamp =3D  true +
+
> This severely impacted the performance of our= + production system, a +
> search page which took 1-3 seconds now takes over= + 30, is this normal? +
+
> I need to get some performance indicators from our= + production db, +
> however I cant turn on logging with such= + performance degradation. +
+

+ +

Hi Theo, +

+ +

One thing you should be sure about is that whichever= + logfile you have configured for the local0 facility is being written to= + asynchronously. Synchronous logging is REALLY expensive.

+ +

If you're using the standard syslogd, you can achieve= + that by prefixing the filename in syslogd.conf with a dash. For= + example,

+ +

    local0.*   = +         /var/log/postgresql.log +

+ +

would become +

+ +

    local0.*   = +         -/var/log/postgresql.log +

+ +

One other option would be to turn off syslog logging= + completely and let postmaster take care of the log on its own, which may= + or may not be possible for you, depending on the policy in effect (remote= + logging, etc.).

+ +

Hope this helped, +
-- +
    Grega Bremec +
    gregab at p0f dot net +

+ + + +
________________________________________________________________= +______
+This email, including attachments, is intended only for the addressee
+and may be confidential, privileged and subject to copyright. If you
+have received this email in error, please advise the sender and delete
+it. If you are not the intended recipient of this email, you must not
+use, copy or disclose its content to anyone. You must not copy or
+communicate to others content that is confidential or subject to
+copyright, unless you have the consent of the content owner.
+
+------_=_NextPart_001_01C4E6E4.EC03CAE0-- + +From pgsql-performance-owner@postgresql.org Mon Dec 20 23:09:28 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 868893AAF02 + for ; + Mon, 20 Dec 2004 23:09:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 17562-07 + for ; + Mon, 20 Dec 2004 23:09:07 +0000 (GMT) +Received: from mailhub2.une.edu.au (mailhub.une.edu.au [129.180.1.142]) + by svr1.postgresql.org (Postfix) with ESMTP id BC57E3AAF75 + for ; + Mon, 20 Dec 2004 23:09:08 +0000 (GMT) +Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) + by mailhub2.une.edu.au (Postfix) with ESMTP id 752A47F29; + Tue, 21 Dec 2004 10:09:06 +1100 (EST) +Received: from [129.180.47.61] ([129.180.47.61]) + by icarus.une.edu.au (8.12.8/8.12.8) with ESMTP id iBKN96T3012657; + Tue, 21 Dec 2004 10:09:06 +1100 +Message-ID: <41C75B92.7000807@abri.une.edu.au> +Date: Tue, 21 Dec 2004 10:09:06 +1100 +From: Alexander Borkowski +Organization: Agricultural Business Research Institute +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Theo Galanakis +Cc: "'pgsql-performance@postgresql.org'" +Subject: Re: PG Logging is Slow +References: <16C0CF355FA04944A69E5A4F5299D30B110EAC@ganesh.au.lpint.net> +In-Reply-To: <16C0CF355FA04944A69E5A4F5299D30B110EAC@ganesh.au.lpint.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/253 +X-Sequence-Number: 9628 + +Theo, + + > I tried the -/var/log/postgresql.log option however I noticed no + > performance improvement. May be the fact that we use redhad linux and + > syslog, I'm no sys-admin, so I'm not sure if there is a difference +between + > syslogd and syslog. + +Did you restart syslogd (that's the server process implementing the +syslog (= system log) service) after you changed its configuration? + +In order to do so, try running + +/etc/init.d/syslog restart + +as root from a commandline. + +HTH + +Alex + +From pgsql-novice-owner@postgresql.org Tue Dec 21 05:42:34 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 43FA03AB1C4 + for ; + Tue, 21 Dec 2004 00:04:08 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 35198-04 + for ; + Tue, 21 Dec 2004 00:04:01 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 84F083AB1AE + for ; Tue, 21 Dec 2004 00:04:03 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 880833196B; Tue, 21 Dec 2004 01:04:03 +0100 (MET) +From: Christopher Browne +X-Newsgroups: pgsql.novice +Subject: Re: slony replication +Date: Mon, 20 Dec 2004 18:31:04 -0500 +Organization: Afilias Canada - Operations Group +Lines: 53 +Message-ID: <60r7lkbl8n.fsf@dba2.int.libertyrms.com> +References: <20041220222526.74532.qmail@web51308.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through + Obscurity, + linux) +Cancel-Lock: sha1:ub5VDUq4+CL0/qo5fsSdlfdBSfk= +To: pgsql-novice@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.24 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200412/205 +X-Sequence-Number: 11782 + +sarlavk@yahoo.com (sarlav kumar) writes: +> I installed slony1.0.5 and tried the example replication of pgbench +> database. That seemed to work. Now I�need to�replicate a DB running +> on a different server. slony1.0.5 is installed on the Fedora core 3 +> machine where Postgres 7.4.6 is installed. I have to replicate the +> 'test' database installed on a different machine using Postgres +> 7.3.2. + +Slony-I does not support versions of PostgreSQL earlier than 7.3.3. +As 7.3.2 is earlier than 7.3.3, I wouldn't expect that to work. + +> In the instructions to replicate the pgbench example, there is +> script file to create the initial configuration for the master-slave +> setup of�the pgbench database. Is this the script file that has to +> be modified accordingly, to replicate my 'test' DB. And ofcourse, +> the shell variables have to be changed to indicate the correct +> location of the master and slave DBs. Am I right? + +Yes, that would be right. + +> Also, in the script, the following lines are used to create sets of tables: +> +> # Slony-I organizes tables into sets.� The smallest unit a node can +> ��� # subscribe is a set.� The following commands create one set containing +> ��� # all 4 pgbench tables.� The master or origin of the set is node 1. +> #-- +> create set (id=1, origin=1, comment='All pgbench tables'); +> set add table (set id=1, origin=1, id=1, fully qualified name = 'public.accounts', comment='accounts table'); +> set add table (set id=1, origin=1, id=2, fully qualified name = 'public.branches', comment='branches table'); +> set add table (set id=1, origin=1, id=3, fully qualified name = 'public.tellers', comment='tellers table'); +> set add table (set id=1, origin=1, id=4, fully qualified name = 'public.history', comment='history table', key = +> serial); +> #-- +> +> Can this be skipped? I have over 200 tables, and I am not sure if I +> have to list each of them in the "set add table" part of the scripts +> file. + +No, you cannot "skip" this. You _must_ submit slonik requests to add +each and every table that you wish to replicate to the replication +set. + +If there are 220 tables, you'll need something rather close to 220 +"set add table" requests. + +> Do I need to change any of the other scripts file in the example? + +Maybe, depending on what you're trying to do. +-- +"cbbrowne","@","ca.afilias.info" + +Christopher Browne +(416) 673-4124 (land) + +From pgsql-performance-owner@postgresql.org Tue Dec 21 01:42:56 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4021B3AB56E + for ; + Tue, 21 Dec 2004 01:42:39 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 67377-04 + for ; + Tue, 21 Dec 2004 01:42:26 +0000 (GMT) +Received: from mail4.hitachi.co.jp (mail4.hitachi.co.jp [133.145.228.5]) + by svr1.postgresql.org (Postfix) with ESMTP id 5CB143AB52A + for ; + Tue, 21 Dec 2004 01:42:28 +0000 (GMT) +Received: from mc2.mcg.hitachi.co.jp (unknown [133.144.237.46]) + by mail4.hitachi.co.jp (Postfix) with ESMTP id 3950633CCB + for ; + Tue, 21 Dec 2004 10:42:28 +0900 (JST) +Received: (from root@localhost) + by mc2.mcg.hitachi.co.jp (8.11.6+Sun/8.11.6) id iBL1gRS24680 + for pgsql-performance@postgresql.org; + Tue, 21 Dec 2004 10:42:27 +0900 (JST) +Received: from unknown [192.168.2.1] + by mc2.mcg.hitachi.co.jp with SMTP id LAA24675; + Tue, 21 Dec 2004 10:42:27 +0900 +Received: from navsg6.hitachi.co.jp by navsg6.hitachi.co.jp + (8.9.3/3.7W-navsg6) id KAA12748; + Tue, 21 Dec 2004 10:42:27 +0900 (JST) +From: kondo_yo@itg.hitachi.co.jp +Received: from mlsv4.itg.hitachi.co.jp ([158.213.165.103]) + by navsg6.hitachi.co.jp (SAVSMTP 3.1.6.45) with SMTP id + M2004122110422602353 + for ; Tue, 21 Dec 2004 10:42:26 +0900 +Received: from mfilter-s1.itg.hitachi.co.jp by mlsv4.itg.hitachi.co.jp + (8.12.10/8.12.10) id iBL1gQAx008873; Tue, 21 Dec 2004 10:42:27 +0900 +Received: from navgw6.itg.hitachi.co.jp (unverified) by + mfilter-s1.itg.hitachi.co.jp + (Content Technologies SMTPRS 4.3.17) with SMTP id + for + ; Tue, 21 Dec 2004 10:42:26 +0900 +Received: from smgw01.itg.hitachi.co.jp. ([158.213.165.30]) + by navgw6.itg.hitachi.co.jp (SMSSMTP 4.0.5.66) with SMTP id + M2004122110422601550 + for ; Tue, 21 Dec 2004 10:42:26 +0900 +Received: from 127.0.0.1 by smgw01.itg.hitachi.co.jp. (8.9.3 + (PHNE_28809+JAGae91741+JAGae92668)/8.7.1) id KAA23282; + Tue, 21 Dec 2004 10:42:26 +0900 (JST) +Message-Type: Multiple Part +MIME-Version: 1.0 +Message-ID: +Content-Type: text/plain; charset=ISO-2022-JP +To: +Date: Tue, 21 Dec 2004 10:42:10 +0900 +Importance: normal +Subject: Question of performance of version 8 +X400-Content-Identifier: X41C77F6300000M +X400-MTS-Identifier: [/C=JP/ADMD=HITNET/PRMD=HITACHI/;gmml0204122110415555F] +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200412/254 +X-Sequence-Number: 9629 + + +Hello. +I tried performance test of version 8.0.0 beta4 by osdl-dbt-1. +The result is that throughput of version 8 fell to about 70 percent +compared with V7.4.6. +Test result is below. (measurement was repeated 3 times) + +------------------------------------------------------- +Hardware spec +$B!!(BCPU$B!!!!!!(BPentium $B-7(B 531.986 MHz +$B!!(BMemory$B!!!!(B125660 Kb +------------------------------------------------------- +Software version +$B!!(BOS$B!!(BLinux Kernel:2.4.21-4.EL +$B!!(BDistribution: Red Hat Enterprise Linux AS release 3 +------------------------------------------------------- +Result$B!J(Btransaction per second$B!K(B + first second third + 7.4.6 $B!!(B 6.8 6.8 5.9 + 8.0 beta4 4.3 4.6 $B!!(B4.4 +------------------------------------------------------- +Parameter of DBT1,PostgreSQL +$B!!(BDatabase Size (items): 1000 +$B!!(BDatabase Size (customers): 10 +$B!!(Bnumber of cache: 1 +$B!!(Bnumber of connections between cache and database: 10 +$B!!(Bnumber of application server: 1 +$B!!(Bnumber of connections between server and database: 20 +$B!!(Bnumber of drivers: 1 +$B!!(Beus/driver: 100 +$B!!(Brampuprate/driver: 60 +$B!!(Bduration/driver: 900 +$B!!(Bthinktime/driver: 1.6 +$B!!(BPut WAL on different driver: 0 +$B!!(BPut pgsql_tmp on different driver: 0 +$B!!(Bdatabase parameters: -i -c listen_addresses='*' +$B!!(Bshmmax: 33554432 +------------------------------------------------------- + +- Both version 8 and version 7 are performed under the same condition. +- Tuning of adjustment of a parameter was not carried out at all. +- The server and client process are performed in the same machine. + +Is there the weak point on the performance in version 8.0.0 ? + +Any help would greatly appreciated. + + kondou + +From pgsql-performance-owner@postgresql.org Tue Dec 21 03:55:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5841A3ABAA0 + for ; + Tue, 21 Dec 2004 03:54:25 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30174-07 + for ; + Tue, 21 Dec 2004 03:54:18 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 48FC03ABABE + for ; + Tue, 21 Dec 2004 03:54:21 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBL3sKgo002256; + Mon, 20 Dec 2004 22:54:20 -0500 (EST) +To: kondo_yo@itg.hitachi.co.jp +Cc: pgsql-performance@postgresql.org +Subject: Re: Question of performance of version 8 +In-reply-to: +References: +Comments: In-reply-to kondo_yo@itg.hitachi.co.jp + message dated "Tue, 21 Dec 2004 10:42:10 +0900" +Date: Mon, 20 Dec 2004 22:54:20 -0500 +Message-ID: <2255.1103601260@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/255 +X-Sequence-Number: 9630 + +kondo_yo@itg.hitachi.co.jp writes: +> I tried performance test of version 8.0.0 beta4 by osdl-dbt-1. +> The result is that throughput of version 8 fell to about 70 percent +> compared with V7.4.6. + +beta4 is a little bit back ... + +I don't have dbt1 at hand, but I tried pg_bench on PG 7.4.6 against 8.0rc2 +just now. For the test case + + pgbench -i -s 10 bench + pgbench -c 10 -t 10000 bench + +on 7.4.6 I get: + +starting vacuum...end. +transaction type: TPC-B (sort of) +scaling factor: 10 +number of clients: 10 +number of transactions per client: 10000 +number of transactions actually processed: 100000/100000 +tps = 65.714249 (including connections establishing) +tps = 65.716363 (excluding connections establishing) + +on 8.0rc2 I get: + +starting vacuum...end. +transaction type: TPC-B (sort of) +scaling factor: 10 +number of clients: 10 +number of transactions per client: 10000 +number of transactions actually processed: 100000/100000 +tps = 107.379742 (including connections establishing) +tps = 107.385301 (excluding connections establishing) + +This is on a Fedora Core 3 machine, generic three-year-old PC with cheap +junk IDE drive that lies about write completion (but I'm running fsync +off so that hardly matters ;-)). And I didn't change any of the default +postgresql.conf settings, just started the postmaster with -F in both +cases. So I wouldn't claim that it's very representative of real-world +performance on real-world server hardware. But I'm not seeing a serious +falloff from 7.4 to 8.0 here --- more the other way 'round. + +Please try dbt1 with 8.0rc2, and let us know if you still see a problem. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Dec 21 05:02:37 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 738F43A95B3 + for ; + Tue, 21 Dec 2004 05:02:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 05217-06 + for ; + Tue, 21 Dec 2004 05:02:14 +0000 (GMT) +Received: from rediffmail.com (unknown [203.199.83.31]) + by svr1.postgresql.org (Postfix) with SMTP id 84EC73A9DD4 + for ; + Tue, 21 Dec 2004 05:02:12 +0000 (GMT) +Received: (qmail 26823 invoked by uid 510); 21 Dec 2004 05:02:56 -0000 +Date: 21 Dec 2004 05:02:56 -0000 +Message-ID: <20041221050256.26822.qmail@webmail46.rediffmail.com> +Received: from unknown (61.95.202.163) by rediffmail.com via HTTP; + 21 dec 2004 05:02:56 -0000 +MIME-Version: 1.0 +From: "Gurpreet Sachdeva" +Reply-To: "Gurpreet Sachdeva" +To: pgsql-performance@postgresql.org +Subject: Postgres on Linux Cluster! +Content-type: multipart/alternative; + boundary="Next_1103605376---0-203.199.83.31-26817" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=4.259 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_IMAGE_ONLY_12, HTML_MESSAGE, + IP_LINK_PLUS, MSGID_FROM_MTA_HEADER, NORMAL_HTTP_TO_IP +X-Spam-Level: **** +X-Archive-Number: 200412/256 +X-Sequence-Number: 9631 + + This is a multipart mime message + + +--Next_1103605376---0-203.199.83.31-26817 +Content-type: text/plain; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +I have recently transfered a big database on my master node of a 4 node ope= +nSSI Cluster... The system is working fine but sometimes, I get following e= +rrors:=0A=0Ahttp://192.168.1.100/cgi-bin/search.py=0A File "/usr/lib/pytho= +n2.2/site-packages/pyPgSQL/PgSQL.py", line 3067, in execute, referer: http:= +//192.168.1.100/cgi-bin/search.py=0A self.conn.conn.query('ROLLBACK WORK= +'), referer: http://192.168.1.100/cgi-bin/search.py=0Alibpq.ProgrammingErro= +r: no connection to the server, referer: http://192.168.1.100/cgi-bin/searc= +h.py=0A, referer: http://192.168.1.100/cgi-bin/search.py=0A=0AThis error co= +mes while insertion of data takes place...=0AIs Postgres successfull on Clu= +ster??? Will that give me performance enhancement in any way??? Please help= +...=0A=0A-- =0AThanks and Regards,=0AGSS +--Next_1103605376---0-203.199.83.31-26817 +Content-type: text/html; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +

=0AI have recently transfered a big database on my master node of a 4 no= +de openSSI Cluster... The system is working fine but sometimes, I get follo= +wing errors:
=0A
=0Ahttp://192.168.1.100/cgi-bin/search.py
=0A&nbs= +p; File "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line= + 3067, in execute, referer: http://192.168.1.100/cgi-bin/search.py
=0A&n= +bsp;   self.conn.conn.query('ROLLBACK WORK'), referer: http://192.168.= +1.100/cgi-bin/search.py
=0Alibpq.ProgrammingError: no connection to the = +server, referer: http://192.168.1.100/cgi-bin/search.py
=0A, referer: ht= +tp://192.168.1.100/cgi-bin/search.py
=0A
=0AThis error comes while in= +sertion of data takes place...
=0AIs Postgres successfull on Cluster??? = +Will that give me performance enhancement in any way??? Please help...
= +=0A
=0A--
=0AThanks and Regards,
=0AGSS=0A

=0A

=0A= +=0A +--Next_1103605376---0-203.199.83.31-26817-- + + +From pgsql-performance-owner@postgresql.org Tue Dec 21 05:04:57 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3EA993ABBB6 + for ; + Tue, 21 Dec 2004 05:04:49 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04949-07 + for ; + Tue, 21 Dec 2004 05:04:41 +0000 (GMT) +Received: from mail6.hitachi.co.jp (mail6.hitachi.co.jp [133.145.228.41]) + by svr1.postgresql.org (Postfix) with ESMTP id B772E3ABB6B + for ; + Tue, 21 Dec 2004 05:04:39 +0000 (GMT) +Received: from mc3.mcg.hitachi.co.jp by mail6.hitachi.co.jp + (8.9.3p3/3.7W-mail6) id OAA14120; + Tue, 21 Dec 2004 14:04:36 +0900 (JST) +From: kondo_yo@itg.hitachi.co.jp +Received: (from root@localhost) + by mc3.mcg.hitachi.co.jp (8.11.6+Sun/8.11.6) id iBL54Zv28709 + for pgsql-performance@postgresql.org; + Tue, 21 Dec 2004 14:04:35 +0900 (JST) +Received: from unknown [192.168.2.1] + by mc3.mcg.hitachi.co.jp with SMTP id QAA28708; + Tue, 21 Dec 2004 14:04:35 +0900 +Received: from navsg1.hitachi.co.jp by navsg1.hitachi.co.jp + (8.9.3/3.7W-navsg1) id OAA09992; + Tue, 21 Dec 2004 14:04:34 +0900 (JST) +Received: from mlsv4.itg.hitachi.co.jp ([158.213.165.103]) + by navsg1.hitachi.co.jp (SAVSMTP 3.1.6.45) with SMTP id + M2004122114043419701 + for ; Tue, 21 Dec 2004 14:04:34 +0900 +Received: from mfilter-s3.itg.hitachi.co.jp by mlsv4.itg.hitachi.co.jp + (8.12.10/8.12.10) id iBL54YAx021044; Tue, 21 Dec 2004 14:04:34 +0900 +Received: from navgw4.itg.hitachi.co.jp (unverified) by + mfilter-s3.itg.hitachi.co.jp (Content Technologies SMTPRS 4.3.17) with + SMTP id for + ; Tue, 21 Dec 2004 14:04:34 +0900 +Received: from smgw01.itg.hitachi.co.jp. ([158.213.165.30]) by + navgw4.itg.hitachi.co.jp (SMSSMTP 4.0.5.66) with SMTP id + M2004122114043406038 for ; + Tue, 21 Dec 2004 14:04:34 +0900 +Received: from 127.0.0.1 by smgw01.itg.hitachi.co.jp. + (8.9.3 (PHNE_28809+JAGae91741+JAGae92668)/8.7.1) id OAA19648; + Tue, 21 Dec 2004 14:04:33 +0900 (JST) +Message-Type: Multiple Part +MIME-Version: 1.0 +Message-ID: +Content-Type: text/plain; charset="us-ascii" +To: +Date: Tue, 21 Dec 2004 14:04:08 +0900 +Importance: normal +Subject: Re: Question of performance of version 8 +X400-Content-Identifier: X41C7AEB100000M +X400-MTS-Identifier: [/C=JP/ADMD=HITNET/PRMD=HITACHI/;gmml02041221140345I9H] +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.178 tagged_above=0 required=5 tests=AWL, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200412/257 +X-Sequence-Number: 9632 + +Thank you for your attention. +I will try again with new postgres release and + examine access method of sql with explain command. + kondo + +From pgsql-performance-owner@postgresql.org Tue Dec 21 05:55:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0B8BD3ABC05 + for ; + Tue, 21 Dec 2004 05:55:52 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 23689-02 + for ; + Tue, 21 Dec 2004 05:55:47 +0000 (GMT) +Received: from angel.lonelyplanet.com.au (sweep.lonelyplanet.com.au + [202.147.44.192]) + by svr1.postgresql.org (Postfix) with ESMTP id E93B93ABC3A + for ; + Tue, 21 Dec 2004 05:55:45 +0000 (GMT) +Received: from Ganesh.au.lpint.net ([192.168.61.44]) by sweep with InterScan + Messaging Security Suite; Tue, 21 Dec 2004 16:50:57 +1100 +Received: by ganesh.au.lpint.net with Internet Mail Service (5.5.2657.72) + id ; Tue, 21 Dec 2004 16:53:54 +1100 +Message-ID: <16C0CF355FA04944A69E5A4F5299D30B110EB6@ganesh.au.lpint.net> +From: Theo Galanakis +To: 'Alexander Borkowski' +Cc: "'pgsql-performance@postgresql.org'" +Subject: Re: PG Logging is Slow +Date: Tue, 21 Dec 2004 16:53:51 +1100 +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C4E721.7280D7C0" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.37 tagged_above=0 required=5 tests=AWL, HTML_40_50, + HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML +X-Spam-Level: +X-Archive-Number: 200412/260 +X-Sequence-Number: 9635 + +This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +------_=_NextPart_001_01C4E721.7280D7C0 +Content-Type: text/plain + + +Thankyou Alexander, + + That has worked and appears to have fixed the issue with syslog. + +Theo + +-----Original Message----- +From: Alexander Borkowski [mailto:alexander.borkowski@abri.une.edu.au] +Sent: Tuesday, 21 December 2004 10:09 AM +To: Theo Galanakis +Cc: 'pgsql-performance@postgresql.org' +Subject: Re: [PERFORM] PG Logging is Slow + + +Theo, + + > I tried the -/var/log/postgresql.log option however I noticed no + > performance improvement. May be the fact that we use redhad linux and > +syslog, I'm no sys-admin, so I'm not sure if there is a difference +between + > syslogd and syslog. + +Did you restart syslogd (that's the server process implementing the +syslog (= system log) service) after you changed its configuration? + +In order to do so, try running + +/etc/init.d/syslog restart + +as root from a commandline. + +HTH + +Alex + + +______________________________________________________________________ +This email, including attachments, is intended only for the addressee +and may be confidential, privileged and subject to copyright. If you +have received this email in error, please advise the sender and delete +it. If you are not the intended recipient of this email, you must not +use, copy or disclose its content to anyone. You must not copy or +communicate to others content that is confidential or subject to +copyright, unless you have the consent of the content owner. +------_=_NextPart_001_01C4E721.7280D7C0 +Content-Type: text/html +Content-Transfer-Encoding: quoted-printable + + + + + + +RE: [PERFORM] PG Logging is Slow + + + +

Thankyou Alexander, +

+ +

        That has= + worked and appears to have fixed the issue with syslog. +

+ +

Theo +

+ +

-----Original Message----- +
From: Alexander Borkowski [mailto:alexander.borkowski@= +abri.une.edu.au] +
Sent: Tuesday, 21 December 2004 10:09 AM +
To: Theo Galanakis +
Cc: 'pgsql-performance@postgresql.org' +
Subject: Re: [PERFORM] PG Logging is Slow +

+
+ +

Theo, +

+ +

 >      I tried the= + -/var/log/postgresql.log option however I noticed no +
 > performance improvement. May be the fact that= + we use redhad linux and  > syslog, I'm no sys-admin, so I'm not= + sure if there is a difference

+ +

between +
 > syslogd and syslog. +

+ +

Did you restart syslogd (that's the server process= + implementing the +
syslog (=3D system log) service) after you changed its= + configuration? +

+ +

In order to do so, try running +

+ +

/etc/init.d/syslog restart +

+ +

as root from a commandline. +

+ +

HTH +

+ +

Alex +

+ + + +
________________________________________________________________= +______
+This email, including attachments, is intended only for the addressee
+and may be confidential, privileged and subject to copyright. If you
+have received this email in error, please advise the sender and delete
+it. If you are not the intended recipient of this email, you must not
+use, copy or disclose its content to anyone. You must not copy or
+communicate to others content that is confidential or subject to
+copyright, unless you have the consent of the content owner.
+
+------_=_NextPart_001_01C4E721.7280D7C0-- + +From pgsql-novice-owner@postgresql.org Fri Dec 24 14:20:04 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7706F3A9E55; + Tue, 21 Dec 2004 06:01:11 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25637-10; Tue, 21 Dec 2004 06:01:03 +0000 (GMT) +Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) + by svr1.postgresql.org (Postfix) with ESMTP id 98A973ABC3E; + Tue, 21 Dec 2004 06:01:00 +0000 (GMT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by localhost (Postfix) with ESMTP id 9E92A6DE29; + Tue, 21 Dec 2004 14:00:57 +0800 (WST) +Received: from vscan01.westnet.com.au ([127.0.0.1]) + by localhost (vscan01.westnet.com.au [127.0.0.1]) (amavisd-new, + port 10024) + with ESMTP id 00562-06; Tue, 21 Dec 2004 14:00:57 +0800 (WST) +Received: from [202.72.133.22] (dsl-202-72-133-22.wa.westnet.com.au + [202.72.133.22]) + by vscan01.westnet.com.au (Postfix) with ESMTP id 0EB436E7C6; + Tue, 21 Dec 2004 13:58:13 +0800 (WST) +Message-ID: <41C7BB76.9090206@familyhealth.com.au> +Date: Tue, 21 Dec 2004 13:58:14 +0800 +From: Christopher Kings-Lynne +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: sarlav kumar +Cc: Bruno Wolff III , + pgsqlnovice , + pgsqlperform +Subject: Re: [PERFORM] Postgres version change - pg_dump +References: <20041220173406.95609.qmail@web51305.mail.yahoo.com> +In-Reply-To: <20041220173406.95609.qmail@web51305.mail.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/246 +X-Sequence-Number: 11823 + +Hi Sarlav, + +> From what I understand, I need to execute the pg_dump command from the +> new server( so that it will use the 7.4.6 version), but connect to the +> old DB. Am I right? + +Basically. + +The truth is Sarlav, that any pg_dump version before the new 8.0 version +is likely to have errors restoring. You should restore the dump like this: + +psql -f dump.sql database + +And then when you get errors, you will see the line number of the error. + Then you can edit the dump to fix it. + +Chris + +From pgsql-novice-owner@postgresql.org Fri Dec 24 14:27:50 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B3A213A9E4C; + Tue, 21 Dec 2004 07:08:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54337-04; Tue, 21 Dec 2004 07:08:01 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 152193A95C3; + Tue, 21 Dec 2004 07:07:59 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBL77rZ29096; + Tue, 21 Dec 2004 16:07:53 +0900 +Message-ID: <006b01c4e72c$161775b0$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "sarlav kumar" , + "pgsqlnovice" , + "pgsqlperform" +References: <20041220144034.93247.qmail@web51306.mail.yahoo.com> +Subject: Re: [PERFORM] Postgres version change - pg_dump +Date: Tue, 21 Dec 2004 16:09:55 +0900 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0067_01C4E777.8291BC50" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.048 tagged_above=0 required=5 tests=AWL, HTML_50_60, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/247 +X-Sequence-Number: 11824 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0067_01C4E777.8291BC50 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit + +As others have already said, use the newer version of pg_dump and it should +go ok. + +I had lots of problems restoring 7.1 dumps into 7.4 database, but it goes +smoothly if I use the 7.4 version of pg_dump. + +Assuming you have 2 servers, the old one and a new one, call pg_dump from +your new server as follows: + +pg_dump --username=postgres --host=192.168.x,x + +and use the IP address of the old server for the --host parameter. + +You may need to edit the pg_hba.conf file on the old server to allow the +connection from the new server. + +This is pretty convenient as you don't even have to copy the dump file from +the old server. + +I was thinking you could set up a backup server in this way. On a busy +system, it may take a load of the main server so that running backups with +users online shouldn't be a problem. That's in theory anyway. + +regards +Iain + + ----- Original Message ----- + From: sarlav kumar + To: pgsqlnovice ; pgsqlperform + Sent: Monday, December 20, 2004 11:40 PM + Subject: [PERFORM] Postgres version change - pg_dump + + + Hi All, + + Thanks to everyone for helping with my previous questions. + + I have a test database running on Postgres 7.3.2. + + version + ------------------------------------------------------------- + PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96 + + I have another server where a newer version of postgres that came with the +Fedora Core 3 package installed. + + version + ------------------------------------------------------------------------------------------------------------------------- + PostgreSQL 7.4.6 on i386-redhat-linux-gnu, compiled by GCC +i386-redhat-linux-gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6) + + I would like to do a pg_dump on the test database, and restore it in the +new database on Postgres 7.4.6. I would like to know if there would be any +problem due to the postgres version/OS change. If so, could someone tell me +what precautions I can take to avoid any problems? + + Thanks in advance, + Saranya + + + + + +------------------------------------------------------------------------------ + Do you Yahoo!? + Yahoo! Mail - Find what you need with new enhanced search. Learn more. + +------=_NextPart_000_0067_01C4E777.8291BC50 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
As others have already said, = +use the newer=20 +version of pg_dump and it should go ok.
+
 
+
I had lots of problems = +restoring 7.1 dumps=20 +into 7.4 database, but it goes smoothly if I use the 7.4 version of=20 +pg_dump.
+
 
+
Assuming you have 2 servers, = +the old one=20 +and a new one, call pg_dump from your new server as = +follows:
+
 
+
pg_dump --username=3Dpostgres=20 +--host=3D192.168.x,x  <other options>
+
 
+
and use the IP address of the = +old server=20 +for the --host parameter.
+
 
+
You may need to edit the = +pg_hba.conf file=20 +on the old server to allow the connection from the new = +server.
+
 
+
This is pretty convenient as = +you don't=20 +even have to copy the dump file from the old server.
+
 
+
I was thinking you could = +set up a=20 +backup server in this way. On a busy system, it may take a load of the = +main=20 +server so that running backups with users online shouldn't be a problem. = +That's=20 +in theory anyway.
+
 
+
regards
+
Iain
+
 
+ +
----- Original Message ----- = +
+ From:=20 + sarlav = +kumar=20 +
+
To: pgsqlnovice ; pgsqlperform = +
+
Sent: Monday, December = +20, 2004=20 + 11:40 PM
+
Subject: [PERFORM] = +Postgres=20 + version change - pg_dump
+

+
Hi All,
+
 
+
Thanks to everyone for helping with my previous questions.
+
 
+
I have a test database running on Postgres 7.3.2.
+
 
+ = +
 version         &= +nbsp;           &n= +bsp;    =20 + = +
-------------------------------------------------------------
&nbs= +p;PostgreSQL=20 + 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96
+
I have another server where a newer version of postgres that came = +with=20 + the Fedora Core 3 package installed.
+
 
+ = +
version          &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;         =20 + = +
---------------------------------------------------------------------= +----------------------------------------------------
 PostgreSQL = + + 7.4.6 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc = +(GCC)=20 + 3.4.2 20041017 (Red Hat 3.4.2-6)
+
 
+
I would like to do a pg_dump on the test database, and restore it = +in the=20 + new database on Postgres 7.4.6. I would like to know if there would be = +any=20 + problem due to the postgres version/OS change. If so, could someone = +tell me=20 + what precautions I can take to avoid any problems?
+
 
+
Thanks in advance,
+
Saranya
+
 
+
 
+
 
+

+


+ Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced = +search.=20 + Learn=20 + more. + +------=_NextPart_000_0067_01C4E777.8291BC50-- + + +From pgsql-performance-owner@postgresql.org Fri Dec 24 14:18:33 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E0AF33AABD4 + for ; + Tue, 21 Dec 2004 09:30:28 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 03297-01 + for ; + Tue, 21 Dec 2004 09:30:10 +0000 (GMT) +Received: from spr.go.th (unknown [203.157.100.42]) + by svr1.postgresql.org (Postfix) with ESMTP id 1E7A83A712B + for ; + Tue, 21 Dec 2004 09:30:08 +0000 (GMT) +Received: from smail.spr.go.th (localhost.localdomain [127.0.0.1]) + by spr.go.th (8.12.8/8.12.8) with ESMTP id iBL9Vnju005314 + for ; Tue, 21 Dec 2004 16:31:49 +0700 +Received: from 192.168.2.6 (SquirrelMail authenticated user amrit); + by smail.spr.go.th with HTTP; Tue, 21 Dec 2004 16:31:49 +0700 (ICT) +Message-ID: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> +Date: Tue, 21 Dec 2004 16:31:49 +0700 (ICT) +Subject: Howto Increased performace ? +From: "Amrit Angsusingh" +To: pgsql-performance@postgresql.org +User-Agent: SquirrelMail/1.4.3a +X-Mailer: SquirrelMail/1.4.3a +MIME-Version: 1.0 +Content-Type: text/plain;charset=tis-620 +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/288 +X-Sequence-Number: 9663 + +I used postgresql 7.3.2-1 with RH 9 on a mechine of 2 Xeon 3.0 Ghz and ram +of 4 Gb. Since 1 1/2 yr. when I started to use the database server after +optimizing the postgresql.conf everything went fine until a couple of +weeks ago , my database grew up to 3.5 Gb and there were more than 140 +concurent connections. +The server seemed to be slower in the rush hour peroid than before . There +is some swap process too. My top and meminfo are shown here below: +14:52:13 up 13 days, 2:50, 2 users, load average: 5.58, 5.97, 6.11 +218 processes: 210 sleeping, 1 running, 0 zombie, 7 stopped +CPU0 states: 7.2% user 55.2% system 0.0% nice 0.0% iowait 36.4% idle +CPU1 states: 8.3% user 56.1% system 0.0% nice 0.0% iowait 34.4% idle +CPU2 states: 10.0% user 57.0% system 0.0% nice 0.0% iowait 32.4% idle +CPU3 states: 6.2% user 55.3% system 0.0% nice 0.0% iowait 37.3% idle +Mem: 4124720k av, 4105916k used, 18804k free, 0k shrd, 10152k buff + 2900720k actv, 219908k in_d, 167468k in_c +Swap: 20370412k av, 390372k used, 19980040k free 2781256k +cached + + PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND + 14 root 18 0 0 0 0 SW 54.5 0.0 766:10 1 +kscand/HighMem +13304 postgres 17 0 280M 280M 276M D 52.5 6.9 0:10 2 postmaster +12035 postgres 16 0 175M 174M 169M D 33.0 4.3 0:26 3 postmaster +13193 postgres 16 0 128M 127M 124M S 28.4 3.1 0:05 3 postmaster +12137 postgres 16 0 498M 497M 431M D 27.2 12.3 0:34 1 postmaster + 11 root 15 0 0 0 0 SW 13.9 0.0 363:00 2 kswapd +13241 postgres 16 0 318M 318M 314M D 7.3 7.9 0:09 2 postmaster + 13 root 16 0 0 0 0 SW 6.9 0.0 82:17 0 +kscand/Normal +13367 postgres 15 0 196M 196M 193M D 6.5 4.8 0:02 2 postmaster +11984 postgres 15 0 305M 305M 301M S 4.9 7.5 2:55 1 postmaster +13331 postgres 16 0 970M 970M 966M S 4.9 24.0 0:22 1 postmaster +12388 postgres 15 0 293M 292M 289M S 3.9 7.2 2:42 3 postmaster +13328 postgres 15 0 276M 276M 272M S 2.7 6.8 0:22 0 postmaster + 26 root 16 0 0 0 0 SW 2.3 0.0 10:12 1 kjournald +11831 postgres 15 0 634M 634M 630M S 1.5 15.7 1:33 3 postmaster +12127 postgres 15 0 117M 116M 114M S 1.1 2.8 0:20 1 postmaster +12002 postgres 15 0 429M 429M 426M S 0.9 10.6 0:24 1 postmaster +12991 postgres 15 0 143M 143M 139M S 0.7 3.5 0:29 1 postmaster +13234 postgres 15 0 288M 288M 284M S 0.7 7.1 0:17 0 postmaster +13337 postgres 15 0 172M 171M 168M S 0.3 4.2 0:06 0 postmaster +13413 root 15 0 1276 1276 856 R 0.3 0.0 0:00 0 top +11937 postgres 15 0 379M 379M 375M S 0.1 9.4 2:59 2 postmaster + +Shared kernel mem: +[root@data3 root]# cat < /proc/sys/kernel/shmmax +4000000000 +[root@data3 root]# cat < /proc/sys/kernel/shmall +300000000 + +meminfo : + total: used: free: shared: buffers: cached: +Mem: 4223713280 4200480768 23232512 0 11497472 3555827712 +Swap: 20859301888 303460352 20555841536 +MemTotal: 4124720 kB +MemFree: 22688 kB +MemShared: 0 kB +Buffers: 11228 kB +Cached: 3367688 kB +SwapCached: 104800 kB +Active: 3141224 kB +ActiveAnon: 684960 kB +ActiveCache: 2456264 kB +Inact_dirty: 220504 kB +Inact_laundry: 166844 kB +Inact_clean: 94252 kB +Inact_target: 724564 kB +HighTotal: 3276736 kB +HighFree: 3832 kB +LowTotal: 847984 kB +LowFree: 18856 kB +SwapTotal: 20370412 kB +SwapFree: 20074064 kB + +Postgresql.conf : +# Connection Parameters +# +tcpip_socket = true +#ssl = false + +#max_connections = 32 +max_connections = 180 +#superuser_reserved_connections = 2 + +#port = 5432 +#hostname_lookup = false +#show_source_port = false + +#unix_socket_directory = '' +#unix_socket_group = '' +#unix_socket_permissions = 0777 # octal + +#virtual_host = '' + +#krb_server_keyfile = '' + + +# +# Shared Memory Size +# +#shared_buffers = 64 # min max_connections*2 or 16, 8KB each +shared_buffers = 250000 +#max_fsm_relations = 1000 # min 10, fsm is free space map, ~40 bytes +#max_fsm_pages = 10000 # min 1000, fsm is free space map, ~6 bytes +#max_locks_per_transaction = 64 # min 10 +#wal_buffers = 8 # min 4, typically 8KB each + +# +# Non-shared Memory Sizes +# +#sort_mem = 1024 # min 64, size in KB +sort_mem = 60000 +#vacuum_mem = 8192 # min 1024, size in KB +vacuum_mem = 20072 + +# Write-ahead log (WAL) +# +#checkpoint_segments = 3 # in logfile segments, min 1, 16MB each +#checkpoint_timeout = 300 # range 30-3600, in seconds +# +#commit_delay = 0 # range 0-100000, in microseconds +commit_delay = 10 +#commit_siblings = 5 # range 1-1000 +# +#fsync = true +fsync = false +#wal_sync_method = fsync # the default varies across platforms: +# # fsync, fdatasync, open_sync, or +open_datasync +#wal_debug = 0 # range 0-16 + + +# +# Optimizer Parameters +# +#enable_seqscan = true +#enable_indexscan = true +#enable_tidscan = true +#enable_sort = true +#enable_nestloop = true +#enable_mergejoin = true +#enable_hashjoin = true + +#effective_cache_size = 1000 # typically 8KB each +effective_cache_size = 5000 +#random_page_cost = 4 # units are one sequential page fetch cost +#cpu_tuple_cost = 0.01 # (same) +#cpu_index_tuple_cost = 0.001 # (same) +#cpu_operator_cost = 0.0025 # (same) + +#default_statistics_target = 10 # range 1-1000 + +# +# GEQO Optimizer Parameters +# +#geqo = true +#geqo_selection_bias = 2.0 # range 1.5-2.0 +#geqo_threshold = 11 +#geqo_pool_size = 0 # default based on tables in statement, + # range 128-1024 +#geqo_effort = 1 +#geqo_generations = 0 + + + +Please give me any comment about adjustment my mechine. +Amrit Angsusingh +nakornsawan , Thailand + + + +From pgsql-performance-owner@postgresql.org Tue Dec 21 11:21:49 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 813613A6A11 + for ; + Tue, 21 Dec 2004 11:21:25 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44985-08 + for ; + Tue, 21 Dec 2004 11:21:12 +0000 (GMT) +Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net + [194.217.242.88]) + by svr1.postgresql.org (Postfix) with ESMTP id 64FE03ABBF6 + for ; + Tue, 21 Dec 2004 11:21:11 +0000 (GMT) +Received: from mwynhau.demon.co.uk ([193.237.186.96] + helo=mainbox.archonet.com) + by anchor-post-30.mail.demon.net with esmtp (Exim 4.42) + id 1Cgi4j-000ICe-1C; Tue, 21 Dec 2004 11:21:09 +0000 +Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP + id 642FA164FD; Tue, 21 Dec 2004 11:21:08 +0000 (GMT) +Message-ID: <41C80723.6060302@archonet.com> +Date: Tue, 21 Dec 2004 11:21:07 +0000 +From: Richard Huxton +User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gurpreet Sachdeva +Cc: pgsql-performance@postgresql.org +Subject: Re: Postgres on Linux Cluster! +References: <20041221050256.26822.qmail@webmail46.rediffmail.com> +In-Reply-To: <20041221050256.26822.qmail@webmail46.rediffmail.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.134 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, IP_LINK_PLUS, NORMAL_HTTP_TO_IP +X-Spam-Level: +X-Archive-Number: 200412/263 +X-Sequence-Number: 9638 + +Gurpreet Sachdeva wrote: +> I have recently transfered a big database on my master node of a 4 +> node openSSI Cluster... The system is working fine but sometimes, I +> get following errors: +> +> http://192.168.1.100/cgi-bin/search.py File +> "/usr/lib/python2.2/site-packages/pyPgSQL/PgSQL.py", line 3067, in +> execute, referer: http://192.168.1.100/cgi-bin/search.py +> self.conn.conn.query('ROLLBACK WORK'), referer: +> http://192.168.1.100/cgi-bin/search.py libpq.ProgrammingError: no +> connection to the server, referer: +> http://192.168.1.100/cgi-bin/search.py , referer: +> http://192.168.1.100/cgi-bin/search.py + +At a wild guess, this happens when a CGI process is migrated to another +node without migrating the accompanying connection (however you'd do that). + +> This error comes while insertion of data takes place... Is Postgres +> successfull on Cluster??? Will that give me performance enhancement +> in any way??? Please help... + +Probably not, and almost certainly not. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Tue Dec 21 14:23:50 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B0F293ABB0B + for ; + Tue, 21 Dec 2004 14:23:41 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 11746-06 + for ; + Tue, 21 Dec 2004 14:23:27 +0000 (GMT) +Received: from gp.word-to-the-wise.com (gp.word-to-the-wise.com + [64.71.176.18]) + by svr1.postgresql.org (Postfix) with ESMTP id 043B33A70DA + for ; + Tue, 21 Dec 2004 14:23:30 +0000 (GMT) +Received: by gp.word-to-the-wise.com (Postfix, from userid 500) + id 59DB990005A; Tue, 21 Dec 2004 06:28:18 -0800 (PST) +Date: Tue, 21 Dec 2004 06:28:18 -0800 +From: Steve Atkins +To: pgsql-performance@postgresql.org +Subject: Re: Tips for a system with _extremely_ slow IO? +Message-ID: <20041221142818.GC28270@gp.word-to-the-wise.com> +References: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/264 +X-Sequence-Number: 9639 + +On Fri, Dec 17, 2004 at 11:51:12PM -0800, Ron Mayer wrote: +> Any advice for settings for extremely IO constrained systems? +> +> A demo I've set up for sales seems to be spending much of it's time in +> disk wait states. +> +> +> The particular system I'm working with is: +> Ext3 on Debian inside Microsoft VirtualPC on NTFS +> on WindowsXP on laptops of our sales team. +> Somewhat surprisingly, CPU performance is close to native; but disk IO +> is much worse - probably orders of magnitude worse - since there are +> so many layers of filesystems involved. Unfortunately, no, I don't +> think the sales guys will upgrade to BSD. :) +> +> The database is too large to fit entirely in memory (3GB of spatial data +> using PostGIS); and has relative large updates (people can add "layers" +> consisting of perhaps 10000 points, lines, and polygons out of a million +> or so possibilities - they do this by doing 10K inserts into tables with +> postgis geometry columns). + +I've found VirtualPC to be somewhat slower than VMWare for some things (and +faster for others) and less friendly to a Linux guest OS. Try an identical +build running inside VMWare. + +Can you run the VM using a native disk partition, rather than one emulated +by a big NTFS file? + +Even if your application needs to run under Linux, can you run the +database directly on XP (8.0RC2 hot off the presses...) and connect to +it from the Linux VM? + +Cheers, + Steve + +From pgsql-performance-owner@postgresql.org Tue Dec 21 18:29:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D2A953ABC2E + for ; + Tue, 21 Dec 2004 18:29:10 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 10187-07 + for ; + Tue, 21 Dec 2004 18:29:06 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 6B3693ABC05 + for ; + Tue, 21 Dec 2004 18:29:05 +0000 (GMT) +Received: from gnari ([157.157.184.21] [157.157.184.21]) by quasar.skima.is + with ESMTP; Tue, 21 Dec 2004 18:29:01 Z +Subject: Re: Tips for a system with _extremely_ slow IO? +From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= +To: Ron Mayer +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Date: Tue, 21 Dec 2004 18:29:56 +0000 +Message-Id: <1103653796.8180.15.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/265 +X-Sequence-Number: 9640 + +On Fri, 2004-12-17 at 23:51 -0800, Ron Mayer wrote: +> Any advice for settings for extremely IO constrained systems? +> +> A demo I've set up for sales seems to be spending much of it's time in +> disk wait states. +> +> +> The particular system I'm working with is: +> Ext3 on Debian inside Microsoft VirtualPC on NTFS +> on WindowsXP on laptops of our sales team. + +As this is only for demo purposes, you might consider turning fsync off, +although I have no idea if it would have any effect on your setup. + +gnari + + + +From pgsql-performance-owner@postgresql.org Tue Dec 21 18:36:57 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 864EB3AAEE8 + for ; + Tue, 21 Dec 2004 18:36:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 14163-04 + for ; + Tue, 21 Dec 2004 18:36:45 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id 303383A459A + for ; + Tue, 21 Dec 2004 18:36:45 +0000 (GMT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 +Subject: Re: Tips for a system with _extremely_ slow IO? +Date: Tue, 21 Dec 2004 13:36:12 -0500 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A757C@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Tips for a system with _extremely_ slow IO? +Thread-Index: AcTni2EwIVtNoHrTRpGHJbtZlibkHgAAE4/w +From: "Merlin Moncure" +To: =?iso-8859-1?Q?Ragnar_Hafsta=F0?= +Cc: +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.052 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/266 +X-Sequence-Number: 9641 + +> > A demo I've set up for sales seems to be spending much of it's time = +in +> > disk wait states. +> > +> > +> > The particular system I'm working with is: +> > Ext3 on Debian inside Microsoft VirtualPC on NTFS +> > on WindowsXP on laptops of our sales team. +>=20 +> As this is only for demo purposes, you might consider turning fsync = +off, +> although I have no idea if it would have any effect on your setup. + +Try removing VirtualPC from the equation. You can run the win32 native = +port or dual boot your laptop for example. + +Merlin + +From pgsql-performance-owner@postgresql.org Tue Dec 21 22:56:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 9D5BC3ABCBB + for ; + Tue, 21 Dec 2004 22:56:47 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30633-10 + for ; + Tue, 21 Dec 2004 22:56:42 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) + by svr1.postgresql.org (Postfix) with ESMTP id 28C543AB07C + for ; + Tue, 21 Dec 2004 22:56:43 +0000 (GMT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 0B4CE1C8F3; Tue, 21 Dec 2004 16:56:43 -0600 (CST) +Date: Tue, 21 Dec 2004 16:56:43 -0600 +From: "Jim C. Nasby" +To: Tom Lane +Cc: Greg Stark , josh@agliodbs.com, + Stacy White , pgsql-performance@postgresql.org +Subject: Re: Partitioned table performance +Message-ID: <20041221225643.GU18180@decibel.org> +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412102152.40442.josh@agliodbs.com> + <001f01c4e26c$99719680$0200a8c0@grownups> + <200412151025.02262.josh@agliodbs.com> + <87oegvqrst.fsf@stark.xeocode.com> <18421.1103160608@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <18421.1103160608@sss.pgh.pa.us> +X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/267 +X-Sequence-Number: 9642 + +Sorry for the late reply, so I included the whole thread. Should this be +a TODO? + +On Wed, Dec 15, 2004 at 08:30:08PM -0500, Tom Lane wrote: +> Greg Stark writes: +> > But I'm a bit puzzled. Why would Append have any significant cost? It's just +> > taking the tuples from one plan node and returning them until they run out, +> > then taking the tuples from another plan node. It should have no i/o cost and +> > hardly any cpu cost. Where is the time going? +> +> As best I can tell by profiling, the cost of the Append node per se is +> indeed negligible --- no more than a couple percent of the runtime in +> CVS tip for a test case similar to Stacy White's example. +> +> It looks bad in EXPLAIN ANALYZE, but you have to realize that passing +> the tuples up through the Append node doubles the instrumentation +> overhead of EXPLAIN ANALYZE, which is pretty sizable already. (If you +> turn on \timing in psql and try the query itself vs. EXPLAIN ANALYZE, +> the actual elapsed time is about double, at least for me.) +> +> The other effect, which I hadn't expected, is that the seqscans +> themselves actually slow down. I get +> +> regression=# explain analyze SELECT COUNT(*), MAX(bar1) FROM super_foo ; +> QUERY PLAN +> ---------------------------------------------------------------------------------------------------------------------------------------- +> Aggregate (cost=16414.32..16414.32 rows=1 width=4) (actual time=32313.980..32313.988 rows=1 loops=1) +> -> Append (cost=0.00..13631.54 rows=556555 width=4) (actual time=0.232..21848.401 rows=524289 loops=1) +> -> Seq Scan on super_foo (cost=0.00..0.00 rows=1 width=4) (actual time=0.020..0.020 rows=0 loops=1) +> -> Seq Scan on sub_foo1 super_foo (cost=0.00..6815.77 rows=278277 width=4) (actual time=0.187..6926.395 rows=262144 loops=1) +> -> Seq Scan on sub_foo2 super_foo (cost=0.00..6815.77 rows=278277 width=4) (actual time=0.168..7026.953 rows=262145 loops=1) +> Total runtime: 32314.993 ms +> (6 rows) +> +> regression=# explain analyze SELECT COUNT(*), MAX(bar1) FROM sub_foo1; +> QUERY PLAN +> ------------------------------------------------------------------------------------------------------------------------ +> Aggregate (cost=8207.16..8207.16 rows=1 width=4) (actual time=9850.420..9850.428 rows=1 loops=1) +> -> Seq Scan on sub_foo1 (cost=0.00..6815.77 rows=278277 width=4) (actual time=0.202..4642.401 rows=262144 loops=1) +> Total runtime: 9851.423 ms +> (3 rows) +> +> Notice the actual times for the sub_foo1 seqscans. That increase (when +> counted for both input tables) almost exactly accounts for the +> difference in non-EXPLAIN ANALYZE runtime. +> +> After digging around, I find that the reason for the difference is that +> the optimization to avoid a projection step (ExecProject) isn't applied +> for scans of inheritance unions: +> +> /* +> * Can't do it with inheritance cases either (mainly because Append +> * doesn't project). +> */ +> if (rel->reloptkind != RELOPT_BASEREL) +> return false; +> +> So if you were to try the example in a pre-7.4 PG, which didn't have +> that optimization, you'd probably find that the speeds were just about +> the same. (I'm too lazy to verify this though.) +> +> I looked briefly at what it would take to cover this case, and decided +> that it's a nontrivial change, so it's too late to do something about it +> for 8.0. I think it's probably possible to fix it though, at least for +> cases where the child tables have rowtypes identical to the parent. +> +> 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 +> + +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +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 Fri Dec 24 14:27:42 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5D7E03ABCBA + for ; + Tue, 21 Dec 2004 23:03:35 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 33183-08 + for ; + Tue, 21 Dec 2004 23:03:22 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 28C813ABCAF + for ; + Tue, 21 Dec 2004 23:03:23 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id A616031958; Wed, 22 Dec 2004 00:03:22 +0100 (MET) +From: "Thomas Wegner" +X-Newsgroups: pgsql.performance +Subject: Speed in V8.0 +Date: Wed, 22 Dec 2004 00:03:18 +0100 +Organization: Hub.Org Networking Services +Lines: 29 +Message-ID: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 +X-RFC2646: Format=Flowed; Original +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.185 tagged_above=0 required=5 tests=PRIORITY_NO_NAME +X-Spam-Level: * +X-Archive-Number: 200412/290 +X-Sequence-Number: 9665 + +Hello, i have a problem between V7.4.3 Cygwin and +V8.0RC2 W2K. I have 2 systems: + +1. Production Machine + - Dual P4 3000MHz + - 2 GB RAM + - W2K + - PostgreSQL 7.4.3 under Cygwin + - i connect to it over a DSL Line +2. Develop Machine + - P4 1800MHz + - 760 MB RAM + - PostgreSQL Native Windows + - local connection 100MB/FD + +Both systems use the default postgresql.conf. Now the problem. +I have an (unoptimized, dynamic) query wich was execute on the +production machine over DSL in 2 seconds and on my develop +machine, connected over local LAN, in 119 seconds! + +Whats this? I can not post the query details here public, its a commercial +project. Any first idea? I execute on both machine the same query with +the same database design! +--------------------------------------------- +Thomas Wegner +CabrioMeter - The Weather Plugin for Trillian +http://www.wegner24.de/cabriometer + + + +From pgsql-performance-owner@postgresql.org Tue Dec 21 23:12:10 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id CA67B3ABCF7 + for ; + Tue, 21 Dec 2004 23:12:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 36619-03 + for ; + Tue, 21 Dec 2004 23:11:55 +0000 (GMT) +Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) + by svr1.postgresql.org (Postfix) with ESMTP id 446693A6351 + for ; + Tue, 21 Dec 2004 23:11:56 +0000 (GMT) +Received: by flake.decibel.org (Postfix, from userid 1001) + id 085A01C8F3; Tue, 21 Dec 2004 17:11:55 -0600 (CST) +Date: Tue, 21 Dec 2004 17:11:55 -0600 +From: "Jim C. Nasby" +To: Josh Berkus +Cc: pgsql-performance@postgresql.org, Greg Stark , + Stacy White +Subject: Re: Partitioned table performance +Message-ID: <20041221231155.GV18180@decibel.org> +References: <000a01c4da74$84e072e0$0200a8c0@grownups> + <200412151025.02262.josh@agliodbs.com> + <87oegvqrst.fsf@stark.xeocode.com> + <200412151156.40908.josh@agliodbs.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200412151156.40908.josh@agliodbs.com> +X-Operating-System: FreeBSD 4.10-RELEASE-p3 i386 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/268 +X-Sequence-Number: 9643 + +On Wed, Dec 15, 2004 at 11:56:40AM -0800, Josh Berkus wrote: +> Greg, +> +> > Well Oracle has lots of partitioning intelligence pushed up to the planner +> > to avoid overhead. +> > +> > If you have a query with something like "WHERE date = '2004-01-01'" and +> > date is your partition key (even if it's a range) then Oracle will figure +> > out which partition it will need at planning time. +> +> Hmmm ... well, we're looking at making a spec for Postgres Table Partitioning. +> Maybe you could help? + +This is something I've been thinking about doing for +http://stats.distributed.net; is there a formal project for this +somewhere? + +On a different note, has anyone looked at the savings you get by +ommitting the partition field from the child tables? ISTM that the +savings would be substantial for narrow tables. Of course that most +likely means doing a union view instead of inheritence, but I'm guessing +here. The table I'm thinking of partitioning is quite narrow (see +below), so I suspect that dropping project_id out would result in a +substantial savings (there's basically nothing that ever queries across +the whole table). With the data distribution, I suspect just breaking +project ID's 205, 5, and 25 into partitioned tables that didn't contain +project_id would save about 450M (4bytes * 95% * 130M). + +(the table has ~130M rows) + + Table "public.email_contrib" + Column | Type | Modifiers +------------+---------+----------- + project_id | integer | not null + id | integer | not null + date | date | not null + team_id | integer | + work_units | bigint | not null +Indexes: + "email_contrib_pkey" primary key, btree (project_id, id, date) + "email_contrib__pk24" btree (id, date) WHERE (project_id = 24) + "email_contrib__pk25" btree (id, date) WHERE (project_id = 25) + "email_contrib__pk8" btree (id, date) WHERE (project_id = 8) + "email_contrib__project_date" btree (project_id, date) +Foreign-key constraints: + "fk_email_contrib__id" FOREIGN KEY (id) REFERENCES stats_participant(id) ON UPDATE CASCADE + "fk_email_contrib__team_id" FOREIGN KEY (team_id) REFERENCES stats_team(team) ON UPDATE CASCADE + +stats=# select * from pg_stats where tablename='email_contrib' and +attname='project_id'; + schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation + ------------+---------------+------------+-----------+-----------+------------+-------------------+---------------------------------------------------------+------------------+------------- + public | email_contrib | project_id | 0 | 4 | 6 | {205,5,25,8,24,3} | {0.461133,0.4455,0.0444333,0.0418667,0.0049,0.00216667} | | 0.703936 +-- +Jim C. Nasby, Database Consultant decibel@decibel.org +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 Fri Dec 24 14:27:33 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 990463ABD2E + for ; + Wed, 22 Dec 2004 00:25:54 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58693-01 + for ; + Wed, 22 Dec 2004 00:25:47 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 026273ABD19 + for ; + Wed, 22 Dec 2004 00:25:47 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id E6D3831971; Wed, 22 Dec 2004 01:25:47 +0100 (MET) +From: "Thomas Wegner" +X-Newsgroups: pgsql.performance +Subject: Re: Speed in V8.0 +Date: Wed, 22 Dec 2004 01:25:45 +0100 +Organization: Hub.Org Networking Services +Lines: 44 +Message-ID: +References: +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 +X-RFC2646: Format=Flowed; Response +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.185 tagged_above=0 required=5 tests=PRIORITY_NO_NAME +X-Spam-Level: * +X-Archive-Number: 200412/289 +X-Sequence-Number: 9664 + +2. Develop Machine + - P4 1800MHz + - 760 MB RAM + - W2K + - PostgreSQL 8.0 RC2 Native Windows + - local connection 100MB/FD +--------------------------------------------- +Thomas Wegner +CabrioMeter - The Weather Plugin for Trillian +http://www.wegner24.de/cabriometer + +"Thomas Wegner" schrieb im Newsbeitrag +news:cqaa3l$12im$2@news.hub.org... +> Hello, i have a problem between V7.4.3 Cygwin and +> V8.0RC2 W2K. I have 2 systems: +> +> 1. Production Machine +> - Dual P4 3000MHz +> - 2 GB RAM +> - W2K +> - PostgreSQL 7.4.3 under Cygwin +> - i connect to it over a DSL Line +> 2. Develop Machine +> - P4 1800MHz +> - 760 MB RAM +> - PostgreSQL Native Windows +> - local connection 100MB/FD +> +> Both systems use the default postgresql.conf. Now the problem. +> I have an (unoptimized, dynamic) query wich was execute on the +> production machine over DSL in 2 seconds and on my develop +> machine, connected over local LAN, in 119 seconds! +> +> Whats this? I can not post the query details here public, its a commercial +> project. Any first idea? I execute on both machine the same query with +> the same database design! +> --------------------------------------------- +> Thomas Wegner +> CabrioMeter - The Weather Plugin for Trillian +> http://www.wegner24.de/cabriometer +> +> + + + +From pgsql-performance-owner@postgresql.org Wed Dec 22 01:41:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EE6FB3ABC89 + for ; + Wed, 22 Dec 2004 01:40:28 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76238-09 + for ; + Wed, 22 Dec 2004 01:40:19 +0000 (GMT) +Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) + by svr1.postgresql.org (Postfix) with ESMTP id 7FC4E3A60CD + for ; + Wed, 22 Dec 2004 01:40:20 +0000 (GMT) +Received: from grownups (c-24-21-166-228.client.comcast.net[24.21.166.228]) + by comcast.net (sccrmhc13) with SMTP + id <20041222014019016003g6gle>; Wed, 22 Dec 2004 01:40:19 +0000 +Message-ID: <006901c4e7c7$62118500$0200a8c0@grownups> +From: "Stacy White" +To: "Josh Berkus" , "Greg Stark" +Cc: +References: + <000a01c4da74$84e072e0$0200a8c0@grownups><200412151025.02262.josh@agliodbs.com><87oegvqrst.fsf@stark.xeocode.com><200412151156.40908.josh@agliodbs.com> + <87vfb3p40w.fsf@stark.xeocode.com> +Subject: Re: Partitioned table performance +Date: Tue, 21 Dec 2004 17:41:39 -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.1409 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.24 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/269 +X-Sequence-Number: 9644 + +The discussion seems to have diverged a little, so I don't feel too bad +about making some semi-off-topic comments. + +From: "Greg Stark" +> Like I said though, we found "global indexes" defeated the whole purpose. + +First semi-off-topic comment: I think this depends on the index, the data, +and the goal of the partitioning. We use partitioning on one of our Oracle +projects for performance rather than managability. In this case, a global +index on a non-partitioned field can be helpful. + +Imagine an 'orders' table with 100 partitions on week. Products have a +short life cycle, and are typically around for only a week or two. A query +like 'SELECT * FROM orders WHERE product_no = ?' forces a lookup on 100 +different local indexes, but only one global index. + + +Second-semi-off-topic comment: Josh mentioned that Oracle's partitioning +introduces it's own overhead, so I re-ran my earlier benchmarks on one of +our Oracle machines. + +I believe Oracle's licensing agreement prohibits me from posting any +benchmarks, so all I'll say is that Postgres' inheritance partitioning +implementation is _very_ low overhead, and even union views are competitive. + + +From pgsql-performance-owner@postgresql.org Wed Dec 22 16:32:05 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 610DC3ABE63 + for ; + Wed, 22 Dec 2004 16:32:04 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 47347-09 + for ; + Wed, 22 Dec 2004 16:31:56 +0000 (GMT) +Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) + by svr1.postgresql.org (Postfix) with ESMTP id B100B3ABDA4 + for ; + Wed, 22 Dec 2004 16:31:55 +0000 (GMT) +Received: from [82.234.66.131] (imac.rilk.com [82.234.66.131]) + (authenticated bits=0) + by mail.rilk.com (8.13.0/8.13.0) with ESMTP id iBMGVpYK002017 + (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO) + for ; + Wed, 22 Dec 2004 17:31:53 +0100 (CET) +Mime-Version: 1.0 (Apple Message framework v619) +Content-Transfer-Encoding: quoted-printable +Message-Id: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +To: pgsql-performance@postgresql.org +From: Pailloncy Jean-Gerard +Subject: 8rc2 & BLCKSZ +Date: Wed, 22 Dec 2004 17:31:50 +0100 +X-Mailer: Apple Mail (2.619) +X-DCC-sgs_public_dcc_server-Metrics: mail.rilk.com 1199; Body=1 Fuz1=1 Fuz2=1 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/270 +X-Sequence-Number: 9645 + +Hi, + +A small test with 8rc2 and BLCKSZ of 8k and 32k. +It seems there is a 10% increase in the number of transactions by=20 +second. +Does someone plan to carefully test the impact of BLCKSZ ? + +Cordialement, +Jean-G=E9rard Pailloncy + +with 8k: + > /test/bin/pgbench -c 10 -t 300 test +starting vacuum...end. +transaction type: TPC-B (sort of) +scaling factor: 10 +number of clients: 10 +number of transactions per client: 300 +number of transactions actually processed: 3000/3000 +... +tps =3D 26.662146 (excluding connections establishing) +tps =3D 23.742071 (excluding connections establishing) +tps =3D 28.323828 (excluding connections establishing) +tps =3D 27.944931 (excluding connections establishing) +tps =3D 25.898393 (excluding connections establishing) +tps =3D 26.727316 (excluding connections establishing) +tps =3D 27.499692 (excluding connections establishing) +tps =3D 25.430853 (excluding connections establishing) + +with 32k: + > /test/bin/pgbench -c 10 -t 300 test +starting vacuum...end. +transaction type: TPC-B (sort of) +scaling factor: 10 +number of clients: 10 +number of transactions per client: 300 +number of transactions actually processed: 3000/3000 +... +tps =3D 28.609049 (excluding connections establishing) +tps =3D 29.978503 (excluding connections establishing) +tps =3D 30.502606 (excluding connections establishing) +tps =3D 33.406386 (excluding connections establishing) +tps =3D 30.422134 (excluding connections establishing) +tps =3D 26.878762 (excluding connections establishing) +tps =3D 31.461116 (excluding connections establishing) + + +From pgsql-performance-owner@postgresql.org Wed Dec 22 20:09:36 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2EF5C3ABE78 + for ; + Wed, 22 Dec 2004 20:09:22 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 19581-03 + for ; + Wed, 22 Dec 2004 20:09:04 +0000 (GMT) +Received: from web13124.mail.yahoo.com (web13124.mail.yahoo.com + [216.136.174.142]) + by svr1.postgresql.org (Postfix) with SMTP id D05283ABD3D + for ; + Wed, 22 Dec 2004 20:09:04 +0000 (GMT) +Received: (qmail 94017 invoked by uid 60001); 22 Dec 2004 20:09:04 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=u4mO870/rV1DLJSQMukwMf6F322/j++cmHSlgzJUuafzo8VumEZwXtwVX7dxjGkjdRizrgETXDskJwpywyINgZpk0ARaOxjazEkbHwy2X1HeqcSG2StWMsJEqAus6XW185CGPJTqnjrh3ApcJ/iQ2GJlMMtpKMgy0q81ETTI0ag= + ; +Message-ID: <20041222200904.94015.qmail@web13124.mail.yahoo.com> +Received: from [63.78.249.230] by web13124.mail.yahoo.com via HTTP; + Wed, 22 Dec 2004 12:09:04 PST +Date: Wed, 22 Dec 2004 12:09:04 -0800 (PST) +From: Litao Wu +Subject: Why so much time difference with a same query/plan? +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/271 +X-Sequence-Number: 9646 + +Merry Xmas! + +I have a query. It sometimes runs OK and sometimes +horrible. Here is result from explain analyze: + +explain analyze +SELECT module, sum(c1) + sum(c2) + sum(c3) + sum(c4) ++ sum(c5) AS "count" +FROM xxx +WHERE created >= ('now'::timestamptz - '1 +day'::interval) AND customer_id='158' + AND domain='xyz.com' +GROUP BY module; + +There is an index: +Indexes: xxx_idx btree (customer_id, created, +"domain") + +Table are regularlly "vacuum full" and reindex and +it has 3 million rows. + + + QUERY PLAN + +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=139.53..141.65 rows=12 width=30) +(actual time=17623.65..17623.65 rows=0 loops=1) + -> Group (cost=139.53..140.14 rows=121 width=30) +(actual time=17623.64..17623.64 rows=0 loops=1) + -> Sort (cost=139.53..139.83 rows=121 +width=30) (actual time=17623.63..17623.63 rows=0 +loops=1) + Sort Key: module + -> Index Scan using xxx_idx on xxx +(cost=0.00..135.33 rows=121 width=30) (actual +time=17622.95..17622.95 rows=0 loops=1) + Index Cond: ((customer_id = 158) +AND (created >= '2004-12-02 +11:26:22.596656-05'::timestamp with time zone) AND +("domain" = 'xyz.com'::character varying)) + Total runtime: 17624.05 msec +(7 rows) + + QUERY PLAN + +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=142.05..144.21 rows=12 width=30) +(actual time=1314931.09..1314931.09 rows=0 loops=1) + -> Group (cost=142.05..142.66 rows=124 width=30) +(actual time=1314931.08..1314931.08 rows=0 loops=1) + -> Sort (cost=142.05..142.36 rows=124 +width=30) (actual time=1314931.08..1314931.08 rows=0 +loops=1) + Sort Key: module + -> Index Scan using xxx_idx on xxx +(cost=0.00..137.74 rows=124 width=30) (actual +time=1314930.72..1314930.72 rows=0 loops=1) + Index Cond: ((customer_id = 158) +AND (created >= '2004-12-01 +15:21:51.785526-05'::timestamp with time zone) AND +("domain" = 'xyz.com'::character varying)) + Total runtime: 1314933.16 msec +(7 rows) + +What can I try? + +Thanks, + + + + +__________________________________ +Do you Yahoo!? +Dress up your holiday email, Hollywood style. Learn more. +http://celebrity.mail.yahoo.com + +From pgsql-performance-owner@postgresql.org Wed Dec 22 20:51:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 96BBB3ABEF1 + for ; + Wed, 22 Dec 2004 20:51:20 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34273-10 + for ; + Wed, 22 Dec 2004 20:51:08 +0000 (GMT) +Received: from lorax.kcilink.com (lorax.kciLink.com [206.112.95.1]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BB423ABE9A + for ; + Wed, 22 Dec 2004 20:51:06 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by lorax.kcilink.com (Postfix) with ESMTP id B7BAF3E0F + for ; + Wed, 22 Dec 2004 15:51:06 -0500 (EST) +Received: from lorax.kcilink.com ([127.0.0.1]) + by localhost (lorax.kcilink.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 76297-04-2 for ; + Wed, 22 Dec 2004 15:51:03 -0500 (EST) +Received: by lorax.kcilink.com (Postfix, from userid 8) + id 22F763E68; Wed, 22 Dec 2004 15:51:03 -0500 (EST) +To: pgsql-performance@postgresql.org +Path: not-for-mail +From: Vivek Khera +Newsgroups: ml.postgres.performance +Subject: Re: 8rc2 & BLCKSZ +Date: Wed, 22 Dec 2004 15:51:02 -0500 +Organization: Khera Communications, Inc., Rockville, MD +Lines: 20 +Message-ID: +References: +NNTP-Posting-Host: yertle.kcilink.com +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Trace: lorax.kcilink.com 1103748663 56099 65.205.34.180 (22 Dec 2004 + 20:51:03 GMT) +X-Complaints-To: daemon@kciLink.com +NNTP-Posting-Date: Wed, 22 Dec 2004 20:51:03 +0000 (UTC) +User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Security Through + Obscurity, berkeley-unix) +Cancel-Lock: sha1:BoY44eTThSFue34de2Yc9xMQ7kE= +X-Virus-Scanned: amavisd-new at kcilink.com +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/272 +X-Sequence-Number: 9647 + +>>>>> "PJ" == Pailloncy Jean-Gerard writes: + +PJ> Hi, +PJ> A small test with 8rc2 and BLCKSZ of 8k and 32k. +PJ> It seems there is a 10% increase in the number of transactions by +PJ> second. +PJ> Does someone plan to carefully test the impact of BLCKSZ ? + +One of the suggestions handed to me a long time ago for speeding up PG +on FreeBSD was to double the default blocksize in PG. I tried it, but +found not a significant enough speed up to make it worth the trouble +to remember to patch every version of Pg during the upgrade path (ie, +7.4.0 -> 7.4.2 etc.) Forgetting to do that would be disastrous! + + +-- +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +Vivek Khera, Ph.D. Khera Communications, Inc. +Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806 +AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/ + +From pgsql-performance-owner@postgresql.org Wed Dec 22 21:06:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8B6B43ABF26 + for ; + Wed, 22 Dec 2004 21:04:55 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39194-09 + for ; + Wed, 22 Dec 2004 21:04:50 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E1E7A3ABEE1 + for ; + Wed, 22 Dec 2004 21:04:51 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBML4oSY020323; + Wed, 22 Dec 2004 16:04:50 -0500 (EST) +To: Vivek Khera +Cc: pgsql-performance@postgresql.org +Subject: Re: 8rc2 & BLCKSZ +In-reply-to: +References: + +Comments: In-reply-to Vivek Khera + message dated "Wed, 22 Dec 2004 15:51:02 -0500" +Date: Wed, 22 Dec 2004 16:04:50 -0500 +Message-ID: <20322.1103749490@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/273 +X-Sequence-Number: 9648 + +Vivek Khera writes: +> One of the suggestions handed to me a long time ago for speeding up PG +> on FreeBSD was to double the default blocksize in PG. I tried it, but +> found not a significant enough speed up to make it worth the trouble +> to remember to patch every version of Pg during the upgrade path (ie, +> 7.4.0 -> 7.4.2 etc.) Forgetting to do that would be disastrous! + +Not really --- the postmaster will refuse to start if the BLCKSZ shown +in pg_control doesn't match what is compiled in. I concur though that +there may be no significant performance gain. For some workloads there +may well be a performance loss from increasing BLCKSZ. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Dec 22 21:52:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5CECA3ABE32 + for ; + Wed, 22 Dec 2004 21:52:48 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 54451-09 + for ; + Wed, 22 Dec 2004 21:52:39 +0000 (GMT) +Received: from web13124.mail.yahoo.com (web13124.mail.yahoo.com + [216.136.174.142]) + by svr1.postgresql.org (Postfix) with SMTP id 0E56E3ABC1C + for ; + Wed, 22 Dec 2004 21:52:40 +0000 (GMT) +Received: (qmail 12347 invoked by uid 60001); 22 Dec 2004 21:52:40 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=BqAgjs0/WRL1mMlMo8sXGu23UKFEOQcPzYEnikNHoDaZ2mpH35rHtNg+ONQI8gJl6RWN/HI8QFH+Y16DEeCwe/antjRGzKdWNRSGQWa5XgYV0rBLGmJoZO0ASl8v8jEbEeDMfwkWeEg6ovelfRp8s5Lmtdq733BvtKDcPaySkNc= + ; +Message-ID: <20041222215240.12345.qmail@web13124.mail.yahoo.com> +Received: from [63.78.249.230] by web13124.mail.yahoo.com via HTTP; + Wed, 22 Dec 2004 13:52:40 PST +Date: Wed, 22 Dec 2004 13:52:40 -0800 (PST) +From: Litao Wu +Subject: Re: Why so much time difference with a same query/plan? +To: Litao Wu , pgsql-performance@postgresql.org +In-Reply-To: <20041222200904.94015.qmail@web13124.mail.yahoo.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.28 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200412/274 +X-Sequence-Number: 9649 + +Does the order of columns in the index matter since +more than 50% customer_id = 158? + +I think it does not in Oracle. + +Will the performance be better if I change index +xxx_idx to ("domain", customer_id, created)? + +I will test myself when possible. + +Thanks, + +--- Litao Wu wrote: + +> Merry Xmas! +> +> I have a query. It sometimes runs OK and sometimes +> horrible. Here is result from explain analyze: +> +> explain analyze +> SELECT module, sum(c1) + sum(c2) + sum(c3) + +> sum(c4) +> + sum(c5) AS "count" +> FROM xxx +> WHERE created >= ('now'::timestamptz - '1 +> day'::interval) AND customer_id='158' +> AND domain='xyz.com' +> GROUP BY module; +> +> There is an index: +> Indexes: xxx_idx btree (customer_id, created, +> "domain") +> +> Table are regularlly "vacuum full" and reindex and +> it has 3 million rows. +> +> +> +> QUERY PLAN +> +> +> +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +> Aggregate (cost=139.53..141.65 rows=12 width=30) +> (actual time=17623.65..17623.65 rows=0 loops=1) +> -> Group (cost=139.53..140.14 rows=121 +> width=30) +> (actual time=17623.64..17623.64 rows=0 loops=1) +> -> Sort (cost=139.53..139.83 rows=121 +> width=30) (actual time=17623.63..17623.63 rows=0 +> loops=1) +> Sort Key: module +> -> Index Scan using xxx_idx on xxx +> (cost=0.00..135.33 rows=121 width=30) (actual +> time=17622.95..17622.95 rows=0 loops=1) +> Index Cond: ((customer_id = +> 158) +> AND (created >= '2004-12-02 +> 11:26:22.596656-05'::timestamp with time zone) AND +> ("domain" = 'xyz.com'::character varying)) +> Total runtime: 17624.05 msec +> (7 rows) +> +> +> QUERY PLAN +> +> +> +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +> Aggregate (cost=142.05..144.21 rows=12 width=30) +> (actual time=1314931.09..1314931.09 rows=0 loops=1) +> -> Group (cost=142.05..142.66 rows=124 +> width=30) +> (actual time=1314931.08..1314931.08 rows=0 loops=1) +> -> Sort (cost=142.05..142.36 rows=124 +> width=30) (actual time=1314931.08..1314931.08 rows=0 +> loops=1) +> Sort Key: module +> -> Index Scan using xxx_idx on xxx +> (cost=0.00..137.74 rows=124 width=30) (actual +> time=1314930.72..1314930.72 rows=0 loops=1) +> Index Cond: ((customer_id = +> 158) +> AND (created >= '2004-12-01 +> 15:21:51.785526-05'::timestamp with time zone) AND +> ("domain" = 'xyz.com'::character varying)) +> Total runtime: 1314933.16 msec +> (7 rows) +> +> What can I try? +> +> Thanks, +> +> +> +> +> __________________________________ +> Do you Yahoo!? +> Dress up your holiday email, Hollywood style. Learn +> more. +> http://celebrity.mail.yahoo.com +> +> ---------------------------(end of +> broadcast)--------------------------- +> TIP 2: you can get off all lists at once with the +> unregister command +> (send "unregister YourEmailAddressHere" to +> majordomo@postgresql.org) +> + + + + +__________________________________ +Do you Yahoo!? +Yahoo! Mail - 250MB free storage. Do more. Manage less. +http://info.mail.yahoo.com/mail_250 + +From pgsql-performance-owner@postgresql.org Wed Dec 22 23:43:09 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1AAF73ABF3F + for ; + Wed, 22 Dec 2004 23:42:57 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 81342-09 + for ; + Wed, 22 Dec 2004 23:42:37 +0000 (GMT) +Received: from mail.rilk.com (mail.rilk.com [193.19.217.130]) + by svr1.postgresql.org (Postfix) with ESMTP id BB5083ABF1B + for ; + Wed, 22 Dec 2004 23:42:38 +0000 (GMT) +Received: from [82.234.66.131] (imac.rilk.com [82.234.66.131]) + (authenticated bits=0) + by mail.rilk.com (8.13.0/8.13.0) with ESMTP id iBMNgUeq003272 + (version=TLSv1/SSLv3 cipher=EDH-DSS-DES-CBC3-SHA bits=168 verify=NO); + Thu, 23 Dec 2004 00:42:36 +0100 (CET) +In-Reply-To: <24692.1103322047@sss.pgh.pa.us> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + + <24692.1103322047@sss.pgh.pa.us> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Message-Id: <233CAA75-5473-11D9-9A44-000A95DE2550@rilk.com> +Content-Transfer-Encoding: quoted-printable +Cc: Tom Lane +From: Pailloncy Jean-Gerard +Subject: Re: Memory leak tsearch2 VACUUM FULL VERBOSE ANALYZE +Date: Thu, 23 Dec 2004 00:42:27 +0100 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.619) +X-DCC-dcc3mcgill-Metrics: mail.rilk.com 1275; Body=2 Fuz1=2 Fuz2=2 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.017 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/275 +X-Sequence-Number: 9650 + +I think I have a test case for 7.4.2 + +So I have a 3 millions of rows table "metadata" with a tsearch2 index. +I had memory leak in "vacuum full verbose analyze" + +I drop the index, run "vacuum full verbose analyze", recreate the index=20= + +and re-run "vacuum full verbose analyze". + +The I run my script to insert near 15000 of rows, and run "vacuum full=20= + +verbose analyze". + +The backend starts with res=3D4Mb of ram. +And grows before the first output line to res=3D69Mb. +and runs staying at res=3D69Mb. +Then after writing INFO: index "metadata_oai_identifier" and before=20 +INFO: index "test_metadata_all" which is the tsearch2 index, the=20 +memory usage grows to size=3D742Mb res=3D804Mb. (Hopefully I have 1 GB = +of=20 +RAM, with 1 GB of swap). +The usage stay at res=3D804MB until INFO: "pg_toast_27007136": found,=20= + +then drop back to res=3D69Mb. +When INFO: "pg_toast_27007136": moved memory usage grows to res=3D200MB. +And did not drop back even after vacuum finished. + +Cordialement, +Jean-G=E9rard Pailloncy + +# vacuum full verbose analyze pkpoai.metadata; +INFO: vacuuming "pkpoai.metadata" +INFO: "metadata": found 15466 removable, 3141229 nonremovable row=20 +versions in 330201 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 168 to 2032 bytes long. +There were 29868 unused item pointers. +Total free space (including removable row versions) is 54151896 bytes. +496 pages are or will become empty, including 0 at the end of the table. +98834 pages containing 44826736 free bytes are potential move=20 +destinations. +CPU 6.10s/1.03u sec elapsed 69.36 sec. +INFO: index "metadata_pkey" now contains 3141229 row versions in 10666=20= + +pages +DETAIL: 15466 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.56s/0.92u sec elapsed 40.45 sec. +INFO: index "metadata_archive_key" now contains 3141229 row versions=20 +in 45733 pages +DETAIL: 15466 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.36s/1.44u sec elapsed 362.57 sec. +INFO: index "metadata_oai_identifier" now contains 3141229 row=20 +versions in 36736 pages +DETAIL: 15466 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.04s/1.25u sec elapsed 244.82 sec. +INFO: index "test_metadata_all" now contains 3141229 row versions in=20 +93922 pages +DETAIL: 15466 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.81s/3.76u sec elapsed 196.50 sec. +INFO: "metadata": moved 14151 row versions, truncated 330201 to 328285=20= + +pages +DETAIL: CPU 2.65s/59.67u sec elapsed 251.01 sec. +INFO: index "metadata_pkey" now contains 3141229 row versions in 10686=20= + +pages +DETAIL: 14151 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.68s/0.29u sec elapsed 67.42 sec. +INFO: index "metadata_archive_key" now contains 3141229 row versions=20 +in 45774 pages +DETAIL: 14151 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.28s/0.54u sec elapsed 347.82 sec. +INFO: index "metadata_oai_identifier" now contains 3141229 row=20 +versions in 36784 pages +DETAIL: 14151 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 2.02s/0.39u sec elapsed 248.27 sec. +INFO: index "test_metadata_all" now contains 3141229 row versions in=20 +94458 pages +DETAIL: 14151 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 1.76s/2.93u sec elapsed 173.22 sec. +INFO: vacuuming "pg_toast.pg_toast_27007136" +INFO: "pg_toast_27007136": found 5790 removable, 135159 nonremovable=20 +row versions in 26847 pages +DETAIL: 0 dead row versions cannot be removed yet. +Nonremovable row versions range from 37 to 2034 bytes long. +There were 665 unused item pointers. +Total free space (including removable row versions) is 24067284 bytes. +559 pages are or will become empty, including 0 at the end of the table. +23791 pages containing 24026432 free bytes are potential move=20 +destinations. +CPU 0.54s/0.12u sec elapsed 19.60 sec. +INFO: index "pg_toast_27007136_index" now contains 135159 row versions=20= + +in 593 pages +DETAIL: 5790 index row versions were removed. +3 index pages have been deleted, 3 are currently reusable. +CPU 0.01s/0.03u sec elapsed 0.77 sec. +INFO: "pg_toast_27007136": moved 5733 row versions, truncated 26847 to=20= + +25695 pages +DETAIL: CPU 0.13s/0.34u sec elapsed 15.25 sec. +INFO: index "pg_toast_27007136_index" now contains 135159 row versions=20= + +in 611 pages +DETAIL: 5733 index row versions were removed. +0 index pages have been deleted, 0 are currently reusable. +CPU 0.00s/0.01u sec elapsed 0.01 sec. +INFO: analyzing "pkpoai.metadata" +INFO: "metadata": 328285 pages, 90000 rows sampled, 3631229 estimated=20= + +total rows +VACUUM + + +From pgsql-performance-owner@postgresql.org Thu Dec 23 00:02:51 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6F0D03ABF1C + for ; + Thu, 23 Dec 2004 00:02:06 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 87511-01 + for ; + Thu, 23 Dec 2004 00:01:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id AD9AD3ABF20 + for ; + Thu, 23 Dec 2004 00:01:26 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBN01RvB022324; + Wed, 22 Dec 2004 19:01:27 -0500 (EST) +To: Pailloncy Jean-Gerard +Cc: pgsql-performance@postgresql.org +Subject: Re: Memory leak tsearch2 VACUUM FULL VERBOSE ANALYZE +In-reply-to: <233CAA75-5473-11D9-9A44-000A95DE2550@rilk.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + + <24692.1103322047@sss.pgh.pa.us> + <233CAA75-5473-11D9-9A44-000A95DE2550@rilk.com> +Comments: In-reply-to Pailloncy Jean-Gerard + message dated "Thu, 23 Dec 2004 00:42:27 +0100" +Date: Wed, 22 Dec 2004 19:01:26 -0500 +Message-ID: <22323.1103760086@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/276 +X-Sequence-Number: 9651 + +Pailloncy Jean-Gerard writes: +> I think I have a test case for 7.4.2 + +Can you send me the test data (off-list)? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Dec 23 07:01:15 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 315F13ABF27 + for ; + Thu, 23 Dec 2004 07:00:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93619-07 + for ; + Thu, 23 Dec 2004 07:00:55 +0000 (GMT) +Received: from relay.icomedias.com (office.icomedias.com [62.99.232.80]) + by svr1.postgresql.org (Postfix) with ESMTP id B42703ABFC5 + for ; + Thu, 23 Dec 2004 07:00:53 +0000 (GMT) +Received: from loki.icomedias.com ([10.192.17.128]) + by relay.icomedias.com (8.13.1/8.13.0) with ESMTP id iBN70gJL014231; + Thu, 23 Dec 2004 08:00:42 +0100 +From: Mario Weilguni +To: pgsql-performance@postgresql.org +Subject: Re: 8rc2 & BLCKSZ +Date: Thu, 23 Dec 2004 08:00:41 +0100 +User-Agent: KMail/1.7.50 +Cc: Tom Lane , Vivek Khera +References: + + <20322.1103749490@sss.pgh.pa.us> +In-Reply-To: <20322.1103749490@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: <200412230800.41210.mweilguni@sime.com> +X-Scanned-By: MIMEDefang 2.43 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=2.174 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_BOGUSMX, DNS_FROM_RFC_POST +X-Spam-Level: ** +X-Archive-Number: 200412/277 +X-Sequence-Number: 9652 + +Am Mittwoch, 22. Dezember 2004 22:04 schrieb Tom Lane: +> Vivek Khera writes: +> > One of the suggestions handed to me a long time ago for speeding up PG +> > on FreeBSD was to double the default blocksize in PG. I tried it, but +> > found not a significant enough speed up to make it worth the trouble +> > to remember to patch every version of Pg during the upgrade path (ie, +> > 7.4.0 -> 7.4.2 etc.) Forgetting to do that would be disastrous! +> +> Not really --- the postmaster will refuse to start if the BLCKSZ shown +> in pg_control doesn't match what is compiled in. I concur though that +> there may be no significant performance gain. For some workloads there +> may well be a performance loss from increasing BLCKSZ. + +I've several databases of the same version 7.2 with rowsizes from 8k and 32k +with the same workload (a content management system), and the performance of +the 32k variants is slightly better for a few queries, overall responsivness +seems to better with 8k (maybe because the 8k variant has 4x more buffers). + +Regards, + Mario Weilguni + +From pgsql-performance-owner@postgresql.org Thu Dec 23 07:05:10 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E7E2B3ABF64 + for ; + Thu, 23 Dec 2004 07:05:08 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94640-06 + for ; + Thu, 23 Dec 2004 07:04:57 +0000 (GMT) +Received: from zong.spline.inf.fu-berlin.de (zong.spline.inf.fu-berlin.de + [160.45.117.133]) + by svr1.postgresql.org (Postfix) with ESMTP id F1CE53ABFAE + for ; + Thu, 23 Dec 2004 07:04:57 +0000 (GMT) +Received: from zong.spline.inf.fu-berlin.de (localhost [127.0.0.1]) + by zong.spline.inf.fu-berlin.de (8.13.1/8.13.1) with ESMTP id + iBN74t4D030067; Thu, 23 Dec 2004 08:04:55 +0100 +Received: (from yann@localhost) + by zong.spline.inf.fu-berlin.de (8.13.1/8.13.1/Submit) id + iBN74rAi030066; Thu, 23 Dec 2004 08:04:53 +0100 +Date: Thu, 23 Dec 2004 08:04:53 +0100 +From: Yann Michel +To: Litao Wu +Cc: pgsql-performance@postgresql.org +Subject: Re: Why so much time difference with a same query/plan? +Message-ID: <20041223070453.GA30031@zong.spline.inf.fu-berlin.de> +References: <20041222200904.94015.qmail@web13124.mail.yahoo.com> + <20041222215240.12345.qmail@web13124.mail.yahoo.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20041222215240.12345.qmail@web13124.mail.yahoo.com> +User-Agent: Mutt/1.4.1i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/278 +X-Sequence-Number: 9653 + +Hi, + +On Wed, Dec 22, 2004 at 01:52:40PM -0800, Litao Wu wrote: +> Does the order of columns in the index matter since +> more than 50% customer_id = 158? +> +> I think it does not in Oracle. +> +> Will the performance be better if I change index +> xxx_idx to ("domain", customer_id, created)? + +Well, in Oracle this would of cause matter. Oracle calculates index +usage by being able to fill all index's attributes from the left to the +right. If any one attribute within is missing Oracle would not test if +it is only one attribute missing, or if all other attributes are missing +within the query's where clause. +Normaly you'd create an index using the most frequently parametrized +attributes first, then the second ones and so on. If the usage isn't +that different, you would use the most granule attribute in foremost +followed by the second and so on. + +Regards, +Yann + +From pgsql-performance-owner@postgresql.org Thu Dec 23 14:27:32 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 58E153B2D3B + for ; + Thu, 23 Dec 2004 14:27:30 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34319-09 + for ; + Thu, 23 Dec 2004 14:27:23 +0000 (GMT) +Received: from m-monitor.net (unknown [207.44.134.28]) + by svr1.postgresql.org (Postfix) with ESMTP id AB7A23B2D19 + for ; + Thu, 23 Dec 2004 14:27:25 +0000 (GMT) +Received: (qmail 2338 invoked from network); 23 Dec 2004 14:27:26 -0000 +Received: from 203-206-50-19.dyn.iinet.net.au (HELO ?127.0.0.1?) + (203.206.50.19) by ev1s-207-44-134-28.ev1servers.net with SMTP; + 23 Dec 2004 14:27:25 -0000 +Message-ID: <41CAD5C3.6090404@meerkatsoft.com> +Date: Fri, 24 Dec 2004 01:27:15 +1100 +From: Alex +User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Some Performance Advice Needed +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/279 +X-Sequence-Number: 9654 + +Hi, +i recently run pgbench against different servers and got some results I +dont quite understand. + +A) EV1: Dual Xenon, 2GHz, 1GB Memory, SCSI 10Krpm, RHE3 +B) Dual Pentium3 1.4ghz (Blade), SCSI Disk 10Krmp, 1GB Memory, Redhat 8 +C) P4 3.2GHz, IDE 7.2Krpm, 1GBMem, Fedora Core2 + +All did run only postgres 7.4.6 + +pgconf settings: +max_connections = 100 +shared_buffers = 8192 +sort_mem = 8192 +vacuum_mem = 32768 +max_fsm_pages = 200000 +max_fsm_relations = 10000 +wal_sync_method = fsync +wal_buffers = 64 +checkpoint_segments = 10 +effective_cache_size = 65536 +random_page_cost = 1.4 + +/etc/sysctl.conf +shmall and shmmax set to 768mb + + +Runnig PGbench reported +A) 220 tps +B) 240 tps +C) 510 tps + +Running hdparm reported +A) 920mb/s (SCSI 10k) +B) 270mb/s (SCSI 10k) +C) 1750mb/s (IDE 7.2k) + +What I dont quite understand is why a P3.2 is twice as fast as a Dual +Xenon with SCSI disks, A dual Xenon 2GHz is not faster than a dual P3 +1.4Ghz, and the hdparm results also dont make much sense. + +Has anybody an explanation for that? Is there something I can do to get +more performance out of the SCSI disks? + +Thanks for any advise +Alex + + + + + + + + + + + + + + + + + + + +From pgsql-performance-owner@postgresql.org Thu Dec 23 14:43:39 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D6A803B238F + for ; + Thu, 23 Dec 2004 14:43:37 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 40371-06 + for ; + Thu, 23 Dec 2004 14:43:26 +0000 (GMT) +Received: from dhcp-7-248.ma.lycos.com (waltham-nat.ma.lycos.com + [209.202.205.1]) + by svr1.postgresql.org (Postfix) with SMTP id B790B3B2E2C + for ; + Thu, 23 Dec 2004 14:43:28 +0000 (GMT) +Received: (qmail 27473 invoked from network); 23 Dec 2004 13:52:59 -0000 +Received: from dhcp-10-124-7-15.ma.lycos.com (HELO ?10.124.7.15?) + (10.124.7.15) + by dhcp-10-124-7-248.ma.lycos.com with SMTP; 23 Dec 2004 13:52:59 -0000 +In-Reply-To: <41CAD5C3.6090404@meerkatsoft.com> +References: <41CAD5C3.6090404@meerkatsoft.com> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: <27CB29DA-54F1-11D9-9712-000D9366F0C4@torgo.978.org> +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org +From: Jeff +Subject: Re: Some Performance Advice Needed +Date: Thu, 23 Dec 2004 09:44:31 -0500 +To: Alex +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.065 tagged_above=0 required=5 tests=AWL, + HELO_DYNAMIC_DHCP +X-Spam-Level: +X-Archive-Number: 200412/280 +X-Sequence-Number: 9655 + + +On Dec 23, 2004, at 9:27 AM, Alex wrote: + + +> Running hdparm reported +> A) 920mb/s (SCSI 10k) +> B) 270mb/s (SCSI 10k) +> C) 1750mb/s (IDE 7.2k) + + +IDE disks lie about write completion (This can be disabled on some +drives) whereas SCSI drives wait for the data to actually be written +before they report success. It is quite +easy to corrupt a PG (Or most any db really) on an IDE drive. Check +the archives for more info. + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-performance-owner@postgresql.org Thu Dec 23 20:50:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 16A8F3B4BD6 + for ; + Thu, 23 Dec 2004 20:50:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 61093-04 + for ; + Thu, 23 Dec 2004 20:50:16 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id D9D7E3B4BD1 + for ; + Thu, 23 Dec 2004 20:50:17 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 5B32031981; Thu, 23 Dec 2004 21:50:17 +0100 (MET) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: Some Performance Advice Needed +Date: Thu, 23 Dec 2004 12:49:09 -0800 +Organization: Hub.Org Networking Services +Lines: 43 +Message-ID: +References: <41CAD5C3.6090404@meerkatsoft.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.7.3) Gecko/20040910 +X-Accept-Language: en-us, en +In-Reply-To: <41CAD5C3.6090404@meerkatsoft.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/281 +X-Sequence-Number: 9656 + +Alex wrote: + +> Hi, +> i recently run pgbench against different servers and got some results I +> dont quite understand. +> +> A) EV1: Dual Xenon, 2GHz, 1GB Memory, SCSI 10Krpm, RHE3 +> B) Dual Pentium3 1.4ghz (Blade), SCSI Disk 10Krmp, 1GB Memory, Redhat 8 +> C) P4 3.2GHz, IDE 7.2Krpm, 1GBMem, Fedora Core2 + > +> Runnig PGbench reported +> A) 220 tps +> B) 240 tps +> C) 510 tps +> +> Running hdparm reported +> A) 920mb/s (SCSI 10k) +> B) 270mb/s (SCSI 10k) +> C) 1750mb/s (IDE 7.2k) +> +> What I dont quite understand is why a P3.2 is twice as fast as a Dual +> Xenon with SCSI disks, A dual Xenon 2GHz is not faster than a dual P3 +> 1.4Ghz, and the hdparm results also dont make much sense. + +A few things to clear up about the P3/P4/Xeons. + +Xeons are P4s. Hence, a P4 2ghz will run the same speed as a Xeon 2ghz +assuming all other variables are the same. Of course they aren't because +your P4 is probably running unregistered memory, uses either a 533mhz or +800mhz FSB compared to the Xeon's shared 400mhz amongs 2 CPUs, running a +faster non-smp kernel. Add all those variables up and it's definitely +possible for a P4 3.2ghz to run twice as fast as a Dual Xeon 2ghz on a +single-thread benchmark. (The corollary here is that in a multi-thread +benchmark, the 2X Xeon can only hope to equal your P4 3.2.) + +P3s are faster than P4s at the same clock rate. By a lot. It's not +really that surprising that a P3 1.4 is faster than a P4/Xeon 2.0. I've +seen results like this many times over a wide range of applications. + +The only variable that is throwing off your comparisons are the hard +drives. IDE drives have write caching on by default -- SCSI drives have +it off. Use: hdparm -W0 /dev/hda to turn it off on the P4 system and +rerun the tests then. + +From pgsql-performance-owner@postgresql.org Thu Dec 23 21:28:40 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id AC0E83B4D32 + for ; + Thu, 23 Dec 2004 21:28:35 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 71378-07 + for ; + Thu, 23 Dec 2004 21:28:27 +0000 (GMT) +Received: from hosting.commandprompt.com (128.commandprompt.com + [207.173.200.128]) + by svr1.postgresql.org (Postfix) with ESMTP id E6E693B4D2E + for ; + Thu, 23 Dec 2004 21:28:28 +0000 (GMT) +Received: from [192.168.1.20] (clbb-248.saw.net [64.146.135.248]) + (authenticated bits=0) + by hosting.commandprompt.com (8.12.8/8.12.8) with ESMTP id + iBNLR3El001108; Thu, 23 Dec 2004 13:27:04 -0800 +Message-ID: <41CB3830.2090201@commandprompt.com> +Date: Thu, 23 Dec 2004 13:27:12 -0800 +From: "Joshua D. Drake" +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Jeff +Cc: Alex , pgsql-performance@postgresql.org +Subject: Re: Some Performance Advice Needed +References: <41CAD5C3.6090404@meerkatsoft.com> + <27CB29DA-54F1-11D9-9712-000D9366F0C4@torgo.978.org> +In-Reply-To: <27CB29DA-54F1-11D9-9712-000D9366F0C4@torgo.978.org> +Content-Type: multipart/mixed; boundary="------------070605030905090702080909" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/282 +X-Sequence-Number: 9657 + +This is a multi-part message in MIME format. +--------------070605030905090702080909 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Jeff wrote: + +> +> On Dec 23, 2004, at 9:27 AM, Alex wrote: +> +> +>> Running hdparm reported +>> A) 920mb/s (SCSI 10k) +>> B) 270mb/s (SCSI 10k) +>> C) 1750mb/s (IDE 7.2k) +> +> +> +> IDE disks lie about write completion (This can be disabled on some +> drives) whereas SCSI drives wait for the data to actually be written +> before they report success. It is quite +> easy to corrupt a PG (Or most any db really) on an IDE drive. Check +> the archives for more info. + +Do we have any real info on this? Specifically which drives? Is SATA the +same way? What about SATA-II? +I am not saying it isn't true (I know it is) but this is a blanket +statement that may or may not be +true with newer tech. + +Sincerely, + +Joshua D. Drake + + + + +> +> -- +> Jeff Trout +> http://www.jefftrout.com/ +> http://www.stuarthamm.net/ +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster + + + +-- +Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC +Postgresql support, programming shared hosting and dedicated hosting. ++1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com +PostgreSQL Replicator -- production quality replication for PostgreSQL + + +--------------070605030905090702080909 +Content-Type: text/x-vcard; charset=utf-8; + name="jd.vcf" +Content-Transfer-Encoding: 7bit +Content-Disposition: attachment; + filename="jd.vcf" + +begin:vcard +fn:Joshua Drake +n:Drake;Joshua +org:Command Prompt, Inc. +adr:;;PO Box 215 ;Cascade Locks;OR;97014;US +email;internet:jd@commandprompt.com +title:Consultant +tel;work:503-667-4564 +tel;fax:503-210-0334 +x-mozilla-html:FALSE +url:http://www.commandprompt.com +version:2.1 +end:vcard + + +--------------070605030905090702080909-- + +From pgsql-performance-owner@postgresql.org Thu Dec 23 21:47:23 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6ECDC3B4DBD + for ; + Thu, 23 Dec 2004 21:47:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 76937-06 + for ; + Thu, 23 Dec 2004 21:47:03 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id BF1E23B4DE5 + for ; + Thu, 23 Dec 2004 21:47:04 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id B004831982; Thu, 23 Dec 2004 22:47:04 +0100 (MET) +From: William Yu +X-Newsgroups: pgsql.performance +Subject: Re: Some Performance Advice Needed +Date: Thu, 23 Dec 2004 13:45:57 -0800 +Organization: Hub.Org Networking Services +Lines: 15 +Message-ID: +References: <41CAD5C3.6090404@meerkatsoft.com> + <27CB29DA-54F1-11D9-9712-000D9366F0C4@torgo.978.org> + <41CB3830.2090201@commandprompt.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@news.hub.org +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.7.3) Gecko/20040910 +X-Accept-Language: en-us, en +In-Reply-To: <41CB3830.2090201@commandprompt.com> +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/283 +X-Sequence-Number: 9658 + +>> IDE disks lie about write completion (This can be disabled on some +>> drives) whereas SCSI drives wait for the data to actually be written +>> before they report success. It is quite +>> easy to corrupt a PG (Or most any db really) on an IDE drive. Check +>> the archives for more info. +> +> +> Do we have any real info on this? Specifically which drives? Is SATA the +> same way? What about SATA-II? +> I am not saying it isn't true (I know it is) but this is a blanket +> statement that may or may not be +> true with newer tech. + + From my experience with SATA controllers, write caching is controlled +via the BIOS. + +From pgsql-performance-owner@postgresql.org Thu Dec 23 22:45:06 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 2C0733B5006 + for ; + Thu, 23 Dec 2004 22:45:01 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94480-08 + for ; + Thu, 23 Dec 2004 22:44:34 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id E4DD63B502B + for ; + Thu, 23 Dec 2004 22:44:35 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBNMiYhu002036; + Thu, 23 Dec 2004 17:44:35 -0500 (EST) +To: Pailloncy Jean-Gerard +Cc: pgsql-performance@postgresql.org +Subject: Re: Memory leak tsearch2 VACUUM FULL VERBOSE ANALYZE +In-reply-to: <233CAA75-5473-11D9-9A44-000A95DE2550@rilk.com> +References: <3D4B6E62-5055-11D9-96E2-000A95DE2550@ifrance.com> + + <24692.1103322047@sss.pgh.pa.us> + <233CAA75-5473-11D9-9A44-000A95DE2550@rilk.com> +Comments: In-reply-to Pailloncy Jean-Gerard + message dated "Thu, 23 Dec 2004 00:42:27 +0100" +Date: Thu, 23 Dec 2004 17:44:34 -0500 +Message-ID: <2035.1103841874@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/284 +X-Sequence-Number: 9659 + +Pailloncy Jean-Gerard writes: +> I think I have a test case for 7.4.2 + +Try the attached patch. + +It looked to me like there were some smaller leaks going on during COPY +and CREATE INDEX, which I will look into later --- but this seems to be +the problem for VACUUM FULL. + + regards, tom lane + +Index: vacuum.c +=================================================================== +RCS file: /cvsroot/pgsql/src/backend/commands/vacuum.c,v +retrieving revision 1.263 +diff -c -r1.263 vacuum.c +*** vacuum.c 2 Oct 2003 23:19:44 -0000 1.263 +--- vacuum.c 23 Dec 2004 22:37:57 -0000 +*************** +*** 2041,2046 **** +--- 2041,2047 ---- + ExecStoreTuple(&newtup, slot, InvalidBuffer, false); + ExecInsertIndexTuples(slot, &(newtup.t_self), + estate, true); ++ ResetPerTupleExprContext(estate); + } + + WriteBuffer(cur_buffer); +*************** +*** 2174,2179 **** +--- 2175,2181 ---- + { + ExecStoreTuple(&newtup, slot, InvalidBuffer, false); + ExecInsertIndexTuples(slot, &(newtup.t_self), estate, true); ++ ResetPerTupleExprContext(estate); + } + } /* walk along page */ + + +From pgsql-performance-owner@postgresql.org Fri Dec 24 01:49:10 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F08B73B56AB + for ; + Fri, 24 Dec 2004 01:47:45 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 42313-08 + for ; + Fri, 24 Dec 2004 01:47:35 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id C15DE3B56E2 + for ; + Fri, 24 Dec 2004 01:47:36 +0000 (GMT) +Received: (qmail 21671 invoked from network); 24 Dec 2004 02:47:38 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 24 Dec 2004 02:47:38 +0100 +To: pgsql-performance@postgresql.org +Subject: Re: LIMIT causes SEQSCAN in subselect +References: + <200412102140.18456.josh@agliodbs.com> +Message-ID: +Date: Fri, 24 Dec 2004 02:47:40 +0100 +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <200412102140.18456.josh@agliodbs.com> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/285 +X-Sequence-Number: 9660 + + +> The fact that the estimator knows that the LIMIT is pointless because +> there +> are less rows in the subselect than the LIMIT will return is not +> something we +> want to count on; sometimes the estimator has innaccurate information. +> The +> UNIQUE index makes this more certain, except that I'm not sure that the +> planner distinguishes between actual UNIQUE indexes and columns which are +> estimated unique (per the pg_stats). And I think you can see in your +> case +> that there's quite a difference between a column we're CERTAIN is unique, +> versus a column we THINK is unique. + + I think a UNIQUE constraint can permit several 'different' NULL values... +better say "UNIQUE NOT NULL" ? + + +From pgsql-performance-owner@postgresql.org Fri Dec 24 02:06:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id F06E83B5784 + for ; + Fri, 24 Dec 2004 02:06:09 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 46785-09 + for ; + Fri, 24 Dec 2004 02:05:52 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id D56E93B5793 + for ; + Fri, 24 Dec 2004 02:05:54 +0000 (GMT) +Received: (qmail 23109 invoked from network); 24 Dec 2004 03:05:56 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 24 Dec 2004 03:05:56 +0100 +Date: Fri, 24 Dec 2004 03:05:59 +0100 +To: pgsql-performance@postgresql.org +Subject: Re: Using LIMIT changes index used by planner +References: <41BD3317.9090507@dmv.com> + <1102931789.11712.9.camel@lamb.mcmillan.net.nz> + <41BE1270.7060908@dmv.com> <28820.1102977787@sss.pgh.pa.us> +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +Message-ID: +In-Reply-To: <28820.1102977787@sss.pgh.pa.us> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/286 +X-Sequence-Number: 9661 + +On Mon, 13 Dec 2004 17:43:07 -0500, Tom Lane wrote: + +> Sven Willenberger writes: +>> explain analyze select storelocation,order_number from custacct where +>> referrer = 1365 and orderdate between '2004-12-07' and '2004-12-07 +>> 12:00:00' order by custacctid limit 10; + + why not create an index on referrer, orderdate ? + +From pgsql-performance-owner@postgresql.org Fri Dec 24 02:19:53 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id C6D4A3B584F + for ; + Fri, 24 Dec 2004 02:19:46 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 51368-03 + for ; + Fri, 24 Dec 2004 02:19:19 +0000 (GMT) +Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) + by svr1.postgresql.org (Postfix) with ESMTP id 722D43B583D + for ; + Fri, 24 Dec 2004 02:19:21 +0000 (GMT) +Received: (qmail 1256 invoked from network); 24 Dec 2004 03:19:24 +0100 +Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) + by boutiquenumerique.com with SMTP; 24 Dec 2004 03:19:24 +0100 +To: pgsql-performance@postgresql.org +Subject: Re: Caching of Queries +References: <20040923152925.18234.qmail@web41114.mail.yahoo.com> + <200409231653.i8NGrUaX017580@ms-smtp-02.nyroc.rr.com> + <415303F0.3050409@bigfoot.com> +Message-ID: +Date: Fri, 24 Dec 2004 03:19:27 +0100 +From: =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= + +Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= +Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +In-Reply-To: <415303F0.3050409@bigfoot.com> +User-Agent: Opera M2/7.54 (Linux, build 751) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/287 +X-Sequence-Number: 9662 + + +>> I've looked at PREPARE, but apparently it only lasts per-session - +>> that's +>> worthless in our case (web based service, one connection per +>> data-requiring +>> connection). + + You don't use persistent connections ??????????? + Your problem might simply be the connection time overhead (also including +a few TCP roudtrips). + +From pgsql-performance-owner@postgresql.org Fri Dec 24 14:52:21 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E9AED3B75C8 + for ; + Fri, 24 Dec 2004 14:52:19 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 70899-02 + for ; + Fri, 24 Dec 2004 14:52:09 +0000 (GMT) +Received: from bayswater1.ymogen.net (unknown [217.27.247.154]) + by svr1.postgresql.org (Postfix) with ESMTP id 382283B75B9 + for ; + Fri, 24 Dec 2004 14:52:12 +0000 (GMT) +Received: from solent (unknown [62.232.40.226]) + by bayswater1.ymogen.net (Postfix) with ESMTP + id E3753A6084; Fri, 24 Dec 2004 14:52:11 +0000 (GMT) +Reply-To: +From: "Matt Clark" +To: "'Thomas Wegner'" , + +Subject: Re: Speed in V8.0 +Date: Fri, 24 Dec 2004 14:52:11 -0000 +Organization: Ymogen Ltd +Message-ID: <014001c4e9c8$266ec0a0$8300a8c0@solent> +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.6626 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 +In-Reply-To: +Importance: Normal +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/291 +X-Sequence-Number: 9666 + +Another man working to the bitter end this Christmas! + +There could be many reasons, but maybe first you should look at the = +amount +of RAM available? If the tables fit in RAM on the production server but = +not +on the dev server, then that will easily defeat the improvement due to = +using +the native DB version. + +Why don't you install cygwin on the dev box and do the comparison using = +the +same hardware? + +M + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org=20 +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of=20 +> Thomas Wegner +> Sent: 21 December 2004 23:03 +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Speed in V8.0 +>=20 +>=20 +> Hello, i have a problem between V7.4.3 Cygwin and +> V8.0RC2 W2K. I have 2 systems: +>=20 +> 1. Production Machine +> - Dual P4 3000MHz +> - 2 GB RAM +> - W2K +> - PostgreSQL 7.4.3 under Cygwin +> - i connect to it over a DSL Line +> 2. Develop Machine +> - P4 1800MHz +> - 760 MB RAM +> - PostgreSQL Native Windows +> - local connection 100MB/FD +>=20 +> Both systems use the default postgresql.conf. Now the=20 +> problem. I have an (unoptimized, dynamic) query wich was=20 +> execute on the production machine over DSL in 2 seconds and=20 +> on my develop machine, connected over local LAN, in 119 seconds! +>=20 +> Whats this? I can not post the query details here public, its=20 +> a commercial project. Any first idea? I execute on both=20 +> machine the same query with the same database design! +> --------------------------------------------- +> Thomas Wegner +> CabrioMeter - The Weather Plugin for Trillian=20 +> http://www.wegner24.de/cabriometer +>=20 +>=20 +>=20 +> ---------------------------(end of=20 +> broadcast)--------------------------- +> TIP 4: Don't 'kill -9' the postmaster +>=20 + + +From pgsql-performance-owner@postgresql.org Fri Dec 24 15:38:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 26AB73B779F + for ; + Fri, 24 Dec 2004 15:38:32 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83970-02 + for ; + Fri, 24 Dec 2004 15:38:10 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 89FBB3B7793 + for ; + Fri, 24 Dec 2004 15:38:12 +0000 (GMT) +Received: from gnari ([157.157.180.107] [157.157.180.107]) by quasar.skima.is + with ESMTP; Fri, 24 Dec 2004 15:38:12 Z +Subject: Re: Howto Increased performace ? +From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= +To: Amrit Angsusingh +Cc: pgsql-performance@postgresql.org +In-Reply-To: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> +Content-Type: text/plain +Date: Fri, 24 Dec 2004 15:39:32 +0000 +Message-Id: <1103902772.4447.5.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/292 +X-Sequence-Number: 9667 + +On Tue, 2004-12-21 at 16:31 +0700, Amrit Angsusingh wrote: +> I used postgresql 7.3.2-1 with RH 9 on a mechine of 2 Xeon 3.0 Ghz and ram +> of 4 Gb. Since 1 1/2 yr. when I started to use the database server after +> optimizing the postgresql.conf everything went fine until a couple of +> weeks ago , my database grew up to 3.5 Gb and there were more than 140 +> concurent connections. +... +> shared_buffers = 250000 +this is much higher than usually adviced on this list. +try to reduce this to 25000 + +> effective_cache_size = 5000 +and increase this instead, to say, 50000 + + +gnari + + + +From pgsql-performance-owner@postgresql.org Fri Dec 24 15:43:54 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 16AD93B775C + for ; + Fri, 24 Dec 2004 15:43:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 85539-03 + for ; + Fri, 24 Dec 2004 15:43:46 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id E216C3B77C1 + for ; + Fri, 24 Dec 2004 15:43:49 +0000 (GMT) +Received: from gnari ([157.157.180.107] [157.157.180.107]) by quasar.skima.is + with ESMTP; Fri, 24 Dec 2004 15:43:50 Z +Subject: Re: Speed in V8.0 +From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= +To: Thomas Wegner +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Date: Fri, 24 Dec 2004 15:45:10 +0000 +Message-Id: <1103903110.4447.8.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/293 +X-Sequence-Number: 9668 + +On Wed, 2004-12-22 at 00:03 +0100, Thomas Wegner wrote: +> Hello, i have a problem between V7.4.3 Cygwin and +> V8.0RC2 W2K. I have 2 systems: +> +> 1. Production Machine +> - Dual P4 3000MHz +> - 2 GB RAM +> - W2K +> - PostgreSQL 7.4.3 under Cygwin +> - i connect to it over a DSL Line +> 2. Develop Machine +> - P4 1800MHz +> - 760 MB RAM +> - PostgreSQL Native Windows +> - local connection 100MB/FD +> +> Both systems use the default postgresql.conf. Now the problem. +> I have an (unoptimized, dynamic) query wich was execute on the +> production machine over DSL in 2 seconds and on my develop +> machine, connected over local LAN, in 119 seconds! + +has the development database been ANALYZED ? + +gnari + + + +From pgsql-performance-owner@postgresql.org Fri Dec 31 03:05:31 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 0AD5A3CC69F + for ; + Sat, 25 Dec 2004 10:21:50 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52056-02 + for ; + Sat, 25 Dec 2004 10:21:41 +0000 (GMT) +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id 32AC13CC685 + for ; + Sat, 25 Dec 2004 10:21:42 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 6E7B331952; Sat, 25 Dec 2004 11:21:42 +0100 (MET) +From: "Thomas Wegner" +X-Newsgroups: pgsql.performance +Subject: Re: Speed in V8.0 +Date: Sat, 25 Dec 2004 11:21:39 +0100 +Organization: Hub.Org Networking Services +Lines: 76 +Message-ID: +References: + <014001c4e9c8$266ec0a0$8300a8c0@solent> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-RFC2646: Format=Flowed; Original +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.185 tagged_above=0 required=5 tests=PRIORITY_NO_NAME +X-Spam-Level: * +X-Archive-Number: 200412/310 +X-Sequence-Number: 9685 + +Ok, i installed the 7.4.3 on the dev machine under +Cygwin and the was 4 times slower than the V8. +They need 394 seconds. Whats wrong with my dev +machine. There was enough free memory available. +--------------------------------------------- +Thomas Wegner +CabrioMeter - The Weather Plugin for Trillian +http://www.wegner24.de/cabriometer + +""Matt Clark"" schrieb im Newsbeitrag +news:014001c4e9c8$266ec0a0$8300a8c0@solent... +> Another man working to the bitter end this Christmas! +> +> There could be many reasons, but maybe first you should look at the amount +> of RAM available? If the tables fit in RAM on the production server but +> not +> on the dev server, then that will easily defeat the improvement due to +> using +> the native DB version. +> +> Why don't you install cygwin on the dev box and do the comparison using +> the +> same hardware? +> +> M +> +>> -----Original Message----- +>> From: pgsql-performance-owner@postgresql.org +>> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of +>> Thomas Wegner +>> Sent: 21 December 2004 23:03 +>> To: pgsql-performance@postgresql.org +>> Subject: [PERFORM] Speed in V8.0 +>> +>> +>> Hello, i have a problem between V7.4.3 Cygwin and +>> V8.0RC2 W2K. I have 2 systems: +>> +>> 1. Production Machine +>> - Dual P4 3000MHz +>> - 2 GB RAM +>> - W2K +>> - PostgreSQL 7.4.3 under Cygwin +>> - i connect to it over a DSL Line +>> 2. Develop Machine +>> - P4 1800MHz +>> - 760 MB RAM +>> - PostgreSQL Native Windows +>> - local connection 100MB/FD +>> +>> Both systems use the default postgresql.conf. Now the +>> problem. I have an (unoptimized, dynamic) query wich was +>> execute on the production machine over DSL in 2 seconds and +>> on my develop machine, connected over local LAN, in 119 seconds! +>> +>> Whats this? I can not post the query details here public, its +>> a commercial project. Any first idea? I execute on both +>> machine the same query with the same database design! +>> --------------------------------------------- +>> Thomas Wegner +>> CabrioMeter - The Weather Plugin for Trillian +>> http://www.wegner24.de/cabriometer +>> +>> +>> +>> ---------------------------(end of +>> broadcast)--------------------------- +>> TIP 4: Don't 'kill -9' the postmaster +>> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 8: explain analyze is your friend +> + + + +From pgsql-performance-owner@postgresql.org Fri Dec 31 03:03:41 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 1199F3A6D16 + for ; + Sat, 25 Dec 2004 13:28:52 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 92747-04 + for ; + Sat, 25 Dec 2004 13:28:42 +0000 (GMT) +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) + by svr1.postgresql.org (Postfix) with ESMTP id DB4043CCCF7 + for ; + Sat, 25 Dec 2004 13:28:44 +0000 (GMT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id E7CED31952; Sat, 25 Dec 2004 14:28:44 +0100 (MET) +From: "Thomas Wegner" +X-Newsgroups: pgsql.performance +Subject: Re: Speed in V8.0 +Date: Sat, 25 Dec 2004 14:28:41 +0100 +Organization: Hub.Org Networking Services +Lines: 42 +Message-ID: +References: + <1103903110.4447.8.camel@localhost.localdomain> +X-Complaints-To: usenet@news.hub.org +X-Priority: 3 +X-MSMail-Priority: Normal +X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 +X-RFC2646: Format=Flowed; Original +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=1.185 tagged_above=0 required=5 tests=PRIORITY_NO_NAME +X-Spam-Level: * +X-Archive-Number: 200412/309 +X-Sequence-Number: 9684 + +Thats was it. Now the speed was ok. Thank you. +--------------------------------------------- +Thomas Wegner +CabrioMeter - The Weather Plugin for Trillian +http://www.wegner24.de/cabriometer + +"Ragnar "Hafsta�"" schrieb im Newsbeitrag +news:1103903110.4447.8.camel@localhost.localdomain... +> On Wed, 2004-12-22 at 00:03 +0100, Thomas Wegner wrote: +>> Hello, i have a problem between V7.4.3 Cygwin and +>> V8.0RC2 W2K. I have 2 systems: +>> +>> 1. Production Machine +>> - Dual P4 3000MHz +>> - 2 GB RAM +>> - W2K +>> - PostgreSQL 7.4.3 under Cygwin +>> - i connect to it over a DSL Line +>> 2. Develop Machine +>> - P4 1800MHz +>> - 760 MB RAM +>> - PostgreSQL Native Windows +>> - local connection 100MB/FD +>> +>> Both systems use the default postgresql.conf. Now the problem. +>> I have an (unoptimized, dynamic) query wich was execute on the +>> production machine over DSL in 2 seconds and on my develop +>> machine, connected over local LAN, in 119 seconds! +> +> has the development database been ANALYZED ? +> +> gnari +> +> +> +> ---------------------------(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 Fri Dec 31 03:08:59 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E946F3F52DE + for ; + Sun, 26 Dec 2004 12:28:35 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06429-09 + for ; + Sun, 26 Dec 2004 12:28:28 +0000 (GMT) +Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) + by svr1.postgresql.org (Postfix) with ESMTP id 1281B3F52D5 + for ; + Sun, 26 Dec 2004 12:28:30 +0000 (GMT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by poros.telenet-ops.be (Postfix) with SMTP + id CAD323BC1D5; Sun, 26 Dec 2004 13:28:29 +0100 (MET) +Received: from localhost.localdomain (d54C27BB6.kabel.telenet.be + [84.194.123.182]) by poros.telenet-ops.be (Postfix) with ESMTP + id 9CCD83BC189; Sun, 26 Dec 2004 13:28:29 +0100 (MET) +Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) + by localhost.localdomain (8.13.1/8.13.1) with ESMTP id iBQCUsBk013613; + Sun, 26 Dec 2004 13:30:54 +0100 +Received: (from kvo@localhost) + by localhost.localdomain (8.13.1/8.13.1/Submit) id iBQCUGe3013499; + Sun, 26 Dec 2004 13:30:16 +0100 +To: Yann Michel +Cc: pgsql-performance@postgresql.org +Subject: Re: Why so much time difference with a same query/plan? +References: <20041222200904.94015.qmail@web13124.mail.yahoo.com> + <20041222215240.12345.qmail@web13124.mail.yahoo.com> + <20041223070453.GA30031@zong.spline.inf.fu-berlin.de> +From: Karl Vogel +Date: Sun, 26 Dec 2004 13:30:15 +0100 +In-Reply-To: <20041223070453.GA30031@zong.spline.inf.fu-berlin.de> (Yann + Michel's message of "Thu, 23 Dec 2004 08:04:53 +0100") +Message-ID: +User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through + Obscurity, linux) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/312 +X-Sequence-Number: 9687 + +Yann Michel writes: + +> On Wed, Dec 22, 2004 at 01:52:40PM -0800, Litao Wu wrote: +>> Does the order of columns in the index matter since +>> more than 50% customer_id = 158? +>> +>> I think it does not in Oracle. +>> +>> Will the performance be better if I change index +>> xxx_idx to ("domain", customer_id, created)? +> +> Well, in Oracle this would of cause matter. Oracle calculates index +> usage by being able to fill all index's attributes from the left to the +> right. If any one attribute within is missing Oracle would not test if +> it is only one attribute missing, or if all other attributes are missing +> within the query's where clause. + +This depends on the version of Oracle you're using. Oracle 9i +introduced Index Skip Scans: + + http://www.oracle.com/technology//products/oracle9i/daily/apr22.html + +I don't know whether pg has something similar? + +From pgsql-performance-owner@postgresql.org Mon Dec 27 01:28:19 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 481A33F79B4 + for ; + Mon, 27 Dec 2004 01:28:00 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 95178-09 + for ; + Mon, 27 Dec 2004 01:27:47 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 33B913F79A8 + for ; + Mon, 27 Dec 2004 01:27:44 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBR1RgZ25756; + Mon, 27 Dec 2004 10:27:42 +0900 +Message-ID: <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "Amrit Angsusingh" , + +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> +Subject: Re: Howto Increased performace ? +Date: Mon, 27 Dec 2004 10:29:54 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="windows-874"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/294 +X-Sequence-Number: 9669 + +Hi, + +> #sort_mem = 1024 # min 64, size in KB +> sort_mem = 60000 + +I think this might be too much. You are using 60000KB _per connection_ here += 10GB for your maximum of 180 connections. + +By comparison, I am specifiying 4096 (subject to adjustment) for a machine +with a similar spec to yours. + +regards +Iain + + + + + +From pgsql-performance-owner@postgresql.org Mon Dec 27 09:33:01 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 559103F8D05 + for ; + Mon, 27 Dec 2004 09:32:54 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 25730-04 + for ; + Mon, 27 Dec 2004 09:32:37 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 535393F8D0D + for ; + Mon, 27 Dec 2004 09:32:36 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBR9WXZ27691; + Mon, 27 Dec 2004 18:32:34 +0900 +Message-ID: <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: +Cc: +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> + <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> + <45410.192.168.2.17.1104139293.squirrel@192.168.2.17> +Subject: Re: Howto Increased performace ? +Date: Mon, 27 Dec 2004 18:34:45 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="windows-874"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/295 +X-Sequence-Number: 9670 + +Hi, + +These are some settings that I am planning to start with for a 4GB RAM dual +opteron system with a maximum of 100 connections: + + +shared_buffers 8192 (=67MB RAM) +sort_mem 4096 (=400MB RAM for 100 connections) +effective_cache_size 380000(@8KB =3.04GB RAM) +vacuum_mem 32768 KB +wal_buffers 64 +checkpoint_segments 8 + +In theory, effective cache size is the amount of memory left over for the OS +to cache the filesystem after running all programs and having 100 users +connected, plus a little slack. + +regards +Iain +----- Original Message ----- +From: "Amrit Angsusingh" +To: "Iain" +Cc: +Sent: Monday, December 27, 2004 6:21 PM +Subject: Re: [PERFORM] Howto Increased performace ? + + +> +> +>>> #sort_mem = 1024 # min 64, size in KB +>>> sort_mem = 60000 +> +>> I think this might be too much. You are using 60000KB _per connection_ +>> here +>> = 10GB for your maximum of 180 connections. +>> +>> By comparison, I am specifiying 4096 (subject to adjustment) for a +>> machine +>> with a similar spec to yours. +>> +>> regards +>> Iain +> +> I reduced it to +> sort_mem = 8192 +> If I increase it higher , what will be result I could expect. +> +> and I also reduce the +> max connection to 160 +> and +> shared buffer to shared_buffers = 27853 +> effective_cache_size = 81920 [what does it for?] +> +> do you think is it still too much especialy effective cache ? +> +> Thanks +> Amrit +> +> Amrit Angsusingh +> Nakornsawan,Thailand + + +From pgsql-performance-owner@postgresql.org Fri Dec 31 03:08:02 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 466813F9189 + for ; + Mon, 27 Dec 2004 11:37:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 66144-05 + for ; + Mon, 27 Dec 2004 11:37:10 +0000 (GMT) +Received: from ebrsrv01.ebravo.it (host166-198.pool21757.interbusiness.it + [217.57.198.166]) + by svr1.postgresql.org (Postfix) with ESMTP id E995A3F9181 + for ; + Mon, 27 Dec 2004 11:37:07 +0000 (GMT) +Received: from [192.168.11.103] ([192.168.11.103]) (authenticated) + by ebrsrv01.ebravo.it (8.11.6/8.12.5) with ESMTP id iBRBatw01240; + Mon, 27 Dec 2004 12:36:55 +0100 +Message-ID: <41CFF3D2.3090305@team2k.net> +Date: Mon, 27 Dec 2004 12:36:50 +0100 +From: Cosimo Streppone +Organization: Team2k +User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Iain +Cc: Postgresql Performance +Subject: Re: Howto Increased performace ? +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> + <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> + <45410.192.168.2.17.1104139293.squirrel@192.168.2.17> + <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> +In-Reply-To: <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> +Content-Type: text/plain; charset=windows-874; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/311 +X-Sequence-Number: 9686 + +Iain wrote: + +> sort_mem 4096 (=400MB RAM for 100 connections) + +If I understand correctly, memory usage related to `sort_mem' +is per connection *and* per sort. +If every client runs a query with 3 sorts in its plan, you are +going to need (in theory) 100 connections * 4Mb * 3 sorts, +which is 1.2 Gb. + +Please correct me if I'm wrong... + +-- +Cosimo + + +From pgsql-performance-owner@postgresql.org Mon Dec 27 13:45:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B1F663F8C6B + for ; + Mon, 27 Dec 2004 13:45:32 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 06986-10 + for ; + Mon, 27 Dec 2004 13:45:18 +0000 (GMT) +Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) + by svr1.postgresql.org (Postfix) with ESMTP id 8DACE3F8F83 + for ; + Mon, 27 Dec 2004 13:45:19 +0000 (GMT) +Received: from jefftrout.com ([24.128.241.68]) + by comcast.net (sccrmhc12) with SMTP + id <20041227134519012007upnpe>; Mon, 27 Dec 2004 13:45:19 +0000 +Received: (qmail 82264 invoked from network); 27 Dec 2004 13:45:19 -0000 +Received: from unknown (HELO ?192.168.0.101?) (10.10.10.20) + by 10.10.10.10 with SMTP; 27 Dec 2004 13:45:19 -0000 +In-Reply-To: <41CB3830.2090201@commandprompt.com> +References: <41CAD5C3.6090404@meerkatsoft.com> + <27CB29DA-54F1-11D9-9712-000D9366F0C4@torgo.978.org> + <41CB3830.2090201@commandprompt.com> +Mime-Version: 1.0 (Apple Message framework v619) +Content-Type: text/plain; charset=US-ASCII; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +Cc: pgsql-performance@postgresql.org, Alex +From: Jeff +Subject: Re: Some Performance Advice Needed +Date: Mon, 27 Dec 2004 08:46:28 -0500 +To: "Joshua D. Drake" +X-Mailer: Apple Mail (2.619) +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.339 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/296 +X-Sequence-Number: 9671 + + +On Dec 23, 2004, at 4:27 PM, Joshua D. Drake wrote: +>> +>> IDE disks lie about write completion (This can be disabled on some +>> drives) whereas SCSI drives wait for the data to actually be written +>> before they report success. It is quite +>> easy to corrupt a PG (Or most any db really) on an IDE drive. Check +>> the archives for more info. +> +> Do we have any real info on this? Specifically which drives? Is SATA +> the same way? What about SATA-II? +> I am not saying it isn't true (I know it is) but this is a blanket +> statement that may or may not be +> true with newer tech. + +Scott Marlowe did some tests a while ago on it. They are likely in the +archives. +Maybe we can get him to pipe up :) + +-- +Jeff Trout +http://www.jefftrout.com/ +http://www.stuarthamm.net/ + + +From pgsql-novice-owner@postgresql.org Mon Dec 27 17:33:08 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 7B08E44E2D2 + for ; + Mon, 27 Dec 2004 17:32:53 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 83958-03 + for ; + Mon, 27 Dec 2004 17:32:36 +0000 (GMT) +Received: from web51301.mail.yahoo.com (web51301.mail.yahoo.com + [206.190.38.167]) + by svr1.postgresql.org (Postfix) with SMTP id DDFCB44E2E0 + for ; Mon, 27 Dec 2004 17:32:34 +0000 (GMT) +Received: (qmail 98752 invoked by uid 60001); 27 Dec 2004 17:32:33 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + b=ttOB86+wm5OzPF9LSS79cVz2pRfX54y+v2fYylxWe6pm3m2OpQLWClpT8bYsZoyjS5z4Kf/bx9EpQP01pJdjndkdFXJK4/OrHIsgdncb8lddIPsEl7+M2cfjBG/TOqzmJIawITFOpxu8n2Rb6srKTEgBfBkkOdqzyyzHEUWeUjs= + ; +Message-ID: <20041227173233.98750.qmail@web51301.mail.yahoo.com> +Received: from [65.218.182.242] by web51301.mail.yahoo.com via HTTP; + Mon, 27 Dec 2004 09:32:33 PST +Date: Mon, 27 Dec 2004 09:32:33 -0800 (PST) +From: sarlav kumar +Subject: user defined data type problem while dumping? +To: pgsqlnovice , + pgsqlperform +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-486103204-1104168753=:97994" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.52 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_50_60, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200412/253 +X-Sequence-Number: 11830 + +--0-486103204-1104168753=:97994 +Content-Type: text/plain; charset=us-ascii + +Hi All, + +I have a database running on Postgres 7.3.2. I am dumping the database schema from postgres 7.4.6 to restore it on the new Postgres version. The two postgres versions are running on different machines. I did the dump and tried restoring it. I got an error message saying type "lo" is not defined yet. I reordered the list and moved the type definition and the functions using the type "lo" to the top, using pg_restore and tried restoring it again. + +These are the corresponding functions/types defined using the type "lo": + +SET SESSION AUTHORIZATION 'user';-- +-- TOC entry 5 (OID 19114) +-- Name: lo; Type: TYPE; Schema: public; Owner: user +-- Data Pos: 0 +-- +CREATE TYPE lo ( + INTERNALLENGTH = 4, + INPUT = lo_in, + OUTPUT = lo_out, + DEFAULT = '-', + ALIGNMENT = int4, + STORAGE = plain +); + + +SET SESSION AUTHORIZATION 'postgres'; +-- +-- TOC entry 851 (OID 19115) +-- Name: lo_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres +-- Data Pos: 0 +-- +CREATE FUNCTION lo_in(cstring) RETURNS lo + AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_in' + LANGUAGE c; + +-- +-- TOC entry 852 (OID 19116) +-- Name: lo_out(lo); Type: FUNCTION; Schema: public; Owner: postgres +-- Data Pos: 0 +-- +CREATE FUNCTION lo_out(lo) RETURNS cstring + AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_out' + LANGUAGE c; + +-- +-- TOC entry 853 (OID 19117) +-- Name: lo_manage(); Type: FUNCTION; Schema: public; Owner: postgres +-- Data Pos: 0 +-- +CREATE FUNCTION lo_manage() RETURNS "trigger" + AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_manage' + LANGUAGE c; + +-- +-- TOC entry 854 (OID 19129) +-- Name: lo_oid(lo); Type: FUNCTION; Schema: public; Owner: postgres +-- Data Pos: 0 +-- +CREATE FUNCTION lo_oid(lo) RETURNS oid + AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_oid' + LANGUAGE c; + +-- +-- TOC entry 855 (OID 19130) +-- Name: oid(lo); Type: FUNCTION; Schema: public; Owner: postgres +-- Data Pos: 0 +-- +CREATE FUNCTION oid(lo) RETURNS oid + AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_oid' + LANGUAGE c; + +SET SESSION AUTHORIZATION 'user'; +-- +-- TOC entry 278 (OID 19119) +-- Name: session; Type: TABLE; Schema: public; Owner: user +-- Data Pos: 0 +-- +CREATE TABLE "session" ( + session_id text NOT NULL, + pid_owner integer DEFAULT 0, + pid_pending integer DEFAULT 0, + created timestamp with time zone DEFAULT now(), + accessed timestamp with time zone DEFAULT now(), + modified timestamp with time zone DEFAULT now(), + uid integer, + ip inet, + browser character varying(200), + params character varying(200), + content lo +); + + I still get the following errors: + + +psql:trialdump1:4364: NOTICE: type "lo" is not yet defined + +DETAIL: Creating a shell type definition. + +psql:trialdump1:4364: ERROR: could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory + +psql:trialdump1:4374: ERROR: type lo does not exist + +psql:trialdump1:4391: ERROR: function lo_in(cstring) does not exist + +psql:trialdump1:4403: ERROR: could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory + +psql:trialdump1:4425: ERROR: type "lo" does not exist + +psql:trialdump1:4437: ERROR: type lo does not exist + +psql:trialdump1:4447: ERROR: type lo does not exist + +psql:trialdump1:4460: ERROR: type "lo" does not exist + +psql:trialdump1:4472: ERROR: could not access file "/usr/lib/test_funcs.so": No such file or directory + +psql:trialdump1:7606: ERROR: relation "session" does not exist + +psql:trialdump1:10868: ERROR: relation "session" does not exist + +psql:trialdump1:13155: ERROR: relation "session" does not exist + + + +The session table uses type "lo" for one of it's columns and hence it does not get created. + +What could the problem be? Is it some sort of access rights problem with respect to the files it is not able to access? + + + +When I restored the dump after commenting out all tables/functions using the type "lo", everything works fine. + + + +It will be great if someone could throw light on this problem. + + + +Thanks, + +Saranya + + + + +__________________________________________________ +Do You Yahoo!? +Tired of spam? Yahoo! Mail has the best spam protection around +http://mail.yahoo.com +--0-486103204-1104168753=:97994 +Content-Type: text/html; charset=us-ascii + +
Hi All,
+
 
+
I have a database running on Postgres 7.3.2. I am dumping the database schema from postgres 7.4.6 to restore it on the new Postgres version. The two postgres versions are running on different machines. I did the dump and tried restoring it. I got an error message saying type "lo" is not defined yet. I reordered the list and moved the type definition and the functions using the type "lo" to the top, using pg_restore and tried restoring it again.
+
 
+
These are the corresponding functions/types defined using the type "lo":
+
 
+
SET SESSION AUTHORIZATION 'user'; +
--
-- TOC entry 5 (OID 19114)
-- Name: lo; Type: TYPE; Schema: public; Owner: user
-- Data Pos: 0
--
+
CREATE TYPE lo (
    INTERNALLENGTH = 4,
    INPUT = lo_in,
    OUTPUT = lo_out,
    DEFAULT = '-',
    ALIGNMENT = int4,
    STORAGE = plain
);
+
SET SESSION AUTHORIZATION 'postgres';
+
--
-- TOC entry 851 (OID 19115)
-- Name: lo_in(cstring); Type: FUNCTION; Schema: public; Owner: postgres
-- Data Pos: 0
--
+
CREATE FUNCTION lo_in(cstring) RETURNS lo
    AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_in'
    LANGUAGE c;
+
--
-- TOC entry 852 (OID 19116)
-- Name: lo_out(lo); Type: FUNCTION; Schema: public; Owner: postgres
-- Data Pos: 0
--
+
CREATE FUNCTION lo_out(lo) RETURNS cstring
    AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_out'
    LANGUAGE c;
+

--
-- TOC entry 853 (OID 19117)
-- Name: lo_manage(); Type: FUNCTION; Schema: public; Owner: postgres
-- Data Pos: 0
--
+
CREATE FUNCTION lo_manage() RETURNS "trigger"
    AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_manage'
    LANGUAGE c;
+

--
-- TOC entry 854 (OID 19129)
-- Name: lo_oid(lo); Type: FUNCTION; Schema: public; Owner: postgres
-- Data Pos: 0
--
+
CREATE FUNCTION lo_oid(lo) RETURNS oid
    AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_oid'
    LANGUAGE c;
+
 
+
--
-- TOC entry 855 (OID 19130)
-- Name: oid(lo); Type: FUNCTION; Schema: public; Owner: postgres
-- Data Pos: 0
--
+
CREATE FUNCTION oid(lo) RETURNS oid
    AS '/usr/local/pgsql/lib/contrib/lo.so', 'lo_oid'
    LANGUAGE c;
+
 
+
SET SESSION AUTHORIZATION 'user';
+
--
-- TOC entry 278 (OID 19119)
-- Name: session; Type: TABLE; Schema: public; Owner: user
-- Data Pos: 0
--
+
CREATE TABLE "session" (
    session_id text NOT NULL,
    pid_owner integer DEFAULT 0,
    pid_pending integer DEFAULT 0,
    created timestamp with time zone DEFAULT now(),
    accessed timestamp with time zone DEFAULT now(),
    modified timestamp with time zone DEFAULT now(),
    uid integer,
    ip inet,
    browser character varying(200),
    params character varying(200),
    content lo
);
+
 
+
 I still get the following errors:
+
 
+
+

psql:trialdump1:4364: NOTICE:  type "lo" is not yet defined

+

DETAIL:  Creating a shell type definition.

+

psql:trialdump1:4364: ERROR:  could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory

+

psql:trialdump1:4374: ERROR:  type lo does not exist

+

psql:trialdump1:4391: ERROR:  function lo_in(cstring) does not exist

+

psql:trialdump1:4403: ERROR:  could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory

+

psql:trialdump1:4425: ERROR:  type "lo" does not exist

+

psql:trialdump1:4437: ERROR:  type lo does not exist

+

psql:trialdump1:4447: ERROR:  type lo does not exist

+

psql:trialdump1:4460: ERROR:  type "lo" does not exist

+

psql:trialdump1:4472: ERROR:  could not access file "/usr/lib/test_funcs.so": No such file or directory

+

psql:trialdump1:7606: ERROR:  relation "session" does not exist

+

psql:trialdump1:10868: ERROR:  relation "session" does not exist

+

psql:trialdump1:13155: ERROR:  relation "session" does not exist

+

 

+

The session table uses type "lo" for one of it's columns and hence it does not get created.

+

What could the problem be? Is it some sort of access rights problem with respect to the files it is not able to access?

+

 

+

When I restored the dump after commenting out all tables/functions using the type "lo", everything works fine.

+

 

+

It will be great if someone could throw light on this problem.

+

 

+

Thanks,

+

Saranya

+

 

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com +--0-486103204-1104168753=:97994-- + +From pgsql-novice-owner@postgresql.org Mon Dec 27 17:57:41 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id D66D644E37E + for ; + Mon, 27 Dec 2004 17:57:36 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 93124-01 + for ; + Mon, 27 Dec 2004 17:57:28 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 33BC044E400 + for ; Mon, 27 Dec 2004 17:57:27 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBRHvQku007507; + Mon, 27 Dec 2004 12:57:26 -0500 (EST) +To: sarlav kumar +Cc: pgsqlnovice +Subject: Re: user defined data type problem while dumping? +In-reply-to: <20041227173233.98750.qmail@web51301.mail.yahoo.com> +References: <20041227173233.98750.qmail@web51301.mail.yahoo.com> +Comments: In-reply-to sarlav kumar + message dated "Mon, 27 Dec 2004 09:32:33 -0800" +Date: Mon, 27 Dec 2004 12:57:26 -0500 +Message-ID: <7506.1104170246@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/254 +X-Sequence-Number: 11831 + +sarlav kumar writes: +> I still get the following errors: + +> psql:trialdump1:4364: ERROR: could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory + +Looks like you forgot to build the datatype's shared library on the new +installation. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Dec 27 18:07:26 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 4C93244E465 + for ; + Mon, 27 Dec 2004 18:07:24 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 94071-10 + for ; + Mon, 27 Dec 2004 18:06:56 +0000 (GMT) +Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) + by svr1.postgresql.org (Postfix) with ESMTP id 9E2FF44E488 + for ; + Mon, 27 Dec 2004 18:06:54 +0000 (GMT) +Received: from gnari ([157.157.175.183] [157.157.175.183]) by quasar.skima.is + with ESMTP; Mon, 27 Dec 2004 18:06:52 Z +Subject: Re: Howto Increased performace ? +From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= +To: postuser@spr.og.th +Cc: Iain , pgsql-performance@postgresql.org +In-Reply-To: <50978.192.168.2.17.1104161471.squirrel@192.168.2.17> +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> + <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> + <45410.192.168.2.17.1104139293.squirrel@192.168.2.17> + <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> + <50978.192.168.2.17.1104161471.squirrel@192.168.2.17> +Content-Type: text/plain +Date: Mon, 27 Dec 2004 18:08:39 +0000 +Message-Id: <1104170919.23792.16.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/298 +X-Sequence-Number: 9673 + +On Mon, 2004-12-27 at 22:31 +0700, Amrit Angsusingh wrote: +> [ iain@mst.co.jp ] +> > +> > These are some settings that I am planning to start with for a 4GB RAM +> > dual +> > opteron system with a maximum of 100 connections: +> > +> > +> > shared_buffers 8192 (=67MB RAM) +> > sort_mem 4096 (=400MB RAM for 100 connections) +> > effective_cache_size 380000(@8KB =3.04GB RAM) +> > vacuum_mem 32768 KB +> > wal_buffers 64 +> > checkpoint_segments 8 +> > +> > In theory, effective cache size is the amount of memory left over for the +> > OS +> > to cache the filesystem after running all programs and having 100 users +> > connected, plus a little slack. + +> I reduced the connection to 160 and configured as below there is some +> improvement in speed . +> shared_buffers = 27853 [Should I reduce it to nearly as you do and what +> will happen?] + +at some point, more shared buffers will do less good than leaving the +memory to the OS to use as disk buffers. you might want to experiment +a bit with different values to find what suits your real-life conditions + +> sort_mem = 8192 +> vacuum_mem = 16384 +> effective_cache_size = 81920 [Should I increase it to more than 200000 ?] +as Iain wrote, this value is an indication of how much memory will be +available to the OS for disk cache. +when all other settings have been made, try to see how much memory your +OS has left under normal conditions, and adjust your setting +accordingly, if it differs significantly. +I have seen cases where an incorrect value (too low) influenced the +planner to use sequential scans instead of better indexscans, +presumably because of a higher ratio of estimated cache hits. + +> Thanks for any comment again. +> +> NB. There is a huge diaster in my country "Tsunamies" and all the people +> over the country include me felt into deep sorrow. + +my condolescences. + +> Amrit Angsusingh +> Thailand + +gnari + + + +From pgsql-performance-owner@postgresql.org Mon Dec 27 18:53:34 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 6BEE644E683 + for ; + Mon, 27 Dec 2004 18:52:45 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 08536-05 + for ; + Mon, 27 Dec 2004 18:52:30 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id C894144E67C + for ; + Mon, 27 Dec 2004 18:52:29 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP id 5120356630 + for ; + Mon, 27 Dec 2004 13:52:24 -0500 (EST) +Message-ID: <41D059EB.9090201@deg.cc> +Date: Mon, 27 Dec 2004 13:52:27 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Wrong Stats and Poor Performance +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/299 +X-Sequence-Number: 9674 + +Hi Everybody. + + I have a table in my production database which gets updated +regularly and the stats on this table in pg_class are totally wrong. I +used to run vacuumdb on the whole database daily once and when i posted +the same problem of wrong stats in the pg_class most of them from this +list and also from postgres docs suggested me to run the "vacuum +analyze" more frequently on this table. + +I had a setup a cronjob couple of weeks ago to run vacuum analyze every +3 hours on this table and still my stats are totally wrong. This is +affecting the performance of the queries running on this table very badly. + +How can i fix this problem ? or is this the standard postgres behaviour ? + +Here are the stats from the problem table on my production database + + relpages | reltuples +----------+------------- + 168730 | 2.19598e+06 + +If i rebuild the same table on dev db and check the stats they are +totally different, I was hoping that there would be some difference in +the stats from the production db stats but not at this extent, as you +can see below there is a huge difference in the stats. + + relpages | reltuples +----------+----------- + 25230 | 341155 + + +Thanks! +Pallav + + + +From pgsql-performance-owner@postgresql.org Mon Dec 27 19:27:27 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id B0F9C44E82E + for ; + Mon, 27 Dec 2004 19:27:22 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 20443-02 + for ; + Mon, 27 Dec 2004 19:27:13 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id 3B0E144E839 + for ; + Mon, 27 Dec 2004 19:27:12 +0000 (GMT) +Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id iBRJR9331672; + Mon, 27 Dec 2004 13:27:09 -0600 +Message-ID: <41D06223.9060500@arbash-meinel.com> +Date: Mon, 27 Dec 2004 13:27:31 -0600 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Pallav Kalva +Cc: pgsql-performance@postgresql.org +Subject: Re: Wrong Stats and Poor Performance +References: <41D059EB.9090201@deg.cc> +In-Reply-To: <41D059EB.9090201@deg.cc> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigB875B1535F936458369CDD6F" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/300 +X-Sequence-Number: 9675 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigB875B1535F936458369CDD6F +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Pallav Kalva wrote: + +> Hi Everybody. +> +> I have a table in my production database which gets updated +> regularly and the stats on this table in pg_class are totally wrong. +> I used to run vacuumdb on the whole database daily once and when i +> posted the same problem of wrong stats in the pg_class most of them +> from this list and also from postgres docs suggested me to run the +> "vacuum analyze" more frequently on this table. +> +> I had a setup a cronjob couple of weeks ago to run vacuum analyze +> every 3 hours on this table and still my stats are totally wrong. This +> is affecting the performance of the queries running on this table very +> badly. +> How can i fix this problem ? or is this the standard postgres +> behaviour ? +> +> Here are the stats from the problem table on my production database +> +> relpages | reltuples +> ----------+------------- +> 168730 | 2.19598e+06 +> +> If i rebuild the same table on dev db and check the stats they are +> totally different, I was hoping that there would be some difference in +> the stats from the production db stats but not at this extent, as you +> can see below there is a huge difference in the stats. +> +> relpages | reltuples +> ----------+----------- +> 25230 | 341155 +> +> +> Thanks! +> Pallav +> + +What version of the database? As I recall, there are versions which +suffer from index bloat if there is a large amount of turnover on the +table. I believe VACUUM FULL ANALYZE helps with this. As does increasing +the max_fsm_pages (after a vacuum full verbose the last couple of lines +can give you an indication of how big max_fsm_pages might need to be.) + +Vacuum full does some locking, which means you don't want to do it all +the time, but if you can do it on the weekend, or maybe evenings or +something it might fix the problem. + +I don't know if you can recover without a vacuum full, but there might +also be something about rebuild index, or maybe dropping and re-creating +the index. +John +=:-> + +--------------enigB875B1535F936458369CDD6F +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.6 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFB0GIjJdeBCYSNAAMRAvqfAKCU+xkvO9JCwlJRBVErj0Bhq6drsACeLtv+ +zUhfZHJhlbBzhP1i8lKrKo8= +=QU/V +-----END PGP SIGNATURE----- + +--------------enigB875B1535F936458369CDD6F-- + +From pgsql-performance-owner@postgresql.org Mon Dec 27 19:51:45 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 3E08144E92D + for ; + Mon, 27 Dec 2004 19:51:40 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27137-04 + for ; + Mon, 27 Dec 2004 19:51:28 +0000 (GMT) +Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) + by svr1.postgresql.org (Postfix) with ESMTP id E7B8744E909 + for ; + Mon, 27 Dec 2004 19:51:26 +0000 (GMT) +Received: from deg.cc (kyle.deg.cc [198.70.16.205]) + by mail.deg.cc (Postfix) with ESMTP + id 52E955665B; Mon, 27 Dec 2004 14:51:18 -0500 (EST) +Message-ID: <41D067B9.5080308@deg.cc> +Date: Mon, 27 Dec 2004 14:51:21 -0500 +From: Pallav Kalva +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: John A Meinel +Cc: pgsql-performance@postgresql.org +Subject: Re: Wrong Stats and Poor Performance +References: <41D059EB.9090201@deg.cc> <41D06223.9060500@arbash-meinel.com> +In-Reply-To: <41D06223.9060500@arbash-meinel.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/301 +X-Sequence-Number: 9676 + +John A Meinel wrote: + +> Pallav Kalva wrote: +> +>> Hi Everybody. +>> +>> I have a table in my production database which gets updated +>> regularly and the stats on this table in pg_class are totally +>> wrong. I used to run vacuumdb on the whole database daily once and +>> when i posted the same problem of wrong stats in the pg_class most of +>> them from this list and also from postgres docs suggested me to run +>> the "vacuum analyze" more frequently on this table. +>> +>> I had a setup a cronjob couple of weeks ago to run vacuum analyze +>> every 3 hours on this table and still my stats are totally wrong. +>> This is affecting the performance of the queries running on this +>> table very badly. +>> How can i fix this problem ? or is this the standard postgres +>> behaviour ? +>> +>> Here are the stats from the problem table on my production database +>> +>> relpages | reltuples +>> ----------+------------- +>> 168730 | 2.19598e+06 +>> +>> If i rebuild the same table on dev db and check the stats they are +>> totally different, I was hoping that there would be some difference +>> in the stats from the production db stats but not at this extent, as +>> you can see below there is a huge difference in the stats. +>> +>> relpages | reltuples +>> ----------+----------- +>> 25230 | 341155 +>> +>> +>> Thanks! +>> Pallav +>> +> +> What version of the database? As I recall, there are versions which +> suffer from index bloat if there is a large amount of turnover on the +> table. I believe VACUUM FULL ANALYZE helps with this. As does +> increasing the max_fsm_pages (after a vacuum full verbose the last +> couple of lines can give you an indication of how big max_fsm_pages +> might need to be.) +> +> Vacuum full does some locking, which means you don't want to do it all +> the time, but if you can do it on the weekend, or maybe evenings or +> something it might fix the problem. +> +> I don't know if you can recover without a vacuum full, but there might +> also be something about rebuild index, or maybe dropping and +> re-creating the index. +> John +> =:-> + +Hi John, + + Thanks! for the reply, My postgres version is 7.4.2. since this +is on a production database and one of critical table in our system I +cant run the vacuum full analyze on this table because of the locks. I +recently rebuilt this table from the scratch and recreated all the +indexes and after 2-3 weeks the same problem again. My max_fsm_pages are +set to the default value due think it might be the problem ? i would +like to change it but that involves restarting the postgres database +which i cant do at this moment . What is index bloat ? do you think +rebuilding the indexes again might help some extent ? + +Pallav + + +From pgsql-performance-owner@postgresql.org Mon Dec 27 20:33:45 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id E0FEB44EAD8 + for ; + Mon, 27 Dec 2004 20:33:42 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 39382-05 + for ; + Mon, 27 Dec 2004 20:33:29 +0000 (GMT) +Received: from ct.radiology.uiowa.edu (ct.radiology.uiowa.edu + [129.255.60.186]) + by svr1.postgresql.org (Postfix) with ESMTP id BF48C44EAE4 + for ; + Mon, 27 Dec 2004 20:33:20 +0000 (GMT) +Received: from [192.168.1.11] (12-217-241-0.client.mchsi.com [12.217.241.0]) + by ct.radiology.uiowa.edu (8.11.6/8.11.6) with ESMTP id iBRKXI332043; + Mon, 27 Dec 2004 14:33:18 -0600 +Message-ID: <41D071A4.8050504@arbash-meinel.com> +Date: Mon, 27 Dec 2004 14:33:40 -0600 +From: John A Meinel +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Pallav Kalva +Cc: pgsql-performance@postgresql.org +Subject: Re: Wrong Stats and Poor Performance +References: <41D059EB.9090201@deg.cc> <41D06223.9060500@arbash-meinel.com> + <41D067B9.5080308@deg.cc> +In-Reply-To: <41D067B9.5080308@deg.cc> +X-Enigmail-Version: 0.89.5.0 +X-Enigmail-Supports: pgp-inline, pgp-mime +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; + boundary="------------enigA91671299AAAC63C6C54A066" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/302 +X-Sequence-Number: 9677 + +This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +--------------enigA91671299AAAC63C6C54A066 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit + +Pallav Kalva wrote: + +> John A Meinel wrote: +> +>> Pallav Kalva wrote: +>> +>>> Hi Everybody. +>>> +>>> I have a table in my production database which gets updated +>>> regularly and the stats on this table in pg_class are totally +>>> wrong. I used to run vacuumdb on the whole database daily once and +>>> when i posted the same problem of wrong stats in the pg_class most +>>> of them from this list and also from postgres docs suggested me to +>>> run the "vacuum analyze" more frequently on this table. +>>> +>>> I had a setup a cronjob couple of weeks ago to run vacuum analyze +>>> every 3 hours on this table and still my stats are totally wrong. +>>> This is affecting the performance of the queries running on this +>>> table very badly. +>>> How can i fix this problem ? or is this the standard postgres +>>> behaviour ? +>>> +>>> Here are the stats from the problem table on my production database +>>> +>>> relpages | reltuples +>>> ----------+------------- +>>> 168730 | 2.19598e+06 +>>> +>>> If i rebuild the same table on dev db and check the stats they are +>>> totally different, I was hoping that there would be some difference +>>> in the stats from the production db stats but not at this extent, as +>>> you can see below there is a huge difference in the stats. +>>> +>>> relpages | reltuples +>>> ----------+----------- +>>> 25230 | 341155 +>>> +>>> +>>> Thanks! +>>> Pallav +>>> +>> +>> What version of the database? As I recall, there are versions which +>> suffer from index bloat if there is a large amount of turnover on the +>> table. I believe VACUUM FULL ANALYZE helps with this. As does +>> increasing the max_fsm_pages (after a vacuum full verbose the last +>> couple of lines can give you an indication of how big max_fsm_pages +>> might need to be.) +>> +>> Vacuum full does some locking, which means you don't want to do it +>> all the time, but if you can do it on the weekend, or maybe evenings +>> or something it might fix the problem. +>> +>> I don't know if you can recover without a vacuum full, but there +>> might also be something about rebuild index, or maybe dropping and +>> re-creating the index. +>> John +>> =:-> +> +> +> Hi John, +> +> Thanks! for the reply, My postgres version is 7.4.2. since this +> is on a production database and one of critical table in our system I +> cant run the vacuum full analyze on this table because of the locks. I +> recently rebuilt this table from the scratch and recreated all the +> indexes and after 2-3 weeks the same problem again. My max_fsm_pages +> are set to the default value due think it might be the problem ? i +> would like to change it but that involves restarting the postgres +> database which i cant do at this moment . What is index bloat ? do +> you think rebuilding the indexes again might help some extent ? +> +> Pallav +> + +I'm going off of what I remember reading from the mailing lists, so +please search them to find more information. But basically, there are +bugs in older version of postgres that don't clean up indexes properly. +So if you add and delete a lot of entries, my understanding is that the +index still contains entries for the deleted items. Which means that if +you have a lot of turnover your index keeps growing in size. + + From what I'm hearing you do need to increase max_fsm_pages, but +without the vacuum full analyze verbose, I don't have any feelings for +what it needs to be. Probably doing a search through the mailing lists +for "increase max_fsm_relations max_fsm_pages" (I forgot about the first +one earlier), should help. + +At the end of a "vacuum full analyze verbose" (vfav) it prints out +something like: +INFO: free space map: 104 relations, 64 pages stored; 1664 total pages +needed +DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 178 kB +shared memory. + +That can be used to understand what you need to set max_fsm_relations +and max_fsm_pages to. As I understand it, you should run under normal +load for a while, run "vfav" and look at the pages. Move your max number +to something closer (you shouldn't jump the whole way). Then run for a +while again, and repeat. I believe the idea is that when you increase +the number, you allow a normal vacuum analyze to keep up with the load. +So the vacuum full doesn't have as much to do. So the requirement is less. + +Obviously my example is a toy database, your numbers should be much higher. + +John +=:-> + + +--------------enigA91671299AAAC63C6C54A066 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: OpenPGP digital signature +Content-Disposition: attachment; filename="signature.asc" + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.6 (Cygwin) +Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org + +iD8DBQFB0HGkJdeBCYSNAAMRAub5AKDSi/88cA2kmA7ad0Kh+zOhs1CwCQCcDXch +iD5J0Y4th7gSxyJJr3I0CnY= +=Dncl +-----END PGP SIGNATURE----- + +--------------enigA91671299AAAC63C6C54A066-- + +From pgsql-performance-owner@postgresql.org Mon Dec 27 20:52:11 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 5954B44EB5C + for ; + Mon, 27 Dec 2004 20:51:48 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 44419-08 + for ; + Mon, 27 Dec 2004 20:51:43 +0000 (GMT) +Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) + by svr1.postgresql.org (Postfix) with ESMTP id B08B744EBAE + for ; + Mon, 27 Dec 2004 20:51:43 +0000 (GMT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1Cj1px-0005I7-00; Mon, 27 Dec 2004 15:51:29 -0500 +To: Pallav Kalva +Cc: John A Meinel , + pgsql-performance@postgresql.org +Subject: Re: Wrong Stats and Poor Performance +References: <41D059EB.9090201@deg.cc> <41D06223.9060500@arbash-meinel.com> + <41D067B9.5080308@deg.cc> +In-Reply-To: <41D067B9.5080308@deg.cc> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 27 Dec 2004 15:51:29 -0500 +Message-ID: <87mzvzbh2m.fsf@stark.xeocode.com> +Lines: 21 +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 hub.org +X-Spam-Status: No, hits=0.049 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/303 +X-Sequence-Number: 9678 + +Pallav Kalva writes: + +> >> I had a setup a cronjob couple of weeks ago to run vacuum analyze every 3 +> >> hours on this table and still my stats are totally wrong. This is affecting +> >> the performance of the queries running on this table very badly. +> >> How can i fix this problem ? or is this the standard postgres behaviour ? + +If you need it there's nothing wrong with running vacuum even more often than +this. As often as every 5 minutes isn't unheard of. + +You should also look at raising the fsm settings. You need to run vacuum often +enough that on average not more tuples are updated in the intervening time +than can be kept track of in the fsm settings. So raising the fsm settings +allow you to run vacuum less often without having things bloat. + +There's a way to use the output vacuum verbose gives you to find out what fsm +settings you need. But I don't remember which number you should be looking at +there offhand. + +-- +greg + + +From pgsql-performance-owner@postgresql.org Tue Dec 28 06:51:12 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id EB0FD44F37F + for ; + Tue, 28 Dec 2004 06:51:10 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 58775-10 + for ; + Tue, 28 Dec 2004 06:50:55 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 68FFC44F936 + for ; + Tue, 28 Dec 2004 02:22:36 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBS2MIZ30403; + Tue, 28 Dec 2004 11:22:18 +0900 +Message-ID: <005801c4ec84$426378f0$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: "Cosimo Streppone" +Cc: "Postgresql Performance" +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> + <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> + <45410.192.168.2.17.1104139293.squirrel@192.168.2.17> + <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> + <41CFF3D2.3090305@team2k.net> +Subject: Re: Howto Increased performace ? +Date: Tue, 28 Dec 2004 11:23:41 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="windows-874"; + reply-type=response +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/306 +X-Sequence-Number: 9681 + +Ho Cosimo, + +I had read that before, so you are right. The amount of memory being used +could run much higher than I wrote. + +In my case, I know that not all the connections are not busy all the time +(this isn't a web application with thousands of users connecting to a pool) +so not all active connections will be doing sorts all the time. As far as I +can tell, sort memory is allocated as needed, so my estimate of 400MB should +still be reasonable, and I have plenty of unaccounted for memory outside the +effective cache so it shouldn't be a problem. + +Presumably, that memory isn't needed after the result set is built. + +If I understand correctly, there isn't any way to limit the amount of memory +allocated for sorting, which means that you can't specifiy generous sort_mem +values to help out when there is spare capacity (few connections) because in +the worst case it could cause swapping when the system is busy. In the the +not so bad case, the effective cache size estimate will just be completely +wrong. + +Maybe a global sort memory limit would be a good idea, I don't know. + +regards +Iain + + +> Iain wrote: +> +>> sort_mem 4096 (=400MB RAM for 100 connections) +> +> If I understand correctly, memory usage related to `sort_mem' +> is per connection *and* per sort. +> If every client runs a query with 3 sorts in its plan, you are +> going to need (in theory) 100 connections * 4Mb * 3 sorts, +> which is 1.2 Gb. +> +> Please correct me if I'm wrong... +> +> -- +> Cosimo + + + +From pgsql-performance-owner@postgresql.org Tue Dec 28 06:37:20 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 8100944DD0F + for ; + Tue, 28 Dec 2004 06:37:18 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 52803-03 + for ; + Tue, 28 Dec 2004 06:37:00 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 5E94944F99C + for ; + Tue, 28 Dec 2004 02:30:39 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBS2UYZ30421; + Tue, 28 Dec 2004 11:30:34 +0900 +Message-ID: <006301c4ec85$68d372f0$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: +Cc: +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> + <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> + <45410.192.168.2.17.1104139293.squirrel@192.168.2.17> + <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> + <51472.192.168.2.17.1104166127.squirrel@192.168.2.17> +Subject: Re: Howto Increased performace ? +Date: Tue, 28 Dec 2004 11:31:55 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="windows-874"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/305 +X-Sequence-Number: 9680 + +Hi Amrit, + +I'm sorry to hear about the disaster in Thailand. I live in a tsunami prone +area myself :-( + +I think that you have enough information to solve your problem now, but it +will just take some time and testing. When you have eliminated the excessive +swapping and tuned your system as best you can, then you can decide if that +is fast enough for you. More memory might help, but I can't say for sure. +There are many other things to consider. I suggest that you spend some time +reading through the performance and maybe the admin lists. + +regards +Iain + +----- Original Message ----- +From: "Amrit Angsusingh" +To: "Iain" +Cc: +Sent: Tuesday, December 28, 2004 1:48 AM +Subject: Re: [PERFORM] Howto Increased performace ? + + +>> Hi, +>> +>> These are some settings that I am planning to start with for a 4GB RAM +>> dual +>> opteron system with a maximum of 100 connections: +>> +>> +>> shared_buffers 8192 (=67MB RAM) +>> sort_mem 4096 (=400MB RAM for 100 connections) +>> effective_cache_size 380000(@8KB =3.04GB RAM) +>> vacuum_mem 32768 KB +>> wal_buffers 64 +>> checkpoint_segments 8 +>> +>> In theory, effective cache size is the amount of memory left over for the +>> OS +>> to cache the filesystem after running all programs and having 100 users +>> connected, plus a little slack. +>> +>> regards +>> Iain +> +> +> I'm not sure if I put more RAM on my mechine ie: 6 GB . The performance +> would increase for more than 20 % ? +> Any comment please, +> +> Amrit Angsusingh +> Comcenter +> Sawanpracharuck Hospital +> Thailand +> +> + + +From pgsql-performance-owner@postgresql.org Tue Dec 28 05:48:02 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 33B2944F9F1 + for ; + Tue, 28 Dec 2004 05:47:59 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27934-06 + for ; + Tue, 28 Dec 2004 05:47:34 +0000 (GMT) +Received: from millenium.mst.co.jp (unknown [210.230.185.241]) + by svr1.postgresql.org (Postfix) with ESMTP id 58E3244FFB3 + for ; + Tue, 28 Dec 2004 04:54:53 +0000 (GMT) +Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) + by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id iBS4skZ30827; + Tue, 28 Dec 2004 13:54:46 +0900 +Message-ID: <007e01c4ec99$a2a043a0$7201a8c0@mst1x5r347kymb> +From: "Iain" +To: , + =?windows-874?B?UmFnbmFyIEhhZnN0YfA=?= +Cc: +References: <2452.192.168.2.6.1103621509.squirrel@192.168.2.6> + <00cb01c4ebb3$94aebf10$7201a8c0@mst1x5r347kymb> + <45410.192.168.2.17.1104139293.squirrel@192.168.2.17> + <003a01c4ebf7$503de6a0$7201a8c0@mst1x5r347kymb> + <50978.192.168.2.17.1104161471.squirrel@192.168.2.17> + <1104170919.23792.16.camel@localhost.localdomain> + <58712.192.168.2.17.1104203972.squirrel@192.168.2.17> +Subject: Re: Howto Increased performace ? +Date: Tue, 28 Dec 2004 13:56:42 +0900 +MIME-Version: 1.0 +Content-Type: text/plain; format=flowed; charset="windows-874"; + reply-type=original +Content-Transfer-Encoding: 7bit +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2180 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/304 +X-Sequence-Number: 9679 + +Hi, + +These are the /etc/sysctl.conf settings that I am planning to use. +Coincidentally, these are the settings recommended by Oracle. If anything +they would be generous, I think. + +file-max 65536 (for 2.2 and 2.4 kernels) +kernel.shmall 134217728 (=128MB) +kernel.shmmax 268435456 +fs.file-max 65536 + +By the way, when you tested your changes, was that with a busy system? I +think that a configuration that gives the best performance (at the client +end) on a machine with just a few connections might not be the configuration +that will give you the best throughput when the system is stressed. + +I'm certainly no expert on tuning Linux systems, or even Postgres but I'd +suggest that you become knowlegable in the use of the various system +monitoring tools that Linux has and keep a record of their output so you can +compare as you change your configuration. In the end though, I think your +aim is to reduce swapping by tuning your memory usage for busy times. + +Also, I heard that (most?what versions?) 32 bit linux kernals are slow at +handling more than 2GB memory so a kernal upgrade might be worth +considering. + +regards +Iain + + +From pgsql-novice-owner@postgresql.org Tue Dec 28 23:58:46 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id A1BDD3ABFCA + for ; + Tue, 28 Dec 2004 23:58:29 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 99722-10 + for ; + Tue, 28 Dec 2004 23:58:13 +0000 (GMT) +Received: from mailhub1.une.edu.au (mailhub.une.edu.au [129.180.1.122]) + by svr1.postgresql.org (Postfix) with ESMTP id 9BDDD3A62CE + for ; Tue, 28 Dec 2004 23:58:07 +0000 (GMT) +Received: from icarus.une.edu.au (icarus.une.edu.au [129.180.47.120]) + by mailhub1.une.edu.au (Postfix) with ESMTP id 812A37F60; + Wed, 29 Dec 2004 10:58:06 +1100 (EST) +Received: from [129.180.47.61] ([129.180.47.61]) + by icarus.une.edu.au (8.12.8/8.12.8) with ESMTP id iBSNw6T3030576; + Wed, 29 Dec 2004 10:58:06 +1100 +Message-ID: <41D1F30E.7060007@abri.une.edu.au> +Date: Wed, 29 Dec 2004 10:58:06 +1100 +From: Alexander Borkowski +Organization: Agricultural Business Research Institute +User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: sarlav kumar +Cc: pgsql-novice@postgresql.org +Subject: Re: [PERFORM] user defined data type problem while dumping? +References: <20041227173233.98750.qmail@web51301.mail.yahoo.com> +In-Reply-To: <20041227173233.98750.qmail@web51301.mail.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/267 +X-Sequence-Number: 11844 + +Hi Saranya, + +> psql:trialdump1:4364: ERROR: could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory +> psql:trialdump1:4403: ERROR: could not access file "/usr/local/pgsql/lib/contrib/lo.so": No such file or directory + +It looks like you need to install the lo library on the machine you are +trying to restore to. It contains the implementation for the type you +are missing and it is not installed by default. You can find it in the +contrib section of the PostgreSQL source tree. + +> psql:trialdump1:4472: ERROR: could not access file "/usr/lib/test_funcs.so": No such file or directory + +Don't know about this one, but this may be a similar problem (i.e. file +exists on the machine you dumped from but not on the one you try to +restore to). + +> What could the problem be? Is it some sort of access rights problem with respect to the files it is not able to access? + +If this was an access permission problem you would probably get +'Permission denied' instead of 'No such file or directory' in the error +messages. + +HTH, + +Alex + +From pgsql-novice-owner@postgresql.org Wed Dec 29 04:02:56 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 68CBA3ABE01; + Wed, 29 Dec 2004 04:01:56 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 88890-05; Wed, 29 Dec 2004 04:01:35 +0000 (GMT) +Received: from lakermmtao06.cox.net (lakermmtao06.cox.net [68.230.240.33]) + by svr1.postgresql.org (Postfix) with ESMTP id 73C1E3ABFFE; + Wed, 29 Dec 2004 04:01:21 +0000 (GMT) +Received: from [192.168.0.8] (really [68.226.6.80]) by lakermmtao06.cox.net + (InterMail vM.6.01.04.00 201-2131-117-20041022) with ESMTP + id <20041229040119.XHDN22789.lakermmtao06.cox.net@[192.168.0.8]>; + Tue, 28 Dec 2004 23:01:19 -0500 +From: Robert Treat +To: sarlav kumar +Subject: Re: [PERFORM] slony replication +Date: Tue, 28 Dec 2004 22:57:28 -0500 +User-Agent: KMail/1.6.2 +Cc: pgsqlnovice , + pgsqlperform +References: <20041220222526.74532.qmail@web51308.mail.yahoo.com> +In-Reply-To: <20041220222526.74532.qmail@web51308.mail.yahoo.com> +MIME-Version: 1.0 +Content-Disposition: inline +Content-Type: text/plain; + charset="utf-8" +Content-Transfer-Encoding: 7bit +Message-Id: <200412282257.28265.xzilla@users.sourceforge.net> +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/268 +X-Sequence-Number: 11845 + +I didn't see any responses to this, but given it is off topic for both groups +that wouldn't surprise me. In the future please direct these questions to the +slony project mailing lists. + +On Monday 20 December 2004 17:25, sarlav kumar wrote: +> Hi All, +> +> I installed slony1.0.5 and tried the example replication of pgbench +> database. That seemed to work. Now I need to replicate a DB running on a +> different server. slony1.0.5 is installed on the Fedora core 3 machine +> where Postgres 7.4.6 is installed. I have to replicate the 'test' database +> installed on a different machine using Postgres 7.3.2. +> +> In the instructions to replicate the pgbench example, there is script file +> to create the initial configuration for the master-slave setup of the +> pgbench database. Is this the script file that has to be modified +> accordingly, to replicate my 'test' DB. And ofcourse, the shell variables +> have to be changed to indicate the correct location of the master and slave +> DBs. Am I right? +> + +More or less. The scripts provided are just examples, but you can modify them +to suite your einvironment rather than write your own. + +> Also, in the script, the following lines are used to create sets of tables: +> # Slony-I organizes tables into sets. The smallest unit a node can +> # subscribe is a set. The following commands create one set containing +> # all 4 pgbench tables. The master or origin of the set is node 1. +> #-- +> create set (id=1, origin=1, comment='All pgbench tables'); +> set add table (set id=1, origin=1, id=1, fully qualified name = +> 'public.accounts', comment='accounts table'); set add table (set id=1, +> origin=1, id=2, fully qualified name = 'public.branches', comment='branches +> table'); set add table (set id=1, origin=1, id=3, fully qualified name = +> 'public.tellers', comment='tellers table'); set add table (set id=1, +> origin=1, id=4, fully qualified name = 'public.history', comment='history +> table', key = serial); +> +> #-- +> +> Can this be skipped? I have over 200 tables, and I am not sure if I have to +> list each of them in the "set add table" part of the scripts file. +> + +nope, you have to do them all, and dont forget the sequences. easiest way i +found was to generate the list programatically around a select * from +pg_class with appropriate where clause to get just the desired tables. + +> Do I need to change any of the other scripts file in the example? +> + +Chances are yes, since those scripts were written for the example scenario +provided, and your environment is sure to be different. Again, post to the +slony mailing lists if you need more help. + +-- +Robert Treat +Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL + +From pgsql-novice-owner@postgresql.org Wed Dec 29 23:11:31 2004 +X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DDEEC3AC1C0 + for ; + Wed, 29 Dec 2004 18:59:21 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 09012-07 + for ; + Wed, 29 Dec 2004 18:59:14 +0000 (GMT) +Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) + by svr1.postgresql.org (Postfix) with ESMTP id 652243AC187 + for ; Wed, 29 Dec 2004 18:59:03 +0000 (GMT) +Received: (from smtp@localhost) + by ll.mit.edu (8.12.10/8.8.8) id iBTIx2f1006432; + Wed, 29 Dec 2004 13:59:02 -0500 (EST) +Received: from sty.llan.ll.mit.edu( ), claiming to be "sty.llan" + via SMTP by llpost, id smtpdAAAy9a4ym; Wed Dec 29 13:58:58 2004 +Date: Wed, 29 Dec 2004 13:58:58 -0500 +From: george young +To: sarlav kumar +Cc: pgsql-novice@postgresql.org +Subject: Re: [PERFORM] INSERT question +Message-Id: <20041229135858.71f8c3cf.gry@ll.mit.edu> +In-Reply-To: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +References: <20041213162839.60931.qmail@web51303.mail.yahoo.com> +Reply-To: gry@ll.mit.edu +Organization: MIT Lincoln Laboratory +X-Mailer: Sylpheed version 0.9.10 (GTK+ 1.2.10; i686-pc-linux-gnu) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200412/271 +X-Sequence-Number: 11848 + +On Mon, 13 Dec 2004 08:28:39 -0800 (PST) +sarlav kumar threw this fish to the penguins: + +> Hi All, +> +> I have a question regarding multiple inserts. +> The following function inserts for each country found in country table, values into merchant_buyer_country. +> +> ----------------------------------------------------------------------------------------------------------------------------------------- +> CSQLStatement st( sql ); +> CSQLStatement st1( sql ); +> SQLINTEGER rows; +> long num_codes = 0; +> rows = st.Select( "SELECT * FROM merchant_buyer_country where merchant_id = %lu ",merchant_id ); +> if ( rows ) +> return 0; +> char code[4]; +> rows = st.Select( "SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL" ); +> SQLBindCol( st.hstmt, 1, SQL_C_CHAR, code, sizeof(code), 0 ); +> long i; +> for (i = 0; i < rows; i++ ) +> { +> st.Fetch(); +> st1.Command("INSERT INTO merchant_buyer_country (merchant_id,country,enabled,group_id) VALUES(%lu ,'%s', true, %lu )", merchant_id, +> code,group_id); +> } +> st.CloseCursor(); +> st1.CloseCursor(); +> return 1; +> ----------------------------------------------------------------------------------------------------------------------------------------- +> +> On looking at the log file, I saw separate inserts being performed, and each insert takes about 1 second. +> +> insert into merchant_buyer_country (merchant_id,country,enabled,group_id) values(1203,'IN','true',1); +> insert into merchant_buyer_country merchant_id,country,enabled,group_id) values(1203,'US','true',1); +> insert into merchant_buyer_country merchant_id,country,enabled,group_id) values (1203,'AR','true',1); +> insert into merchant_buyer_country (merchant_id,country,enabled,group_id) values(1203,'AZ','true',1); +> insert into merchant_buyer_country merchant_id,country,enabled,group_id) values (1203,'BG','true',1); +> insert into merchant_buyer_country merchant_id,country,enabled,group_id) values(1203,'SP','true',1); +> ..... +> +> +> +> +> +> +> There are more than 100 countries and this takes a lot of time for the inserts to complete. +> Is there a way to write the INSERT as follows? +> +> INSERT into merchant_buyer_country (merchant_id,country,enabled,group_id) values (1203, +> (SELECT code FROM country WHERE send IS NOT NULL OR receive IS NOT NULL), 'true',1); +> +> I tried this, but I get the following problem: +> ERROR: More than one tuple returned by a subselect used as an expression. +> +> I know there is a way to this, but I am not sure where I am going wrong. Can someone please help me figure this out. + +Try: + +insert into merchant_buyer_country select 1203,code,true,1 from country where send is not null or receive is not null; + +-- George Young +-- +"Are the gods not just?" "Oh no, child. +What would become of us if they were?" (CSL) + +From pgsql-performance-owner@postgresql.org Thu Dec 30 22:06:37 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id DA38E3A18D1 + for ; + Thu, 30 Dec 2004 22:06:36 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 04313-04 + for ; + Thu, 30 Dec 2004 22:06:27 +0000 (GMT) +Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) + by svr1.postgresql.org (Postfix) with ESMTP id F227A3A18BD + for ; + Thu, 30 Dec 2004 22:06:29 +0000 (GMT) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 +Subject: sudden drop in statement turnaround latency -- yay!. +Date: Thu, 30 Dec 2004 17:05:54 -0500 +Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A758A@Herge.rcsinc.local> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: sudden drop in statement turnaround latency -- yay!. +Thread-Index: AcTuu7tmke8ZUENbQgCkcJ/YXdENFw== +From: "Merlin Moncure" +To: "pgsqlperform" +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200412/308 +X-Sequence-Number: 9683 + +I took advantage of the holidays to update a production server (dual +Opteron on win2k) from an 11/16 build (about beta5 or so) to the latest +release candidate. No configuration changes were made, just a binary +swap and a server stop/start. =20 + +I was shocked to see that statement latency dropped by a fairly large +margin. Here is a log snippet taken as measured from the client +application: + +0.000278866 sec: data1_read_key_item_vendor_file_0 params: $1=3D005988 +$2=3D002255=20 +0.00032731 sec: data1_read_key_item_link_file_1 params: $1=3D005988=20 +0.000327063 sec: data1_read_key_bm_header_file_0 params: $1=3D008704=20 +0.000304915 sec: data1_read_key_item_vendor_file_0 params: $1=3D008704 +$2=3D000117=20 +0.00029838 sec: data1_read_key_item_link_file_1 params: $1=3D008704=20 +0.0003252 sec: data1_read_key_bm_header_file_0 params: $1=3D000268=20 +0.000274747 sec: data1_read_key_item_vendor_file_0 params: $1=3D000268 +$2=3D000117=20 +0.000324275 sec: data1_read_key_item_link_file_1 params: $1=3D000268 + +These are statements that are run (AFIK) the fastest possible way, which +is using prepared statements over parse/bind. The previous latencies +usually varied between .0005 and .0007 sec, but never below .5 ms for a +index read. Now, as demonstated by the log, I'm getting times less than +half that figure. I benchmarked a transversal over a bill of materials +(several thousand statements) and noticed about a 40% reduction in time +to complete the operation. + +I wonder exactly what and when this happened, has anybody else noticed a +similar change? + +Merlin + +From pgsql-performance-owner@postgresql.org Fri Dec 31 05:31:04 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 670F13A1960 + for ; + Fri, 31 Dec 2004 05:31:03 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 27808-04 + for ; + Fri, 31 Dec 2004 05:30:58 +0000 (GMT) +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by svr1.postgresql.org (Postfix) with ESMTP id 6D6703A18D0 + for ; + Fri, 31 Dec 2004 05:30:57 +0000 (GMT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id iBV5UuJ6007018; + Fri, 31 Dec 2004 00:30:57 -0500 (EST) +To: "Merlin Moncure" +Cc: "pgsqlperform" +Subject: Re: sudden drop in statement turnaround latency -- yay!. +In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3412A758A@Herge.rcsinc.local> +References: <6EE64EF3AB31D5448D0007DD34EEB3412A758A@Herge.rcsinc.local> +Comments: In-reply-to "Merlin Moncure" + message dated "Thu, 30 Dec 2004 17:05:54 -0500" +Date: Fri, 31 Dec 2004 00:30:56 -0500 +Message-ID: <7017.1104471056@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/313 +X-Sequence-Number: 9688 + +"Merlin Moncure" writes: +> I took advantage of the holidays to update a production server (dual +> Opteron on win2k) from an 11/16 build (about beta5 or so) to the latest +> release candidate. No configuration changes were made, just a binary +> swap and a server stop/start. + +> I was shocked to see that statement latency dropped by a fairly large +> margin. + +Hmm ... I trawled through the CVS logs since 11/16, and did not see very +many changes that looked like they might improve performance (list +attached) --- and even of those, hardly any looked like the change would +be significant. Do you know whether the query plans changed? Are you +running few enough queries per connection that backend startup overhead +might be an issue? + + regards, tom lane + + +2004-12-15 14:16 tgl + + * src/backend/access/nbtree/nbtutils.c: Calculation of + keys_are_unique flag was wrong for cases involving redundant + cross-datatype comparisons. Per example from Merlin Moncure. + +2004-12-02 10:32 momjian + + * configure, configure.in, doc/src/sgml/libpq.sgml, + doc/src/sgml/ref/copy.sgml, src/interfaces/libpq/fe-connect.c, + src/interfaces/libpq/fe-print.c, src/interfaces/libpq/fe-secure.c, + src/interfaces/libpq/libpq-fe.h, src/interfaces/libpq/libpq-int.h: + Rework libpq threaded SIGPIPE handling to avoid interference with + calling applications. This is done by blocking sigpipe in the + libpq thread and using sigpending/sigwait to possibily discard any + sigpipe we generated. + +2004-12-01 20:34 tgl + + * src/: backend/optimizer/path/costsize.c, + backend/optimizer/util/plancat.c, + test/regress/expected/geometry.out, + test/regress/expected/geometry_1.out, + test/regress/expected/geometry_2.out, + test/regress/expected/inherit.out, test/regress/expected/join.out, + test/regress/sql/inherit.sql, test/regress/sql/join.sql: Make some + adjustments to reduce platform dependencies in plan selection. In + particular, there was a mathematical tie between the two possible + nestloop-with-materialized-inner-scan plans for a join (ie, we + computed the same cost with either input on the inside), resulting + in a roundoff error driven choice, if the relations were both small + enough to fit in sort_mem. Add a small cost factor to ensure we + prefer materializing the smaller input. This changes several + regression test plans, but with any luck we will now have more + stability across platforms. + +2004-12-01 14:00 tgl + + * doc/src/sgml/catalogs.sgml, doc/src/sgml/diskusage.sgml, + doc/src/sgml/perform.sgml, doc/src/sgml/release.sgml, + src/backend/access/nbtree/nbtree.c, src/backend/catalog/heap.c, + src/backend/catalog/index.c, src/backend/commands/vacuum.c, + src/backend/commands/vacuumlazy.c, + src/backend/optimizer/util/plancat.c, + src/backend/optimizer/util/relnode.c, src/include/access/genam.h, + src/include/nodes/relation.h, src/test/regress/expected/case.out, + src/test/regress/expected/inherit.out, + src/test/regress/expected/join.out, + src/test/regress/expected/join_1.out, + src/test/regress/expected/polymorphism.out: Change planner to use + the current true disk file size as its estimate of a relation's + number of blocks, rather than the possibly-obsolete value in + pg_class.relpages. Scale the value in pg_class.reltuples + correspondingly to arrive at a hopefully more accurate number of + rows. When pg_class contains 0/0, estimate a tuple width from the + column datatypes and divide that into current file size to estimate + number of rows. This improved methodology allows us to jettison + the ancient hacks that put bogus default values into pg_class when + a table is first created. Also, per a suggestion from Simon, make + VACUUM (but not VACUUM FULL or ANALYZE) adjust the value it puts + into pg_class.reltuples to try to represent the mean tuple density + instead of the minimal density that actually prevails just after + VACUUM. These changes alter the plans selected for certain + regression tests, so update the expected files accordingly. (I + removed join_1.out because it's not clear if it still applies; we + can add back any variant versions as they are shown to be needed.) + +2004-11-21 17:57 tgl + + * src/backend/utils/hash/dynahash.c: Fix rounding problem in + dynahash.c's decision about when the target fill factor has been + exceeded. We usually run with ffactor == 1, but the way the test + was coded, it wouldn't split a bucket until the actual fill factor + reached 2.0, because of use of integer division. Change from > to + >= so that it will split more aggressively when the table starts to + get full. + +2004-11-21 17:48 tgl + + * src/backend/utils/mmgr/portalmem.c: Reduce the default size of + the PortalHashTable in order to save a few cycles during + transaction exit. A typical session probably wouldn't have as many + as half a dozen portals open at once, so the original value of 64 + seems far larger than needed. + +2004-11-20 15:19 tgl + + * src/backend/utils/cache/relcache.c: Avoid scanning the relcache + during AtEOSubXact_RelationCache when there is nothing to do, which + is most of the time. This is another simple improvement to cut + subtransaction entry/exit overhead. + +2004-11-20 15:16 tgl + + * src/backend/storage/lmgr/lock.c: Reduce the default size of the + local lock hash table. There's usually no need for it to be nearly + as big as the global hash table, and since it's not in shared + memory it can grow if it does need to be bigger. By reducing the + size, we speed up hash_seq_search(), which saves a significant + fraction of subtransaction entry/exit overhead. + +2004-11-19 19:48 tgl + + * src/backend/tcop/postgres.c: Move pgstat_report_tabstat() call so + that stats are not reported to the collector until the transaction + commits. Per recent discussion, this should avoid confusing + autovacuum when an updating transaction runs for a long time. + +2004-11-16 22:13 neilc + + * src/backend/access/: hash/hash.c, nbtree/nbtree.c: + Micro-optimization of markpos() and restrpos() in btree and hash + indexes. Rather than using ReadBuffer() to increment the reference + count on an already-pinned buffer, we should use + IncrBufferRefCount() as it is faster and does not require acquiring + the BufMgrLock. + +2004-11-16 19:14 tgl + + * src/: backend/main/main.c, backend/port/win32/signal.c, + backend/postmaster/pgstat.c, backend/postmaster/postmaster.c, + include/port/win32.h: Fix Win32 problems with signals and sockets, + by making the forkexec code even uglier than it was already :-(. + Also, on Windows only, use temporary shared memory segments instead + of ordinary files to pass over critical variable values from + postmaster to child processes. Magnus Hagander + +From pgsql-performance-owner@postgresql.org Fri Dec 31 05:48:13 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 70AD13A197F + for ; + Fri, 31 Dec 2004 05:48:12 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 30490-08 + for ; + Fri, 31 Dec 2004 05:48:04 +0000 (GMT) +Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) + by svr1.postgresql.org (Postfix) with ESMTP id 8CD323A1921 + for ; + Fri, 31 Dec 2004 05:48:03 +0000 (GMT) +Received: by wproxy.gmail.com with SMTP id 68so227417wra + for ; + Thu, 30 Dec 2004 21:48:02 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; + b=HVGgKo/ooGa0YXGtDhpHcsJMem2XCcC4C/gfRuss+h6HdrCpiDnUN7YUyYW7GxSruarLf/67S3QpVHqVMCEEYQRPULA4mVAezhm7dqfmyCP8Sjii8YrPUpBW2J/BppQg6pStvulIwfz6l2pjIRS3QaNmeGWzw9mJ9sZUUJ1HSro= +Received: by 10.54.3.71 with SMTP id 71mr53319wrc; + Thu, 30 Dec 2004 21:48:02 -0800 (PST) +Received: by 10.54.28.71 with HTTP; Thu, 30 Dec 2004 21:48:02 -0800 (PST) +Message-ID: <77b69d210412302148104d8e35@mail.gmail.com> +Date: Fri, 31 Dec 2004 11:18:02 +0530 +From: "Vishal Kashyap @ [SaiHertz]" +Reply-To: "Vishal Kashyap @ [SaiHertz]" +To: pgsqlperform +Subject: Optimization while compiling +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP +X-Spam-Level: +X-Archive-Number: 200412/314 +X-Sequence-Number: 9689 + +Dear all, + +What would be the best configure line that would suite for optimization + +As I understand by eliminating unwanted modules, I would make the DB lighter +and faster. + +Lets say the module needed are only english module with LC_collate C +module type. + +How could we eliminate the unwanted modules. + + +-- +With Best Regards, +Vishal Kashyap. +http://vishalkashyap.tk + +From pgsql-performance-owner@postgresql.org Fri Dec 31 05:57:39 2004 +X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org +Received: from localhost (unknown [200.46.204.144]) + by svr1.postgresql.org (Postfix) with ESMTP id 743A23A1968 + for ; + Fri, 31 Dec 2004 05:57:38 +0000 (GMT) +Received: from svr1.postgresql.org ([200.46.204.71]) + by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) + with ESMTP id 34142-02 + for ; + Fri, 31 Dec 2004 05:57:25 +0000 (GMT) +Received: from wolff.to (wolff.to [66.93.249.74]) + by svr1.postgresql.org (Postfix) with SMTP id A79E03A197E + for ; + Fri, 31 Dec 2004 05:57:24 +0000 (GMT) +Received: (qmail 18473 invoked by uid 500); 31 Dec 2004 06:10:42 -0000 +Date: Fri, 31 Dec 2004 00:10:42 -0600 +From: Bruno Wolff III +To: Karl Vogel +Cc: Yann Michel , pgsql-performance@postgresql.org +Subject: Re: Why so much time difference with a same query/plan? +Message-ID: <20041231061042.GA17555@wolff.to> +Mail-Followup-To: Karl Vogel , + Yann Michel , + pgsql-performance@postgresql.org +References: <20041222200904.94015.qmail@web13124.mail.yahoo.com> + <20041222215240.12345.qmail@web13124.mail.yahoo.com> + <20041223070453.GA30031@zong.spline.inf.fu-berlin.de> + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.6i +X-Virus-Scanned: by amavisd-new at hub.org +X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200412/315 +X-Sequence-Number: 9690 + +On Sun, Dec 26, 2004 at 13:30:15 +0100, + Karl Vogel wrote: +> +> This depends on the version of Oracle you're using. Oracle 9i +> introduced Index Skip Scans: +> +> http://www.oracle.com/technology//products/oracle9i/daily/apr22.html +> +> I don't know whether pg has something similar? + +Postgres doesn't currently do this. There was some discussion about this +not too long ago, but I don't think anyone indicated that they were going to +work on it for 8.1. + +Postgres can use the leading part of a multikey index to start a scan, +but it will just do a normal index scan with a filter. +