From pgsql-performance-owner@postgresql.org Sun Jan 2 02:52:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6FD813A2B0A for ; Sun, 2 Jan 2005 02:52: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 12763-01 for ; Sun, 2 Jan 2005 02:51:50 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id AC8873A29AC for ; Sun, 2 Jan 2005 02:51:52 +0000 (GMT) Received: (qmail 31234 invoked from network); 2 Jan 2005 02:54:34 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 2 Jan 2005 02:54:34 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 28529-61 for ; Sun, 2 Jan 2005 09:54:32 +0700 (ICT) Received: (qmail 31220 invoked from network); 2 Jan 2005 02:54:32 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 2 Jan 2005 02:54:32 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Sun, 2 Jan 2005 09:54:32 +0700 Message-ID: <1104634472.41d762681b548@webmail.moph.go.th> Date: Sun, 2 Jan 2005 09:54:32 +0700 From: amrit@health2.moph.go.th To: pgsql-performance@postgresql.org Subject: Low Performance for big hospital server .. MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/1 X-Sequence-Number: 9691 I try to adjust my server for a couple of weeks with some sucess but it still slow when the server has stress in the moring from many connection . 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 160 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: 207 processes: 203 sleeping, 4 running, 0 zombie, 0 stopped CPU0 states: 15.0% user 12.1% system 0.0% nice 0.0% iowait 72.2% idle CPU1 states: 11.0% user 11.1% system 0.0% nice 0.0% iowait 77.2% idle CPU2 states: 22.3% user 27.3% system 0.0% nice 0.0% iowait 49.3% idle CPU3 states: 15.4% user 13.0% system 0.0% nice 0.0% iowait 70.4% idle Mem: 4124720k av, 4085724k used, 38996k free, 0k shrd, 59012k buff 3141420k actv, 48684k in_d, 76596k in_c Swap: 20370412k av, 46556k used, 20323856k free 3493136k cached PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND 16708 postgres 15 0 264M 264M 261M S 14.7 6.5 0:18 2 postmaster 16685 postgres 15 0 264M 264M 261M S 14.5 6.5 1:22 0 postmaster 16690 postgres 15 0 264M 264M 261M S 13.7 6.5 1:35 3 postmaster 16692 postgres 15 0 264M 264M 261M S 13.3 6.5 0:49 1 postmaster 16323 postgres 16 0 264M 264M 261M R 11.1 6.5 1:48 2 postmaster 16555 postgres 15 0 264M 264M 261M S 9.7 6.5 1:52 3 postmaster 16669 postgres 15 0 264M 264M 261M S 8.7 6.5 1:58 3 postmaster 16735 postgres 15 0 264M 264M 261M S 7.7 6.5 0:15 0 postmaster 16774 postgres 16 0 256M 256M 254M R 7.5 6.3 0:09 0 postmaster 16247 postgres 15 0 263M 263M 261M S 7.1 6.5 0:46 0 postmaster 16696 postgres 15 0 263M 263M 261M S 6.7 6.5 0:24 1 postmaster 16682 postgres 15 0 264M 264M 261M S 4.3 6.5 1:19 3 postmaster 16726 postgres 15 0 263M 263M 261M S 1.5 6.5 0:21 3 postmaster 14 root 15 0 0 0 0 RW 1.3 0.0 126:42 1 kscand/HighMem 16766 postgres 15 0 134M 134M 132M S 1.1 3.3 0:01 2 postmaster 16772 postgres 15 0 258M 258M 256M S 1.1 6.4 0:04 1 postmaster 16835 root 15 0 1252 1252 856 R 0.9 0.0 0:00 3 top 2624 root 24 0 13920 7396 1572 S 0.5 0.1 6:25 1 java 16771 postgres 15 0 263M 263M 261M S 0.5 6.5 0:06 0 postmaster 26 root 15 0 0 0 0 SW 0.3 0.0 3:24 1 kjournald 2114 root 15 0 276 268 216 S 0.1 0.0 2:48 2 irqbalance 1 root 15 0 108 76 56 S 0.0 0.0 0:07 3 init 2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0 3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1 4 root RT 0 0 0 0 SW 0.0 0.0 0:00 2 migration/2 5 root RT 0 0 0 0 SW 0.0 0.0 0:00 3 migration/3 6 root 15 0 0 0 0 SW 0.0 0.0 0:03 1 keventd [root@data3 root]# cat < /proc/meminfo total: used: free: shared: buffers: cached: Mem: 4223713280 4203782144 19931136 0 37982208 3684573184 Swap: 20859301888 65757184 20793544704 MemTotal: 4124720 kB MemFree: 19464 kB MemShared: 0 kB Buffers: 37092 kB Cached: 3570800 kB SwapCached: 27416 kB Active: 3215984 kB ActiveAnon: 245576 kB ActiveCache: 2970408 kB Inact_dirty: 330796 kB Inact_laundry: 164256 kB Inact_clean: 160968 kB Inact_target: 774400 kB HighTotal: 3276736 kB HighFree: 1024 kB LowTotal: 847984 kB LowFree: 18440 kB SwapTotal: 20370412 kB SwapFree: 20306196 kB [root@data3 root]# cat < /proc/sys/kernel/shmmax 4000000000[root@data3 root]# cat < /proc/sys/kernel/shmall 134217728 max_connections = 165 shared_buffers = 32768 sort_mem = 20480 vacuum_mem = 16384 effective_cache_size = 256900 I still in doubt whether this figture is optimized and putting more ram will help the system throughtput. Any idea please . My organization is one oof the big hospital in Thailand Thanks Amrit Thailand From pgsql-performance-owner@postgresql.org Sun Jan 2 09:20:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 577F93A2BFA for ; Sun, 2 Jan 2005 09:20: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 08418-09 for ; Sun, 2 Jan 2005 09:20:01 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 52A093A2BF6 for ; Sun, 2 Jan 2005 09:20:01 +0000 (GMT) Received: (qmail 15089 invoked from network); 2 Jan 2005 09:19:57 -0000 Received: from 218-101-14-101.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.101) by 0 with SMTP; 2 Jan 2005 09:19:57 -0000 Message-ID: <41D7BDA1.7000109@coretech.co.nz> Date: Sun, 02 Jan 2005 22:23:45 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> In-Reply-To: <1104634472.41d762681b548@webmail.moph.go.th> 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: 200501/2 X-Sequence-Number: 9692 amrit@health2.moph.go.th wrote: >I try to adjust my server for a couple of weeks with some sucess but it still >slow when the server has stress in the moring from many connection . 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 160 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: > > You might just be running low on ram - your sort_mem setting means that 160 connections need about 3.1G. Add to that the 256M for your shared_buffers and there may not be much left for the os to use effectively (this could explain the fact that some swap is being used). Is reducing sort_mem an option ? regards Mark From pgsql-performance-owner@postgresql.org Sun Jan 2 14:08:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 58BBE3A1D66 for ; Sun, 2 Jan 2005 14:08: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 80954-01 for ; Sun, 2 Jan 2005 14:08:28 +0000 (GMT) Received: from mail3.panix.com (mail3.panix.com [166.84.1.74]) by svr1.postgresql.org (Postfix) with ESMTP id 804263A2C40 for ; Sun, 2 Jan 2005 14:08:28 +0000 (GMT) Received: from panix1.panix.com (panix1.panix.com [166.84.1.1]) by mail3.panix.com (Postfix) with ESMTP id B00D0981C4; Sun, 2 Jan 2005 09:08:28 -0500 (EST) Received: (from adler@localhost) by panix1.panix.com (8.11.6p3/8.8.8/PanixN1.1) id j02E8Sx06526; Sun, 2 Jan 2005 09:08:28 -0500 (EST) Date: Sun, 2 Jan 2005 09:08:28 -0500 From: Michael Adler To: amrit@health2.moph.go.th Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. Message-ID: <20050102140828.GA21826@pobox.com> References: <1104634472.41d762681b548@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1104634472.41d762681b548@webmail.moph.go.th> 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: 200501/3 X-Sequence-Number: 9693 On Sun, Jan 02, 2005 at 09:54:32AM +0700, amrit@health2.moph.go.th wrote: > postgresql 7.3.2-1 with RH 9 on a mechine of 2 Xeon 3.0 Ghz and ram of 4 Gb. You may want to try disabling hyperthreading, if you don't mind rebooting. > grew up to 3.5 Gb and there were more than 160 concurent connections. Looks like your growing dataset won't fit in your OS disk cache any longer. Isolate your most problematic queries and check out their query plans. I bet you have some sequential scans that used to read from cache but now need to read the disk. An index may help you. More RAM wouldn't hurt. =) -Mike Adler From pgsql-performance-owner@postgresql.org Sun Jan 2 16:25:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 954123A2C50 for ; Sun, 2 Jan 2005 16:25: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 18321-08 for ; Sun, 2 Jan 2005 16:25:36 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 8671D3A2C7E for ; Sun, 2 Jan 2005 16:25:34 +0000 (GMT) Received: (qmail 4746 invoked from network); 2 Jan 2005 16:28:14 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 2 Jan 2005 16:28:14 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 01857-57 for ; Sun, 2 Jan 2005 23:28:14 +0700 (ICT) Received: (qmail 4736 invoked from network); 2 Jan 2005 16:28:13 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 2 Jan 2005 16:28:13 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Sun, 2 Jan 2005 23:28:13 +0700 Message-ID: <1104683293.41d8211d62221@webmail.moph.go.th> Date: Sun, 2 Jan 2005 23:28:13 +0700 From: amrit@health2.moph.go.th To: pgsql-performance@postgresql.org Cc: Mark Kirkwood , Michael Adler Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> In-Reply-To: <20050102140828.GA21826@pobox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/4 X-Sequence-Number: 9694 > > postgresql 7.3.2-1 with RH 9 on a mechine of 2 Xeon 3.0 Ghz and ram of 4 > Gb. > > You may want to try disabling hyperthreading, if you don't mind > rebooting. Can you give me an idea why should I use the SMP kernel instead of Bigmen kernel [turn off the hyperthreading]? Will it be better to turn off ? > > grew up to 3.5 Gb and there were more than 160 concurent connections. > > Looks like your growing dataset won't fit in your OS disk cache any > longer. Isolate your most problematic queries and check out their > query plans. I bet you have some sequential scans that used to read > from cache but now need to read the disk. An index may help you. > > More RAM wouldn't hurt. =) I think so that there may be some query load on our programe and I try to locate it. But if I reduce the config to : max_connections = 160 shared_buffers = 2048 [Total = 2.5 Gb.] sort_mem = 8192 [Total = 1280 Mb.] vacuum_mem = 16384 effective_cache_size = 128897 [= 1007 Mb. = 1 Gb. ] Will it be more suitable for my server than before? Thanks for all comment. Amrit Thailand From pgsql-performance-owner@postgresql.org Sun Jan 2 16:56:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 860693A2C45 for ; Sun, 2 Jan 2005 16:56: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 28978-03 for ; Sun, 2 Jan 2005 16:56:40 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 433CD3A19BF for ; Sun, 2 Jan 2005 16:56:39 +0000 (GMT) Received: (qmail 12460 invoked from network); 2 Jan 2005 16:56:11 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 2 Jan 2005 16:56:11 -0000 Message-ID: <41D827C1.3050707@fastcrypt.com> Date: Sun, 02 Jan 2005 11:56:33 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> In-Reply-To: <1104683293.41d8211d62221@webmail.moph.go.th> Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit 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: 200501/5 X-Sequence-Number: 9695 The common wisdom of shared buffers is around 6-10% of available memory. Your proposal below is about 50% of memory. I'm not sure what the original numbers actually meant, they are quite large. also effective cache is the sum of kernel buffers + shared_buffers so it should be bigger than shared buffers. Also turning hyperthreading off may help, it is unlikely it is doing any good unless you are running a relatively new (2.6.x) kernel. I presume you are vacuuming on a regular basis? amrit@health2.moph.go.th wrote: >>>postgresql 7.3.2-1 with RH 9 on a mechine of 2 Xeon 3.0 Ghz and ram of 4 >>> >>> >>Gb. >> >>You may want to try disabling hyperthreading, if you don't mind >>rebooting. >> >> > >Can you give me an idea why should I use the SMP kernel instead of Bigmen kernel >[turn off the hyperthreading]? Will it be better to turn off ? > > > >>>grew up to 3.5 Gb and there were more than 160 concurent connections. >>> >>> >>Looks like your growing dataset won't fit in your OS disk cache any >>longer. Isolate your most problematic queries and check out their >>query plans. I bet you have some sequential scans that used to read >>from cache but now need to read the disk. An index may help you. >> >>More RAM wouldn't hurt. =) >> >> > >I think so that there may be some query load on our programe and I try to locate >it. >But if I reduce the config to : >max_connections = 160 >shared_buffers = 2048 [Total = 2.5 Gb.] >sort_mem = 8192 [Total = 1280 Mb.] >vacuum_mem = 16384 >effective_cache_size = 128897 [= 1007 Mb. = 1 Gb. ] >Will it be more suitable for my server than before? > >Thanks for all comment. >Amrit >Thailand > > >---------------------------(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 > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Mon Jan 3 01:51:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 123173A1A2E for ; Mon, 3 Jan 2005 01:51: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 95941-03 for ; Mon, 3 Jan 2005 01:51:24 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 51EB83A2D30 for ; Mon, 3 Jan 2005 01:51:25 +0000 (GMT) Received: (qmail 2902 invoked from network); 3 Jan 2005 01:54:05 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 3 Jan 2005 01:54:05 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 01649-25 for ; Mon, 3 Jan 2005 08:54:04 +0700 (ICT) Received: (qmail 2889 invoked from network); 3 Jan 2005 01:54:04 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 3 Jan 2005 01:54:04 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Mon, 3 Jan 2005 08:54:03 +0700 Message-ID: <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> Date: Mon, 3 Jan 2005 08:54:03 +0700 From: amrit@health2.moph.go.th To: pg@fastcrypt.com Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> In-Reply-To: <41D827C1.3050707@fastcrypt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/6 X-Sequence-Number: 9696 > The common wisdom of shared buffers is around 6-10% of available memory. > Your proposal below is about 50% of memory. > > I'm not sure what the original numbers actually meant, they are quite large. > I will try to reduce shared buffer to 1536 [1.87 Mb]. > also effective cache is the sum of kernel buffers + shared_buffers so it > should be bigger than shared buffers. also make the effective cache to 2097152 [2 Gb]. I will give you the result , because tomorrow [4/12/05] will be the official day of my hospital [which have more than 1700 OPD patient/day]. > Also turning hyperthreading off may help, it is unlikely it is doing any > good unless you are running a relatively new (2.6.x) kernel. Why , could you give me the reason? > I presume you are vacuuming on a regular basis? Yes , vacuumdb daily. From pgsql-performance-owner@postgresql.org Mon Jan 3 02:22:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 71EB03A1A2E for ; Mon, 3 Jan 2005 02:22: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 13080-02 for ; Mon, 3 Jan 2005 02:22:20 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 6EA2E3A2D5F for ; Mon, 3 Jan 2005 02:22:22 +0000 (GMT) Received: (qmail 5653 invoked from network); 3 Jan 2005 02:22:21 -0000 Received: from 218-101-14-25.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.25) by 0 with SMTP; 3 Jan 2005 02:22:21 -0000 Message-ID: <41D8AD42.1010806@coretech.co.nz> Date: Mon, 03 Jan 2005 15:26:10 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: pgsql-performance@postgresql.org, Michael Adler Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> In-Reply-To: <1104683293.41d8211d62221@webmail.moph.go.th> 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: 200501/7 X-Sequence-Number: 9697 amrit@health2.moph.go.th wrote: > >max_connections = 160 >shared_buffers = 2048 [Total = 2.5 Gb.] >sort_mem = 8192 [Total = 1280 Mb.] >vacuum_mem = 16384 >effective_cache_size = 128897 [= 1007 Mb. = 1 Gb. ] >Will it be more suitable for my server than before? > > > > I would keep shared_buffers in the 10000->20000 range, as this is allocated *once* into shared memory, so only uses 80->160 Mb in *total*. The lower sort_mem will help reduce memory pressure (as this is allocated for every backend connection) and this will help performance - *unless* you have lots of queries that need to sort large datasets. If so, then these will hammer your i/o subsystem, possibly canceling any gain from freeing up more memory. So there is a need to understand what sort of workload you have! best wishes Mark From pgsql-performance-owner@postgresql.org Mon Jan 3 04:51:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3474A3A2D4C for ; Mon, 3 Jan 2005 04:51: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 00711-04 for ; Mon, 3 Jan 2005 04:51:33 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 1F8B63A2CC6 for ; Mon, 3 Jan 2005 04:51:31 +0000 (GMT) Received: (qmail 3020 invoked from network); 3 Jan 2005 04:54:12 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 3 Jan 2005 04:54:12 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 02219-17 for ; Mon, 3 Jan 2005 11:54:12 +0700 (ICT) Received: (qmail 3007 invoked from network); 3 Jan 2005 04:54:10 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 3 Jan 2005 04:54:10 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Mon, 3 Jan 2005 11:54:10 +0700 Message-ID: <1104728050.41d8cff2b2b29@webmail.moph.go.th> Date: Mon, 3 Jan 2005 11:54:10 +0700 From: amrit@health2.moph.go.th To: Mark Kirkwood Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D8AD42.1010806@coretech.co.nz> In-Reply-To: <41D8AD42.1010806@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/8 X-Sequence-Number: 9698 > >max_connections = 160 > >shared_buffers = 2048 [Total = 2.5 Gb.] > >sort_mem = 8192 [Total = 1280 Mb.] > >vacuum_mem = 16384 > >effective_cache_size = 128897 [= 1007 Mb. = 1 Gb. ] > >Will it be more suitable for my server than before? > > > > > > > > > I would keep shared_buffers in the 10000->20000 range, as this is > allocated *once* into shared memory, so only uses 80->160 Mb in *total*. You mean that if I increase the share buffer to arround 12000 [160 comnnections ] , this will not affect the mem. usage ? > The lower sort_mem will help reduce memory pressure (as this is > allocated for every backend connection) and this will help performance - > *unless* you have lots of queries that need to sort large datasets. If > so, then these will hammer your i/o subsystem, possibly canceling any > gain from freeing up more memory. So there is a need to understand what > sort of workload you have! Will the increasing in effective cache size to arround 200000 make a little bit improvement ? Do you think so? Any comment please , thanks. Amrit Thailand From pgsql-performance-owner@postgresql.org Mon Jan 3 06:16:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 50F0F3A2C0C for ; Mon, 3 Jan 2005 06:16: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 75990-07 for ; Mon, 3 Jan 2005 06:16:05 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 92CEC3A2D9B for ; Mon, 3 Jan 2005 06:16:04 +0000 (GMT) Received: (qmail 11590 invoked from network); 3 Jan 2005 06:16:02 -0000 Received: from 218-101-14-25.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.25) by 0 with SMTP; 3 Jan 2005 06:16:02 -0000 Message-ID: <41D8E406.1090501@coretech.co.nz> Date: Mon, 03 Jan 2005 19:19:50 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D8AD42.1010806@coretech.co.nz> <1104728050.41d8cff2b2b29@webmail.moph.go.th> In-Reply-To: <1104728050.41d8cff2b2b29@webmail.moph.go.th> 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: 200501/9 X-Sequence-Number: 9699 amrit@health2.moph.go.th wrote: >>>max_connections = 160 >>>shared_buffers = 2048 [Total = 2.5 Gb.] >>>sort_mem = 8192 [Total = 1280 Mb.] >>>vacuum_mem = 16384 >>>effective_cache_size = 128897 [= 1007 Mb. = 1 Gb. ] >>>Will it be more suitable for my server than before? >>> >>> >>> >>> >>> >>> >>I would keep shared_buffers in the 10000->20000 range, as this is >>allocated *once* into shared memory, so only uses 80->160 Mb in *total*. >> >> > >You mean that if I increase the share buffer to arround 12000 [160 comnnections >] , this will not affect the mem. usage ? > > > shared_buffers = 12000 will use 12000*8192 bytes (i.e about 96Mb). It is shared, so no matter how many connections you have it will only use 96M. >>The lower sort_mem will help reduce memory pressure (as this is >>allocated for every backend connection) and this will help performance - >>*unless* you have lots of queries that need to sort large datasets. If >>so, then these will hammer your i/o subsystem, possibly canceling any >>gain from freeing up more memory. So there is a need to understand what >>sort of workload you have! >> >> > >Will the increasing in effective cache size to arround 200000 make a little bit >improvement ? Do you think so? > > > I would leave it at the figure you proposed (128897), and monitor your performance. (you can always increase it later and see what the effect is). regards Mark From pgsql-performance-owner@postgresql.org Mon Jan 3 08:16:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B9DD3A3AE8 for ; Mon, 3 Jan 2005 08:16: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 12889-01 for ; Mon, 3 Jan 2005 08:16:18 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id D13DB3A3AE7 for ; Mon, 3 Jan 2005 08:16:17 +0000 (GMT) Received: (qmail 18687 invoked from network); 3 Jan 2005 08:18:57 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 3 Jan 2005 08:18:57 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 16555-44 for ; Mon, 3 Jan 2005 15:18:56 +0700 (ICT) Received: (qmail 18674 invoked from network); 3 Jan 2005 08:18:56 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 3 Jan 2005 08:18:56 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Mon, 3 Jan 2005 15:18:56 +0700 Message-ID: <1104740336.41d8fff03ff3a@webmail.moph.go.th> Date: Mon, 3 Jan 2005 15:18:56 +0700 From: amrit@health2.moph.go.th To: Mark Kirkwood Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D8AD42.1010806@coretech.co.nz> <1104728050.41d8cff2b2b29@webmail.moph.go.th> <41D8E406.1090501@coretech.co.nz> In-Reply-To: <41D8E406.1090501@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/10 X-Sequence-Number: 9700 > shared_buffers = 12000 will use 12000*8192 bytes (i.e about 96Mb). It is > shared, so no matter how many connections you have it will only use 96M. Now I use the figure of 27853 > > > >Will the increasing in effective cache size to arround 200000 make a little > bit > >improvement ? Do you think so? > > Decrease the sort mem too much [8196] make the performance much slower so I use sort_mem = 16384 and leave effective cache to the same value , the result is quite better but I should wait for tomorrow morning [official hour] to see the end result. > > > I would leave it at the figure you proposed (128897), and monitor your > performance. > (you can always increase it later and see what the effect is). Yes , I use this figure. If the result still poor , putting more ram "6-8Gb" [also putting more money too] will solve the problem ? Thanks , Amrit Thailand From pgsql-performance-owner@postgresql.org Mon Jan 3 08:34:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 488673A3AD0 for ; Mon, 3 Jan 2005 08:34: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 16371-08 for ; Mon, 3 Jan 2005 08:34:13 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 67D273A2DBA for ; Mon, 3 Jan 2005 08:34:11 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 50DB0313D4; Mon, 3 Jan 2005 09:34:11 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Low Performance for big hospital server .. Date: Mon, 03 Jan 2005 00:32:10 -0800 Organization: Hub.Org Networking Services Lines: 38 Message-ID: References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> 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: <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> 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: 200501/11 X-Sequence-Number: 9701 amrit@health2.moph.go.th wrote: > I will try to reduce shared buffer to 1536 [1.87 Mb]. 1536 is probaby too low. I've tested a bunch of different settings on my 8GB Opteron server and 10K seems to be the best setting. >>also effective cache is the sum of kernel buffers + shared_buffers so it >>should be bigger than shared buffers. > > also make the effective cache to 2097152 [2 Gb]. > I will give you the result , because tomorrow [4/12/05] will be the official day > of my hospital [which have more than 1700 OPD patient/day]. To figure out your effective cache size, run top and add free+cached. >>Also turning hyperthreading off may help, it is unlikely it is doing any >>good unless you are running a relatively new (2.6.x) kernel. > > Why , could you give me the reason? Pre 2.6, the kernel does not know the difference between logical and physical CPUs. Hence, in a dual processor system with hyperthreading, it actually sees 4 CPUs. And when assigning processes to CPUs, it may assign to 2 logical CPUs in the same physical CPU. > > >>I presume you are vacuuming on a regular basis? > > Yes , vacuumdb daily. Do you vacuum table by table or the entire DB? I find over time, the system tables can get very bloated and cause a lot of slowdowns just due to schema queries/updates. You might want to try a VACUUM FULL ANALYZE just on the system tables. From pgsql-performance-owner@postgresql.org Mon Jan 3 08:52:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5E1923A3B01 for ; Mon, 3 Jan 2005 08:52: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 21577-08 for ; Mon, 3 Jan 2005 08:51:50 +0000 (GMT) Received: from ms-smtp-02-eri0.ohiordc.rr.com (ms-smtp-02-smtplb.ohiordc.rr.com [65.24.5.136]) by svr1.postgresql.org (Postfix) with ESMTP id 715013A3AE3 for ; Mon, 3 Jan 2005 08:51:50 +0000 (GMT) Received: from enzo.mascari.com (dhcp065-024-156-214.columbus.rr.com [65.24.156.214]) by ms-smtp-02-eri0.ohiordc.rr.com (8.12.10/8.12.7) with ESMTP id j038plJl014043; Mon, 3 Jan 2005 03:51:47 -0500 (EST) Received: from [192.168.2.8] (mercedes.mascari.com [192.168.2.8]) by enzo.mascari.com (8.12.8/8.12.8) with ESMTP id j038phnj009599; Mon, 3 Jan 2005 03:51:43 -0500 Message-ID: <41D9079E.5020104@mascari.com> Date: Mon, 03 Jan 2005 03:51:42 -0500 From: Mike Mascari User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: William Yu Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mascari-MailScanner-Information: Please contact the ISP for more information X-Mascari-MailScanner: Found to be clean X-Mascari-MailScanner-SpamCheck: not spam, SpamAssassin (score=0, required 6, autolearn=not spam) X-MailScanner-From: mascarm@mascari.com X-Virus-Scanned: Symantec AntiVirus Scan Engine 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: 200501/12 X-Sequence-Number: 9702 William Yu wrote: > amrit@health2.moph.go.th wrote: >> Yes , vacuumdb daily. > > Do you vacuum table by table or the entire DB? I find over time, the > system tables can get very bloated and cause a lot of slowdowns just due > to schema queries/updates. You might want to try a VACUUM FULL ANALYZE > just on the system tables. A REINDEX of the system tables in stand-alone mode might also be in order, even for a 7.4.x database: http://www.postgresql.org/docs/7.4/interactive/sql-reindex.html If a dump-reload-analyze cycle yields significant performance improvements then we know it's due to dead-tuple bloat - either heap tuples or index tuples. Mike Mascari From pgsql-performance-owner@postgresql.org Mon Jan 3 09:33:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2D6BE3A3AF4 for ; Mon, 3 Jan 2005 09:33: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 35204-05 for ; Mon, 3 Jan 2005 09:32:46 +0000 (GMT) Received: from loki.globexplorer.com (unknown [208.35.14.101]) by svr1.postgresql.org (Postfix) with ESMTP id 61C543A2DA5 for ; Mon, 3 Jan 2005 09:32:47 +0000 (GMT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Subject: Re: Low Performance for big hospital server .. Date: Mon, 3 Jan 2005 01:32:45 -0800 Message-ID: <71E37EF6B7DCC1499CEA0316A256832801D4BC91@loki.wc.globexplorer.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Low Performance for big hospital server .. Thread-Index: AcTxbKXQzB+Ei/20QdSmsjp1pbmT0QACD4Ce From: "Gregory S. Williamson" To: , "Mark Kirkwood" Cc: "PGsql-performance" 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: 200501/13 X-Sequence-Number: 9703 Amrit -- >-----Original Message----- >From: amrit@health2.moph.go.th [mailto:amrit@health2.moph.go.th] >Sent: Mon 1/3/2005 12:18 AM >To: Mark Kirkwood >Cc: PGsql-performance >Subject: Re: [PERFORM] Low Performance for big hospital server .. >> shared_buffers =3D 12000 will use 12000*8192 bytes (i.e about 96Mb). = It is >> shared, so no matter how many connections you have it will only use = 96M. > >Now I use the figure of 27853 > >> > >> >Will the increasing in effective cache size to arround 200000 make a = >little >> bit >> >improvement ? Do you think so? >> > >Decrease the sort mem too much [8196] make the performance much slower = so I >use >sort_mem =3D 16384 >and leave effective cache to the same value , the result is quite = better but >I >should wait for tomorrow morning [official hour] to see the end = result. > >> > >> I would leave it at the figure you proposed (128897), and monitor = your >> performance. >> (you can always increase it later and see what the effect is). >Yes , I use this figure. > >If the result still poor , putting more ram "6-8Gb" [also putting more = money >too] will solve the problem ? Adding RAM will almost always help, at least for a while. Our small = runitme servers have 2 gigs of RAM; the larger ones have 4 gigs; I do = anticipate the need to add RAM as we add users. If you have evaluated the queries that are running and verified that = they are using indexes properly, etc., and tuned the other parameters = for your system and its disks, adding memory helps because it increases = the chance that data is already in memory, thus saving the time to fetch = it from disk. Studying performance under load with top, vmstat, etc. and = detailed analysis of queries can often trade some human time for the = money that extra hardware would cost. Sometimes easier to do than = getting downtime for a critical server, as well. If you don't have a reliable way of reproducing real loads on a test = system, it is best to change things cautiously, and observe the system = under load; if you change too many things (ideally only 1 at a time but = often that is not possible) you mau actually defeat a good change with a = bad one; at the least,m you may not know which change was the most = important one if you make several at once. Best of luck, Greg Williamson DBA GlobeXplorer LLC >Thanks , >Amrit >Thailand ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Mon Jan 3 10:07:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6D8DE3A2D7A for ; Mon, 3 Jan 2005 10:07: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 43227-08 for ; Mon, 3 Jan 2005 10:07:32 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 0F4C23A1996 for ; Mon, 3 Jan 2005 10:07:33 +0000 (GMT) Received: (qmail 8088 invoked from network); 3 Jan 2005 11:07:42 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 3 Jan 2005 11:07:42 +0100 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D8AD42.1010806@coretech.co.nz> <1104728050.41d8cff2b2b29@webmail.moph.go.th> <41D8E406.1090501@coretech.co.nz> <1104740336.41d8fff03ff3a@webmail.moph.go.th> Message-ID: Date: Mon, 03 Jan 2005 11:08:32 +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: <1104740336.41d8fff03ff3a@webmail.moph.go.th> 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: 200501/14 X-Sequence-Number: 9704 > Decrease the sort mem too much [8196] make the performance much slower > so I use > sort_mem = 16384 > and leave effective cache to the same value , the result is quite better > but I > should wait for tomorrow morning [official hour] to see the end result. You could also profile your queries to see where those big sorts come from, and maybe add some indexes to try to replace sorts by index-scans-in-order, which use no temporary memory. Can you give an example of your queries which make use of big sorts like this ? From pgsql-performance-owner@postgresql.org Mon Jan 3 14:02:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 929FD3A3BC2 for ; Mon, 3 Jan 2005 14: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 13353-01 for ; Mon, 3 Jan 2005 14:01:48 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id C2B3F3A3BB4 for ; Mon, 3 Jan 2005 14:01:50 +0000 (GMT) Received: (qmail 23465 invoked from network); 3 Jan 2005 14:01:22 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 3 Jan 2005 14:01:22 -0000 Message-ID: <41D95042.70705@fastcrypt.com> Date: Mon, 03 Jan 2005 09:01:38 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: William Yu Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> In-Reply-To: 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.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/15 X-Sequence-Number: 9705 William Yu wrote: > amrit@health2.moph.go.th wrote: > >> I will try to reduce shared buffer to 1536 [1.87 Mb]. > > > 1536 is probaby too low. I've tested a bunch of different settings on > my 8GB Opteron server and 10K seems to be the best setting. Be careful here, he is not using opterons which can access physical memory above 4G efficiently. Also he only has 4G the 6-10% rule still applies > > >>> also effective cache is the sum of kernel buffers + shared_buffers >>> so it >>> should be bigger than shared buffers. >> >> >> also make the effective cache to 2097152 [2 Gb]. >> I will give you the result , because tomorrow [4/12/05] will be the >> official day >> of my hospital [which have more than 1700 OPD patient/day]. > > > To figure out your effective cache size, run top and add free+cached. My understanding is that effective cache is the sum of shared buffers, plus kernel buffers, not sure what free + cached gives you? > > >>> Also turning hyperthreading off may help, it is unlikely it is doing >>> any >>> good unless you are running a relatively new (2.6.x) kernel. >> >> >> Why , could you give me the reason? > > > Pre 2.6, the kernel does not know the difference between logical and > physical CPUs. Hence, in a dual processor system with hyperthreading, > it actually sees 4 CPUs. And when assigning processes to CPUs, it may > assign to 2 logical CPUs in the same physical CPU. Right, the pre 2.6 kernels don't really know how to handle hyperthreaded CPU's > > >> >> >>> I presume you are vacuuming on a regular basis? >> >> >> Yes , vacuumdb daily. > > > Do you vacuum table by table or the entire DB? I find over time, the > system tables can get very bloated and cause a lot of slowdowns just > due to schema queries/updates. You might want to try a VACUUM FULL > ANALYZE just on the system tables. You may want to try this but regular vacuum analyze should work fine as long as you have the free space map settings correct. Also be aware that pre-7.4.x the free space map is not populated on startup so you should do a vacuum analyze right after startup. > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Mon Jan 3 14:10:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18DBA3A3BA1 for ; Mon, 3 Jan 2005 14:10: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 14914-05 for ; Mon, 3 Jan 2005 14:10:39 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 69C0E3A3B82 for ; Mon, 3 Jan 2005 14:10:42 +0000 (GMT) Received: (qmail 23547 invoked from network); 3 Jan 2005 14:10:15 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 3 Jan 2005 14:10:15 -0000 Message-ID: <41D9525D.3000409@fastcrypt.com> Date: Mon, 03 Jan 2005 09:10:37 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> In-Reply-To: <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> Content-Type: multipart/alternative; boundary="------------000801040400030508060009" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.056 tagged_above=0 required=5 tests=AWL, HTML_30_40, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/16 X-Sequence-Number: 9706 This is a multi-part message in MIME format. --------------000801040400030508060009 Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit Amrit, I realize you may be stuck with 7.3.x but you should be aware that 7.4 is considerably faster, and 8.0 appears to be even faster yet. I would seriously consider upgrading, if at all possible. A few more hints. Random page cost is quite conservative if you have reasonably fast disks. Speaking of fast disks, not all disks are created equal, some RAID drives are quite slow (Bonnie++ is your friend here) Sort memory can be set on a per query basis, I'd consider lowering it quite low and only increasing it when necessary. Which brings us to how to find out when it is necessary. Turn logging on and turn on log_pid, and log_duration, then you will need to sort through the logs to find the slow queries. There are some special cases where postgresql can be quite slow, and minor adjustments to the query can improve it significantly For instance pre-8.0 select * from foo where id = '1'; where id is a int8 will never use an index even if it exists. Regards, Dave amrit@health2.moph.go.th wrote: >>The common wisdom of shared buffers is around 6-10% of available memory. >>Your proposal below is about 50% of memory. >> >>I'm not sure what the original numbers actually meant, they are quite large. >> >> >> >I will try to reduce shared buffer to 1536 [1.87 Mb]. > > > >>also effective cache is the sum of kernel buffers + shared_buffers so it >>should be bigger than shared buffers. >> >> >also make the effective cache to 2097152 [2 Gb]. >I will give you the result , because tomorrow [4/12/05] will be the official day >of my hospital [which have more than 1700 OPD patient/day]. > > > > >>Also turning hyperthreading off may help, it is unlikely it is doing any >>good unless you are running a relatively new (2.6.x) kernel. >> >> >Why , could you give me the reason? > > > >>I presume you are vacuuming on a regular basis? >> >> >Yes , vacuumdb daily. > > > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 --------------000801040400030508060009 Content-Type: text/html; charset=TIS-620 Content-Transfer-Encoding: 7bit Amrit,

I realize you may be stuck with 7.3.x but you should be aware that 7.4 is considerably faster, and 8.0 appears to be even faster yet.

I would seriously consider upgrading, if at all possible.

A few more hints.

Random page cost is quite conservative if you have reasonably fast disks.
Speaking of fast disks, not all disks are created equal, some RAID drives are quite slow (Bonnie++ is your friend here)

Sort memory can be set on a per query basis, I'd consider lowering it quite low and only increasing it when necessary.

Which brings us to how to find out when it is necessary.
Turn logging on and turn on log_pid, and log_duration, then you will need to sort through the logs to find the slow queries.

There are some special cases where postgresql can be quite slow, and minor adjustments to the query can improve it significantly

For instance pre-8.0 select * from foo where id = '1'; where id is a int8 will never use an index even if it exists.


Regards,

Dave


amrit@health2.moph.go.th wrote:
The common wisdom of shared buffers is around 6-10% of available memory.
Your proposal below is about 50% of memory.

I'm not sure what the original numbers actually meant, they are quite large.

    
I will try to reduce shared buffer to 1536 [1.87 Mb].

  
also effective cache is the sum of kernel buffers + shared_buffers so it
should be bigger than shared buffers.
    
also make the effective cache to 2097152 [2 Gb].
I will give you the result , because tomorrow [4/12/05] will be the official day
of my hospital [which have more than 1700 OPD patient/day].


  
Also turning hyperthreading off may help, it is unlikely it is doing any
good unless you are running a relatively new (2.6.x) kernel.
    
Why , could you give me the reason?

  
I presume you are vacuuming on a regular basis?
    
Yes , vacuumdb daily.




  

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
--------------000801040400030508060009-- From pgsql-performance-owner@postgresql.org Mon Jan 3 14:55:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B15493A1996 for ; Mon, 3 Jan 2005 14:55: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 29621-02 for ; Mon, 3 Jan 2005 14:54:58 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 20D243A3BD5 for ; Mon, 3 Jan 2005 14:55:01 +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: Re: Low Performance for big hospital server .. Date: Mon, 3 Jan 2005 09:55:06 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A758B@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Low Performance for big hospital server .. Thread-Index: AcTwdqPjTiOOIOJ7STGXHdWNwU5syABK9k5A From: "Merlin Moncure" To: Cc: 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: 200501/17 X-Sequence-Number: 9707 amrit wrote: > I try to adjust my server for a couple of weeks with some sucess but it > still > slow when the server has stress in the moring from many connection . 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 160 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: well, you've hit the 'wall'...your system seems to be more or less at the limit of what 32 bit technology can deliver. If upgrade to Opteron and 64 bit is out of the question, here are a couple of new tactics you can try. Optimizing postgresql.conf can help, but only so much. =20 Optimize queries: One big often looked performance gainer is to use functional indexes to access data from a table. This can save space by making the index smaller and more efficient. This wins on cache and speed at the price of some flexibility. =20 Optimize datums: replace numeric(4) with int2, numeric(6) with int4, etc. This will save a little space on the tuple which will ease up on the cache a bit. Use constraints where necessary to preserve data integrity. Materialized views: These can provide an enormous win if you can deal incorporate them into your application. With normal views, multiple backends can share a query plan. With mat-views, backends can share both the plan and its execution. Merlin From pgsql-performance-owner@postgresql.org Mon Jan 3 15:39:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 378883A3C58 for ; Mon, 3 Jan 2005 15: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 92616-08 for ; Mon, 3 Jan 2005 15:38:34 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id A9F333A3C06 for ; Mon, 3 Jan 2005 15:38:25 +0000 (GMT) Received: (qmail 5856 invoked from network); 3 Jan 2005 15:40:22 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 3 Jan 2005 15:40:22 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 05427-35 for ; Mon, 3 Jan 2005 22:40:20 +0700 (ICT) Received: (qmail 5673 invoked from network); 3 Jan 2005 15:40:06 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 3 Jan 2005 15:40:06 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Mon, 3 Jan 2005 22:40:05 +0700 Message-ID: <1104766805.41d96755a40d9@webmail.moph.go.th> Date: Mon, 3 Jan 2005 22:40:05 +0700 From: amrit@health2.moph.go.th To: pg@fastcrypt.com Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> <41D9525D.3000409@fastcrypt.com> In-Reply-To: <41D9525D.3000409@fastcrypt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/18 X-Sequence-Number: 9708 > I realize you may be stuck with 7.3.x but you should be aware that 7.4 > is considerably faster, and 8.0 appears to be even faster yet. There are a little bit incompatibility between 7.3 -8 , so rather difficult to change. > I would seriously consider upgrading, if at all possible. > > A few more hints. > > Random page cost is quite conservative if you have reasonably fast disks. > Speaking of fast disks, not all disks are created equal, some RAID > drives are quite slow (Bonnie++ is your friend here) > > Sort memory can be set on a per query basis, I'd consider lowering it > quite low and only increasing it when necessary. > > Which brings us to how to find out when it is necessary. > Turn logging on and turn on log_pid, and log_duration, then you will > need to sort through the logs to find the slow queries. In standard RH 9.0 , if I enable both of the log [pid , duration] , where could I look for the result of the log, and would it make the system to be slower? Amrit Thailand From pgsql-performance-owner@postgresql.org Mon Jan 3 16:55:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0FBEA3A3C44 for ; Mon, 3 Jan 2005 16:55: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 30722-05 for ; Mon, 3 Jan 2005 16:55:36 +0000 (GMT) Received: from zoom.spline.inf.fu-berlin.de (zoom.spline.inf.fu-berlin.de [160.45.117.148]) by svr1.postgresql.org (Postfix) with ESMTP id 3C0EE3A2D7A for ; Mon, 3 Jan 2005 16:55:35 +0000 (GMT) Received: by zoom.spline.inf.fu-berlin.de (Postfix, from userid 2091) id 398618D609; Mon, 3 Jan 2005 17:55:32 +0100 (CET) Date: Mon, 3 Jan 2005 17:55:32 +0100 From: Yann Michel To: pgsql-performance@postgresql.org Subject: query rewrite using materialized views Message-ID: <20050103165532.GA21212@zoom.spline.inf.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: 200501/19 X-Sequence-Number: 9709 Hi, are there any plans for rewriting queries to preexisting materialized views? I mean, rewrite a query (within the optimizer) to use a materialized view instead of the originating table? Regards, Yann From pgsql-performance-owner@postgresql.org Mon Jan 3 19:01:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F42023A3CEA for ; Mon, 3 Jan 2005 19:01: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 08147-09 for ; Mon, 3 Jan 2005 19:00:49 +0000 (GMT) Received: from lakermmtao08.cox.net (lakermmtao08.cox.net [68.230.240.31]) by svr1.postgresql.org (Postfix) with ESMTP id 5CD613A3D05 for ; Mon, 3 Jan 2005 18:56:25 +0000 (GMT) Received: from [192.168.0.8] (really [68.101.70.207]) by lakermmtao08.cox.net (InterMail vM.6.01.04.00 201-2131-117-20041022) with ESMTP id <20050103185625.SRUF16610.lakermmtao08.cox.net@[192.168.0.8]>; Mon, 3 Jan 2005 13:56:25 -0500 From: Robert Treat To: amrit@health2.moph.go.th Subject: Re: Low Performance for big hospital server .. Date: Mon, 3 Jan 2005 13:51:55 -0500 User-Agent: KMail/1.6.2 Cc: pg@fastcrypt.com, PGsql-performance References: <1104634472.41d762681b548@webmail.moph.go.th> <41D9525D.3000409@fastcrypt.com> <1104766805.41d96755a40d9@webmail.moph.go.th> In-Reply-To: <1104766805.41d96755a40d9@webmail.moph.go.th> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="tis-620" Content-Transfer-Encoding: 7bit Message-Id: <200501031351.55065.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: 200501/20 X-Sequence-Number: 9710 On Monday 03 January 2005 10:40, amrit@health2.moph.go.th wrote: > > I realize you may be stuck with 7.3.x but you should be aware that 7.4 > > is considerably faster, and 8.0 appears to be even faster yet. > > There are a little bit incompatibility between 7.3 -8 , so rather difficult > to change. > Sure, but even moving to 7.4 would be a bonus, especially if you use a lot of select * from tab where id in (select ... ) type queries, and the incompataibility is less as well. > > I would seriously consider upgrading, if at all possible. > > > > A few more hints. > > One thing I didn't see mentioned that should have been was to watch for index bloat, which was a real problem on 7.3 machines. You can determine which indexes are bloated by studying vacuum output or by comparing index size on disk to table size on disk. Another thing I didn't see mentioned was to your free space map settings. Make sure these are large enough to hold your data... max_fsm_relations should be larger then the total # of tables you have in your system (check the archives for the exact query needed) and max_fsm_pages needs to be big enough to hold all of the pages you use in a day... this is hard to calculate in 7.3, but if you look at your vacuum output and add the number of pages cleaned up for all tables, this could give you a good number to work with. It would certainly tell you if your setting is too small. -- Robert Treat Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL From pgsql-performance-owner@postgresql.org Mon Jan 3 19:21:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3765B3A3BEF for ; Mon, 3 Jan 2005 19:21: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 32854-03 for ; Mon, 3 Jan 2005 19:20:44 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 28CC83A3C2C for ; Mon, 3 Jan 2005 19:20:42 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so241319wri for ; Mon, 03 Jan 2005 11:20:42 -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=p9oh907M9gwxj5+vBC6CsRyBppoq5iEVAUjrkGGTMHy7QcSrgRXRDvN1Srodx+mNBWA1xPYTyBrfdcgtw5EG8fOGD51gSHzwKl3qL4QVaMhOMgODYjbYYujWMgKoWKOXrBsV3zo9EZ4ifgMSY2QVTzr/ZRh+VLoCX/2WpEs8/58= Received: by 10.54.59.24 with SMTP id h24mr237581wra; Mon, 03 Jan 2005 11:20:41 -0800 (PST) Received: by 10.54.59.22 with HTTP; Mon, 3 Jan 2005 11:20:41 -0800 (PST) Message-ID: <330532b6050103112034cf47c8@mail.gmail.com> Date: Mon, 3 Jan 2005 14:20:41 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: pgsql-performance@postgresql.org Subject: Re: Hardware purchase question In-Reply-To: <41BDD001.8070701@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> <41BDD001.8070701@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: 200501/21 X-Sequence-Number: 9711 On Mon, 13 Dec 2004 09:23:13 -0800, Joshua D. Drake wrote: > > RAID 10 will typically always outperform RAID 5 with the same HD config. Isn't RAID10 just RAID5 mirrored? How does that speed up performance? Or am I missing something? -- Mitch From pgsql-performance-owner@postgresql.org Mon Jan 3 19:38:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 285063A3C45 for ; Mon, 3 Jan 2005 19:38: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 36037-09 for ; Mon, 3 Jan 2005 19:38:27 +0000 (GMT) Received: from srv1.alteeve.com (unknown [209.167.86.38]) by svr1.postgresql.org (Postfix) with ESMTP id BD12F3A3C2C for ; Mon, 3 Jan 2005 19:38:25 +0000 (GMT) Received: from [192.168.1.99] (nabiki.thelinuxexperience.com [209.167.86.34]) by srv1.alteeve.com (8.12.10/8.12.10) with ESMTP id j03IxVBX015063 for ; Mon, 3 Jan 2005 13:59:31 -0500 Message-ID: <41D99E7E.3080704@alteeve.com> Date: Mon, 03 Jan 2005 14:35:26 -0500 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 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> <330532b6050103112034cf47c8@mail.gmail.com> In-Reply-To: <330532b6050103112034cf47c8@mail.gmail.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/22 X-Sequence-Number: 9712 Mitch Pirtle wrote: > On Mon, 13 Dec 2004 09:23:13 -0800, Joshua D. Drake > wrote: > >>RAID 10 will typically always outperform RAID 5 with the same HD config. > > > Isn't RAID10 just RAID5 mirrored? How does that speed up performance? > Or am I missing something? > > -- Mitch Hi Mitch, Nope, Raid 10 (one zero) is a mirror is stripes, no parity. with r10 you get the benefit of a full mirror which means your system does not need to calculate the XOR parity but you only get 50% disk usage. The mirror causes a slight write hit as the data needs to be split between two disk (or in this case, to striped pairs) but reads can be up to twice as fast (theoretically). By adding the stripe you negate the write hit and actually gain write performance because half the data goes to mirror A, half to mirror B (same with reads, roughly). Raid 10 is a popular choice for software raid because of the reduced overhead. Raid 5 on the otherhand does require that a parity bit is calculated for every N-1 disks. With r5 you get N-1 disk usage (you get the combined capacity of 3 disks in a 4 disk r5 array) and still get the benefit of striping across the disks so long as you have a dedicated raid asic that can do the XOR calculations. Without it, specially in a failure state, the performance can collapse as the CPU performs all that extra math. hth Madison From pgsql-performance-owner@postgresql.org Mon Jan 3 20:00:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B78603A3C02 for ; Mon, 3 Jan 2005 20: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 64198-07 for ; Mon, 3 Jan 2005 19:59:48 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 393793A3B91 for ; Mon, 3 Jan 2005 19:59:48 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 5C892313E8; Mon, 3 Jan 2005 20:59:48 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Low Performance for big hospital server .. Date: Mon, 03 Jan 2005 11:57:50 -0800 Organization: Hub.Org Networking Services Lines: 32 Message-ID: References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> <41D95042.70705@fastcrypt.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: <41D95042.70705@fastcrypt.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: 200501/23 X-Sequence-Number: 9713 Dave Cramer wrote: > > > William Yu wrote: > >> amrit@health2.moph.go.th wrote: >> >>> I will try to reduce shared buffer to 1536 [1.87 Mb]. >> >> >> >> 1536 is probaby too low. I've tested a bunch of different settings on >> my 8GB Opteron server and 10K seems to be the best setting. > > > Be careful here, he is not using opterons which can access physical > memory above 4G efficiently. Also he only has 4G the 6-10% rule still > applies 10% of 4GB is 400MB. 10K buffers is 80MB. Easily less than the 6-10% rule. >> To figure out your effective cache size, run top and add free+cached. > > > My understanding is that effective cache is the sum of shared buffers, > plus kernel buffers, not sure what free + cached gives you? Not true. Effective cache size is the free memory available that the OS can use for caching for Postgres. In a system that runs nothing but Postgres, it's free + cached. From pgsql-performance-owner@postgresql.org Mon Jan 3 20:22:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EDFAA3A3CBC for ; Mon, 3 Jan 2005 20:22: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 99455-01 for ; Mon, 3 Jan 2005 20:22:07 +0000 (GMT) Received: from srv1.alteeve.com (unknown [209.167.86.38]) by svr1.postgresql.org (Postfix) with ESMTP id 8E4A53A3C5A for ; Mon, 3 Jan 2005 20:22:03 +0000 (GMT) Received: from [192.168.1.99] (nabiki.thelinuxexperience.com [209.167.86.34]) by srv1.alteeve.com (8.12.10/8.12.10) with ESMTP id j03JhABX015249 for ; Mon, 3 Jan 2005 14:43:10 -0500 Message-ID: <41D9A8B8.2030708@alteeve.com> Date: Mon, 03 Jan 2005 15:19:04 -0500 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 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> <330532b6050103112034cf47c8@mail.gmail.com> <41D99E7E.3080704@alteeve.com> In-Reply-To: <41D99E7E.3080704@alteeve.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/24 X-Sequence-Number: 9714 Madison Kelly wrote: > Nope, Raid 10 (one zero) is a mirror is stripes, no parity. with r10 Woops, that should be "mirror of stripes". By the way, what you are thinking of is possible, it would be 51 (five one; a raid 5 built on mirrors) or 15 (a mirror of raid 5 arrays). Always be careful, 10 and 01 are also not the same. You want to think carefully about what you want out of your array before building it. Madison From pgsql-performance-owner@postgresql.org Mon Jan 3 20:36:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7DA453A3CE1 for ; Mon, 3 Jan 2005 20:36: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 07835-04 for ; Mon, 3 Jan 2005 20:36:15 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 237AF3A3B5B for ; Mon, 3 Jan 2005 20:36:16 +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 1ClYvw-00089T-00; Mon, 03 Jan 2005 15:36:08 -0500 To: Madison Kelly Cc: pgsql-performance@postgresql.org Subject: Re: Hardware purchase question References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> <41BDD001.8070701@commandprompt.com> <330532b6050103112034cf47c8@mail.gmail.com> <41D99E7E.3080704@alteeve.com> In-Reply-To: <41D99E7E.3080704@alteeve.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 03 Jan 2005 15:36:07 -0500 Message-ID: <87wtuu6yiw.fsf@stark.xeocode.com> Lines: 19 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: 200501/25 X-Sequence-Number: 9715 Madison Kelly writes: > Without it, specially in a failure state, the performance can collapse as > the CPU performs all that extra math. It's really not the math that makes raid 5 hurt. It's that in order to calculate the checksum block the raid controller needs to read in the existing checksum block and write out the new version. So every write causes not just one drive seeking and writing, but a second drive seeking and performing a read and a write. The usual strategy for dealing with that is stuffing a huge nonvolatile cache in the controller so those reads are mostly cached and the extra writes don't saturate the i/o throughput. But those kinds of controllers are expensive and not an option for software raid. -- greg From pgsql-performance-owner@postgresql.org Mon Jan 3 20:45:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E6EDA3A3D95 for ; Mon, 3 Jan 2005 20: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 10485-06 for ; Mon, 3 Jan 2005 20:44:43 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id E5D3D3A3D8A for ; Mon, 3 Jan 2005 20:44:44 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so246199wri for ; Mon, 03 Jan 2005 12:44:44 -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=m0+JWk8V8rTPCQBww+fVeW/YTFyrvrzSs6D8n/EgHBKiSwq69KYspDJnA79/Ij37fhxps6T+dCO9RIFCpGN7kIsGmPyoFo3QSTg/64hG3rVaGQDvJZc66EGNXulPAfx9u7IIDwH/3DUSb1cjdj06fZntEuOLcnRH2LM6Q6sPETo= Received: by 10.54.59.24 with SMTP id h24mr260583wra; Mon, 03 Jan 2005 12:44:44 -0800 (PST) Received: by 10.54.59.22 with HTTP; Mon, 3 Jan 2005 12:44:44 -0800 (PST) Message-ID: <330532b60501031244130fe819@mail.gmail.com> Date: Mon, 3 Jan 2005 15:44:44 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: Madison Kelly Subject: Re: Hardware purchase question Cc: pgsql-performance@postgresql.org In-Reply-To: <41D9A8B8.2030708@alteeve.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> <41BDD001.8070701@commandprompt.com> <330532b6050103112034cf47c8@mail.gmail.com> <41D99E7E.3080704@alteeve.com> <41D9A8B8.2030708@alteeve.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/26 X-Sequence-Number: 9716 You are right, I now remember that setup was originally called "RAID 10 plus 1", and I believe is was an incorrect statement from an overzealous salesman ;-) Thanks for the clarification! - Mitch On Mon, 03 Jan 2005 15:19:04 -0500, Madison Kelly wrote: > Madison Kelly wrote: > > Nope, Raid 10 (one zero) is a mirror is stripes, no parity. with r10 > > Woops, that should be "mirror of stripes". > > By the way, what you are thinking of is possible, it would be 51 (five > one; a raid 5 built on mirrors) or 15 (a mirror of raid 5 arrays). > Always be careful, 10 and 01 are also not the same. You want to think > carefully about what you want out of your array before building it. From pgsql-performance-owner@postgresql.org Mon Jan 3 21:13:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAB6A3A3DF2 for ; Mon, 3 Jan 2005 21: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 47928-08 for ; Mon, 3 Jan 2005 21:13:10 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id B54E93A19D0 for ; Mon, 3 Jan 2005 21:13:08 +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: Re: sudden drop in statement turnaround latency -- yay!. Date: Mon, 3 Jan 2005 16:11:44 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A758D@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] sudden drop in statement turnaround latency -- yay!. Thread-Index: AcTu+ekfmN8JlGE9Tx6EsSl8Y0uENAC21TfA From: "Merlin Moncure" To: "Tom Lane" Cc: "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: 200501/27 X-Sequence-Number: 9717 Tom Lane wrote: > "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. >=20 > > I was shocked to see that statement latency dropped by a fairly large > > margin. >=20 > 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? No, everything is run over persistent connections and prepared statements. All queries boil down to an index scan of some sort, so the planner is not really a factor. It's all strictly execution times, and data is almost always read right off of the cache. The performance of the ISAM driver is driven by 3 factors (in order). 1. network latency (including o/s overhead context switches, etc.) 2. i/o factors (data read from cache, disk, etc). 3. overhead for pg to execute trivial transaction. #1 & #2 are well understood problems. It's #3 that improved substantially and without warning. See my comments below: > regards, tom lane >=20 >=20 > 2004-12-15 14:16 tgl >=20 > * 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. Not likely to have a performance benefit. =20 > 2004-12-02 10:32 momjian >=20 > * 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. Doubtful. =20 > 2004-12-01 20:34 tgl >=20 > * 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. No. The planner is not a factor. =20 > 2004-12-01 14:00 tgl >=20 > * 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.) doesn't seem like this would apply. =20 > 2004-11-21 17:57 tgl >=20 > * 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 =3D=3D 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 > >=3D so that it will split more aggressively when the table starts to > get full. Hmm. Not likely. =20 > 2004-11-21 17:48 tgl >=20 > * 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. Strong possibility...'few cycles' seems pretty small tho :). =20 > 2004-11-20 15:19 tgl >=20 > * 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. Not clear from the comments: does this apply to every transaction, or only ones with savepoints? If all transactions, it's a contender. =20 > 2004-11-20 15:16 tgl >=20 > * 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. Same comments as above. =20 > 2004-11-19 19:48 tgl >=20 > * 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. Not likely. =20 > 2004-11-16 22:13 neilc >=20 > * 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. Another contender...maybe the cost of acquiring the lock is higher on some platforms than others. =20 > 2004-11-16 19:14 tgl >=20 > * 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 As I understand it, this only affects backend startup time, so, no. I'll benchmark some more until I get a better answer. Merlin From pgsql-performance-owner@postgresql.org Mon Jan 3 21:45:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B3D7C3A3EFE for ; Mon, 3 Jan 2005 21:45: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 60666-01 for ; Mon, 3 Jan 2005 21:45:08 +0000 (GMT) Received: from ensim.creoe.com (unknown [207.44.172.93]) by svr1.postgresql.org (Postfix) with ESMTP id B7CB23A3E87 for ; Mon, 3 Jan 2005 21:45:06 +0000 (GMT) Received: from AERS04 (linksys-router.idc.uvic.ca [142.104.12.41]) (authenticated (0 bits)) by ensim.creoe.com (8.11.6/8.11.6) with ESMTP id j03MFB508287 for ; Mon, 3 Jan 2005 14:15:11 -0800 Message-ID: <001d01c4f1dd$7eb98390$97019696@AERS04> From: "Adam Palmblad" To: "Postgres Performance" Subject: Bad Index Choices with user defined data type Date: Mon, 3 Jan 2005 13:44:27 -0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001A_01C4F19A.58072F60" 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.137 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/28 X-Sequence-Number: 9718 This is a multi-part message in MIME format. ------=_NextPart_000_001A_01C4F19A.58072F60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I've got a table using a data type that I have created as the type for = its primary key. I (hope) I have the type set up properly - it seems = okay, and does not have any problem creating a b-tree index for the = type. The problem I am having is that the index seems to never be = chosen for use. I can force the use of the index by setting = enable_seqscan to off. The table has about 1.2 million rows. I have = also analyzed the table - and immediately afterwards there is no affect = on the index's behaviour. Any thoughts? -Adam ------=_NextPart_000_001A_01C4F19A.58072F60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I've got a table using a data type that = I have=20 created as the type for its primary key.  I (hope) I have the type = set up=20 properly - it seems okay, and does not have any problem creating a = b-tree index=20 for the type.  The problem I am having is that the index seems to = never be=20 chosen for use.  I can force the use of the index by setting = enable_seqscan=20 to off.  The table has about 1.2 million rows.  I have also = analyzed=20 the table - and immediately afterwards there is no affect on the index's = behaviour.
 
Any thoughts?
 
-Adam
------=_NextPart_000_001A_01C4F19A.58072F60-- From pgsql-performance-owner@postgresql.org Mon Jan 3 22:19:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 543F53A3F82 for ; Mon, 3 Jan 2005 22:19: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 66922-07 for ; Mon, 3 Jan 2005 22:19:17 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 2D88C3A3FCF for ; Mon, 3 Jan 2005 22:19:18 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 116DE56246 for ; Mon, 3 Jan 2005 17:19:11 -0500 (EST) Message-ID: <41D9C4E3.3050001@deg.cc> Date: Mon, 03 Jan 2005 17:19:15 -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: Postgres Performance Subject: Very Bad 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: 200501/29 X-Sequence-Number: 9719 Hi , I am experiencing a very bad performance on my production database lately , all my queries are slowing down. Our application is a webbased system with lot of selects and updates. I am running "vacuumdb" daily on all the databases, are the below postgres configuration parameters are set properly ? can anyone take a look. Let me know if you need anymore information. Postgres Version: 7.4 Operating System: Linux Red Hat 9 Cpus: 2 Hyperthreaded RAM: 4 gb Postgres Settings: max_fsm_pages | 20000 max_fsm_relations | 1000 shared_buffers | 65536 sort_mem | 16384 vacuum_mem | 32768 wal_buffers | 64 effective_cache_size | 393216 Thanks! Pallav From pgsql-performance-owner@postgresql.org Mon Jan 3 23:44:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5CE4A3A19AE for ; Mon, 3 Jan 2005 23:44: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 93829-06 for ; Mon, 3 Jan 2005 23:44:06 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 3F77C3A2346 for ; Mon, 3 Jan 2005 23:44:07 +0000 (GMT) Received: (qmail 28966 invoked from network); 3 Jan 2005 23:43:39 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 3 Jan 2005 23:43:39 -0000 Message-ID: <41D9D8C1.4090906@fastcrypt.com> Date: Mon, 03 Jan 2005 18:44:01 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pallav Kalva Cc: Postgres Performance Subject: Re: Very Bad Performance. References: <41D9C4E3.3050001@deg.cc> In-Reply-To: <41D9C4E3.3050001@deg.cc> 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.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/30 X-Sequence-Number: 9720 Well, it's not quite that simple the rule of thumb is 6-10% of available memory before postgres loads is allocated to shared_buffers. then effective cache is set to the SUM of shared_buffers + kernel buffers Then you have to look at individual slow queries to determine why they are slow, fortunately you are running 7.4 so you can set log_min_duration to some number like 1000ms and then try to analyze why those queries are slow. Also hyperthreading may not be helping you.. Dave Pallav Kalva wrote: > Hi , > > I am experiencing a very bad performance on my production database > lately , all my queries are slowing down. Our application is a > webbased system with lot of selects and updates. I am running > "vacuumdb" daily on all the databases, are the below postgres > configuration parameters are set properly ? can anyone take a look. > Let me know if you need anymore information. > > > Postgres Version: 7.4 > Operating System: Linux Red Hat 9 > Cpus: 2 Hyperthreaded > RAM: 4 gb > Postgres Settings: > max_fsm_pages | 20000 > max_fsm_relations | 1000 > shared_buffers | 65536 > sort_mem | 16384 > vacuum_mem | 32768 > wal_buffers | 64 > effective_cache_size | 393216 > > Thanks! > Pallav > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Tue Jan 4 00:13:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EB8053A2193 for ; Tue, 4 Jan 2005 00:13: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 01346-07 for ; Tue, 4 Jan 2005 00:13:44 +0000 (GMT) Received: from web53701.mail.yahoo.com (web53701.mail.yahoo.com [206.190.37.22]) by svr1.postgresql.org (Postfix) with SMTP id E70AF3A3C0E for ; Tue, 4 Jan 2005 00:13:46 +0000 (GMT) Received: (qmail 81977 invoked by uid 60001); 4 Jan 2005 00:13:45 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=0AtVkNuqD9o7/vG+4axbg5kknqeQnL9SZZ8y9tn/V12vbf5UBaH3xzqvhtyPEUWOCJEmZxzAtVPBiztephMOL3hH82KIThvciOJ/WtWyLUShvY73rTF7Jdkm222TUwjhgpOGdy2OicirVa17eGZibcz0lanbOjsgZqP3JpgXw3Q= ; Message-ID: <20050104001345.81975.qmail@web53701.mail.yahoo.com> Received: from [140.252.3.127] by web53701.mail.yahoo.com via HTTP; Mon, 03 Jan 2005 16:13:45 PST Date: Mon, 3 Jan 2005 16:13:45 -0800 (PST) From: Stan Y Subject: PostgreSQL's Statspack? 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.918 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS X-Spam-Level: X-Archive-Number: 200501/31 X-Sequence-Number: 9721 Besides the tables pg_stat_xxx, are there any stronger tools for PostgreSQL as the counterpart of Oracle's Statspack? Is it possible at all to trace and log the cpu and io cost for each committed transaction? Thanks a lot! -Stan __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From pgsql-performance-owner@postgresql.org Tue Jan 4 00:49:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 694543A3CBE for ; Tue, 4 Jan 2005 00:49: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 10555-05 for ; Tue, 4 Jan 2005 00:48:56 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3051A3A3C6C for ; Tue, 4 Jan 2005 00:48:55 +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 j040mtWj011788; Mon, 3 Jan 2005 19:48:55 -0500 (EST) To: "Merlin Moncure" Cc: "pgsqlperform" Subject: Re: sudden drop in statement turnaround latency -- yay!. In-reply-to: <6EE64EF3AB31D5448D0007DD34EEB3412A758D@Herge.rcsinc.local> References: <6EE64EF3AB31D5448D0007DD34EEB3412A758D@Herge.rcsinc.local> Comments: In-reply-to "Merlin Moncure" message dated "Mon, 03 Jan 2005 16:11:44 -0500" Date: Mon, 03 Jan 2005 19:48:54 -0500 Message-ID: <11787.1104799734@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: 200501/32 X-Sequence-Number: 9722 "Merlin Moncure" writes: > Tom Lane wrote: >> 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. > No. The planner is not a factor. You are missing the point: the possible change in a generated plan could be a factor. >> 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. > doesn't seem like this would apply. Same point. Unless you have done EXPLAINs to verify that the same plans were used before and after, you can't dismiss this. >> * 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. > Not clear from the comments: does this apply to every transaction, or > only ones with savepoints? If all transactions, it's a contender. It only applies to subtransactions, ie something involving savepoints. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 4 00:57:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9FD653A2D8D for ; Tue, 4 Jan 2005 00:57: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 13081-02 for ; Tue, 4 Jan 2005 00:57:29 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id A82D93A1A18 for ; Tue, 4 Jan 2005 00:57:31 +0000 (GMT) Received: (qmail 29603 invoked from network); 4 Jan 2005 00:57:04 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 4 Jan 2005 00:57:04 -0000 Message-ID: <41D9E9F0.2060905@fastcrypt.com> Date: Mon, 03 Jan 2005 19:57:20 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> <41D9525D.3000409@fastcrypt.com> <1104766805.41d96755a40d9@webmail.moph.go.th> In-Reply-To: <1104766805.41d96755a40d9@webmail.moph.go.th> Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/33 X-Sequence-Number: 9723 amrit@health2.moph.go.th wrote: >>I realize you may be stuck with 7.3.x but you should be aware that 7.4 >>is considerably faster, and 8.0 appears to be even faster yet. >> >> > >There are a little bit incompatibility between 7.3 -8 , so rather difficult to >change. > > > >>I would seriously consider upgrading, if at all possible. >> >>A few more hints. >> >>Random page cost is quite conservative if you have reasonably fast disks. >>Speaking of fast disks, not all disks are created equal, some RAID >>drives are quite slow (Bonnie++ is your friend here) >> >>Sort memory can be set on a per query basis, I'd consider lowering it >>quite low and only increasing it when necessary. >> >>Which brings us to how to find out when it is necessary. >>Turn logging on and turn on log_pid, and log_duration, then you will >>need to sort through the logs to find the slow queries. >> >> > >In standard RH 9.0 , if I enable both of the log [pid , duration] , where could >I look for the result of the log, and would it make the system to be slower? > > On a redhat system logging is more or less disabled if you used the rpm you can set syslog=2 in the postgresql.conf and then you will get the logs in messages.log Yes, it will make it slower, but you have to find out which queries are slow. Dave > >Amrit >Thailand > > >---------------------------(end of broadcast)--------------------------- >TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Tue Jan 4 00:59:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AEBC43A2B1B for ; Tue, 4 Jan 2005 00:58: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 12850-07 for ; Tue, 4 Jan 2005 00:58:46 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 94B3D3A19E7 for ; Tue, 4 Jan 2005 00:58:49 +0000 (GMT) Received: (qmail 29623 invoked from network); 4 Jan 2005 00:58:21 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 4 Jan 2005 00:58:21 -0000 Message-ID: <41D9EA44.3020504@fastcrypt.com> Date: Mon, 03 Jan 2005 19:58:44 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: William Yu Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104634472.41d762681b548@webmail.moph.go.th> <20050102140828.GA21826@pobox.com> <1104683293.41d8211d62221@webmail.moph.go.th> <41D827C1.3050707@fastcrypt.com> <1104717243.41d8a5bb9cb9b@webmail.moph.go.th> <41D95042.70705@fastcrypt.com> In-Reply-To: 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.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/34 X-Sequence-Number: 9724 William Yu wrote: > Dave Cramer wrote: > >> >> >> William Yu wrote: >> >>> amrit@health2.moph.go.th wrote: >>> >>>> I will try to reduce shared buffer to 1536 [1.87 Mb]. >>> >>> >>> >>> >>> 1536 is probaby too low. I've tested a bunch of different settings >>> on my 8GB Opteron server and 10K seems to be the best setting. >> >> >> >> Be careful here, he is not using opterons which can access physical >> memory above 4G efficiently. Also he only has 4G the 6-10% rule still >> applies > > > 10% of 4GB is 400MB. 10K buffers is 80MB. Easily less than the 6-10% > rule. > Correct, I didn't actually do the math, I refrain from giving actual numbers as every system is different. > >>> To figure out your effective cache size, run top and add free+cached. >> >> >> >> My understanding is that effective cache is the sum of shared >> buffers, plus kernel buffers, not sure what free + cached gives you? > > > Not true. Effective cache size is the free memory available that the > OS can use for caching for Postgres. In a system that runs nothing but > Postgres, it's free + cached. You still need to add in the shared buffers as they are part of the "effective cache" Dave > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Tue Jan 4 01:18:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A9B113A2B1B for ; Tue, 4 Jan 2005 01:18: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 18591-05 for ; Tue, 4 Jan 2005 01:17:38 +0000 (GMT) Received: from svarog.thaico.si (p0f.net [193.77.154.190]) by svr1.postgresql.org (Postfix) with ESMTP id 63B033A3C51 for ; Tue, 4 Jan 2005 01:17:39 +0000 (GMT) Received: from lunik.p0f.net ([192.168.50.128]) by svarog.thaico.si with esmtp (Exim 3.32 #1 (Debian)) id 1CldKG-0002bC-00; Tue, 04 Jan 2005 02:17:32 +0100 Received: from lunik.p0f.net (localhost [127.0.0.1]) by lunik.p0f.net (8.12.10/8.12.10) with ESMTP id j041LASw010740; Tue, 4 Jan 2005 02:21:10 +0100 Received: (from gregab@localhost) by lunik.p0f.net (8.12.10/8.12.10/Submit) id j041LApQ010739; Tue, 4 Jan 2005 02:21:10 +0100 Date: Tue, 4 Jan 2005 02:21:10 +0100 From: Grega Bremec To: Mitch Pirtle Cc: pgsql-performance@postgresql.org Subject: Re: Hardware purchase question Message-ID: <20050104012110.GA9518@lunik.p0f.net> References: <6.0.1.1.0.20041124114556.04b7cc80@mail.marketingsolutionsinc.com> <41BDD001.8070701@commandprompt.com> <330532b6050103112034cf47c8@mail.gmail.com> <41D99E7E.3080704@alteeve.com> <41D9A8B8.2030708@alteeve.com> <330532b60501031244130fe819@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline In-Reply-To: <330532b60501031244130fe819@mail.gmail.com> User-Agent: Mutt/1.4.1i Organization: p0f X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.208 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL X-Spam-Level: * X-Archive-Number: 200501/35 X-Sequence-Number: 9725 --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =2E..and on Mon, Jan 03, 2005 at 03:44:44PM -0500, Mitch Pirtle used the ke= yboard: > > You are right, I now remember that setup was originally called "RAID > 10 plus 1", and I believe is was an incorrect statement from an > overzealous salesman ;-) > Just an afterthought - that could well be the unfortunate consequence of salesmen specializing in sales as an act rather than the goods they were selling - it might be that he/she was referring to the specifics of the concrete configuration they were selling you (or trying to sell you), which should, in the case you were mentioning, probably be called "a RAID10 array with a hotspare drive" - that is, it would be preconfigured to, upon the failure of one of array members, detect the failed drive and automatically replace it with one that has been sitting there all the time, doing nothing but waiting for one of its active companions to fail. But this already falls into the category that has, so far, probably caused the vast majority of misunderstandings, failed investments and grey hair in RAID, namely data safety, and I don't feel particularly qualified for getting into specifics of this at this moment, as it happens to be 2AM, I had a couple of beers (my friend's birthday's due) and I'm dying to get some sleep. :) HTH, cheers, --=20 Grega Bremec gregab at p0f dot net --FL5UXtIhxfXey3p5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFB2e+Gfu4IwuB3+XoRAjS+AJ9YAsLYrbwzItSGHXEJ4ufvj3SYqwCfRx+O QUjcsYMUbSOVfNhygSX7SZc= =4Cc+ -----END PGP SIGNATURE----- --FL5UXtIhxfXey3p5-- From pgsql-performance-owner@postgresql.org Tue Jan 4 05:06:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 974F83A19D0 for ; Tue, 4 Jan 2005 05: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 69928-07 for ; Tue, 4 Jan 2005 05:06:30 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id DDE8C3A3D67 for ; Tue, 4 Jan 2005 05:06:30 +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 j0456OXu039479 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 3 Jan 2005 22:06:26 -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 j0456O0m081350; Mon, 3 Jan 2005 22:06:24 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j0456ME9081349; Mon, 3 Jan 2005 22:06:22 -0700 (MST) (envelope-from mfuhr) Date: Mon, 3 Jan 2005 22:06:21 -0700 From: Michael Fuhr To: Adam Palmblad Cc: Postgres Performance Subject: Re: Bad Index Choices with user defined data type Message-ID: <20050104050621.GA81266@winnie.fuhr.org> References: <001d01c4f1dd$7eb98390$97019696@AERS04> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001d01c4f1dd$7eb98390$97019696@AERS04> 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: 200501/36 X-Sequence-Number: 9726 On Mon, Jan 03, 2005 at 01:44:27PM -0800, Adam Palmblad wrote: > I've got a table using a data type that I have created as the type for > its primary key. I (hope) I have the type set up properly - it seems > okay, and does not have any problem creating a b-tree index for the > type. The problem I am having is that the index seems to never be > chosen for use. I can force the use of the index by setting > enable_seqscan to off. The table has about 1.2 million rows. I have > also analyzed the table - and immediately afterwards there is no affect > on the index's behaviour. Please post the query and the EXPLAIN ANALYZE output for both cases: one query with enable_seqscan on and one with it off. It might also be useful to see the column's statistics from pg_stats, and perhaps the SQL statements that create the table, the type, the type's operators, etc. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Tue Jan 4 11:01:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EFBEA3A3D1E for ; Tue, 4 Jan 2005 11:01: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 53529-08 for ; Tue, 4 Jan 2005 11:01:24 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id D64FC3A3C4D for ; Tue, 4 Jan 2005 11:01:24 +0000 (GMT) Received: (qmail 16203 invoked from network); 4 Jan 2005 09:31:48 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 4 Jan 2005 09:31:48 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 14896-23 for ; Tue, 4 Jan 2005 16:31:48 +0700 (ICT) Received: (qmail 16196 invoked from network); 4 Jan 2005 09:31:47 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 4 Jan 2005 09:31:47 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Tue, 4 Jan 2005 16:31:47 +0700 Message-ID: <1104831107.41da6283add0c@webmail.moph.go.th> Date: Tue, 4 Jan 2005 16:31:47 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Cc: ""@, ""@, ""@ Subject: Re: Low Performance for big hospital server .. MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/37 X-Sequence-Number: 9727 Today is the first official day of this weeks and the system run better in serveral points but there are still some points that need to be corrected. Some queries or some tables are very slow. I think the queries inside the programe need to be rewrite. Now I put the sort mem to a little bit bigger: sort mem = 16384 increase the sort mem makes no effect on the slow point eventhough there is little connnection. shared_buffers = 27853 effective cache = 120000 I will put more ram but someone said RH 9.0 had poor recognition on the Ram above 4 Gb? Should I close the hyperthreading ? Would it make any differnce between open and close the hyperthreading? Thanks for any comment Amrit Thailand From pgsql-performance-owner@postgresql.org Tue Jan 4 11:13:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6BD433A2D7A for ; Tue, 4 Jan 2005 11:13: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 56583-07 for ; Tue, 4 Jan 2005 11:13:14 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id E6F5D3A3CB7 for ; Tue, 4 Jan 2005 11:13:14 +0000 (GMT) Received: from localhost (swm@localhost) by linuxworld.com.au (8.11.6/8.11.4) with ESMTP id j04BDCW08956; Tue, 4 Jan 2005 22:13:12 +1100 Date: Tue, 4 Jan 2005 22:13:12 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. In-Reply-To: <1104831107.41da6283add0c@webmail.moph.go.th> Message-ID: References: <1104831107.41da6283add0c@webmail.moph.go.th> 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.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/38 X-Sequence-Number: 9728 On Tue, 4 Jan 2005 amrit@health2.moph.go.th wrote: > Today is the first official day of this weeks and the system run better in > serveral points but there are still some points that need to be corrected. Some > queries or some tables are very slow. I think the queries inside the programe > need to be rewrite. > Now I put the sort mem to a little bit bigger: > sort mem = 16384 increase the sort mem makes no effect on the slow point > eventhough there is little connnection. > shared_buffers = 27853 > effective cache = 120000 Even though others have said otherwise, I've had good results from setting sort_mem higher -- even if that is per query. > > I will put more ram but someone said RH 9.0 had poor recognition on the Ram > above 4 Gb? I think they were refering to 32 bit architectures, not distributions as such. > Should I close the hyperthreading ? Would it make any differnce between open and > close the hyperthreading? > Thanks for any comment In my experience, the largest performance increases come from intensive analysis and optimisation of queries. Look at the output of EXPLAIN ANALYZE for the queries your application is generating and see if they can be tuned in anyway. More often than not, they can. Feel free to ask for assistence on irc at irc.freenode.net #postgresql. People there help optimise queries all day ;-). > Amrit > Thailand Gavin From pgsql-performance-owner@postgresql.org Tue Jan 4 14:38:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 67F8F3A3E55 for ; Tue, 4 Jan 2005 14:38: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 14366-09 for ; Tue, 4 Jan 2005 14:38:07 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 147F63A3E15 for ; Tue, 4 Jan 2005 14:38:08 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 984F156274; Tue, 4 Jan 2005 09:38:03 -0500 (EST) Message-ID: <41DAAA4C.2070201@deg.cc> Date: Tue, 04 Jan 2005 09:38: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: pg@fastcrypt.com Cc: Postgres Performance Subject: Re: Very Bad Performance. References: <41D9C4E3.3050001@deg.cc> <41D9D8C1.4090906@fastcrypt.com> In-Reply-To: <41D9D8C1.4090906@fastcrypt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/39 X-Sequence-Number: 9729 Dave Cramer wrote: > Well, it's not quite that simple > > the rule of thumb is 6-10% of available memory before postgres loads > is allocated to shared_buffers. > then effective cache is set to the SUM of shared_buffers + kernel buffers > > Then you have to look at individual slow queries to determine why they > are slow, fortunately you are running 7.4 so you can set > log_min_duration to some number like 1000ms and then > try to analyze why those queries are slow. I had that already set on my database , and when i look at the log for all the problem queries, most of the queries are slow from one of the table. when i look at the stats on that table they are really wrong, not sure how to fix them. i run vacuumdb and analyze daily. > > > Also hyperthreading may not be helping you.. does it do any harm to the system if it is hyperthreaded ? > > > Dave > > Pallav Kalva wrote: > >> Hi , >> >> I am experiencing a very bad performance on my production >> database lately , all my queries are slowing down. Our application is >> a webbased system with lot of selects and updates. I am running >> "vacuumdb" daily on all the databases, are the below postgres >> configuration parameters are set properly ? can anyone take a look. >> Let me know if you need anymore information. >> >> >> Postgres Version: 7.4 >> Operating System: Linux Red Hat 9 >> Cpus: 2 Hyperthreaded >> RAM: 4 gb >> Postgres Settings: >> max_fsm_pages | 20000 >> max_fsm_relations | 1000 >> shared_buffers | 65536 >> sort_mem | 16384 >> vacuum_mem | 32768 >> wal_buffers | 64 >> effective_cache_size | 393216 >> >> Thanks! >> Pallav >> >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 4: Don't 'kill -9' the postmaster >> >> > From pgsql-performance-owner@postgresql.org Tue Jan 4 18:06:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 606883A3E97 for ; Tue, 4 Jan 2005 18:06: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 83809-07 for ; Tue, 4 Jan 2005 18:06:18 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 93A8B3A3F00 for ; Tue, 4 Jan 2005 18:06:18 +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 6864756; Tue, 04 Jan 2005 10:07:55 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: query rewrite using materialized views Date: Tue, 4 Jan 2005 10:06:18 -0800 User-Agent: KMail/1.6.2 Cc: Yann Michel References: <20050103165532.GA21212@zoom.spline.inf.fu-berlin.de> In-Reply-To: <20050103165532.GA21212@zoom.spline.inf.fu-berlin.de> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501041006.18735.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/40 X-Sequence-Number: 9730 Yann, > are there any plans for rewriting queries to preexisting materialized > views? I mean, rewrite a query (within the optimizer) to use a > materialized view instead of the originating table? Automatically, and by default, no. Using the RULES system? Yes, you can already do this and the folks on the MattView project on pgFoundry are working to make it easier. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 4 18:42:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3309B3A3F02 for ; Tue, 4 Jan 2005 18:42: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 92601-08 for ; Tue, 4 Jan 2005 18:41:54 +0000 (GMT) Received: from mail14-kan-R.bigfish.com (mail-kan.bigfish.com [63.161.60.29]) by svr1.postgresql.org (Postfix) with ESMTP id 632D53A3ECD for ; Tue, 4 Jan 2005 18:41:54 +0000 (GMT) Received: from mail14-kan.bigfish.com (localhost.localdomain [127.0.0.1]) by mail14-kan-R.bigfish.com (Postfix) with ESMTP id 8D0631A12E9 for ; Tue, 4 Jan 2005 18:41:53 +0000 (UCT) X-BigFish: VC Received: by mail14-kan (MessageSwitch) id 1104864113518239_7956; Tue, 4 Jan 2005 18:41:53 +0000 (UCT) Received: from smtpgw5.sprintspectrum.com (smtpgw5.sprintspectrum.com [207.40.188.13]) by mail14-kan.bigfish.com (Postfix) with ESMTP id 6C8471A1291 for ; Tue, 4 Jan 2005 18:41:53 +0000 (UCT) Received: from mailhost.sprintspectrum.com (smtpgw7.it.sprintspectrum.com [207.40.65.55]) by smtpgw5.sprintspectrum.com (8.12.10/8.12.8) with ESMTP id j04IfqLY022491 for ; Tue, 4 Jan 2005 12:41:52 -0600 (CST) Received: from PKDWG01A.ad.sprint.com (PKDWG01A.corp.sprint.com [10.185.12.78]) by mailhost.sprintspectrum.com (Switch-2.2.8/Switch-2.2.8) with ESMTP id j04Ifp501867 for ; Tue, 4 Jan 2005 12:41:51 -0600 (CST) Received: from pdawb06c.ad.sprint.com ([10.184.134.46]) by PKDWG01A.ad.sprint.com with Microsoft SMTPSVC(6.0.3790.211); Tue, 4 Jan 2005 12:41:46 -0600 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: query rewrite using materialized views Date: Tue, 4 Jan 2005 12:41:45 -0600 Message-ID: <8543375597A43D4D8388D75ACD32B9B301F72C19@PDAWB06C.ad.sprint.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] query rewrite using materialized views Thread-Index: AcTyid0R1BR7uQGPQuCcF7/9x3uy8AAAlGRg From: "Wager, Ryan D [NTK]" To: X-OriginalArrivalTime: 04 Jan 2005 18:41:46.0205 (UTC) FILETIME=[0AFF98D0:01C4F28D] 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: 200501/41 X-Sequence-Number: 9731 All, I am currently working on a project for my company that entails Databasing upwards of 300 million specific parameters. In the current DB Design, these parameters are mapped against two lookup tables (2 million, and 1.5 million respectively) and I am having extreme issues getting PG to scale to a working level. Here are my issues: 1)the 250 million records are currently whipped and reinserted as a "daily snapshot" and the fastest way I have found "COPY" to do this from a file is no where near fast enough to do this. SQL*Loader from Oracle does some things that I need, ie Direct Path to the db files access (skipping the RDBMS), inherently ignoring indexing rules and saving a ton of time (Dropping the index, COPY'ing 250 million records, then Recreating the index just takes way too long). 2)Finding a way to keep this many records in a fashion that can be easily queried. I even tried breaking it up into almost 2800 separate tables, basically views of the data pre-broken down, if this is a working method it can be done this way, but when I tried it, VACUUM, and the COPY's all seemed to slow down extremely. If there is anyone that can give me some tweak parameters or design help on this, it would be ridiculously appreciated. I have already created this in Oracle and it works, but we don't want to have to pay the monster if something as wonderful as Postgres can handle it. Ryan Wager -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh Berkus Sent: Tuesday, January 04, 2005 12:06 PM To: pgsql-performance@postgresql.org Cc: Yann Michel Subject: Re: [PERFORM] query rewrite using materialized views Yann, > are there any plans for rewriting queries to preexisting materialized > views? I mean, rewrite a query (within the optimizer) to use a > materialized view instead of the originating table? Automatically, and by default, no. Using the RULES system? Yes, you can=20 already do this and the folks on the MattView project on pgFoundry are=20 working to make it easier. --=20 Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) From pgsql-performance-owner@postgresql.org Tue Jan 4 19:04:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 394B53A3E75 for ; Tue, 4 Jan 2005 19:04: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 01644-01 for ; Tue, 4 Jan 2005 19:03:56 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0AEE23A3EDB for ; Tue, 4 Jan 2005 19:03:56 +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 8A16476A7D; Tue, 4 Jan 2005 14:03:55 -0500 (EST) Subject: Re: query rewrite using materialized views From: Rod Taylor To: "Wager, Ryan D [NTK]" Cc: Postgresql Performance In-Reply-To: <8543375597A43D4D8388D75ACD32B9B301F72C19@PDAWB06C.ad.sprint.com> References: <8543375597A43D4D8388D75ACD32B9B301F72C19@PDAWB06C.ad.sprint.com> Content-Type: text/plain Date: Tue, 04 Jan 2005 14:02:18 -0500 Message-Id: <1104865338.37702.107.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: 200501/42 X-Sequence-Number: 9732 > 1)the 250 million records are currently whipped and reinserted as a > "daily snapshot" and the fastest way I have found "COPY" to do this from > a file is no where near fast enough to do this. SQL*Loader from Oracle > does some things that I need, ie Direct Path to the db files access > (skipping the RDBMS), inherently ignoring indexing rules and saving a > ton of time (Dropping the index, COPY'ing 250 million records, then > Recreating the index just takes way too long). If you have the hardware for it, instead of doing 1 copy, do 1 copy command per CPU (until your IO is maxed out anyway) and divide the work amongst them. I can push through 100MB/sec using methods like this -- which makes loading 100GB of data much faster. Ditto for indexes. Don't create a single index on one CPU and wait -- send off one index creation command per CPU. > 2)Finding a way to keep this many records in a fashion that can be > easily queried. I even tried breaking it up into almost 2800 separate > tables, basically views of the data pre-broken down, if this is a > working method it can be done this way, but when I tried it, VACUUM, and > the COPY's all seemed to slow down extremely. Can you send us EXPLAIN ANALYSE output for the slow selects and a little insight into what your doing? A basic table structure, and indexes involved would be handy. You may change column and table names if you like. > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh Berkus > Sent: Tuesday, January 04, 2005 12:06 PM > To: pgsql-performance@postgresql.org > Cc: Yann Michel > Subject: Re: [PERFORM] query rewrite using materialized views > > Yann, > > > are there any plans for rewriting queries to preexisting materialized > > views? I mean, rewrite a query (within the optimizer) to use a > > materialized view instead of the originating table? > > Automatically, and by default, no. Using the RULES system? Yes, you > can > already do this and the folks on the MattView project on pgFoundry are > working to make it easier. > -- From pgsql-performance-owner@postgresql.org Tue Jan 4 19:13:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92E893A3E75 for ; Tue, 4 Jan 2005 19: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 03425-02 for ; Tue, 4 Jan 2005 19:13:10 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id CDF563A1AAC for ; Tue, 4 Jan 2005 19:13:10 +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 6865079; Tue, 04 Jan 2005 11:14:48 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Wager, Ryan D [NTK]" Subject: Re: query rewrite using materialized views Date: Tue, 4 Jan 2005 11:16:49 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <8543375597A43D4D8388D75ACD32B9B301F72C19@PDAWB06C.ad.sprint.com> In-Reply-To: <8543375597A43D4D8388D75ACD32B9B301F72C19@PDAWB06C.ad.sprint.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501041116.49197.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: 200501/43 X-Sequence-Number: 9733 Wagner, > If there is anyone that can give me some tweak parameters or design > help on this, it would be ridiculously appreciated. I have already > created this in Oracle and it works, but we don't want to have to pay > the monster if something as wonderful as Postgres can handle it. In addition to Rod's advice, please increase your checkpoint_segments and checkpoint_timeout parameters and make sure that the pg_xlog is on a seperate disk resource from the database. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 4 19:27:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7A0833A3E75 for ; Tue, 4 Jan 2005 19:27: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 05044-10 for ; Tue, 4 Jan 2005 19:26:38 +0000 (GMT) Received: from mail14-ash-R.bigfish.com (mail-ash.bigfish.com [206.16.192.253]) by svr1.postgresql.org (Postfix) with ESMTP id 893AE3A1AAC for ; Tue, 4 Jan 2005 19:26:38 +0000 (GMT) Received: from mail14-ash.bigfish.com (localhost.localdomain [127.0.0.1]) by mail14-ash-R.bigfish.com (Postfix) with ESMTP id 0D25E46D5AF; Tue, 4 Jan 2005 19:26:38 +0000 (UCT) X-BigFish: VC Received: by mail14-ash (MessageSwitch) id 1104866797970083_30141; Tue, 4 Jan 2005 19:26:37 +0000 (UCT) Received: from smtpgw6.it.sprintspectrum.com (smtpgw6.sprintspectrum.com [207.40.188.14]) by mail14-ash.bigfish.com (Postfix) with ESMTP id D4E3046CBC5; Tue, 4 Jan 2005 19:26:37 +0000 (UCT) Received: from mailhost.sprintspectrum.com (smtpgw8.it.sprintspectrum.com [207.40.65.56]) by smtpgw6.it.sprintspectrum.com (8.12.11.Beta0/8.12.8) with ESMTP id j04JQbfR017768; Tue, 4 Jan 2005 13:26:37 -0600 (CST) Received: from PKDWG02A.ad.sprint.com (PKDWG02A.corp.sprint.com [10.185.12.80]) by mailhost.sprintspectrum.com (Switch-2.2.8/Switch-2.2.8) with ESMTP id j04JQbJ13092; Tue, 4 Jan 2005 13:26:37 -0600 (CST) Received: from pdawb06c.ad.sprint.com ([10.184.134.47]) by PKDWG02A.ad.sprint.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 4 Jan 2005 13:26:37 -0600 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: query rewrite using materialized views X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Date: Tue, 4 Jan 2005 13:26:36 -0600 Message-ID: <8543375597A43D4D8388D75ACD32B9B301F72C1A@PDAWB06C.ad.sprint.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] query rewrite using materialized views Thread-Index: AcTykCnQfAioN076QACAgzreIoIehwAAhUWg From: "Wager, Ryan D [NTK]" To: "Rod Taylor" Cc: "Postgresql Performance" X-OriginalArrivalTime: 04 Jan 2005 19:26:37.0024 (UTC) FILETIME=[4ED9FE00:01C4F293] 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: 200501/44 X-Sequence-Number: 9734 Rod, I do this, PG gets forked many times, it is tough to find the max number of times I can do this, but I have a Proc::Queue Manager Perl driver that handles all of the copy calls. I have a quad CPU machine. Each COPY only hits ones CPU for like 2.1% but anything over about 5 kicks the load avg up. Ill get some explain analysis and table structures out there pronto. -----Original Message----- From: Rod Taylor [mailto:pg@rbt.ca]=20 Sent: Tuesday, January 04, 2005 1:02 PM To: Wager, Ryan D [NTK] Cc: Postgresql Performance Subject: Re: [PERFORM] query rewrite using materialized views > 1)the 250 million records are currently whipped and reinserted as a > "daily snapshot" and the fastest way I have found "COPY" to do this from > a file is no where near fast enough to do this. SQL*Loader from Oracle > does some things that I need, ie Direct Path to the db files access > (skipping the RDBMS), inherently ignoring indexing rules and saving a > ton of time (Dropping the index, COPY'ing 250 million records, then > Recreating the index just takes way too long). If you have the hardware for it, instead of doing 1 copy, do 1 copy command per CPU (until your IO is maxed out anyway) and divide the work amongst them. I can push through 100MB/sec using methods like this -- which makes loading 100GB of data much faster. Ditto for indexes. Don't create a single index on one CPU and wait -- send off one index creation command per CPU. > 2)Finding a way to keep this many records in a fashion that can be > easily queried. I even tried breaking it up into almost 2800 separate > tables, basically views of the data pre-broken down, if this is a > working method it can be done this way, but when I tried it, VACUUM, and > the COPY's all seemed to slow down extremely. Can you send us EXPLAIN ANALYSE output for the slow selects and a little insight into what your doing? A basic table structure, and indexes involved would be handy. You may change column and table names if you like. > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh Berkus > Sent: Tuesday, January 04, 2005 12:06 PM > To: pgsql-performance@postgresql.org > Cc: Yann Michel > Subject: Re: [PERFORM] query rewrite using materialized views >=20 > Yann, >=20 > > are there any plans for rewriting queries to preexisting materialized > > views? I mean, rewrite a query (within the optimizer) to use a > > materialized view instead of the originating table? >=20 > Automatically, and by default, no. Using the RULES system? Yes, you > can=20 > already do this and the folks on the MattView project on pgFoundry are > working to make it easier. >=20 --=20 From pgsql-performance-owner@postgresql.org Tue Jan 4 19:56:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3B4B23A3F2F for ; Tue, 4 Jan 2005 19:56: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 12351-08 for ; Tue, 4 Jan 2005 19:55:55 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1C7E23A3EF7 for ; Tue, 4 Jan 2005 19:55:55 +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 DC3CB76A80; Tue, 4 Jan 2005 14:55:58 -0500 (EST) Subject: Re: query rewrite using materialized views From: Rod Taylor To: "Wager, Ryan D [NTK]" Cc: Postgresql Performance In-Reply-To: <8543375597A43D4D8388D75ACD32B9B301F72C1A@PDAWB06C.ad.sprint.com> References: <8543375597A43D4D8388D75ACD32B9B301F72C1A@PDAWB06C.ad.sprint.com> Content-Type: text/plain Date: Tue, 04 Jan 2005 14:54:22 -0500 Message-Id: <1104868462.37702.114.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: 200501/45 X-Sequence-Number: 9735 On Tue, 2005-01-04 at 13:26 -0600, Wager, Ryan D [NTK] wrote: > Rod, > I do this, PG gets forked many times, it is tough to find the max > number of times I can do this, but I have a Proc::Queue Manager Perl > driver that handles all of the copy calls. I have a quad CPU machine. > Each COPY only hits ones CPU for like 2.1% but anything over about 5 > kicks the load avg up. Sounds like disk IO is slowing down the copy then. > Ill get some explain analysis and table structures out there pronto. > > -----Original Message----- > From: Rod Taylor [mailto:pg@rbt.ca] > Sent: Tuesday, January 04, 2005 1:02 PM > To: Wager, Ryan D [NTK] > Cc: Postgresql Performance > Subject: Re: [PERFORM] query rewrite using materialized views > > > 1)the 250 million records are currently whipped and reinserted as a > > "daily snapshot" and the fastest way I have found "COPY" to do this > from > > a file is no where near fast enough to do this. SQL*Loader from > Oracle > > does some things that I need, ie Direct Path to the db files access > > (skipping the RDBMS), inherently ignoring indexing rules and saving a > > ton of time (Dropping the index, COPY'ing 250 million records, then > > Recreating the index just takes way too long). > > If you have the hardware for it, instead of doing 1 copy, do 1 copy > command per CPU (until your IO is maxed out anyway) and divide the work > amongst them. I can push through 100MB/sec using methods like this -- > which makes loading 100GB of data much faster. > > Ditto for indexes. Don't create a single index on one CPU and wait -- > send off one index creation command per CPU. > > > 2)Finding a way to keep this many records in a fashion that can be > > easily queried. I even tried breaking it up into almost 2800 separate > > tables, basically views of the data pre-broken down, if this is a > > working method it can be done this way, but when I tried it, VACUUM, > and > > the COPY's all seemed to slow down extremely. > > Can you send us EXPLAIN ANALYSE output for the slow selects and a little > insight into what your doing? A basic table structure, and indexes > involved would be handy. You may change column and table names if you > like. > > > -----Original Message----- > > From: pgsql-performance-owner@postgresql.org > > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh > Berkus > > Sent: Tuesday, January 04, 2005 12:06 PM > > To: pgsql-performance@postgresql.org > > Cc: Yann Michel > > Subject: Re: [PERFORM] query rewrite using materialized views > > > > Yann, > > > > > are there any plans for rewriting queries to preexisting > materialized > > > views? I mean, rewrite a query (within the optimizer) to use a > > > materialized view instead of the originating table? > > > > Automatically, and by default, no. Using the RULES system? Yes, you > > can > > already do this and the folks on the MattView project on pgFoundry are > > > working to make it easier. > > -- From pgsql-performance-owner@postgresql.org Tue Jan 4 20:50:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 40CB63A3F02 for ; Tue, 4 Jan 2005 20:50: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 28568-06 for ; Tue, 4 Jan 2005 20:50:06 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7E4403A3FA8 for ; Tue, 4 Jan 2005 20:50:06 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 67B6331975; Tue, 4 Jan 2005 21:50:05 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Very Bad Performance. Date: Tue, 04 Jan 2005 14:58:04 -0500 Organization: cbbrowne Computing Inc Lines: 53 Message-ID: References: <41D9C4E3.3050001@deg.cc> <41D9D8C1.4090906@fastcrypt.com> <41DAAA4C.2070201@deg.cc> 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 (Corporate Culture, linux) Cancel-Lock: sha1:RBMbVsBdjMNSXqc/9xp+laUA1/o= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.089 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/46 X-Sequence-Number: 9736 Martha Stewart called it a Good Thing when pkalva@deg.cc (Pallav Kalva) wrote: >> Then you have to look at individual slow queries to determine why >> they are slow, fortunately you are running 7.4 so you can set >> log_min_duration to some number like 1000ms and then >> try to analyze why those queries are slow. > > I had that already set on my database , and when i look at the log > for all the problem queries, most of the queries are slow from one of > the table. when i look at the stats on that table they are really > wrong, not sure how to fix them. i run vacuumdb and analyze daily. Well, it's at least good news to be able to focus attention on one table, rather than being unfocused. If the problem is that stats on one table are bad, then the next question is "Why is that?" A sensible answer might be that the table is fairly large, but has some fields (that are relevant to indexing) that have a small number of values where some are real common and others aren't. For instance, you might have a customer/supplier ID where there are maybe a few hundred unique values, but where the table is dominated by a handful of them. The default in PostgreSQL is to collect a histogram of statistics based on having 10 "bins," filling them using 300 samples. If you have a pretty skewed distribution on some of the fields, that won't be good enough. I would suggest looking for columns where things are likely to be "skewed" (customer/supplier IDs are really good candidates for this), and bump them up to collect more stats. Thus, something like: alter table my_table alter column something_id set statistics 100; Then ANALYZE MY_TABLE, which will collect 100 bins worth of stats for the 'offending' column, based on 3000 sampled records, and see if that helps. >> Also hyperthreading may not be helping you.. > > does it do any harm to the system if it is hyperthreaded ? Yes. If you have multiple "hyperthreads" running on one CPU, that'll wind up causing extra memory contention of one sort or another. -- let name="cbbrowne" and tld="linuxfinances.info" in name ^ "@" ^ tld;; http://www.ntlug.org/~cbbrowne/sgml.html "People who don't use computers are more sociable, reasonable, and ... less twisted" -- Arthur Norman From pgsql-performance-owner@postgresql.org Tue Jan 4 21:34:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6CF443A25AF for ; Tue, 4 Jan 2005 21: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 42311-01 for ; Tue, 4 Jan 2005 21:33:47 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id AC2D23A3F79 for ; Tue, 4 Jan 2005 21:33: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 6865575; Tue, 04 Jan 2005 13:35:26 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Rod Taylor Subject: Re: query rewrite using materialized views Date: Tue, 4 Jan 2005 13:37:27 -0800 User-Agent: KMail/1.7.1 Cc: "Wager, Ryan D [NTK]" , Postgresql Performance References: <8543375597A43D4D8388D75ACD32B9B301F72C1A@PDAWB06C.ad.sprint.com> <1104868462.37702.114.camel@home> In-Reply-To: <1104868462.37702.114.camel@home> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501041337.27884.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: 200501/47 X-Sequence-Number: 9737 Ryan, > > I do this, PG gets forked many times, it is tough to find the max > > number of times I can do this, but I have a Proc::Queue Manager Perl > > driver that handles all of the copy calls. I have a quad CPU machine. > > Each COPY only hits ones CPU for like 2.1% but anything over about 5 > > kicks the load avg up. That's consistent with Xeon problems we've seen elsewhere. Keep the # of processes at or below the # of processors. Moving pg_xlog is accomplished through: 1) in 8.0, changes to postgresql.conf (in 8.0 you'd also want to explore using multiple arrays with tablespaces to make things even faster) 2) in other versions: a) mount a seperate disk on PGDATA/pg_xlog, or b) symlink PGDATA/pg_xlog to another location -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 4 23:24:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7B4623A3F6E for ; Tue, 4 Jan 2005 23:24: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 69609-03 for ; Tue, 4 Jan 2005 23:24:33 +0000 (GMT) Received: from cmailg2.svr.pol.co.uk (cmailg2.svr.pol.co.uk [195.92.195.172]) by svr1.postgresql.org (Postfix) with ESMTP id D27D33A1AAC for ; Tue, 4 Jan 2005 23:24:34 +0000 (GMT) Received: from modem-3952.lemur.dialup.pol.co.uk ([217.135.143.112] helo=192.168.0.102) by cmailg2.svr.pol.co.uk with esmtp (Exim 4.14) id 1Cly2R-0005iS-Po; Tue, 04 Jan 2005 23:24:32 +0000 Subject: Re: query rewrite using materialized views From: Simon Riggs To: Rod Taylor Cc: "Wager, Ryan D [NTK]" , Postgresql Performance In-Reply-To: <1104865338.37702.107.camel@home> References: <8543375597A43D4D8388D75ACD32B9B301F72C19@PDAWB06C.ad.sprint.com> <1104865338.37702.107.camel@home> Content-Type: text/plain Organization: 2nd Quadrant Date: Tue, 04 Jan 2005 23:20:10 +0000 Message-Id: <1104880810.22450.38.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/48 X-Sequence-Number: 9738 On Tue, 2005-01-04 at 14:02 -0500, Rod Taylor wrote: > > 1)the 250 million records are currently whipped and reinserted as a > > "daily snapshot" and the fastest way I have found "COPY" to do this from > > a file is no where near fast enough to do this. SQL*Loader from Oracle > > does some things that I need, ie Direct Path to the db files access > > (skipping the RDBMS), inherently ignoring indexing rules and saving a > > ton of time (Dropping the index, COPY'ing 250 million records, then > > Recreating the index just takes way too long). > > If you have the hardware for it, instead of doing 1 copy, do 1 copy > command per CPU (until your IO is maxed out anyway) and divide the work > amongst them. I can push through 100MB/sec using methods like this -- > which makes loading 100GB of data much faster. > > Ditto for indexes. Don't create a single index on one CPU and wait -- > send off one index creation command per CPU. Not sure what you mean by "whipped". If you mean select and re-insert then perhaps using a pipe would produce better performance, since no disk access for the data file would be involved. In 8.0 COPY and CREATE INDEX is optimised to not use WAL at all if archive_command is not set. 8 is great... > > 2)Finding a way to keep this many records in a fashion that can be > > easily queried. I even tried breaking it up into almost 2800 separate > > tables, basically views of the data pre-broken down, if this is a > > working method it can be done this way, but when I tried it, VACUUM, and > > the COPY's all seemed to slow down extremely. > > Can you send us EXPLAIN ANALYSE output for the slow selects and a little > insight into what your doing? A basic table structure, and indexes > involved would be handy. You may change column and table names if you > like. There's a known issue using UNION ALL views in 8.0 that makes them slightly more inefficient than using a single table. Perhaps that would explain your results. There shouldn't be any need to do the 2800 table approach in this instance. -- Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Wed Jan 5 07:27:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F0D043A4157 for ; Wed, 5 Jan 2005 07:27: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 93635-03 for ; Wed, 5 Jan 2005 07:27:14 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 86BC53A18D2 for ; Wed, 5 Jan 2005 07:27:13 +0000 (GMT) Received: (qmail 25136 invoked from network); 5 Jan 2005 05:07:17 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 5 Jan 2005 05:07:17 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 24977-02 for ; Wed, 5 Jan 2005 12:07:14 +0700 (ICT) Received: (qmail 25079 invoked from network); 5 Jan 2005 05:07:13 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 5 Jan 2005 05:07:13 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Wed, 5 Jan 2005 12:07:13 +0700 Message-ID: <1104901633.41db76016e568@webmail.moph.go.th> Date: Wed, 5 Jan 2005 12:07:13 +0700 From: amrit@health2.moph.go.th To: Gavin Sherry Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/49 X-Sequence-Number: 9739 > > I will put more ram but someone said RH 9.0 had poor recognition on the Ram > > above 4 Gb? > > I think they were refering to 32 bit architectures, not distributions as > such. Sorry for wrong reason , then should I increase more RAM than 4 Gb. on 32 bit Arche.? > > Should I close the hyperthreading ? Would it make any differnce between > open and > > close the hyperthreading? > > Thanks for any comment > > In my experience, the largest performance increases come from intensive > analysis and optimisation of queries. Look at the output of EXPLAIN > ANALYZE for the queries your application is generating and see if they can > be tuned in anyway. More often than not, they can. So what you mean is that the result is the same whether close or open hyperthreading ? Will it be any harm if I open it ? The main point shiuld be adjustment the query , right. > Feel free to ask for assistence on irc at irc.freenode.net #postgresql. > People there help optimise queries all day ;-). How could I contact with those people ;=> which url ? Thanks again. Amrit Thailand From pgsql-performance-owner@postgresql.org Wed Jan 5 08:12:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 601FF3A291E for ; Wed, 5 Jan 2005 08:12: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 03206-03 for ; Wed, 5 Jan 2005 08:11:51 +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 7E97D3A2913 for ; Wed, 5 Jan 2005 08:11:49 +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 j058BhoX012092; Wed, 5 Jan 2005 09:11:43 +0100 Received: (from yann@localhost) by zong.spline.inf.fu-berlin.de (8.13.1/8.13.1/Submit) id j058BfWE012091; Wed, 5 Jan 2005 09:11:41 +0100 Date: Wed, 5 Jan 2005 09:11:41 +0100 From: Yann Michel To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: query rewrite using materialized views Message-ID: <20050105081141.GA12084@zong.spline.inf.fu-berlin.de> References: <20050103165532.GA21212@zoom.spline.inf.fu-berlin.de> <200501041006.18735.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200501041006.18735.josh@agliodbs.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: 200501/50 X-Sequence-Number: 9740 Hi, On Tue, Jan 04, 2005 at 10:06:18AM -0800, Josh Berkus wrote: > > are there any plans for rewriting queries to preexisting materialized > > views? I mean, rewrite a query (within the optimizer) to use a > > materialized view instead of the originating table? > > Automatically, and by default, no. Using the RULES system? Yes, you can > already do this and the folks on the MattView project on pgFoundry are > working to make it easier. I was just wondering if this might be on schedule for 8.x due to I read the thread about materialized views some days ago. If materialized views are someday implemented one should kepp this requested feature in mind due to I know from Oracle to let it improve query execution plans... Regards, Yann From pgsql-performance-owner@postgresql.org Wed Jan 5 17:23:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BE7FF3A4ADA for ; Wed, 5 Jan 2005 17:23: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 87548-08 for ; Wed, 5 Jan 2005 17:22:43 +0000 (GMT) Received: by svr1.postgresql.org (Postfix, from userid 1001) id 4756C3A5569; Wed, 5 Jan 2005 17:56:24 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 8EB183A4CD9 for ; Wed, 5 Jan 2005 16:26:22 +0000 (GMT) Received: (qmail 16773 invoked from network); 5 Jan 2005 15:35:46 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 5 Jan 2005 15:35:46 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 13602-66 for ; Wed, 5 Jan 2005 22:35:45 +0700 (ICT) Received: (qmail 16765 invoked from network); 5 Jan 2005 15:35:45 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 5 Jan 2005 15:35:45 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Wed, 5 Jan 2005 22:35:42 +0700 Message-ID: <1104939342.41dc094ecb1cf@webmail.moph.go.th> Date: Wed, 5 Jan 2005 22:35:42 +0700 From: amrit@health2.moph.go.th To: Frank Wiles , PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> <20050104094657.540232d7.frank@wiles.org> In-Reply-To: <20050104094657.540232d7.frank@wiles.org> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/51 X-Sequence-Number: 9741 > > Today is the first official day of this weeks and the system run > > better in serveral points but there are still some points that need to > > be corrected. Some queries or some tables are very slow. I think the > > queries inside the programe need to be rewrite. > > Now I put the sort mem to a little bit bigger: > > sort mem = 16384 increase the sort mem makes no effect on the > > slow point eventhough there is little connnection. > > shared_buffers = 27853 > > effective cache = 120000 > If I were you I would upgrade from RH 9 to Fedora Core 2 or 3 after > some initial testing. You'll see a huge improvement of speed on the > system as a whole. I would try turning hyperthreading off also. Now I turn hyperthreading off and readjust the conf . I found the bulb query that was : update one flag of the table [8 million records which I think not too much] .When I turned this query off everything went fine. I don't know whether update the data is much slower than insert [Postgresql 7.3.2] and how could we improve the update method? Thanks for many helps. Amrit Thailand NB. I would like to give my appreciation to all of the volunteers from many countries who combat with big disaster [Tsunamies] in my country [Thailand]. From pgsql-performance-owner@postgresql.org Wed Jan 5 18:25:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C342F3A1A78 for ; Wed, 5 Jan 2005 18:25: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 14669-03 for ; Wed, 5 Jan 2005 18:24:44 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 33F7A3A4187 for ; Wed, 5 Jan 2005 18:22:12 +0000 (GMT) Received: (qmail 19374 invoked from network); 5 Jan 2005 18:21:42 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 5 Jan 2005 18:21:42 -0000 Message-ID: <41DC3047.2030806@fastcrypt.com> Date: Wed, 05 Jan 2005 13:21:59 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: Frank Wiles , PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> <20050104094657.540232d7.frank@wiles.org> <1104939342.41dc094ecb1cf@webmail.moph.go.th> In-Reply-To: <1104939342.41dc094ecb1cf@webmail.moph.go.th> Content-Type: multipart/alternative; boundary="------------080003020207080106010107" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, HTML_30_40, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/52 X-Sequence-Number: 9742 This is a multi-part message in MIME format. --------------080003020207080106010107 Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit Amrit, can you post explain so we can see what it does ? Dave amrit@health2.moph.go.th wrote: >>>Today is the first official day of this weeks and the system run >>>better in serveral points but there are still some points that need to >>>be corrected. Some queries or some tables are very slow. I think the >>>queries inside the programe need to be rewrite. >>>Now I put the sort mem to a little bit bigger: >>>sort mem = 16384 increase the sort mem makes no effect on the >>>slow point eventhough there is little connnection. >>>shared_buffers = 27853 >>>effective cache = 120000 >>> >>> > > > >> If I were you I would upgrade from RH 9 to Fedora Core 2 or 3 after >> some initial testing. You'll see a huge improvement of speed on the >> system as a whole. I would try turning hyperthreading off also. >> >> > > >Now I turn hyperthreading off and readjust the conf . I found the bulb query >that was : >update one flag of the table [8 million records which I think not too much] >.When I turned this query off everything went fine. >I don't know whether update the data is much slower than insert [Postgresql >7.3.2] and how could we improve the update method? >Thanks for many helps. >Amrit >Thailand > >NB. I would like to give my appreciation to all of the volunteers from many >countries who combat with big disaster [Tsunamies] in my country [Thailand]. > >---------------------------(end of broadcast)--------------------------- >TIP 8: explain analyze is your friend > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 --------------080003020207080106010107 Content-Type: text/html; charset=TIS-620 Content-Transfer-Encoding: 7bit Amrit,

can you post

explain <your slow update query>

so we can see what it does ?

Dave

amrit@health2.moph.go.th wrote:
Today is the first official day of this weeks and the system run
better in serveral points but there are still some points that need to
be corrected. Some queries or some tables are very slow. I think the
queries inside the programe need to be rewrite.
Now I put the sort mem to a little bit bigger:
sort mem = 16384       increase  the sort mem makes no effect on the
slow point eventhough there is little connnection.
shared_buffers = 27853
effective cache = 120000
      

  
  If I were you I would upgrade from RH 9 to Fedora Core 2 or 3 after
  some initial testing.  You'll see a huge improvement of speed on the
  system as a whole.  I would try turning hyperthreading off also.
    


Now I turn hyperthreading off and readjust the conf . I found the bulb query
that was :
update one flag of the table [8 million records which I think not too much]
.When I turned this query off everything went fine.
I don't know whether update the data is much slower than insert [Postgresql
7.3.2] and how could we improve the update method?
Thanks for many helps.
Amrit
Thailand

NB. I would like to give my appreciation to all of the volunteers from many
countries who combat with big disaster [Tsunamies] in my country [Thailand].

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


  

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
--------------080003020207080106010107-- From pgsql-performance-owner@postgresql.org Sun Jan 9 09:58:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4B2983A19FF for ; Wed, 5 Jan 2005 19:09: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 26981-08 for ; Wed, 5 Jan 2005 19:09:15 +0000 (GMT) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by svr1.postgresql.org (Postfix) with ESMTP id 5A2773A1A1F for ; Wed, 5 Jan 2005 19:09:15 +0000 (GMT) Received: from [192.168.1.52] (h000d605e415b.ne.client2.attbi.com[24.60.119.214]) by comcast.net (sccrmhc12) with ESMTP id <20050105190912012003p65te>; Wed, 5 Jan 2005 19:09:12 +0000 Message-ID: <41DC3B57.2040109@comcast.net> Date: Wed, 05 Jan 2005 14:09:11 -0500 From: Jeffrey Tenny User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Null integer columns 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=2.242 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: ** X-Archive-Number: 200501/100 X-Sequence-Number: 9790 I have an integer column that is not needed for some rows in the table (whether it is necessary is a factor of other row attributes, and it isn't worth putting in a separate table). What are the performance tradeoffs (storage space, query speed) of using NULL versus a sentinel integer value? Not that it matters, but in the event where the column values matter, the numberic value is a foreign key. Advice on that welcome too. Thanks! From pgsql-performance-owner@postgresql.org Thu Jan 6 02:50:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B593C3A443D for ; Thu, 6 Jan 2005 02:49: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 10130-10 for ; Thu, 6 Jan 2005 02:49:36 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 2F11E3A1909 for ; Thu, 6 Jan 2005 02:49:30 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.195]) by www.postgresql.com (Postfix) with ESMTP id C3EDD739CCB for ; Thu, 6 Jan 2005 02:48:45 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id c16so62180rne for ; Wed, 05 Jan 2005 18:38:30 -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=uWbXISduAR1dp5lYf8DHKR3gBp3Pr2v/2BhQdYVT7DYiOxuPUyl/8xXzxPbDY1M+toAsD4RrhrCNMgKMmFRK1JYhH2QycmjSCwjQdRUVcUbPaJ2M8Y8eR+yaVGrdwSyjcD2Q8kJAk0ZaUYQojU3gCRSNuI/e68BHNRKPvlhQM+Y= Received: by 10.38.76.49 with SMTP id y49mr142473rna; Wed, 05 Jan 2005 18:31:50 -0800 (PST) Received: by 10.38.151.34 with HTTP; Wed, 5 Jan 2005 18:31:49 -0800 (PST) Message-ID: <59b2d39b0501051831643e90f2@mail.gmail.com> Date: Wed, 5 Jan 2005 18:31:49 -0800 From: Miles Keaton Reply-To: Miles Keaton To: pgsql-performance@postgresql.org Subject: Benchmark two separate SELECTs versus one LEFT JOIN 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: 200501/53 X-Sequence-Number: 9743 Has anyone seen a benchmark on the speed difference between: SELECT * FROM item WHERE id=123; and SELECT * FROM vendor WHERE id=515; versus: SELECT * FROM item LEFT JOIN vendor ON item.vendor_id=vendor.id WHERE item.id=123; I only have a laptop here so I can't really benchmark properly. I'm hoping maybe someone else has, or just knows which would be faster under high traffic/quantity. Thanks! From pgsql-performance-owner@postgresql.org Thu Jan 6 03:42:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 12D203A4417 for ; Thu, 6 Jan 2005 03:42: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 23846-08 for ; Thu, 6 Jan 2005 03:41:37 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id E43293A443E for ; Thu, 6 Jan 2005 03:40:35 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by www.postgresql.com (Postfix) with ESMTP id 85231739541 for ; Thu, 6 Jan 2005 03:39:51 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id A16E83197C; Thu, 6 Jan 2005 04:33:09 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Low Performance for big hospital server .. Date: Wed, 05 Jan 2005 19:31:10 -0800 Organization: Hub.Org Networking Services Lines: 21 Message-ID: References: <1104831107.41da6283add0c@webmail.moph.go.th> <20050104094657.540232d7.frank@wiles.org> <1104939342.41dc094ecb1cf@webmail.moph.go.th> 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: <1104939342.41dc094ecb1cf@webmail.moph.go.th> 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: 200501/54 X-Sequence-Number: 9744 amrit@health2.moph.go.th wrote: > Now I turn hyperthreading off and readjust the conf . I found the bulb query > that was : > update one flag of the table [8 million records which I think not too much] > .When I turned this query off everything went fine. > I don't know whether update the data is much slower than insert [Postgresql > 7.3.2] and how could we improve the update method? UPDATE is expensive. Under a MVCC setup, it's roughtly the equivalent of DELETE + INSERT new record (ie, old record deprecated, new version of record. Updating 8 million records would be very I/O intensive and probably flushes your OS cache so all other queries hit disk versus superfast memory. And if this operation is run multiple times during the day, you may end up with a lot of dead tuples in the table which makes querying it deadly slow. If it's a dead tuples issue, you probably have to increase your freespace map and vacuum analyze that specific table more often. If it's an I/O hit issue, a lazy updating procedure would help if the operation is not time critical (eg. load the record keys that need updating and loop through the records with a time delay.) From pgsql-performance-owner@postgresql.org Thu Jan 6 08:03:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D6D763A1909 for ; Thu, 6 Jan 2005 08:03: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 83812-07 for ; Thu, 6 Jan 2005 08:02:56 +0000 (GMT) Received: from smtp002.bizmail.yahoo.com (smtp002.bizmail.yahoo.com [216.136.172.126]) by svr1.postgresql.org (Postfix) with SMTP id BA89B3A43E4 for ; Thu, 6 Jan 2005 08:02:56 +0000 (GMT) Received: from unknown (HELO ?172.16.22.2?) (ben%viatornetworks.com@213.42.80.183 with plain) by smtp002.bizmail.yahoo.com with SMTP; 6 Jan 2005 08:02:52 -0000 Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.com> Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-performance@postgresql.org From: Ben Bostow Subject: Problems with high traffic Date: Thu, 6 Jan 2005 12:02:49 +0400 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: 200501/55 X-Sequence-Number: 9745 I'm still relatively new to Postgres. I usually just do SQL programming but have found my self having to administer the DB now. I have I have a problem on my website that when there is high amounts of traffic coming from one computer to my web server. I suspect it is because of a virus. But what when I notice this, my processor drops to 0.0% idle with postmaster being my highest CPU user. Under normal circumstances the processor runs >90% idle or <10% used. I have tried tuning postgres but it doesn't seem to make a difference, unless I am doing something wrong. If I would like to find a solution other than rewriting all of my SQL statements and creating them to take the least amount of time to process. From pgsql-performance-owner@postgresql.org Thu Jan 6 12:15:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0252C3A44E2 for ; Thu, 6 Jan 2005 12:15: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 59648-01 for ; Thu, 6 Jan 2005 12:15:33 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3161E3A445F for ; Thu, 6 Jan 2005 12:15:33 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id a36so69007rnf for ; Thu, 06 Jan 2005 04:15:33 -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=qFFJMc6oIfyfWHI90u2eSP/mvMllXTd+t9ltiHH9V4dxEMeXgTnyCZfjn8eiKzUPG3RnMKyK7n9Wwy6CVcNGh1UO7OQRo6sge+elUC7EyoyvHwyDJjgKF/wPqQP9E/ovUTpUR03/kT53MOJZVOygog3m0/l1sHCaknHDZCpiSFc= Received: by 10.38.92.16 with SMTP id p16mr87628rnb; Thu, 06 Jan 2005 04:15:33 -0800 (PST) Received: by 10.38.163.47 with HTTP; Thu, 6 Jan 2005 04:15:33 -0800 (PST) Message-ID: <758d5e7f050106041510f07dc5@mail.gmail.com> Date: Thu, 6 Jan 2005 13:15:33 +0100 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. In-Reply-To: <1104939342.41dc094ecb1cf@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1104831107.41da6283add0c@webmail.moph.go.th> <20050104094657.540232d7.frank@wiles.org> <1104939342.41dc094ecb1cf@webmail.moph.go.th> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/56 X-Sequence-Number: 9746 On Wed, 5 Jan 2005 22:35:42 +0700, amrit@health2.moph.go.th wrote: > Now I turn hyperthreading off and readjust the conf . I found the bulb query > that was : > update one flag of the table [8 million records which I think not too much] Ahh, the huge update. Below are my "hints" I've found while trying to optimize such updates. First of all, does this update really changes this 'flag'? Say, you have update: UPDATE foo SET flag = 4 WHERE [blah]; are you sure, that flag always is different than 4? If not, then add: UPDATE foo SET flag = 4 WHERE flag <> 4 AND [blah]; This makes sure only tuples which actually need the change will receive it. [ IIRC mySQL does this, while PgSQL will always perform UPDATE, regardless if it changes or not ]; Divide the update, if possible. This way query uses less memory and you may call VACUUM inbetween updates. To do this, first SELECT INTO TEMPORARY table the list of rows to update (their ids or something), and then loop through it to update the values. I guess the problem with huge updates is that until the update is finished, the new tuples are not visible, so the old cannot be freed... Regards, Dawid From pgsql-performance-owner@postgresql.org Thu Jan 6 13:07:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8E4BC3A4405 for ; Thu, 6 Jan 2005 13:07: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 70568-01 for ; Thu, 6 Jan 2005 13:06:54 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id A73713A43EE for ; Thu, 6 Jan 2005 13:06:56 +0000 (GMT) Received: (qmail 29195 invoked from network); 6 Jan 2005 13:06:27 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 6 Jan 2005 13:06:27 -0000 Message-ID: <41DD37EB.8050206@fastcrypt.com> Date: Thu, 06 Jan 2005 08:06:51 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ben Bostow Cc: pgsql-performance@postgresql.org Subject: Re: Problems with high traffic References: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.com> In-Reply-To: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.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.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/57 X-Sequence-Number: 9747 Ben Well, we need more information pg version, hardware, memory, etc you may want to turn on log_duration to see exactly which statement is causeing the problem. I'm assuming since it is taking a lot of CPU it will take some time to complete( this may not be true) On your last point, that is where you will get the most optimization, but I'd still use log_duration to make sure optimizing the statement will actually help. dave Ben Bostow wrote: > I'm still relatively new to Postgres. I usually just do SQL > programming but have found my self having to administer the DB now. I > have I have a problem on my website that when there is high amounts of > traffic coming from one computer to my web server. I suspect it is > because of a virus. But what when I notice this, my processor drops to > 0.0% idle with postmaster being my highest CPU user. Under normal > circumstances the processor runs >90% idle or <10% used. I have tried > tuning postgres but it doesn't seem to make a difference, unless I am > doing something wrong. If I would like to find a solution other than > rewriting all of my SQL statements and creating them to take the least > amount of time to process. > > ---------------------------(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 > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Thu Jan 6 13:19:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 740F23A4388 for ; Thu, 6 Jan 2005 13:19: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 73146-01 for ; Thu, 6 Jan 2005 13:19:05 +0000 (GMT) Received: from test.inroomhsia.com (unknown [213.42.80.183]) by svr1.postgresql.org (Postfix) with ESMTP id 2F6083A44D8 for ; Thu, 6 Jan 2005 13:19:04 +0000 (GMT) Received: from [172.16.22.2] (test.inroomhsia.com [127.0.0.1]) by test.inroomhsia.com (8.11.6/8.11.6) with ESMTP id j06HGcv20242; Thu, 6 Jan 2005 21:16:41 +0400 In-Reply-To: <41DD37EB.8050206@fastcrypt.com> References: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.com> <41DD37EB.8050206@fastcrypt.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <7D282078-5FE5-11D9-9915-000D93C56ABE@viatornetworks.com> Content-Transfer-Encoding: 7bit Cc: pgsql-performance@postgresql.org From: Ben Bostow Subject: Re: Problems with high traffic Date: Thu, 6 Jan 2005 17:18:43 +0400 To: pg@fastcrypt.com X-Mailer: Apple Mail (2.619) 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: 200501/58 X-Sequence-Number: 9748 I am running postgresql 7.2.4-5.73, Dual P4, 1GB Ram. The big problem is that I redirect all internal port 80 traffic to my web server so I see all traffic whether it is a virus or not and intended for my server or not. I originally had a problem with running out of memory but I found a bug in my software that kept the DB connection open so the next time a new connection was made on top of that. As soon as I removed that I started getting the processor problem. I am working on patching my kernel to have the string matching and other new iptables features to limit the virus traffic but I would like to figure the Processor problem out as I am working on moving everything to the 2.6 kernel when RedHat finalizes their release. I am not familular with many of the logging features of postgres just the outputing the output to a file instead of /dev/null. Benjamin On Jan 6, 2005, at 5:06 PM, Dave Cramer wrote: > Ben > > Well, we need more information > > pg version, hardware, memory, etc > > you may want to turn on log_duration to see exactly which statement is > causeing the problem. I'm assuming since it is taking a lot of CPU it > will take some time to complete( this may not be true) > > On your last point, that is where you will get the most optimization, > but I'd still use log_duration to make sure optimizing the statement > will actually help. > > dave > > Ben Bostow wrote: > >> I'm still relatively new to Postgres. I usually just do SQL >> programming but have found my self having to administer the DB now. >> I have I have a problem on my website that when there is high amounts >> of traffic coming from one computer to my web server. I suspect it is >> because of a virus. But what when I notice this, my processor drops >> to 0.0% idle with postmaster being my highest CPU user. Under normal >> circumstances the processor runs >90% idle or <10% used. I have tried >> tuning postgres but it doesn't seem to make a difference, unless I am >> doing something wrong. If I would like to find a solution other than >> rewriting all of my SQL statements and creating them to take the >> least amount of time to process. >> >> ---------------------------(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 >> >> > > -- > Dave Cramer > http://www.postgresintl.com > 519 939 0336 > ICQ#14675561 > From pgsql-performance-owner@postgresql.org Thu Jan 6 13:20:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B0843A4449 for ; Thu, 6 Jan 2005 13:20: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 73354-03 for ; Thu, 6 Jan 2005 13:19:49 +0000 (GMT) Received: from webserver.squadra.com.br (webserver.squadra.com.br [200.162.92.46]) by svr1.postgresql.org (Postfix) with ESMTP id B4E773A4398 for ; Thu, 6 Jan 2005 13:19:51 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by webserver.squadra.com.br (Postfix) with ESMTP id 74C1221B5A for ; Thu, 6 Jan 2005 11:19:50 -0200 (BRST) Received: from proxy.squadra.com.br (proxy.squadra.com.br [192.168.0.1]) by webserver.squadra.com.br (Postfix) with ESMTP id E72F611546 for ; Thu, 6 Jan 2005 11:19:49 -0200 (BRST) Received: from [192.168.2.21] (proj11.squadra.com.br [192.168.2.21]) by proxy.squadra.com.br (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id j06DJm522187 for ; Thu, 6 Jan 2005 11:19:48 -0200 Message-ID: <41DD3AF7.6000202@squadra.com.br> Date: Thu, 06 Jan 2005 11:19:51 -0200 From: Vinicius Caldeira Carvalho User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: first postgrreSQL tunning Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by SQUADRA Anti-virus X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/59 X-Sequence-Number: 9749 Hi there! I'm doing my first tunning on my postgreSQL, my server is for a small app, largest table shall never exceed 10k rows, and less than 1k transactions/day. So I don't think I should run out of resources. The machine is a Fedora Core 3.0 with 1gb ran and kernel 2.6. I'm thinking in having 50 connections limit, so besides semaphores should I do anything special on kernel parameters. The app is so small that during late night time almost no one will access so, I'm thinking in full vacuuming it every day at 1:00AM. Any tips are very very welcome :D Thanks all From pgsql-performance-owner@postgresql.org Thu Jan 6 13:33:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A74FA3A44D8 for ; Thu, 6 Jan 2005 13:32: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 75375-10 for ; Thu, 6 Jan 2005 13:32:47 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 4B05B3A4449 for ; Thu, 6 Jan 2005 13:32:49 +0000 (GMT) Received: (qmail 29579 invoked from network); 6 Jan 2005 13:32:21 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 6 Jan 2005 13:32:21 -0000 Message-ID: <41DD3DF9.1090004@fastcrypt.com> Date: Thu, 06 Jan 2005 08:32:41 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ben Bostow Cc: pgsql-performance@postgresql.org Subject: Re: Problems with high traffic References: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.com> <41DD37EB.8050206@fastcrypt.com> <7D282078-5FE5-11D9-9915-000D93C56ABE@viatornetworks.com> In-Reply-To: <7D282078-5FE5-11D9-9915-000D93C56ABE@viatornetworks.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.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/60 X-Sequence-Number: 9750 Ben, Hmmm... ok 7.2.4 is quite old now and log_duration doesn't exist in the logging. You will see an immediate performance benefit just by moving to 7.4.x, but I'll bet that's not a reasonable path for you. in postgresql.conf you can change the logging to: log_pid=true log_duration=true log_statement=true syslog=2 ; to log to syslog Then in syslogd.conf add local0.none to the /var/log/messages line to stop logging to messages redirect local0.* to /var/log/postgres ; this step isn't really necesssary but will keep postgres logs separate HUP syslogd restart postgres Then you should be able to see which statements are taking the longest. Why do random hits to your web server cause postgres activity? Is your site dynamically created from the database ? Dave Ben Bostow wrote: > I am running postgresql 7.2.4-5.73, Dual P4, 1GB Ram. The big problem > is that I redirect all internal port 80 traffic to my web server so I > see all traffic whether it is a virus or not and intended for my > server or not. I originally had a problem with running out of memory > but I found a bug in my software that kept the DB connection open so > the next time a new connection was made on top of that. As soon as I > removed that I started getting the processor problem. I am working on > patching my kernel to have the string matching and other new iptables > features to limit the virus traffic but I would like to figure the > Processor problem out as I am working on moving everything to the 2.6 > kernel when RedHat finalizes their release. > > I am not familular with many of the logging features of postgres just > the outputing the output to a file instead of /dev/null. > > Benjamin > > On Jan 6, 2005, at 5:06 PM, Dave Cramer wrote: > >> Ben >> >> Well, we need more information >> >> pg version, hardware, memory, etc >> >> you may want to turn on log_duration to see exactly which statement >> is causeing the problem. I'm assuming since it is taking a lot of CPU >> it will take some time to complete( this may not be true) >> >> On your last point, that is where you will get the most optimization, >> but I'd still use log_duration to make sure optimizing the statement >> will actually help. >> >> dave >> >> Ben Bostow wrote: >> >>> I'm still relatively new to Postgres. I usually just do SQL >>> programming but have found my self having to administer the DB now. >>> I have I have a problem on my website that when there is high >>> amounts of traffic coming from one computer to my web server. I >>> suspect it is because of a virus. But what when I notice this, my >>> processor drops to 0.0% idle with postmaster being my highest CPU >>> user. Under normal circumstances the processor runs >90% idle or >>> <10% used. I have tried tuning postgres but it doesn't seem to make >>> a difference, unless I am doing something wrong. If I would like to >>> find a solution other than rewriting all of my SQL statements and >>> creating them to take the least amount of time to process. >>> >>> ---------------------------(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 >>> >>> >> >> -- >> Dave Cramer >> http://www.postgresintl.com >> 519 939 0336 >> ICQ#14675561 >> > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Thu Jan 6 13:34:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D106C3A41E1 for ; Thu, 6 Jan 2005 13:34: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 77087-01 for ; Thu, 6 Jan 2005 13:34:20 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 3129E3A450F for ; Thu, 6 Jan 2005 13:34:22 +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: Re: first postgrreSQL tunning Date: Thu, 6 Jan 2005 08:34:23 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A7595@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] first postgrreSQL tunning Thread-Index: AcTz83LO/j0aX8I+Q9qG6APAqQi7LQAADBgw From: "Merlin Moncure" To: "Vinicius Caldeira Carvalho" Cc: 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: 200501/61 X-Sequence-Number: 9751 > Hi there! I'm doing my first tunning on my postgreSQL, my server is for > a small app, largest table shall never exceed 10k rows, and less than 1k > transactions/day. So I don't think I should run out of resources. The > machine is a Fedora Core 3.0 with 1gb ran and kernel 2.6. I'm thinking > in having 50 connections limit, so besides semaphores should I do > anything special on kernel parameters. The app is so small that during > late night time almost no one will access so, I'm thinking in full > vacuuming it every day at 1:00AM. The biggest danger with small databases is it's easy to become overconfident...writing poor queries and such and not properly indexing. 50 users can hit your system pretty hard if they all decide to do something at once. Aside from that, just remember to bump up work_mem a bit for fast joining. Your application may be small, but if it is written well and works, it well inevitably become larger and more complex, so plan for the future :) Merlin From pgsql-performance-owner@postgresql.org Thu Jan 6 13:46:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F35D3A44FE for ; Thu, 6 Jan 2005 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 79122-10 for ; Thu, 6 Jan 2005 13:46:37 +0000 (GMT) Received: from webserver.squadra.com.br (webserver.squadra.com.br [200.162.92.46]) by svr1.postgresql.org (Postfix) with ESMTP id 8278C3A445F for ; Thu, 6 Jan 2005 13:46:39 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by webserver.squadra.com.br (Postfix) with ESMTP id 4876B21BC6 for ; Thu, 6 Jan 2005 11:46:37 -0200 (BRST) Received: from proxy.squadra.com.br (proxy.squadra.com.br [192.168.0.1]) by webserver.squadra.com.br (Postfix) with ESMTP id AFB7E11547 for ; Thu, 6 Jan 2005 11:46:36 -0200 (BRST) Received: from [192.168.2.21] (proj11.squadra.com.br [192.168.2.21]) by proxy.squadra.com.br (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id j06Dka522361 for ; Thu, 6 Jan 2005 11:46:36 -0200 Message-ID: <41DD413D.6000009@squadra.com.br> Date: Thu, 06 Jan 2005 11:46:37 -0200 From: Vinicius Caldeira Carvalho User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: first postgrreSQL tunning References: <6EE64EF3AB31D5448D0007DD34EEB3412A7595@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A7595@Herge.rcsinc.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by SQUADRA Anti-virus X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/62 X-Sequence-Number: 9752 Merlin Moncure wrote: >>Hi there! I'm doing my first tunning on my postgreSQL, my server is >> >> >for > > >>a small app, largest table shall never exceed 10k rows, and less than >> >> >1k > > >>transactions/day. So I don't think I should run out of resources. The >>machine is a Fedora Core 3.0 with 1gb ran and kernel 2.6. I'm thinking >>in having 50 connections limit, so besides semaphores should I do >>anything special on kernel parameters. The app is so small that during >>late night time almost no one will access so, I'm thinking in full >>vacuuming it every day at 1:00AM. >> >> > >The biggest danger with small databases is it's easy to become >overconfident...writing poor queries and such and not properly indexing. >50 users can hit your system pretty hard if they all decide to do >something at once. Aside from that, just remember to bump up work_mem a >bit for fast joining. > >Your application may be small, but if it is written well and works, it >well inevitably become larger and more complex, so plan for the future >:) > >Merlin > > >---------------------------(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 > > > > Thanks Merlin, besides what I said of tunning anything else I should care looking at? From pgsql-performance-owner@postgresql.org Thu Jan 6 13:58:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B87383A41E1 for ; Thu, 6 Jan 2005 13:58: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 82168-06 for ; Thu, 6 Jan 2005 13:57:57 +0000 (GMT) Received: from test.inroomhsia.com (unknown [213.42.80.183]) by svr1.postgresql.org (Postfix) with ESMTP id 5B48B3A433F for ; Thu, 6 Jan 2005 13:57:55 +0000 (GMT) Received: from [172.16.22.2] (test.inroomhsia.com [127.0.0.1]) by test.inroomhsia.com (8.11.6/8.11.6) with ESMTP id j06Htcv24134; Thu, 6 Jan 2005 21:55:41 +0400 In-Reply-To: <41DD3DF9.1090004@fastcrypt.com> References: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.com> <41DD37EB.8050206@fastcrypt.com> <7D282078-5FE5-11D9-9915-000D93C56ABE@viatornetworks.com> <41DD3DF9.1090004@fastcrypt.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 From: Ben Bostow Subject: Re: Problems with high traffic Date: Thu, 6 Jan 2005 17:57:38 +0400 To: pg@fastcrypt.com X-Mailer: Apple Mail (2.619) 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: 200501/63 X-Sequence-Number: 9753 I know 7.2 is old I'm trying to fix this in the mean time moving everything to the latest Linux software when RedHat releases the enterprise with 2.6. Postgres complains about log_duration and log_statement are they a different name under 7.2? Is there documentation on the type of logging the postgres can do? I can't seem to find it in the 7.2 docs. If you know of any good resources for Postgres in administering and tuning I would like to know. Benjamin On Jan 6, 2005, at 5:32 PM, Dave Cramer wrote: > Ben, > > Hmmm... ok 7.2.4 is quite old now and log_duration doesn't exist in > the logging. You will see an immediate performance benefit just by > moving to 7.4.x, but I'll bet that's not a reasonable path for you. > > in postgresql.conf you can change the logging to: > > log_pid=true > log_duration=true > log_statement=true > > syslog=2 ; to log to syslog > > Then in syslogd.conf > > add local0.none to the /var/log/messages line to stop logging to > messages > redirect local0.* to /var/log/postgres ; this step isn't really > necesssary but will keep postgres logs separate > > HUP syslogd > > restart postgres > > Then you should be able to see which statements are taking the longest. > > Why do random hits to your web server cause postgres activity? Is your > site dynamically created from the database ? > > Dave > > Ben Bostow wrote: > >> I am running postgresql 7.2.4-5.73, Dual P4, 1GB Ram. The big problem >> is that I redirect all internal port 80 traffic to my web server so I >> see all traffic whether it is a virus or not and intended for my >> server or not. I originally had a problem with running out of memory >> but I found a bug in my software that kept the DB connection open so >> the next time a new connection was made on top of that. As soon as I >> removed that I started getting the processor problem. I am working on >> patching my kernel to have the string matching and other new iptables >> features to limit the virus traffic but I would like to figure the >> Processor problem out as I am working on moving everything to the 2.6 >> kernel when RedHat finalizes their release. >> >> I am not familular with many of the logging features of postgres just >> the outputing the output to a file instead of /dev/null. >> >> Benjamin >> >> On Jan 6, 2005, at 5:06 PM, Dave Cramer wrote: >> >>> Ben >>> >>> Well, we need more information >>> >>> pg version, hardware, memory, etc >>> >>> you may want to turn on log_duration to see exactly which statement >>> is causeing the problem. I'm assuming since it is taking a lot of >>> CPU it will take some time to complete( this may not be true) >>> >>> On your last point, that is where you will get the most >>> optimization, but I'd still use log_duration to make sure optimizing >>> the statement will actually help. >>> >>> dave >>> >>> Ben Bostow wrote: >>> >>>> I'm still relatively new to Postgres. I usually just do SQL >>>> programming but have found my self having to administer the DB now. >>>> I have I have a problem on my website that when there is high >>>> amounts of traffic coming from one computer to my web server. I >>>> suspect it is because of a virus. But what when I notice this, my >>>> processor drops to 0.0% idle with postmaster being my highest CPU >>>> user. Under normal circumstances the processor runs >90% idle or >>>> <10% used. I have tried tuning postgres but it doesn't seem to make >>>> a difference, unless I am doing something wrong. If I would like to >>>> find a solution other than rewriting all of my SQL statements and >>>> creating them to take the least amount of time to process. >>>> >>>> ---------------------------(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 >>>> >>>> >>> >>> -- >>> Dave Cramer >>> http://www.postgresintl.com >>> 519 939 0336 >>> ICQ#14675561 >>> >> >> >> > > -- > Dave Cramer > http://www.postgresintl.com > 519 939 0336 > ICQ#14675561 > From pgsql-performance-owner@postgresql.org Thu Jan 6 15:17:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A54E73A41E1 for ; Thu, 6 Jan 2005 15:17: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 98331-05 for ; Thu, 6 Jan 2005 15:17:27 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 5BD943A42E4 for ; Thu, 6 Jan 2005 15:17:30 +0000 (GMT) Received: (qmail 30628 invoked from network); 6 Jan 2005 15:17:02 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 6 Jan 2005 15:17:02 -0000 Message-ID: <41DD5658.70803@fastcrypt.com> Date: Thu, 06 Jan 2005 10:16:40 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ben Bostow Cc: pgsql-performance@postgresql.org Subject: Re: Problems with high traffic References: <5BE6686A-5FB9-11D9-9915-000D93C56ABE@viatornetworks.com> <41DD37EB.8050206@fastcrypt.com> <7D282078-5FE5-11D9-9915-000D93C56ABE@viatornetworks.com> <41DD3DF9.1090004@fastcrypt.com> In-Reply-To: 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.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/64 X-Sequence-Number: 9754 Ben, It turns out that 7.2 has neither of those options you will have to set the debug_level to something higher than 0 and less than 4 to get information out. I'm afraid I'm not sure which value will give you what you are looking for. The link below explains what is available, and it isn't much :( http://www.postgresql.org/docs/7.2/static/runtime-config.html#LOGGING Dave Ben Bostow wrote: > I know 7.2 is old I'm trying to fix this in the mean time moving > everything to the latest Linux software when RedHat releases the > enterprise with 2.6. Postgres complains about log_duration and > log_statement are they a different name under 7.2? Is there > documentation on the type of logging the postgres can do? I can't seem > to find it in the 7.2 docs. If you know of any good resources for > Postgres in administering and tuning I would like to know. > > Benjamin > > On Jan 6, 2005, at 5:32 PM, Dave Cramer wrote: > >> Ben, >> >> Hmmm... ok 7.2.4 is quite old now and log_duration doesn't exist in >> the logging. You will see an immediate performance benefit just by >> moving to 7.4.x, but I'll bet that's not a reasonable path for you. >> >> in postgresql.conf you can change the logging to: >> >> log_pid=true >> log_duration=true >> log_statement=true >> >> syslog=2 ; to log to syslog >> >> Then in syslogd.conf >> >> add local0.none to the /var/log/messages line to stop logging to >> messages >> redirect local0.* to /var/log/postgres ; this step isn't really >> necesssary but will keep postgres logs separate >> >> HUP syslogd >> >> restart postgres >> >> Then you should be able to see which statements are taking the longest. >> >> Why do random hits to your web server cause postgres activity? Is >> your site dynamically created from the database ? >> >> Dave >> >> Ben Bostow wrote: >> >>> I am running postgresql 7.2.4-5.73, Dual P4, 1GB Ram. The big >>> problem is that I redirect all internal port 80 traffic to my web >>> server so I see all traffic whether it is a virus or not and >>> intended for my server or not. I originally had a problem with >>> running out of memory but I found a bug in my software that kept the >>> DB connection open so the next time a new connection was made on top >>> of that. As soon as I removed that I started getting the processor >>> problem. I am working on patching my kernel to have the string >>> matching and other new iptables features to limit the virus traffic >>> but I would like to figure the Processor problem out as I am working >>> on moving everything to the 2.6 kernel when RedHat finalizes their >>> release. >>> >>> I am not familular with many of the logging features of postgres >>> just the outputing the output to a file instead of /dev/null. >>> >>> Benjamin >>> >>> On Jan 6, 2005, at 5:06 PM, Dave Cramer wrote: >>> >>>> Ben >>>> >>>> Well, we need more information >>>> >>>> pg version, hardware, memory, etc >>>> >>>> you may want to turn on log_duration to see exactly which statement >>>> is causeing the problem. I'm assuming since it is taking a lot of >>>> CPU it will take some time to complete( this may not be true) >>>> >>>> On your last point, that is where you will get the most >>>> optimization, but I'd still use log_duration to make sure >>>> optimizing the statement will actually help. >>>> >>>> dave >>>> >>>> Ben Bostow wrote: >>>> >>>>> I'm still relatively new to Postgres. I usually just do SQL >>>>> programming but have found my self having to administer the DB >>>>> now. I have I have a problem on my website that when there is >>>>> high amounts of traffic coming from one computer to my web server. >>>>> I suspect it is because of a virus. But what when I notice this, >>>>> my processor drops to 0.0% idle with postmaster being my highest >>>>> CPU user. Under normal circumstances the processor runs >90% idle >>>>> or <10% used. I have tried tuning postgres but it doesn't seem to >>>>> make a difference, unless I am doing something wrong. If I would >>>>> like to find a solution other than rewriting all of my SQL >>>>> statements and creating them to take the least amount of time to >>>>> process. >>>>> >>>>> ---------------------------(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 >>>>> >>>>> >>>> >>>> -- >>>> Dave Cramer >>>> http://www.postgresintl.com >>>> 519 939 0336 >>>> ICQ#14675561 >>>> >>> >>> >>> >> >> -- >> Dave Cramer >> http://www.postgresintl.com >> 519 939 0336 >> ICQ#14675561 >> > > > ---------------------------(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 > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Thu Jan 6 15:51:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BCE1E3A4490 for ; Thu, 6 Jan 2005 15:51: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 03879-06 for ; Thu, 6 Jan 2005 15:51:02 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id AE06D3A42E4 for ; Thu, 6 Jan 2005 15:51:04 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j06FphOt006583; Thu, 6 Jan 2005 09:51:44 -0600 Date: Thu, 6 Jan 2005 09:52:19 -0600 From: Frank Wiles To: Vinicius Caldeira Carvalho Cc: pgsql-performance@postgresql.org Subject: Re: first postgrreSQL tunning Message-Id: <20050106095219.5a690860.frank@wiles.org> In-Reply-To: <41DD3AF7.6000202@squadra.com.br> References: <41DD3AF7.6000202@squadra.com.br> 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: 200501/65 X-Sequence-Number: 9755 On Thu, 06 Jan 2005 11:19:51 -0200 Vinicius Caldeira Carvalho wrote: > Hi there! I'm doing my first tunning on my postgreSQL, my server is > for a small app, largest table shall never exceed 10k rows, and less > than 1k transactions/day. So I don't think I should run out of > resources. The machine is a Fedora Core 3.0 with 1gb ran and kernel > 2.6. I'm thinking in having 50 connections limit, so besides > semaphores should I do anything special on kernel parameters. The app > is so small that during late night time almost no one will access so, > I'm thinking in full vacuuming it every day at 1:00AM. > > Any tips are very very welcome :D You'll want to tune shared_buffers and sort_mem. Possibly also effective_cache_size. It really depends on your system. Having tuned a ton of apps to work with PostgreSQL what I usually do is write a small script that does the major resource intensive queries on the database and time it. Tweak a PostgreSQL parameter and re-run, wash, rinse, repeat until I get what I believe is the best performance I can. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Jan 6 16:32:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4AC9B3A45A0 for ; Thu, 6 Jan 2005 16: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 13249-08 for ; Thu, 6 Jan 2005 16:32:18 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id A8F073A4590 for ; Thu, 6 Jan 2005 16:32:16 +0000 (GMT) Received: (qmail 4850 invoked from network); 6 Jan 2005 16:34:47 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 6 Jan 2005 16:34:47 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 02544-48 for ; Thu, 6 Jan 2005 23:34:44 +0700 (ICT) Received: (qmail 4828 invoked from network); 6 Jan 2005 16:34:44 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 6 Jan 2005 16:34:44 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Thu, 6 Jan 2005 23:34:43 +0700 Message-ID: <1105029283.41dd68a3ead99@webmail.moph.go.th> Date: Thu, 6 Jan 2005 23:34:43 +0700 From: amrit@health2.moph.go.th To: Dawid Kuroczko Cc: PGsql-performance Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> <20050104094657.540232d7.frank@wiles.org> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> In-Reply-To: <758d5e7f050106041510f07dc5@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/66 X-Sequence-Number: 9756 > Ahh, the huge update. Below are my "hints" I've > found while trying to optimize such updates. > > First of all, does this update really changes this 'flag'? > Say, you have update: > UPDATE foo SET flag = 4 WHERE [blah]; > are you sure, that flag always is different than 4? > If not, then add: > UPDATE foo SET flag = 4 WHERE flag <> 4 AND [blah]; > This makes sure only tuples which actually need the change will > receive it. [ IIRC mySQL does this, while PgSQL will always perform > UPDATE, regardless if it changes or not ]; > > Divide the update, if possible. This way query uses > less memory and you may call VACUUM inbetween > updates. To do this, first SELECT INTO TEMPORARY > table the list of rows to update (their ids or something), > and then loop through it to update the values. > > I guess the problem with huge updates is that > until the update is finished, the new tuples are > not visible, so the old cannot be freed... Yes, very good point I must try this and I will give you the result , thanks a lot. Amrit Thailand From pgsql-performance-owner@postgresql.org Thu Jan 6 16:58:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1356D3A4547 for ; Thu, 6 Jan 2005 16:58: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 17815-04 for ; Thu, 6 Jan 2005 16:58:04 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id C04043A45A8 for ; Thu, 6 Jan 2005 16:58: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 6873270; Thu, 06 Jan 2005 08:59:42 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org, Miles Keaton Subject: Re: Benchmark two separate SELECTs versus one LEFT JOIN Date: Thu, 6 Jan 2005 08:57:56 -0800 User-Agent: KMail/1.6.2 References: <59b2d39b0501051831643e90f2@mail.gmail.com> In-Reply-To: <59b2d39b0501051831643e90f2@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501060857.56812.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/67 X-Sequence-Number: 9757 Miles, > I only have a laptop here so I can't really benchmark properly. > I'm hoping maybe someone else has, or just knows which would be faster > under high traffic/quantity. Well, it's really a difference between round-trip time vs. the time required to compute the join. If your database is setup correctly, the 2nd should be faster. However, it should be very easy to test .... -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jan 6 17:07:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2D3F83A4573 for ; Thu, 6 Jan 2005 17: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 17955-07 for ; Thu, 6 Jan 2005 17:07:06 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 375113A4590 for ; Thu, 6 Jan 2005 17:07:05 +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 6873317 for pgsql-performance@postgresql.org; Thu, 06 Jan 2005 09:08:42 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. Date: Thu, 6 Jan 2005 09:06:55 -0800 User-Agent: KMail/1.6.2 References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> In-Reply-To: <758d5e7f050106041510f07dc5@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501060906.55832.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/68 X-Sequence-Number: 9758 Dawid, > Ahh, the huge update. Below are my "hints" I've > found while trying to optimize such updates. > Divide the update, if possible. This way query uses > less memory and you may call VACUUM inbetween > updates. To do this, first SELECT INTO TEMPORARY > table the list of rows to update (their ids or something), > and then loop through it to update the values. There are other ways to deal as well -- one by normalizing the database. Often, I find that massive updates like this are caused by a denormalized database. For example, Lyris stores its "mailing numbers" only as repeated numbers in the recipients table. When a mailing is complete, Lyris updates all of the recipients .... up to 750,000 rows in the case of my client ... to indicate the completion of the mailing (it's actually a little more complicated than that, but the essential problem is the example) It would be far better for Lyris to use a seperate mailings table, with a status in that table ... which would then require only *one* update row to indicate completion, instead of 750,000. I can't tell you how many times I've seen this sort of thing. And the developers always tell me "Well, we denormalized for performance reasons ... " -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jan 6 17:11:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C3A93A4562 for ; Thu, 6 Jan 2005 17:11: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 20304-09 for ; Thu, 6 Jan 2005 17:11:02 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id B94B13A4590 for ; Thu, 6 Jan 2005 17:10:55 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j06HBWws006757; Thu, 6 Jan 2005 11:11:32 -0600 Date: Thu, 6 Jan 2005 11:12:07 -0600 From: Frank Wiles To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. Message-Id: <20050106111207.52e39d04.frank@wiles.org> In-Reply-To: <200501060906.55832.josh@agliodbs.com> References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> <200501060906.55832.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: 200501/69 X-Sequence-Number: 9759 On Thu, 6 Jan 2005 09:06:55 -0800 Josh Berkus wrote: > I can't tell you how many times I've seen this sort of thing. And > the developers always tell me "Well, we denormalized for performance > reasons ... " Now that's rich. I don't think I've ever seen a database perform worse after it was normalized. In fact, I can't even think of a situation where it could! --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Jan 6 17:36:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1EB2A3A45FB for ; Thu, 6 Jan 2005 17:36: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 25737-05 for ; Thu, 6 Jan 2005 17:35:43 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id A170A3A47FC for ; Thu, 6 Jan 2005 17:35:42 +0000 (GMT) Received: (qmail 31984 invoked from network); 6 Jan 2005 17:35:12 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 6 Jan 2005 17:35:12 -0000 Message-ID: <41DD76E5.1090806@fastcrypt.com> Date: Thu, 06 Jan 2005 12:35:33 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frank Wiles Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> In-Reply-To: <20050106111207.52e39d04.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.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/70 X-Sequence-Number: 9760 Reading can be worse for a normalized db, which is likely what the developers were concerned about. One always have to be careful to measure the right thing. Dave Frank Wiles wrote: >On Thu, 6 Jan 2005 09:06:55 -0800 >Josh Berkus wrote: > > > >>I can't tell you how many times I've seen this sort of thing. And >>the developers always tell me "Well, we denormalized for performance >>reasons ... " >> >> > > Now that's rich. I don't think I've ever seen a database perform > worse after it was normalized. In fact, I can't even think of a > situation where it could! > > --------------------------------- > Frank Wiles > http://www.wiles.org > --------------------------------- > > >---------------------------(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 > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Thu Jan 6 17:39:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A14F33A499F for ; Thu, 6 Jan 2005 17:39: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 26057-06 for ; Thu, 6 Jan 2005 17:39:04 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id C3A423A41E1 for ; Thu, 6 Jan 2005 17:38: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 6873502; Thu, 06 Jan 2005 09:40:37 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Denormalization WAS: Low Performance for big hospital server .. Date: Thu, 6 Jan 2005 09:38:45 -0800 User-Agent: KMail/1.6.2 Cc: Frank Wiles References: <1104831107.41da6283add0c@webmail.moph.go.th> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> In-Reply-To: <20050106111207.52e39d04.frank@wiles.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501060938.45688.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/71 X-Sequence-Number: 9761 Frank, > Now that's rich. I don't think I've ever seen a database perform > worse after it was normalized. In fact, I can't even think of a > situation where it could! Oh, there are some. For example, Primer's issues around his dating database; it turned out that a fully normalized design resulted in very bad select performance because of the number of joins involved. Of course, the method that did perform well was *not* a simple denormalization, either. The issue with denormalization is, I think, that a lot of developers cut their teeth on the likes of MS Access, Sybase 2 or Informix 1.0, where a poor-performing join often didn't complete at all. As a result, they got into the habit of "preemptive tuning"; that is, doing things "for performance reasons" when the system was still in the design phase, before they even know what the performance issues *were*. Not that this was a good practice even then, but the average software project allocates grossly inadequate time for testing, so you can see how it became a bad habit. And most younger DBAs learn their skills on the job from the older DBAs, so the misinformation gets passed down. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jan 6 17:53:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5636F3A41E1 for ; Thu, 6 Jan 2005 17:53: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 28195-07 for ; Thu, 6 Jan 2005 17:52:51 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id BEF943A460E for ; Thu, 6 Jan 2005 17:52:45 +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 97CF476A28; Thu, 6 Jan 2005 12:52:47 -0500 (EST) Subject: Re: Low Performance for big hospital server .. From: Rod Taylor To: pg@fastcrypt.com Cc: Frank Wiles , Josh Berkus , Postgresql Performance In-Reply-To: <41DD76E5.1090806@fastcrypt.com> References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> <41DD76E5.1090806@fastcrypt.com> Content-Type: text/plain Date: Thu, 06 Jan 2005 12:51:14 -0500 Message-Id: <1105033874.56556.24.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: 200501/72 X-Sequence-Number: 9762 On Thu, 2005-01-06 at 12:35 -0500, Dave Cramer wrote: > Reading can be worse for a normalized db, which is likely what the > developers were concerned about. To a point. Once you have enough data that you start running out of space in memory then normalization starts to rapidly gain ground again because it's often smaller in size and won't hit the disk as much. Moral of the story is don't tune with a smaller database than you expect to have. > Frank Wiles wrote: > > >On Thu, 6 Jan 2005 09:06:55 -0800 > >Josh Berkus wrote: > > > > > > > >>I can't tell you how many times I've seen this sort of thing. And > >>the developers always tell me "Well, we denormalized for performance > >>reasons ... " > >> > >> > > > > Now that's rich. I don't think I've ever seen a database perform > > worse after it was normalized. In fact, I can't even think of a > > situation where it could! > > > > --------------------------------- > > Frank Wiles > > http://www.wiles.org > > --------------------------------- > > > > > >---------------------------(end of broadcast)--------------------------- > >TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > > > > > > > > -- From pgsql-performance-owner@postgresql.org Thu Jan 6 18:24:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F09E43A49E7 for ; Thu, 6 Jan 2005 18: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 35220-07 for ; Thu, 6 Jan 2005 18:23:35 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id D124B3A4767 for ; Thu, 6 Jan 2005 18:23:31 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j06IO5in006933; Thu, 6 Jan 2005 12:24:05 -0600 Date: Thu, 6 Jan 2005 12:24:40 -0600 From: Frank Wiles To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: Denormalization WAS: Low Performance for big hospital Message-Id: <20050106122440.4b64fc3d.frank@wiles.org> In-Reply-To: <200501060938.45688.josh@agliodbs.com> References: <1104831107.41da6283add0c@webmail.moph.go.th> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> <200501060938.45688.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: 200501/73 X-Sequence-Number: 9763 On Thu, 6 Jan 2005 09:38:45 -0800 Josh Berkus wrote: > Frank, > > > Now that's rich. I don't think I've ever seen a database perform > > worse after it was normalized. In fact, I can't even think of a > > situation where it could! > > Oh, there are some. For example, Primer's issues around his dating > database; it turned out that a fully normalized design resulted in > very bad select performance because of the number of joins involved. > Of course, the method that did perform well was *not* a simple > denormalization, either. > > The issue with denormalization is, I think, that a lot of developers > cut their teeth on the likes of MS Access, Sybase 2 or Informix 1.0, > where a poor-performing join often didn't complete at all. As a > result, they got into the habit of "preemptive tuning"; that is, doing > things "for performance reasons" when the system was still in the > design phase, before they even know what the performance issues > *were*. > > Not that this was a good practice even then, but the average software > project allocates grossly inadequate time for testing, so you can see > how it became a bad habit. And most younger DBAs learn their skills > on the job from the older DBAs, so the misinformation gets passed > down. Yeah the more I thought about it I had a fraud detection system I built for a phone company years ago that when completely normalized couldn't get the sub-second response the users wanted. It was Oracle and we didn't have the best DBA in the world. I ended up having to push about 20% of the deep call details into flat files and surprisingly enough it was faster to grep the flat files than use the database, because as was previously mentioned all of the joins. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Thu Jan 6 18:45:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C3B93A4A4F; Thu, 6 Jan 2005 18:45: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 39473-08; Thu, 6 Jan 2005 18:45:07 +0000 (GMT) Received: from tus-gate4.raytheon.com (tus-gate4.raytheon.com [199.46.245.233]) by svr1.postgresql.org (Postfix) with ESMTP id BFF143A4580; Thu, 6 Jan 2005 18:44:15 +0000 (GMT) Received: from ds02t00.directory.ray.com (ds02t00.directory.ray.com [147.25.154.117]) by tus-gate4.raytheon.com (8.12.10/8.12.10) with ESMTP id j06Ii8Lg027872; Thu, 6 Jan 2005 11:44:08 -0700 (MST) Received: from ds02t00 (localhost [127.0.0.1]) by ds02t00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j06Ihi62021769; Thu, 6 Jan 2005 18:43:45 GMT Received: from ds02t00.directory.ray.com with LMTP by ds02t00 (2.0.6/sieved-2-0-build-559); Thu, 6 Jan 2005 18:43:44 +0000 Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com [151.168.145.35]) by ds02t00.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j06Ih1tm021471 sender Richard_D_Levine@raytheon.com; Thu, 6 Jan 2005 18:43:05 GMT Subject: Re: Low Performance for big hospital server .. To: Frank Wiles Cc: Josh Berkus , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001 Message-ID: From: Richard_D_Levine@raytheon.com Date: Thu, 6 Jan 2005 13:33:00 -0500 X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, 2004) at 01/06/2005 01:43:05 PM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-SPAM: 0.00 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.181 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200501/74 X-Sequence-Number: 9764 In my younger days I denormalized a database for performance reasons and have been paid for it dearly with increased maintenance costs. Adding enhanced capabilities and new functionality will render denormalization worse than useless quickly. --Rick Frank Wiles To: Josh Berkus Sent by: cc: pgsql-performance@postgresql.org pgsql-performance-owner@pos Subject: Re: [PERFORM] Low Performance for big hospital server .. tgresql.org 01/06/2005 12:12 PM On Thu, 6 Jan 2005 09:06:55 -0800 Josh Berkus wrote: > I can't tell you how many times I've seen this sort of thing. And > the developers always tell me "Well, we denormalized for performance > reasons ... " Now that's rich. I don't think I've ever seen a database perform worse after it was normalized. In fact, I can't even think of a situation where it could! --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- ---------------------------(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 Sun Jan 9 09:56:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4F9413A45D3 for ; Thu, 6 Jan 2005 19:02: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 45625-03 for ; Thu, 6 Jan 2005 19:01:41 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 23B433A45EF for ; Thu, 6 Jan 2005 19:01:42 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B707431981; Thu, 6 Jan 2005 20:01:41 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: PostgreSQL vs. Oracle vs. Microsoft Date: Thu, 6 Jan 2005 19:01:38 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 21 Message-ID: X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/98 X-Sequence-Number: 9788 I'm looking for recent performance statistics on PostgreSQL vs. Oracle vs. Microsoft SQL Server. Recently someone has been trying to convince my client to switch from SyBASE to Microsoft SQL Server (they originally wanted to go with Oracle but have since fallen in love with Microsoft). All this time I've been recommending PostgreSQL for cost and stability (my own testing has shown it to be better at handling abnormal shutdowns and using fewer system resources) in addition to true cross-platform compatibility. If I can show my client some statistics that PostgreSQL outperforms these (I'm more concerned about it beating Oracle because I know that Microsoft's stuff is always slower, but I need the information anyway to protect my client from falling victim to a 'sales job'), then PostgreSQL will be the solution of choice as the client has always believed that they need a high-performance solution. I've already convinced them on the usual price, cross-platform compatibility, open source, long history, etc. points, and I've been assured that if the performance is the same or better than Oracle's and Microsoft's solutions that PostgreSQL is what they'll choose. Thanks in advance. From pgsql-performance-owner@postgresql.org Thu Jan 6 19:10:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4CA363A4A9A for ; Thu, 6 Jan 2005 19:10: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 47293-07 for ; Thu, 6 Jan 2005 19:10:27 +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 DF9AC3A4AAC for ; Thu, 6 Jan 2005 19:10:26 +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 j06JAFP7015923; Thu, 6 Jan 2005 20:10:15 +0100 Received: (from yann@localhost) by zong.spline.inf.fu-berlin.de (8.13.1/8.13.1/Submit) id j06J9wsq015922; Thu, 6 Jan 2005 20:09:58 +0100 Date: Thu, 6 Jan 2005 20:09:57 +0100 From: Yann Michel To: Rod Taylor Cc: pg@fastcrypt.com, Frank Wiles , Josh Berkus , Postgresql Performance Subject: Re: Low Performance for big hospital server .. Message-ID: <20050106190957.GA15890@zong.spline.inf.fu-berlin.de> References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> <41DD76E5.1090806@fastcrypt.com> <1105033874.56556.24.camel@home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1105033874.56556.24.camel@home> 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: 200501/75 X-Sequence-Number: 9765 Hi On Thu, Jan 06, 2005 at 12:51:14PM -0500, Rod Taylor wrote: > On Thu, 2005-01-06 at 12:35 -0500, Dave Cramer wrote: > > Reading can be worse for a normalized db, which is likely what the > > developers were concerned about. > > To a point. Once you have enough data that you start running out of > space in memory then normalization starts to rapidly gain ground again > because it's often smaller in size and won't hit the disk as much. Well, in datawarehousing applications you'll often denormalize your entities due to most of the time the access method is a (more or less) simple select. Regards, Yann From pgsql-performance-owner@postgresql.org Sun Jan 9 09:58:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E89123A49BE for ; Thu, 6 Jan 2005 19:15: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 46485-10 for ; Thu, 6 Jan 2005 19:14:49 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A55603A4A72 for ; Thu, 6 Jan 2005 19:14:49 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id E370F31981; Thu, 6 Jan 2005 20:14:48 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: Re: Some Performance Advice Needed Date: Thu, 6 Jan 2005 19:14:45 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 60 Message-ID: References: <41CAD5C3.6090404@meerkatsoft.com> <27CB29DA-54F1-11D9-9712-000D9366F0C4@torgo.978.org> <41CB3830.2090201@commandprompt.com> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/99 X-Sequence-Number: 9789 "jd@commandprompt.com ("Joshua D. Drake")" wrote in pgsql.performance: > 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. The name hasn't changed, but don't let that give you the wrong impression because SCSI continues to improve. I only use SCSI drives in all my servers, and that's because they always seem to outperform SATA and IDE when there's a multi-user[1] requirement (of course, the choice of OS [2] is an important factor here too). Disk fragmentation also plays a role, but can actually become a hinderance when in a multi-user environment. I find that the caching algorithm in the OS that I usually choose [2] actually performs extremely well when more users are accessing data on volumes where the data is fragmented. I'm told that this is very similar in the Unix environment as well. Defragmentation makes more sense in a single-user environment because there are generally a very small number of files being loaded at one time, and so a user can benefit hugely from defragmentation. Here's an interesting article (it comes complete with anonymous non- logical emotion-based reader comments too): SCSI vs. IDE: Which is really faster? http://hardware.devchannel.org/hardwarechannel/03/10/20/1953249.shtml? tid=20&tid=38&tid=49 [1] A somewhat busy web and/or eMail server certainly counts as a multi- user requirement. Put a database on it where the data isn't being accessed sequentially, and that can certainly meet the requirements too. [2] Nearly all my servers run Novell NetWare. -- Randolf Richardson, pro-active spam fighter - rr@8x.ca Vancouver, British Columbia, Canada Sending eMail to other SMTP servers is a privilege. From pgsql-performance-owner@postgresql.org Thu Jan 6 19:47:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0EC8B3A4AB4 for ; Thu, 6 Jan 2005 19:47: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 53225-10 for ; Thu, 6 Jan 2005 19:47:29 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 3BCBC3A4A4A for ; Thu, 6 Jan 2005 19:47: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 1CmdbP-0006TS-00; Thu, 06 Jan 2005 14:47:23 -0500 To: Frank Wiles Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> In-Reply-To: <20050106111207.52e39d04.frank@wiles.org> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 06 Jan 2005 14:47:22 -0500 Message-ID: <87mzvmz6et.fsf@stark.xeocode.com> Lines: 11 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: 200501/76 X-Sequence-Number: 9766 Frank Wiles writes: > Now that's rich. I don't think I've ever seen a database perform > worse after it was normalized. In fact, I can't even think of a > situation where it could! Just remember. All generalisations are false. -- greg From pgsql-performance-owner@postgresql.org Thu Jan 6 20:22:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D875F3A4A4C for ; Thu, 6 Jan 2005 20:22: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 59921-10 for ; Thu, 6 Jan 2005 20:21:37 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 0B3943A4B48 for ; Thu, 6 Jan 2005 20:21:37 +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 j06KLX60030730; Thu, 6 Jan 2005 12:21:33 -0800 Message-ID: <41DD9DBF.8040501@commandprompt.com> Date: Thu, 06 Jan 2005 12:21:19 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: Frank Wiles , Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Low Performance for big hospital server .. References: <1104831107.41da6283add0c@webmail.moph.go.th> <1104939342.41dc094ecb1cf@webmail.moph.go.th> <758d5e7f050106041510f07dc5@mail.gmail.com> <200501060906.55832.josh@agliodbs.com> <20050106111207.52e39d04.frank@wiles.org> <87mzvmz6et.fsf@stark.xeocode.com> In-Reply-To: <87mzvmz6et.fsf@stark.xeocode.com> Content-Type: multipart/mixed; boundary="------------080102060300080902090002" 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: 200501/77 X-Sequence-Number: 9767 This is a multi-part message in MIME format. --------------080102060300080902090002 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Greg Stark wrote: > Frank Wiles writes: > > >> Now that's rich. I don't think I've ever seen a database perform >> worse after it was normalized. In fact, I can't even think of a >> situation where it could! > > > Just remember. All generalisations are false. In general, I would agree. 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 --------------080102060300080902090002 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 --------------080102060300080902090002-- From pgsql-performance-owner@postgresql.org Sat Jan 8 03:03:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBA313A5086 for ; Sat, 8 Jan 2005 02:57: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 37061-02 for ; Sat, 8 Jan 2005 02:57:40 +0000 (GMT) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr1.postgresql.org (Postfix) with ESMTP id 2649D3A505E for ; Sat, 8 Jan 2005 02:57:21 +0000 (GMT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Fri, 7 Jan 2005 18:59:39 -0800 Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 7 Jan 2005 18:59:34 -0800 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005010718593419683 for ; Fri, 07 Jan 2005 18:59:34 -0800 X-ASG-Debug-ID: 1105153025-2584-0-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from mail1 (mail1.hq.corp [192.168.160.5]) by barracuda.tecarta.com (Spam Firewall) with SMTP id 5A820200D547 for ; Fri, 7 Jan 2005 18:57:05 -0800 (PST) Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Fri, 7 Jan 2005 18:59:28 -0800 Message-ID: <41DED994.9070305@sfnet.cc> Date: Fri, 07 Jan 2005 18:48:52 +0000 From: Steve Poe User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: josh@agliodbs.com Cc: PGsql-performance X-ASG-Orig-Subj: Re: [PERFORM] Does "HYPERTHREADING" do any harm if we use with RH9.0 and postgresql? Subject: Re: Does "HYPERTHREADING" do any harm if we use with RH9.0 References: <1105144158.41df295e07cc9@webmail.moph.go.th> <200501071720.08858.josh@agliodbs.com> In-Reply-To: <200501071720.08858.josh@agliodbs.com> Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 08 Jan 2005 02:59:28.0287 (UTC) FILETIME=[116CF2F0:01C4F52E] X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com X-Barracuda-Spam-Score: -4.55 X-Barracuda-Spam-Status: No, SCORE=-4.55 using global scores of TAG_LEVEL=4.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_00, DATE_IN_PAST_06_12 X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.792 Rule breakdown below pts rule name description ---- ---------------------- ------------------------------------------- -5.40 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0052] 0.85 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.336 tagged_above=0 required=5 tests=AWL, DATE_IN_PAST_06_12, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/85 X-Sequence-Number: 9775 Josh Berkus wrote: >Amrit, > > > >>I use RH 9.0 with postgresql 7.3.2 and 4 Gb ram [server spec. Dual Xeon >>3.0] and someone mention that the hyperthreading will not help but if I let >>it there will it be any harm to the system? >>Any comment please. >> >> > >Sometimes. Run a test and take a look at your CS (context switch) levels on >VMSTAT. If they're high, turn HT off. > >If it's a dedicated PG system, though, just turn HT off. We can't use it. > >Also, upgrade PostgreSQL to 7.3.8 at least. 7.3.2 is known-buggy. > > > Sorry for the "dumb" question, but what would be considered high regarding CS levels? We just upgraded our server's to dual 2.8Ghz Xeon CPUs from dual Xeon 1.8Ghz which unfortunately HT built-in. We also upgraded our database from version 7.3.4 to 7.4.2 Thanks. Steve Poe From pgsql-performance-owner@postgresql.org Fri Jan 7 19:18:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B3543A4F6C for ; Fri, 7 Jan 2005 19:18: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 50417-03 for ; Fri, 7 Jan 2005 19:17:46 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by svr1.postgresql.org (Postfix) with ESMTP id B0A8C3A4AD9 for ; Fri, 7 Jan 2005 19:17:32 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so1938116wra for ; Fri, 07 Jan 2005 11:17:32 -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=GoGLrpTUoKKUhRKh+JMZ4Tm01mhWSP5N2I5qrrqpqa3i/oMVbXusTZhMz3cqYTeusEF/MZOVPrnlPE5L3GNgQ9d04cgRqI94Odp4/AGg2EpCY0v1pobOAQYUOBwfGm7V9OEqMarWq4F74uZ7AiHAX+Kd3kDivTdzi4mJqKFSLnY= Received: by 10.54.13.33 with SMTP id 33mr183885wrm; Fri, 07 Jan 2005 11:17:31 -0800 (PST) Received: by 10.54.13.17 with HTTP; Fri, 7 Jan 2005 11:17:31 -0800 (PST) Message-ID: Date: Fri, 7 Jan 2005 14:17:31 -0500 From: David Jaquay Reply-To: David Jaquay To: pgsql-performance@postgresql.org Subject: Query across a date range In-Reply-To: <20050107182106.6CBEC5AF685@svr4.postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050107182106.6CBEC5AF685@svr4.postgresql.org> 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: 200501/78 X-Sequence-Number: 9768 Summary: Doing a two or three table join for a date range performs worse than doing the same query individually for each date in the range. What works: Doing a query just on a single date or a date range (against just one table) runs quick; 'explain' says it uses an index scan. Doing a query on a single date for one store or for one market uses all index scans, and runs quick as well. The problem: Doing a query for a date range on a particular store or market, though, for a date range of more than a few days does a sequential scan of sales_tickets, and performs worse than doing one single date query for each date. My 'explain' for one such query is below. Background: I have two or three tables involved in a query. One table is holds stores (7 rows at present), one holds sales tickets (about 5 million) and one holds line items (about 10 million). It's test data that I've generated and loaded using '\copy from'. Each has a primary key, and line items have two dates, written and delivered, that are indexed individually. Store has a market id; a market contains multiple stores (in my case, 2 or 3). Each sales ticket has 1-3 line items. Is there a way to tell postgres to use an index scan on sales_tickets? Curiously, in response to recent postings in the "Low Performance for big hospital server" thread, when I flatten the tables by putting storeid into line_items, it runs somewhat faster in all cases, and much faster in some; (I have times, if anyone is interested). Thanks, Dave mydb=> explain select * from line_items t, sales_tickets s where writtenDate >= '12/01/2002' and writtenDate <= '12/31/2002' and t.ticketId = s.ticketId and s.storeId = 1; QUERY PLAN --------------------------------------------------------------------------------------------------- Hash Join (cost=93865.46..114054.74 rows=19898 width=28) Hash Cond: ("outer".ticketId = "inner".ticketId) -> Index Scan using line_items_written on line_items t (cost=0.00..3823.11 rows=158757 width=16) Index Cond: ((writtendate >= '2002-12-01'::date) AND (writtendate <= '2002-12-31'::date)) -> Hash (cost=89543.50..89543.50 rows=626783 width=12) -> Seq Scan on sales_tickets s (cost=0.00..89543.50 rows=626783 width=12) Filter: (storeid = 1) (7 rows) mydb=> explain select * from line_items t, sales_tickets s where writtenDate = '12/01/2002' and t.ticketId = s.ticketId and s.storeid = 1; QUERY PLAN --------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..16942.25 rows=697 width=28) -> Index Scan using line_items_written on soldtrx t (cost=0.00..121.97 rows=5554 width=16) Index Cond: (writtendate = '2002-12-01'::date) -> Index Scan using sales_tickets_pkey on sales_tickets s (cost=0.00..3.02 rows=1 width=12) Index Cond: ("outer".ticketId = s.ticketId) Filter: (storeid = 1) (6 rows) The tables: create table stores -- 7 rows ( storeId integer not null, marketId integer not null ); create table sales_tickets -- 500,000 rows ( ticketId integer primary key, storeId integer not null, custId integer not null ); create table line_items -- 1,000,000 rows ( lineItemId integer primary key, ticketId integer references sales_tickets, writtenDate date not null, deliveredDate date not null ); create index line_items_written on line_items (writtenDate); create index line_items_delivered on line_items (deliveredDate); From pgsql-performance-owner@postgresql.org Fri Jan 7 19:35:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 35AD73A4F96 for ; Fri, 7 Jan 2005 19:35: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 53209-10 for ; Fri, 7 Jan 2005 19:35:08 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AB8863A4F94 for ; Fri, 7 Jan 2005 19:35:06 +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 j07JZ5m8028728; Fri, 7 Jan 2005 14:35:05 -0500 (EST) To: David Jaquay Cc: pgsql-performance@postgresql.org Subject: Re: Query across a date range In-reply-to: References: <20050107182106.6CBEC5AF685@svr4.postgresql.org> Comments: In-reply-to David Jaquay message dated "Fri, 07 Jan 2005 14:17:31 -0500" Date: Fri, 07 Jan 2005 14:35:04 -0500 Message-ID: <28727.1105126504@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: 200501/80 X-Sequence-Number: 9770 David Jaquay writes: > Summary: Doing a two or three table join for a date range performs > worse than doing the same query individually for each date in the > range. Could we see EXPLAIN ANALYZE, not just EXPLAIN, results? Also, have you ANALYZEd lately? If the estimated row counts are at all accurate, I doubt that forcing a nestloop indexscan would improve the situation. Also, what PG version is this? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 7 19:31:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 095023A1A7C for ; Fri, 7 Jan 2005 19:31: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 54261-01 for ; Fri, 7 Jan 2005 19:31:30 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id E7DB43A4F10 for ; Fri, 7 Jan 2005 19:31:30 +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 6878758; Fri, 07 Jan 2005 11:33:08 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: David Jaquay Subject: Re: Query across a date range Date: Fri, 7 Jan 2005 11:35:11 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <20050107182106.6CBEC5AF685@svr4.postgresql.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200501071135.11229.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: 200501/79 X-Sequence-Number: 9769 David, > The problem: Doing a query for a date range on a particular store or > market, though, for a date range of more than a few days does a > sequential scan of sales_tickets, and performs worse than doing one > single date query for each date. =A0My 'explain' for one such query is > below. Can you run EXPLAIN ANALYZE instead of just EXPLAIN? That will show you th= e=20 discrepancy between estimated and actual costs, and probably show you what= =20 needs fixing. =2D-=20 =2D-Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 7 20:08:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E57963A292C for ; Fri, 7 Jan 2005 20:04: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 03469-05 for ; Fri, 7 Jan 2005 20:04:24 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by svr1.postgresql.org (Postfix) with ESMTP id 6E9123A4F75 for ; Fri, 7 Jan 2005 20:04:28 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 70so453579wra for ; Fri, 07 Jan 2005 12:04:28 -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=WsSa51ERg+jwq9If+q9Wy2mj4RobcmOeTRPcpBMsYDXXlWzt4c403LDl+h7C9c9K6thAHGThff0LtW67QB2eHwEYvGkx/f2EuQlQEgrD+o9T40cbMyk1RZTifFJ9tnl57VSN//zcLWgGWToHcJvqu6fco7X/w+Q8p6KZwjIGLQE= Received: by 10.54.5.9 with SMTP id 9mr551029wre; Fri, 07 Jan 2005 12:04:28 -0800 (PST) Received: by 10.54.13.17 with HTTP; Fri, 7 Jan 2005 12:04:28 -0800 (PST) Message-ID: Date: Fri, 7 Jan 2005 15:04:28 -0500 From: David Jaquay Reply-To: David Jaquay To: josh@agliodbs.com Subject: Re: Query across a date range Cc: pgsql-performance@postgresql.org In-Reply-To: <200501071135.11229.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050107182106.6CBEC5AF685@svr4.postgresql.org> <200501071135.11229.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: 200501/81 X-Sequence-Number: 9771 'explain analyze' output is below. I have done analyze recently, and am using pg 7.4.2 on SuSE 9.1. I'd be curious to know how to "a nestloop indexscan" to try it out. Thanks, Dave mydb=> explain analyze select * from line_items t, sales_tickets s where writtenDate >= '12/01/2002' and writtenDate <= '12/31/2002' and t.ticketid = s.ticketId and s.storeId = 1; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=93865.46..114054.74 rows=19898 width=28) (actual time=25419.088..32140.217 rows=23914 loops=1) Hash Cond: ("outer".ticketid = "inner".ticketid) -> Index Scan using line_items_written on line_items t (cost=0.00..3823.11 rows=158757 width=16) (actual time=100.621..3354.818 rows=169770 loops=1) Index Cond: ((writtendate >= '2002-12-01'::date) AND (writtendate <= '2002-12-31'::date)) -> Hash (cost=89543.50..89543.50 rows=626783 width=12) (actual time=22844.146..22844.146 rows=0 loops=1) -> Seq Scan on sales_tickets s (cost=0.00..89543.50 rows=626783 width=12) (actual time=38.017..19387.447 rows=713846 loops=1) Filter: (storeid = 1) Total runtime: 32164.948 ms (8 rows) On Fri, 7 Jan 2005 11:35:11 -0800, Josh Berkus wrote: > Can you run EXPLAIN ANALYZE instead of just EXPLAIN? That will show you the > discrepancy between estimated and actual costs, and probably show you what > needs fixing. Also, Tom Lane wrote: > Could we see EXPLAIN ANALYZE, not just EXPLAIN, results? > > Also, have you ANALYZEd lately? If the estimated row counts are at all > accurate, I doubt that forcing a nestloop indexscan would improve the > situation. > > Also, what PG version is this? From pgsql-performance-owner@postgresql.org Fri Jan 7 20:12:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B9043A443F for ; Fri, 7 Jan 2005 20:12: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 04097-09 for ; Fri, 7 Jan 2005 20:11:43 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 53B933A4AA9 for ; Fri, 7 Jan 2005 20:11:47 +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 6878925; Fri, 07 Jan 2005 12:13:25 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: David Jaquay Subject: Re: Query across a date range Date: Fri, 7 Jan 2005 12:15:27 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <20050107182106.6CBEC5AF685@svr4.postgresql.org> <200501071135.11229.josh@agliodbs.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: <200501071215.27782.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/82 X-Sequence-Number: 9772 Dave, Ah .... > -> Seq Scan on sales_tickets s (cost=0.00..89543.50 > rows=626783 width=12) (actual time=38.017..19387.447 rows=713846 > loops=1) This is just more than 1/2 the time of your query. The issue is that you're pulling 713,000 rows (PG estimates 626,000 which is in the right ballpark) and PG thinks that this is enough rows where a seq scan is faster. It could be right. You can test that, force an indexscan by doing: SET enable_seqscan = FALSE; Also, please remember to run each query 3 times and report the time of the *last* run to us. We don't want differences in caching to throw off your evaulation. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sat Jan 8 00:27:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7FDD93A4F8C for ; Sat, 8 Jan 2005 00:27: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 25594-09 for ; Sat, 8 Jan 2005 00:27:19 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 0BAA03A292C for ; Sat, 8 Jan 2005 00:26:48 +0000 (GMT) Received: (qmail 4057 invoked from network); 8 Jan 2005 00:29:19 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 8 Jan 2005 00:29:19 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 04010-01 for ; Sat, 8 Jan 2005 07:29:18 +0700 (ICT) Received: (qmail 4052 invoked from network); 8 Jan 2005 00:29:18 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 8 Jan 2005 00:29:18 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Sat, 8 Jan 2005 07:29:18 +0700 Message-ID: <1105144158.41df295e07cc9@webmail.moph.go.th> Date: Sat, 8 Jan 2005 07:29:18 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Subject: Does "HYPERTHREADING" do any harm if we use with RH9.0 and postgresql? MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/83 X-Sequence-Number: 9773 I use RH 9.0 with postgresql 7.3.2 and 4 Gb ram [server spec. Dual Xeon 3.0] and someone mention that the hyperthreading will not help but if I let it there will it be any harm to the system? Any comment please. Amrit Thailand From pgsql-performance-owner@postgresql.org Sat Jan 8 01:16:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D9E13A5052 for ; Sat, 8 Jan 2005 01:16: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 28861-02 for ; Sat, 8 Jan 2005 01:16:20 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id B781D3A5046 for ; Sat, 8 Jan 2005 01:16:27 +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 6880097; Fri, 07 Jan 2005 17:18:06 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: amrit@health2.moph.go.th Subject: Re: Does "HYPERTHREADING" do any harm if we use with RH9.0 and postgresql? Date: Fri, 7 Jan 2005 17:20:08 -0800 User-Agent: KMail/1.7.1 Cc: PGsql-performance References: <1105144158.41df295e07cc9@webmail.moph.go.th> In-Reply-To: <1105144158.41df295e07cc9@webmail.moph.go.th> MIME-Version: 1.0 Content-Type: text/plain; charset="tis-620" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501071720.08858.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: 200501/84 X-Sequence-Number: 9774 Amrit, > I use RH 9.0 with postgresql 7.3.2 and 4 Gb ram [server spec. Dual Xeon > 3.0] and someone mention that the hyperthreading will not help but if I let > it there will it be any harm to the system? > Any comment please. Sometimes. Run a test and take a look at your CS (context switch) levels on VMSTAT. If they're high, turn HT off. If it's a dedicated PG system, though, just turn HT off. We can't use it. Also, upgrade PostgreSQL to 7.3.8 at least. 7.3.2 is known-buggy. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sat Jan 8 03:36:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A157B3A508F for ; Sat, 8 Jan 2005 03:36: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 40578-01 for ; Sat, 8 Jan 2005 03:36:45 +0000 (GMT) Received: from hosea.tallye.com (joel.tallye.com [216.99.199.78]) by svr1.postgresql.org (Postfix) with ESMTP id D77103A5037 for ; Sat, 8 Jan 2005 03:36:49 +0000 (GMT) Received: from hosea.tallye.com (hosea.tallye.com [127.0.0.1]) by hosea.tallye.com (8.12.8/8.12.10) with ESMTP id j083amYs003561 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 7 Jan 2005 19:36:48 -0800 Received: (from sttng359@localhost) by hosea.tallye.com (8.12.8/8.12.10/Submit) id j083alaH003559 for pgsql-performance@postgresql.org; Fri, 7 Jan 2005 19:36:47 -0800 X-Authentication-Warning: hosea.tallye.com: sttng359 set sender to lorenl@alzatex.com using -f Date: Fri, 7 Jan 2005 19:36:47 -0800 From: "Loren M. Lang" To: PostgreSQL Perfomance Subject: TEXT field and Postgresql Perfomance Message-ID: <20050108033647.GB2867@alzatex.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-GPG-Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc X-GPG-Fingerprint: B3B9 D669 69C9 09EC 1BCD 835A FAF3 7A46 E4A3 280C 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: 200501/86 X-Sequence-Number: 9776 Do large TEXT or VARCHAR entries in postgresql cause any performance degradation when a query is being executed to search for data in a table where the TEXT/VARCHAR fields aren't being searched themselves? Since, according to the postgresql docs, theirs no performance difference between VARCHAR and TEXT, I'm assuming VARCHAR is identical to TEXT entries with a restriction set on the length. And since TEXT can be of any possible size, then they must be stored independently of the rest of the table which is probably all stored in a fixed size rows since all or nearly all of the other types have a specific size including CHAR. Therefore TEXT entries must be in some other hash table that only needs to be looked up when that column is referenced. If this is the case then all other row data will need to be read in for an unindexed query, but the TEXT columns will only be read if their being searched though or queried. And if they're only being queried, then only the rows that matched will need the TEXT columns read in which should have minimal impact on performance even if they contain kilobytes of information. -- I sense much NT in you. NT leads to Bluescreen. Bluescreen leads to downtime. Downtime leads to suffering. NT is the path to the darkside. Powerful Unix is. Public Key: ftp://ftp.tallye.com/pub/lorenl_pubkey.asc Fingerprint: B3B9 D669 69C9 09EC 1BCD 835A FAF3 7A46 E4A3 280C From pgsql-performance-owner@postgresql.org Sat Jan 8 03:49:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92B993A5088 for ; Sat, 8 Jan 2005 03:49: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 41294-03 for ; Sat, 8 Jan 2005 03:49:37 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 8E18E3A292C for ; Sat, 8 Jan 2005 03:49:44 +0000 (GMT) Received: (qmail 17591 invoked by uid 500); 8 Jan 2005 04:03:23 -0000 Date: Fri, 7 Jan 2005 22:03:23 -0600 From: Bruno Wolff III To: "Loren M. Lang" Cc: PostgreSQL Perfomance Subject: Re: TEXT field and Postgresql Perfomance Message-ID: <20050108040323.GA13889@wolff.to> Mail-Followup-To: "Loren M. Lang" , PostgreSQL Perfomance References: <20050108033647.GB2867@alzatex.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050108033647.GB2867@alzatex.com> User-Agent: Mutt/1.5.6i 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: 200501/87 X-Sequence-Number: 9777 On Fri, Jan 07, 2005 at 19:36:47 -0800, "Loren M. Lang" wrote: > Do large TEXT or VARCHAR entries in postgresql cause any performance > degradation when a query is being executed to search for data in a table > where the TEXT/VARCHAR fields aren't being searched themselves? Yes in that the data is more spread out because of the wider rows and that results in more disk blocks being looked at to get the desired data. > Since, according to the postgresql docs, theirs no performance > difference between VARCHAR and TEXT, I'm assuming VARCHAR is identical > to TEXT entries with a restriction set on the length. And since TEXT > can be of any possible size, then they must be stored independently of No. > the rest of the table which is probably all stored in a fixed size rows No, Postgres uses variable length records. From pgsql-performance-owner@postgresql.org Sat Jan 8 05:03:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD9523A50B7 for ; Sat, 8 Jan 2005 05:03: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 46130-09 for ; Sat, 8 Jan 2005 05:02:56 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id 49DF33A508E for ; Sat, 8 Jan 2005 05:02:55 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so38071wra for ; Fri, 07 Jan 2005 21:02:55 -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=Onyl45yHSk69BRCyHxaEqZOCqtQ5BYczrwcOdmjopx2pSNf0/Q7nm2QMgxF2bKO63snJydHScBLwAoOw3STwi2WXA66jlppbnGmIgSwNO3QeUvwXoDXtYgcoKa2k0ZQx6HtT0i4XWnnWO0IPQqLJoMaOeCqdmjU0C+sB40dvUjY= Received: by 10.54.18.23 with SMTP id 23mr81946wrr; Fri, 07 Jan 2005 21:02:54 -0800 (PST) Received: by 10.54.18.72 with HTTP; Fri, 7 Jan 2005 21:02:54 -0800 (PST) Message-ID: <33c6269f0501072102144e82dc@mail.gmail.com> Date: Sat, 8 Jan 2005 00:02:54 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: "Loren M. Lang" , PostgreSQL Perfomance Subject: Re: TEXT field and Postgresql Perfomance In-Reply-To: <20050108040323.GA13889@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050108033647.GB2867@alzatex.com> <20050108040323.GA13889@wolff.to> 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: 200501/88 X-Sequence-Number: 9778 I guess my question that would follow is, when does it work best to start using BLOBs/CLOBs (I forget if pg has CLOBs) instead of textfields because your table is going to balloon in disk blocks if you have large amounts of data, and all fields you want to search on would have to be indexed, increasing insert time substantialy. Does it ever pay to use text and not CLOB unless your text is going to be short, in which case why not just varchar, leading to the thought that the text datatype is just bad? Alex Turner NetEconomist On Fri, 7 Jan 2005 22:03:23 -0600, Bruno Wolff III wrote: > On Fri, Jan 07, 2005 at 19:36:47 -0800, > "Loren M. Lang" wrote: > > Do large TEXT or VARCHAR entries in postgresql cause any performance > > degradation when a query is being executed to search for data in a table > > where the TEXT/VARCHAR fields aren't being searched themselves? > > Yes in that the data is more spread out because of the wider rows and that > results in more disk blocks being looked at to get the desired data. > > > Since, according to the postgresql docs, theirs no performance > > difference between VARCHAR and TEXT, I'm assuming VARCHAR is identical > > to TEXT entries with a restriction set on the length. And since TEXT > > can be of any possible size, then they must be stored independently of > > No. > > > the rest of the table which is probably all stored in a fixed size rows > > No, Postgres uses variable length records. > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Sat Jan 8 05:23:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5A4A83A50B0 for ; Sat, 8 Jan 2005 05:23: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 47736-07 for ; Sat, 8 Jan 2005 05:23:36 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 6DA773A508E for ; Sat, 8 Jan 2005 05:23:35 +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 j085NQBQ045147 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Jan 2005 22:23:28 -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 j085NQiB003634; Fri, 7 Jan 2005 22:23:26 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j085NDtt003633; Fri, 7 Jan 2005 22:23:13 -0700 (MST) (envelope-from mfuhr) Date: Fri, 7 Jan 2005 22:23:13 -0700 From: Michael Fuhr To: "Loren M. Lang" , PostgreSQL Perfomance Subject: Re: TEXT field and Postgresql Perfomance Message-ID: <20050108052313.GA3509@winnie.fuhr.org> References: <20050108033647.GB2867@alzatex.com> <20050108040323.GA13889@wolff.to> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050108040323.GA13889@wolff.to> 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: 200501/89 X-Sequence-Number: 9779 On Fri, Jan 07, 2005 at 10:03:23PM -0600, Bruno Wolff III wrote: > On Fri, Jan 07, 2005 at 19:36:47 -0800, "Loren M. Lang" wrote: > > > Since, according to the postgresql docs, theirs no performance > > difference between VARCHAR and TEXT, I'm assuming VARCHAR is identical > > to TEXT entries with a restriction set on the length. And since TEXT > > can be of any possible size, then they must be stored independently of > > No. > > > the rest of the table which is probably all stored in a fixed size rows > > No, Postgres uses variable length records. A discussion of TOAST and ALTER TABLE SET STORAGE might be appropriate here, but I'll defer that to somebody who understands such things better than me. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Sat Jan 8 05:49:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E20803A50FF for ; Sat, 8 Jan 2005 05:49: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 48541-09 for ; Sat, 8 Jan 2005 05:49: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 1FCE23A50E8 for ; Sat, 8 Jan 2005 05:49: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 j085n8n2003334; Sat, 8 Jan 2005 00:49:08 -0500 (EST) To: Bruno Wolff III Cc: "Loren M. Lang" , PostgreSQL Perfomance Subject: Re: TEXT field and Postgresql Perfomance In-reply-to: <20050108040323.GA13889@wolff.to> References: <20050108033647.GB2867@alzatex.com> <20050108040323.GA13889@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Fri, 07 Jan 2005 22:03:23 -0600" Date: Sat, 08 Jan 2005 00:49:07 -0500 Message-ID: <3333.1105163347@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: 200501/90 X-Sequence-Number: 9780 Bruno Wolff III writes: > On Fri, Jan 07, 2005 at 19:36:47 -0800, > "Loren M. Lang" wrote: >> Do large TEXT or VARCHAR entries in postgresql cause any performance >> degradation when a query is being executed to search for data in a table >> where the TEXT/VARCHAR fields aren't being searched themselves? > Yes in that the data is more spread out because of the wider rows and that > results in more disk blocks being looked at to get the desired data. You are overlooking the effects of TOAST. Fields wider than a kilobyte or two will be pushed out-of-line and will thereby not impose a penalty on queries that only access the other fields in the table. (If Loren's notion of "large" is "a hundred bytes" then there may be a measurable impact. If it's "a hundred K" then there won't be.) regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jan 8 21:07:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B1DDC3A52BE for ; Sat, 8 Jan 2005 21:07: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 55082-04 for ; Sat, 8 Jan 2005 21:07:00 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by svr1.postgresql.org (Postfix) with ESMTP id DEE143A52AA for ; Sat, 8 Jan 2005 21:07:01 +0000 (GMT) Received: from [192.168.1.52] (h000d605e415b.ne.client2.attbi.com[24.60.119.214]) by comcast.net (sccrmhc11) with ESMTP id <20050108210659011003bj29e>; Sat, 8 Jan 2005 21:06:59 +0000 Message-ID: <41E04B74.8050609@comcast.net> Date: Sat, 08 Jan 2005 16:07:00 -0500 From: Jeffrey Tenny User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Null integer columns 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=2.242 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: ** X-Archive-Number: 200501/91 X-Sequence-Number: 9781 I have an integer column that is not needed for some rows in the table (whether it is necessary is a factor of other row attributes, and it isn't worth putting in a separate table). What are the performance tradeoffs (storage space, query speed) of using a NULL enabled column versus a NOT-NULL column with a sentinel integer value? Not that it matters, but in the event where the column values matter, the numberic value is a foreign key. Advice on that welcome too. Thanks! From pgsql-performance-owner@postgresql.org Sat Jan 8 21:56:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A71143A52BA for ; Sat, 8 Jan 2005 21:55: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 63210-07 for ; Sat, 8 Jan 2005 21:55:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6A8B23A52A9 for ; Sat, 8 Jan 2005 21:55: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 j08Ltnwu008513; Sat, 8 Jan 2005 16:55:49 -0500 (EST) To: Jeffrey Tenny Cc: pgsql-performance@postgresql.org Subject: Re: Null integer columns In-reply-to: <41E04B74.8050609@comcast.net> References: <41E04B74.8050609@comcast.net> Comments: In-reply-to Jeffrey Tenny message dated "Sat, 08 Jan 2005 16:07:00 -0500" Date: Sat, 08 Jan 2005 16:55:49 -0500 Message-ID: <8512.1105221349@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: 200501/92 X-Sequence-Number: 9782 Jeffrey Tenny writes: > What are the performance tradeoffs (storage space, query speed) of using > a NULL enabled column versus a NOT-NULL column with a sentinel integer > value? > Not that it matters, but in the event where the column values matter, > the numberic value is a foreign key. Advice on that welcome too. In that case you want to use NULL, because the foreign key mechanism will understand that there's no reference implied. With a sentinel value you'd have to have a dummy row in the master table --- which will cause you enough semantic headaches that you don't want to go there. The performance difference could go either way depending on a lot of other details, but it will be insignificant in any case. Don't screw up your database semantics for it. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 9 04:44:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBE003A5323 for ; Sun, 9 Jan 2005 04:44: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 92201-04 for ; Sun, 9 Jan 2005 04:44:47 +0000 (GMT) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by svr1.postgresql.org (Postfix) with ESMTP id 3AA973A5250 for ; Sun, 9 Jan 2005 04:44:46 +0000 (GMT) Received: from EVON600c (c220-237-7-72.randw1.nsw.optusnet.com.au [220.237.7.72]) (authenticated bits=0) by mail01.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id j094ideg019542 for ; Sun, 9 Jan 2005 15:44:43 +1100 Message-Id: <200501090444.j094ideg019542@mail01.syd.optusnet.com.au> From: "Guenzl, Martin" To: Subject: Help with EXPLAIN ANALYZE runtimes Date: Sun, 9 Jan 2005 15:44:30 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcT2BedwEqD+1YGrR5S3pZKXvVuduQ== 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: 200501/93 X-Sequence-Number: 9783 Hi, I am a recent convert to Postgresql, and am trying to tune a very slow query across ten tables all with only a few rows at this stage (<20), and was looking for some help to get me out of a dead-end. It runs very slowly both on a hosted Postgresql 7.3.4 server running on FreeBSD UNIX box, and also on a Postgresql 8.0.0.0-rc2 server running on a Win XP box. On the latter, the EXPLAIN ANALYZE returned what I thought was a strange result - here is the excerpt ... (Start) SQL: Query Results QUERY PLAN Unique (cost=7.16..7.32 rows=3 width=188) (actual time=51.000..51.000 rows=16 loops=1) -> Sort (cost=7.16..7.16 rows=3 width=188) (actual time=51.000..51.000 rows=16 loops=1) Sort Key: am.id_assessment, c.id_claim, c.nm_claim, p.id_provider, p.nm_title, p.nm_first, p.nm_last, ad.id_address, ad.nm_address_1, ad.nm_address_2, ad.nm_address_3, ad.nm_suburb, ad.nm_city, s.nm_state_short, ad.nm_postcode, am.dt_assessment, am.dt_booking, ast.nm_assessmentstatus, ast.b_offer_report, asn.id_assessmentstatus, asn.nm_assessmentstatus -> Merge Join (cost=4.60..7.13 rows=3 width=188) (actual time=41.000..51.000 rows=16 loops=1) Merge Cond: ("outer".id_datastatus = "inner".id_datastatus) Join Filter: (("inner".id_claim = "outer".id_claim) AND ("inner".id_assessment = "outer".id_assessment)) : : : -> Index Scan using address_pkey on address ad (cost=0.00..14.14 rows=376 width=76) (actual time=10.000..10.000 rows=82 loops=1) -> Sort (cost=1.05..1.06 rows=3 width=36) (actual time=0.000..0.000 rows=3 loops=1) Sort Key: am.id_address -> Seq Scan on assessment am (cost=0.00..1.03 rows=3 width=36) (actual time=0.000..0.000 rows=3 loops=1) Total runtime: 51.000 ms 44 row(s) Total runtime: 11,452.979 ms (End) It's the bit at the bottom that throws me - I can't work out why one Total runtime says 51ms, and yet the next Total runtime would be 11,452ms. (I'm assuming that the clue to getting the query time down is to solve this puzzle.) I've done vacuum analyze on all tables, but that didn't help. This query stands out among others as being very slow. Any ideas or suggestions? Thanks in advance, Martin From pgsql-performance-owner@postgresql.org Sun Jan 9 05:23:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 841783A53B4 for ; Sun, 9 Jan 2005 05:23: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 94398-01 for ; Sun, 9 Jan 2005 05:23:45 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 69B4F3A53A6 for ; Sun, 9 Jan 2005 05:23:44 +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 j095NglG024310; Sun, 9 Jan 2005 00:23:42 -0500 (EST) To: "Guenzl, Martin" Cc: pgsql-performance@postgresql.org Subject: Re: Help with EXPLAIN ANALYZE runtimes In-reply-to: <200501090444.j094ideg019542@mail01.syd.optusnet.com.au> References: <200501090444.j094ideg019542@mail01.syd.optusnet.com.au> Comments: In-reply-to "Guenzl, Martin" message dated "Sun, 09 Jan 2005 15:44:30 +1100" Date: Sun, 09 Jan 2005 00:23:42 -0500 Message-ID: <24309.1105248222@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: 200501/94 X-Sequence-Number: 9784 "Guenzl, Martin" writes: > On the latter, the EXPLAIN ANALYZE returned what I thought was a strange > result - here is the excerpt ... Do you think we are psychics who can guess at your problem when you've shown us none of the table definitions, none of the query, and only a small part of the EXPLAIN output? Donning my Karnak headgear, I will guess that this is actually not a SELECT query but some kind of update operation, and that the time sink is in the updating part and not in the data extraction part. (Inefficient foreign-key operations would be a likely cause, as would poorly written user-defined triggers.) But that's strictly a guess. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 9 05:45:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE9663A5383 for ; Sun, 9 Jan 2005 05: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 95212-06 for ; Sun, 9 Jan 2005 05:45:35 +0000 (GMT) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by svr1.postgresql.org (Postfix) with ESMTP id AD73E3A53A7 for ; Sun, 9 Jan 2005 05:45:34 +0000 (GMT) Received: from EVON600c (c220-237-7-72.randw1.nsw.optusnet.com.au [220.237.7.72]) (authenticated bits=0) by mail08.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id j095jScb010756; Sun, 9 Jan 2005 16:45:31 +1100 Message-Id: <200501090545.j095jScb010756@mail08.syd.optusnet.com.au> From: "Guenzl, Martin" To: Cc: "'Tom Lane'" Subject: Re: Help with EXPLAIN ANALYZE runtimes Date: Sun, 9 Jan 2005 16:45:18 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcT2C0s0XgPOh6YTSmKF02/wCdAJEQAAKOWg In-Reply-To: <24309.1105248222@sss.pgh.pa.us> 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: 200501/95 X-Sequence-Number: 9785 LOL ... Excuse my ignorance but what's Karnak headear? It's a SELECT statement. There are no foreign-keys, just primary keys and indexes (some clustered). All joins are through integers / big integers (since anything beginning with id_ is either an integer or big integer). The intention of showing an excerpt was to keep the focus of my question on the two different runtimes - what these two runtimes mean (in contrast to each other), and what causes them to be so different, so that I could tackle the optimisation of the query. This obviously backfired :-( Below are the EXPLAIN ANALYZE and queries in full. What has got me bamboozled is how the query plan seems to report 51ms but it then reports a final figure of over 11 seconds - why the huge jump? Thanks and regards Martin ________________________________ Start of EXPLAIN ANALYZE ... SQL: Query Results QUERY PLAN Unique (cost=7.16..7.32 rows=3 width=188) (actual time=51.000..51.000 rows=16 loops=1) -> Sort (cost=7.16..7.16 rows=3 width=188) (actual time=51.000..51.000 rows=16 loops=1) Sort Key: am.id_assessment, c.id_claim, c.nm_claim, p.id_provider, p.nm_title, p.nm_first, p.nm_last, ad.id_address, ad.nm_address_1, ad.nm_address_2, ad.nm_address_3, ad.nm_suburb, ad.nm_city, s.nm_state_short, ad.nm_postcode, am.dt_assessment, am.dt_booking, ast.nm_assessmentstatus, ast.b_offer_report, asn.id_assessmentstatus, asn.nm_assessmentstatus -> Merge Join (cost=4.60..7.13 rows=3 width=188) (actual time=41.000..51.000 rows=16 loops=1) Merge Cond: ("outer".id_datastatus = "inner".id_datastatus) Join Filter: (("inner".id_claim = "outer".id_claim) AND ("inner".id_assessment = "outer".id_assessment)) -> Nested Loop (cost=0.00..19.31 rows=8 width=97) (actual time=0.000..0.000 rows=48 loops=1) Join Filter: ("inner".id_datastatus = "outer".id_datastatus) -> Nested Loop (cost=0.00..16.09 rows=3 width=74) (actual time=0.000..0.000 rows=16 loops=1) Join Filter: (("inner".id_previous = "outer".id_assessmentstatus) AND ("inner".id_datastatus = "outer".id_datastatus)) -> Nested Loop (cost=0.00..8.23 rows=1 width=53) (actual time=0.000..0.000 rows=2 loops=1) Join Filter: (("outer".id_assessmentstatus = "inner".id_assessmentstatus) AND ("inner".id_datastatus = "outer".id_datastatus)) -> Nested Loop (cost=0.00..6.98 rows=1 width=20) (actual time=0.000..0.000 rows=2 loops=1) Join Filter: ("inner".id_datastatus = "outer".id_datastatus) -> Index Scan using datastatus_pkey on datastatus ds (cost=0.00..5.93 rows=1 width=8) (actual time=0.000..0.000 rows=1 loops=1) Filter: (b_active <> 0) -> Seq Scan on assessmentworkflow aw (cost=0.00..1.02 rows=2 width=12) (actual time=0.000..0.000 rows=2 loops=1) -> Seq Scan on assessmentstatus ast (cost=0.00..1.10 rows=10 width=33) (actual time=0.000..0.000 rows=10 loops=2) -> Merge Join (cost=0.00..7.23 rows=42 width=37) (actual time=0.000..0.000 rows=42 loops=2) Merge Cond: ("outer".id_assessmentstatus = "inner".id_assessmentstatus) Join Filter: ("outer".id_datastatus = "inner".id_datastatus) -> Index Scan using assessmentstatus_pkey on assessmentstatus asn (cost=0.00..3.11 rows=10 width=29) (actual time=0.000..0.000 rows=10 loops=2) -> Index Scan using idx_assessmenttransition_1 on assessmenttransition "at" (cost=0.00..3.46 rows=42 width=12) (actual time=0.000..0.000 rows=42 loops=2) -> Seq Scan on claim c (cost=0.00..1.04 rows=3 width=23) (actual time=0.000..0.000 rows=3 loops=16) Filter: (id_user = 1) -> Sort (cost=4.60..4.60 rows=3 width=143) (actual time=41.000..41.000 rows=97 loops=1) Sort Key: p.id_datastatus -> Merge Join (cost=3.94..4.57 rows=3 width=143) (actual time=10.000..41.000 rows=3 loops=1) Merge Cond: ("outer".id_provider = "inner".id_provider) Join Filter: (("inner".id_state = "outer".id_state) AND ("outer".id_datastatus = "inner".id_datastatus)) -> Nested Loop (cost=0.00..508.65 rows=3336 width=51) (actual time=0.000..20.000 rows=2153 loops=1) Join Filter: ("outer".id_datastatus = "inner".id_datastatus) -> Index Scan using provider_pkey on provider p (cost=0.00..16.59 rows=417 width=33) (actual time=0.000..0.000 rows=270 loops=1) -> Seq Scan on state s (cost=0.00..1.08 rows=8 width=18) (actual time=0.000..0.000 rows=8 loops=270) -> Sort (cost=3.94..3.94 rows=3 width=108) (actual time=10.000..10.000 rows=17 loops=1) Sort Key: am.id_provider -> Merge Join (cost=1.05..3.91 rows=3 width=108) (actual time=10.000..10.000 rows=3 loops=1) Merge Cond: ("outer".id_address = "inner".id_address) Join Filter: ("outer".id_datastatus = "inner".id_datastatus) -> Index Scan using address_pkey on address ad (cost=0.00..14.14 rows=376 width=76) (actual time=10.000..10.000 rows=82 loops=1) -> Sort (cost=1.05..1.06 rows=3 width=36) (actual time=0.000..0.000 rows=3 loops=1) Sort Key: am.id_address -> Seq Scan on assessment am (cost=0.00..1.03 rows=3 width=36) (actual time=0.000..0.000 rows=3 loops=1) Total runtime: 51.000 ms 44 row(s) Total runtime: 11,452.979 ms ... End of EXPLAIN ANALYZE Start of query ... SELECT DISTINCT am.id_assessment, c.id_claim, c.nm_claim, p.id_provider, p.nm_title, p.nm_first, p.nm_last, ad.id_address, ad.nm_address_1, ad.nm_address_2, ad.nm_address_3, ad.nm_suburb, ad.nm_city, s.nm_state_short, ad.nm_postcode, am.dt_assessment, am.dt_booking, ast.nm_assessmentstatus, ast.b_offer_report, asn.id_assessmentstatus, asn.nm_assessmentstatus FROM assessment am, address ad, assessmentworkflow aw, assessmenttransition at, assessmentstatus ast, assessmentstatus asn, claim c, state s, provider p, datastatus ds WHERE am.id_claim = c.id_claim AND am.id_assessment = aw.id_assessment AND aw.id_assessmentstatus = ast.id_assessmentstatus AND am.id_provider = p.id_provider AND c.id_user = 1 AND at.id_previous = aw.id_assessmentstatus AND asn.id_assessmentstatus = at.id_assessmentstatus AND am.id_address = ad.id_address AND ad.id_state = s.id_state AND am.id_datastatus = ds.id_datastatus AND ad.id_datastatus = ds.id_datastatus AND aw.id_datastatus = ds.id_datastatus AND at.id_datastatus = ds.id_datastatus AND ast.id_datastatus = ds.id_datastatus AND asn.id_datastatus = ds.id_datastatus AND c.id_datastatus = ds.id_datastatus AND s.id_datastatus = ds.id_datastatus AND p.id_datastatus = ds.id_datastatus AND ds.b_active <> 0 ... End of query. From pgsql-performance-owner@postgresql.org Sun Jan 9 06:53:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BD7A73A53B7 for ; Sun, 9 Jan 2005 06:53: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 97959-09 for ; Sun, 9 Jan 2005 06:53:02 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id A52203A535A for ; Sun, 9 Jan 2005 06:53:01 +0000 (GMT) Received: (qmail 9236 invoked by uid 500); 9 Jan 2005 07:06:41 -0000 Date: Sun, 9 Jan 2005 01:06:41 -0600 From: Bruno Wolff III To: "Guenzl, Martin" Cc: pgsql-performance@postgresql.org, 'Tom Lane' Subject: Re: Help with EXPLAIN ANALYZE runtimes Message-ID: <20050109070641.GB8872@wolff.to> Mail-Followup-To: "Guenzl, Martin" , pgsql-performance@postgresql.org, 'Tom Lane' References: <24309.1105248222@sss.pgh.pa.us> <200501090545.j095jScb010756@mail08.syd.optusnet.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200501090545.j095jScb010756@mail08.syd.optusnet.com.au> User-Agent: Mutt/1.5.6i 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: 200501/96 X-Sequence-Number: 9786 On Sun, Jan 09, 2005 at 16:45:18 +1100, "Guenzl, Martin" wrote: > LOL ... Excuse my ignorance but what's Karnak headear? Jonny Carson used to do sketches on the Tonight show where he was Karnak and would give answers to questions in sealed envelopes which would later be read by Ed McMahon. From pgsql-performance-owner@postgresql.org Sun Jan 9 08:59:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3FF713A5466 for ; Sun, 9 Jan 2005 08:59: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 01130-09 for ; Sun, 9 Jan 2005 08:58:57 +0000 (GMT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by svr1.postgresql.org (Postfix) with ESMTP id 453FB3A53C8 for ; Sun, 9 Jan 2005 08:58:43 +0000 (GMT) Received: from mail20.syd.optusnet.com.au (mail20.syd.optusnet.com.au [211.29.132.201]) by svr4.postgresql.org (Postfix) with ESMTP id 2DC7A5AFA02 for ; Sun, 9 Jan 2005 08:32:37 +0000 (GMT) Received: from EVON600c (c220-237-7-72.randw1.nsw.optusnet.com.au [220.237.7.72]) (authenticated bits=0) by mail20.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id j098UXDL028760 for ; Sun, 9 Jan 2005 19:30:36 +1100 Message-Id: <200501090830.j098UXDL028760@mail20.syd.optusnet.com.au> From: "Guenzl, Martin" To: Subject: Re: Help with EXPLAIN ANALYZE runtimes Date: Sun, 9 Jan 2005 19:30:23 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcT2BedwEqD+1YGrR5S3pZKXvVuduQAHZF1A In-Reply-To: <200501090444.j094ideg019542@mail01.syd.optusnet.com.au> 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: 200501/97 X-Sequence-Number: 9787 In case anyone is interested, I finally found what I believe to be the cause ... Or at least, I found the solution, and think I understand why. Having read "Section 10.3 Controlling the Planner with Explicit JOIN Clauses" (http://postgresql.org/docs/7.3/interactive/explicit-joins.html), I modified the query to use INNER JOINS with the table datastatus, instead of the implicit cross joins. The INNER JOINS now seem to reduce the choices the planner has to make. The clue was the high number of tables involved, and the repeated reference to the same table. All's well that ends well ... with or without the Karnak headgear. Martin -----Original Message----- From: Guenzl, Martin [mailto:martin@guenzl.com] Sent: Sunday, 9 January 2005 3:45 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Help with EXPLAIN ANALYZE runtimes Hi, I am a recent convert to Postgresql, and am trying to tune a very slow query across ten tables all with only a few rows at this stage (<20), and was looking for some help to get me out of a dead-end. It runs very slowly both on a hosted Postgresql 7.3.4 server running on FreeBSD UNIX box, and also on a Postgresql 8.0.0.0-rc2 server running on a Win XP box. On the latter, the EXPLAIN ANALYZE returned what I thought was a strange result - here is the excerpt ... (Start) SQL: Query Results QUERY PLAN Unique (cost=7.16..7.32 rows=3 width=188) (actual time=51.000..51.000 rows=16 loops=1) -> Sort (cost=7.16..7.16 rows=3 width=188) (actual time=51.000..51.000 rows=16 loops=1) Sort Key: am.id_assessment, c.id_claim, c.nm_claim, p.id_provider, p.nm_title, p.nm_first, p.nm_last, ad.id_address, ad.nm_address_1, ad.nm_address_2, ad.nm_address_3, ad.nm_suburb, ad.nm_city, s.nm_state_short, ad.nm_postcode, am.dt_assessment, am.dt_booking, ast.nm_assessmentstatus, ast.b_offer_report, asn.id_assessmentstatus, asn.nm_assessmentstatus -> Merge Join (cost=4.60..7.13 rows=3 width=188) (actual time=41.000..51.000 rows=16 loops=1) Merge Cond: ("outer".id_datastatus = "inner".id_datastatus) Join Filter: (("inner".id_claim = "outer".id_claim) AND ("inner".id_assessment = "outer".id_assessment)) : : : -> Index Scan using address_pkey on address ad (cost=0.00..14.14 rows=376 width=76) (actual time=10.000..10.000 rows=82 loops=1) -> Sort (cost=1.05..1.06 rows=3 width=36) (actual time=0.000..0.000 rows=3 loops=1) Sort Key: am.id_address -> Seq Scan on assessment am (cost=0.00..1.03 rows=3 width=36) (actual time=0.000..0.000 rows=3 loops=1) Total runtime: 51.000 ms 44 row(s) Total runtime: 11,452.979 ms (End) It's the bit at the bottom that throws me - I can't work out why one Total runtime says 51ms, and yet the next Total runtime would be 11,452ms. (I'm assuming that the clue to getting the query time down is to solve this puzzle.) I've done vacuum analyze on all tables, but that didn't help. This query stands out among others as being very slow. Any ideas or suggestions? Thanks in advance, Martin ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match From pgsql-performance-owner@postgresql.org Mon Jan 10 00:04:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 110563A535F for ; Mon, 10 Jan 2005 00: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 33691-07 for ; Mon, 10 Jan 2005 00:04:01 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id F10223A3BDF for ; Mon, 10 Jan 2005 00:04:02 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j0A04HtK012276; Sun, 9 Jan 2005 18:04:20 -0600 Date: Sun, 9 Jan 2005 18:04:52 -0600 From: Frank Wiles To: Randolf Richardson Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-Id: <20050109180452.03723387.frank@wiles.org> In-Reply-To: References: 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: 200501/101 X-Sequence-Number: 9791 On Thu, 6 Jan 2005 19:01:38 +0000 (UTC) Randolf Richardson wrote: > I'm looking for recent performance statistics on PostgreSQL vs. > Oracle > vs. Microsoft SQL Server. Recently someone has been trying to > convince my client to switch from SyBASE to Microsoft SQL Server (they > originally wanted to go with Oracle but have since fallen in love with > Microsoft). All this time I've been recommending PostgreSQL for cost > and stability (my own testing has shown it to be better at handling > abnormal shutdowns and using fewer system resources) in addition to > true cross-platform compatibility. > > If I can show my client some statistics that PostgreSQL > outperforms > these (I'm more concerned about it beating Oracle because I know that > Microsoft's stuff is always slower, but I need the information anyway > to protect my client from falling victim to a 'sales job'), then > PostgreSQL will be the solution of choice as the client has always > believed that they need a high-performance solution. > > I've already convinced them on the usual price, cross-platform > compatibility, open source, long history, etc. points, and I've been > assured that if the performance is the same or better than Oracle's > and Microsoft's solutions that PostgreSQL is what they'll choose. While this doesn't exactly answer your question, I use this little tidbit of information when "selling" people on PostgreSQL. PostgreSQL was chosen over Oracle as the database to handle all of the .org TLDs information. While I don't believe the company that won was chosen solely because they used PostgreSQL vs Oracle ( vs anything else ), it does go to show that PostgreSQL can be used in a large scale environment. Another tidbit you can use in this particular case: I was involved in moving www.ljworld.com, www.lawrence.com, and www.kusports.com from a Sybase backend to a PostgreSQL backend back in 2000-2001. We got roughly a 200% speed improvement at that time and PostgreSQL has only improved since then. I would be more than happy to elaborate on this migration off list if you would like. kusports.com gets a TON of hits especially during "March Madness" and PostgreSQL has never been an issue in the performance of the site. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Mon Jan 10 05:04:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 978CB3A5526 for ; Mon, 10 Jan 2005 05:04: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 60422-01 for ; Mon, 10 Jan 2005 05:04:28 +0000 (GMT) Received: from mail0.rawbw.com (mail0.rawbw.com [198.144.192.41]) by svr1.postgresql.org (Postfix) with ESMTP id 9BF093A5527 for ; Mon, 10 Jan 2005 05:04:27 +0000 (GMT) Received: (from www@localhost) by mail0.rawbw.com (8.11.6p2/8.11.6) id j0A54QW75594 for pgsql-performance@postgresql.org; Sun, 9 Jan 2005 21:04:26 -0800 (PST) Received: from 198.144.203.171 ([198.144.203.171]) by webmail.rawbw.com (IMP) with HTTP for ; Sun, 9 Jan 2005 21:04:26 -0800 Message-ID: <1105333466.41e20cda39716@webmail.rawbw.com> Date: Sun, 9 Jan 2005 21:04:26 -0800 From: mudfoot@rawbw.com To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.1 X-Originating-IP: 198.144.203.171 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: 200501/102 X-Sequence-Number: 9792 Quoting Randolf Richardson : > I'm looking for recent performance statistics on PostgreSQL vs. Oracle > > vs. Microsoft SQL Server. Recently someone has been trying to convince my I don't know anything about your customer's requirements other than that they have a DB currently and somebody(ies) is(are) trying to get them to switch to another. I don't think you'll find meaningful numbers unless you do your own benchmarks. DB performance is very largely determined by how the application functions, hardware, OS and the DBA's familiarity with the platform. I would suspect that for any given workload on relatively similar hardware that just about any of the DB's you mention would perform similarly if tuned appropriately. > client to switch from SyBASE to Microsoft SQL Server (they originally wanted > > to go with Oracle but have since fallen in love with Microsoft). All this > time I've been recommending PostgreSQL for cost and stability (my own testing > > has shown it to be better at handling abnormal shutdowns and using fewer > system resources) in addition to true cross-platform compatibility. Right for the customer? How about "Don't fix it if it ain't broke"? Replacing a DB backend isn't always trivial (understatement). I suppose if their application is very simple and uses few if any proprietary features of Sybase then changing the DB would be simple. That depends heavily on the application. In general, though, you probably shouldn't rip and replace DB platforms unless there's a very good strategic reason. I don't know about MSSQL, but I know that, if managed properly, Sybase and Oracle can be pretty rock-solid and high performing. If *you* have found FooDB to be the most stable and highest performing, then that probably means that FooDB is the one you're most familiar with rather than FooDB being the best in all circumstances. PostgreSQL is great. I love it. In the right hands and under the right circumstances, it is the best DB. So is Sybase. And Oracle. And MSSQL. > > If I can show my client some statistics that PostgreSQL outperforms > these (I'm more concerned about it beating Oracle because I know that > Microsoft's stuff is always slower, but I need the information anyway to > protect my client from falling victim to a 'sales job'), then PostgreSQL will > > be the solution of choice as the client has always believed that they need a > > high-performance solution. > Unless there's a really compelling reason to switch, optimizing what they already have is probably the best thing for them. They've already paid for it. They've already written their own application and have some familiarity with managing the DB. According to Sybase, Sybase is the fastest thing going. :-) Which is probably pretty close to the truth if the application and DB are tuned appropriately. > I've already convinced them on the usual price, cross-platform > compatibility, open source, long history, etc. points, and I've been assured > > that if the performance is the same or better than Oracle's and Microsoft's > > solutions that PostgreSQL is what they'll choose. Are you telling me that they're willing to pay $40K per CPU for Oracle if it performs 1% better than PostgreSQL, which is $0? Not to mention throw away Sybase, which is a highly scalable platform in and of itself. The best DB platform is what they currently have, regardless of what they have, unless there is a very compelling reason to switch. > > Thanks in advance. > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Mon Jan 10 07:32:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8A8823A549D for ; Mon, 10 Jan 2005 07:32: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 79847-10 for ; Mon, 10 Jan 2005 07:32:26 +0000 (GMT) Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id ED5D53A5537 for ; Mon, 10 Jan 2005 07:32:08 +0000 (GMT) Received: from [192.168.1.2] (unknown [192.168.1.2]) by server.gpdnet.co.uk (Postfix) with ESMTP id A318A3AAD55 for ; Mon, 10 Jan 2005 07:35:29 +0000 (GMT) Message-ID: <41E22F04.103@gpdnet.co.uk> Date: Mon, 10 Jan 2005 07:30:12 +0000 From: Gary Doades User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: In-Reply-To: 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: 200501/103 X-Sequence-Number: 9793 Randolf Richardson wrote: > I'm looking for recent performance statistics on PostgreSQL vs. Oracle > vs. Microsoft SQL Server. Recently someone has been trying to convince my > client to switch from SyBASE to Microsoft SQL Server (they originally wanted > to go with Oracle but have since fallen in love with Microsoft). All this > time I've been recommending PostgreSQL for cost and stability (my own testing > has shown it to be better at handling abnormal shutdowns and using fewer > system resources) in addition to true cross-platform compatibility. > I'm not sure that you are going to get a simple answer to this one. It really depends on what you are trying to do. The only way you will know for sure what the performance of PostgreSQL is is to try it with samples of your common queries, updates etc. I have recently ported a moderately complex database from MS SQLServer to Postgres with reasonable success. 70% selects, 20% updates, 10% insert/deletes. I had to do a fair bit of work to get the best performance out of Postgres, but most of the SQL has as good or better performance then SQLServer. There are still areas where SQLServer outperforms Postgres. For me these tend to be the larger SQL Statements with correlated subqueries. SQLServer tends to optimise them better a lot of the time. Updates tend to be a fair bit faster on SQLServer too, this may be MS taking advantage of Windows specific optimisations in the filesystem. I did give Oracle a try out of curiosity. I never considered it seriously because of the cost. The majority of my SQL was *slower* under Oracle than SQLServer. I spent some time with it and did get good performance, but it took a *lot* of work tuning to Oracle specific ways of doing things. My Summary: SQLServer: A good all round database, fast, stable. Moderately expensive to buy, cheap and easy to work with and program for (on Windows) PostgreSQL: A good all rounder, fast most of the time, stable. Free to acquire, more expensive to work with and program for. Client drivers may be problematic depending on platform and programming language. Needs more work than SQLServer to get the best out of it. Improving all the time and worth serious consideration. Oracle: A bit of a monstrosity. Can be very fast with a lot of work, can't comment on stability but I guess it's pretty good. Very expensive to acquire and work with. Well supported server and clients. Cheers, Gary. From pgsql-performance-owner@postgresql.org Mon Jan 10 16:08:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42FF23A5605 for ; Mon, 10 Jan 2005 16:08: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 00659-10 for ; Mon, 10 Jan 2005 16:07:57 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 85FCE3A54C1 for ; Mon, 10 Jan 2005 16:07:56 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so271845wra for ; Mon, 10 Jan 2005 08:07:56 -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=j6VHbbxydEcE0vrvkOl0EZTPnX8UGeL5elR57sadGaeDu3ZaREjtbxSi3W253TZXc8T9vnKfVtmFEAAX6WI9TKr7J0wsy3k1s5wE/hLz5KhvVekHOVhP+spq18cjXT8YRAMT4bbh+0yKxwGA6V2wbljIa2n9jlSFaQIcDXre51Y= Received: by 10.54.26.76 with SMTP id 76mr128348wrz; Mon, 10 Jan 2005 08:07:56 -0800 (PST) Received: by 10.54.18.72 with HTTP; Mon, 10 Jan 2005 08:07:55 -0800 (PST) Message-ID: <33c6269f05011008074b33b812@mail.gmail.com> Date: Mon, 10 Jan 2005 11:07:55 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Gary Doades Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Cc: pgsql-performance@postgresql.org In-Reply-To: <41E22F04.103@gpdnet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41E22F04.103@gpdnet.co.uk> 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: 200501/104 X-Sequence-Number: 9794 Quick reply on this - I have worked with Oracle, MSSQL and Postgresql, the first and last extensively. Oracle is not that expensive - standard one can be got for $149/user or $5k/CPU, and for most applications, the features in standard one are fine. Oracle is a beast to manage. It does alot more logging that most other RDBMses, which is where you start needed more disk partitions for it to be effective (System, Redo, Archive Redo, Undo, Table (posibly Index)). The biggest cost for Oracle is hiring someone who knows how to set it up and maintain it properly, and it can be quite a feat. MS-SQL _is_ expensive for what you get. MS-SQL lacks many features that both Postgresql and oracle. I have particularly noticed aggregate queries and grouping operations aren't as advanced. Transact-SQL is also big pain in the ass. Neither Oracle nor MS-SQL have the range of stored procedure langauges that Postgresql supports. Postgresql is certainly the easiest to set up and maintain and get good performance. For small to medium database sizes on systems with limited drive partitions, I would expect postgresql to outperform Oracle in most tests. If you have $25k to spend on a DB server, and over $100k/year for an Oracle DBA, and you need 60x60x24x7x365 uptime with recoverability, realtime replication and clustering - Oracle might be your best bet, otherwise - pick Postgresql ;) Alex Turner NetEconoimst On Mon, 10 Jan 2005 07:30:12 +0000, Gary Doades wrote: > Randolf Richardson wrote: > > I'm looking for recent performance statistics on PostgreSQL vs. Oracle > > vs. Microsoft SQL Server. Recently someone has been trying to convince my > > client to switch from SyBASE to Microsoft SQL Server (they originally wanted > > to go with Oracle but have since fallen in love with Microsoft). All this > > time I've been recommending PostgreSQL for cost and stability (my own testing > > has shown it to be better at handling abnormal shutdowns and using fewer > > system resources) in addition to true cross-platform compatibility. > > > > I'm not sure that you are going to get a simple answer to this one. It > really depends on what you are trying to do. The only way you will know > for sure what the performance of PostgreSQL is is to try it with samples > of your common queries, updates etc. > > I have recently ported a moderately complex database from MS SQLServer > to Postgres with reasonable success. 70% selects, 20% updates, 10% > insert/deletes. I had to do a fair bit of work to get the best > performance out of Postgres, but most of the SQL has as good or better > performance then SQLServer. There are still areas where SQLServer > outperforms Postgres. For me these tend to be the larger SQL Statements > with correlated subqueries. SQLServer tends to optimise them better a > lot of the time. Updates tend to be a fair bit faster on SQLServer too, > this may be MS taking advantage of Windows specific optimisations in the > filesystem. > > I did give Oracle a try out of curiosity. I never considered it > seriously because of the cost. The majority of my SQL was *slower* under > Oracle than SQLServer. I spent some time with it and did get good > performance, but it took a *lot* of work tuning to Oracle specific ways > of doing things. > > My Summary: > > SQLServer: A good all round database, fast, stable. Moderately expensive > to buy, cheap and easy to work with and program for (on Windows) > > PostgreSQL: A good all rounder, fast most of the time, stable. Free to > acquire, more expensive to work with and program for. Client drivers may > be problematic depending on platform and programming language. Needs > more work than SQLServer to get the best out of it. Improving all the > time and worth serious consideration. > > Oracle: A bit of a monstrosity. Can be very fast with a lot of work, > can't comment on stability but I guess it's pretty good. Very expensive > to acquire and work with. Well supported server and clients. > > Cheers, > Gary. > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Mon Jan 10 17:33:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5BE223A5699 for ; Mon, 10 Jan 2005 17:33: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 11970-09 for ; Mon, 10 Jan 2005 17:33:15 +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 6CA743A5686 for ; Mon, 10 Jan 2005 17:33:14 +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 j0AHX9nQ018364; Mon, 10 Jan 2005 18:33:09 +0100 Received: (from yann@localhost) by zong.spline.inf.fu-berlin.de (8.13.1/8.13.1/Submit) id j0AHX7nP018363; Mon, 10 Jan 2005 18:33:07 +0100 Date: Mon, 10 Jan 2005 18:33:07 +0100 From: Yann Michel To: alex@neteconomist.com Cc: Gary Doades , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-ID: <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33c6269f05011008074b33b812@mail.gmail.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: 200501/105 X-Sequence-Number: 9795 Hi, On Mon, Jan 10, 2005 at 11:07:55AM -0500, Alex Turner wrote: > Neither Oracle nor MS-SQL have the range of stored procedure langauges > that Postgresql supports. That is not true. Oracle uses PL/SQL for its stored procedures and M$-SQL does have a stored procedural language. Regards, Yann - OCA ;-) From pgsql-performance-owner@postgresql.org Mon Jan 10 17:41:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0FDB73A56B7 for ; Mon, 10 Jan 2005 17: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 13465-04 for ; Mon, 10 Jan 2005 17:40:48 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id D4F0B3A5686 for ; Mon, 10 Jan 2005 17:40:45 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j0AHfPBe014441; Mon, 10 Jan 2005 11:41:25 -0600 Date: Mon, 10 Jan 2005 11:42:00 -0600 From: Frank Wiles To: Yann Michel Cc: alex@neteconomist.com, gpd@gpdnet.co.uk, pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-Id: <20050110114200.76e9a51d.frank@wiles.org> In-Reply-To: <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> 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: 200501/106 X-Sequence-Number: 9796 On Mon, 10 Jan 2005 18:33:07 +0100 Yann Michel wrote: > Hi, > > On Mon, Jan 10, 2005 at 11:07:55AM -0500, Alex Turner wrote: > > Neither Oracle nor MS-SQL have the range of stored procedure > > langauges that Postgresql supports. > > That is not true. Oracle uses PL/SQL for its stored procedures and > M$-SQL does have a stored procedural language. By "range" I believe he meant number of stored procedure languages. He wasn't saying they didn't have a stored procedure langauge or support, just that PostgreSQL had more languages to choose from. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Mon Jan 10 17:47:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 539923A55F4 for ; Mon, 10 Jan 2005 17:47: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 13940-08 for ; Mon, 10 Jan 2005 17:46:58 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 41C433A56B1 for ; Mon, 10 Jan 2005 17:46:58 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so286502wra for ; Mon, 10 Jan 2005 09:46: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=L9M69euAsL36jYHrxUo1QrhomQ7ukfqsNJwk04084I1+rUTBQmN0C8F2N60EpPbdGJRtw8z9exh1Lg2mHtPEZYSClii/DL1h4FcR5duZTrWCUm2Z1+EefZNOW0pzGNxcoVJlhb05F4fcA/zK4uJnvI3wGO3lyxe6eTJ1HUHcqfo= Received: by 10.54.33.35 with SMTP id g35mr319391wrg; Mon, 10 Jan 2005 09:46:02 -0800 (PST) Received: by 10.54.18.72 with HTTP; Mon, 10 Jan 2005 09:46:01 -0800 (PST) Message-ID: <33c6269f050110094646897c3e@mail.gmail.com> Date: Mon, 10 Jan 2005 12:46:01 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Frank Wiles Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Cc: Yann Michel , gpd@gpdnet.co.uk, pgsql-performance@postgresql.org In-Reply-To: <20050110114200.76e9a51d.frank@wiles.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> 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: 200501/107 X-Sequence-Number: 9797 You sir are correct! You can't use perl in MS-SQL or Oracle ;). Alex Turner NetEconomist On Mon, 10 Jan 2005 11:42:00 -0600, Frank Wiles wrote: > On Mon, 10 Jan 2005 18:33:07 +0100 > Yann Michel wrote: > > > Hi, > > > > On Mon, Jan 10, 2005 at 11:07:55AM -0500, Alex Turner wrote: > > > Neither Oracle nor MS-SQL have the range of stored procedure > > > langauges that Postgresql supports. > > > > That is not true. Oracle uses PL/SQL for its stored procedures and > > M$-SQL does have a stored procedural language. > > By "range" I believe he meant number of stored procedure languages. > He wasn't saying they didn't have a stored procedure langauge or > support, just that PostgreSQL had more languages to choose from. > > --------------------------------- > Frank Wiles > http://www.wiles.org > --------------------------------- > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Mon Jan 10 20:08:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E01853A571C for ; Mon, 10 Jan 2005 20:08: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 33257-04 for ; Mon, 10 Jan 2005 20:08:01 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 0FF613A55C7 for ; Mon, 10 Jan 2005 20:08:01 +0000 (GMT) Received: (qmail 22637 invoked from network); 10 Jan 2005 21:08:04 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 10 Jan 2005 21:08:04 +0100 To: alex@neteconomist.com, "Frank Wiles" Cc: "Yann Michel" , gpd@gpdnet.co.uk, pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> 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, 10 Jan 2005 21:08:37 +0100 In-Reply-To: <33c6269f050110094646897c3e@mail.gmail.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: 200501/108 X-Sequence-Number: 9798 On Mon, 10 Jan 2005 12:46:01 -0500, Alex Turner wrote: > You sir are correct! You can't use perl in MS-SQL or Oracle ;). Can you benefit from the luminous power of Visual Basic as a pl in MSSQL ? From pgsql-performance-owner@postgresql.org Mon Jan 10 20:14:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 075263A571C for ; Mon, 10 Jan 2005 20:14: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 34495-01 for ; Mon, 10 Jan 2005 20:14:04 +0000 (GMT) Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id E0D853A5697 for ; Mon, 10 Jan 2005 20:14:05 +0000 (GMT) Received: from [192.168.1.2] (unknown [192.168.1.2]) by server.gpdnet.co.uk (Postfix) with ESMTP id 119863AAC68 for ; Mon, 10 Jan 2005 20:17:31 +0000 (GMT) Message-ID: <41E2E19D.1000903@gpdnet.co.uk> Date: Mon, 10 Jan 2005 20:12:13 +0000 From: Gary Doades 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: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> 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: 200501/109 X-Sequence-Number: 9799 Pierre-Fr�d�ric Caillaud wrote: > On Mon, 10 Jan 2005 12:46:01 -0500, Alex Turner wrote: > >> You sir are correct! You can't use perl in MS-SQL or Oracle ;). > > > Can you benefit from the luminous power of Visual Basic as a pl in > MSSQL ? > The .NET Runtime will be a part of the next MS SQLServer engine. You will be able to have C# as a pl in the database engine with the next version of MSSQL. That certainly will be something to think about. Cheers, Gary. From pgsql-performance-owner@postgresql.org Mon Jan 10 20:30:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49AA03A5710 for ; Mon, 10 Jan 2005 20:30: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 35311-10 for ; Mon, 10 Jan 2005 20:30:08 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 238763A5599 for ; Mon, 10 Jan 2005 20:30:08 +0000 (GMT) Received: (qmail 24181 invoked from network); 10 Jan 2005 20:29:37 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 10 Jan 2005 20:29:37 -0000 Message-ID: <41E2E5CA.2020700@fastcrypt.com> Date: Mon, 10 Jan 2005 15:30:02 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gary Doades Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> In-Reply-To: <41E2E19D.1000903@gpdnet.co.uk> 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.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/110 X-Sequence-Number: 9800 Currently there are two java pl's available for postgres. Dave Gary Doades wrote: > Pierre-Fr�d�ric Caillaud wrote: > >> On Mon, 10 Jan 2005 12:46:01 -0500, Alex Turner >> wrote: >> >>> You sir are correct! You can't use perl in MS-SQL or Oracle ;). >> >> >> >> Can you benefit from the luminous power of Visual Basic as a pl >> in MSSQL ? >> > > The .NET Runtime will be a part of the next MS SQLServer engine. You > will be able to have C# as a pl in the database engine with the next > version of MSSQL. That certainly will be something to think about. > > Cheers, > Gary. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Mon Jan 10 20:33:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D1973A573D for ; Mon, 10 Jan 2005 20:33: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 36747-02 for ; Mon, 10 Jan 2005 20:33:36 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 249053A571A for ; Mon, 10 Jan 2005 20:33:26 +0000 (GMT) Received: (qmail 28093 invoked from network); 10 Jan 2005 21:33:31 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 10 Jan 2005 21:33:31 +0100 To: "Gary Doades" Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> 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, 10 Jan 2005 21:34:04 +0100 In-Reply-To: <41E2E19D.1000903@gpdnet.co.uk> 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: 200501/111 X-Sequence-Number: 9801 > The .NET Runtime will be a part of the next MS SQLServer engine. You > will be able to have C# as a pl in the database engine with the next > version of MSSQL. That certainly will be something to think about. Ah, well, if it's C# (or even VB.NET) then it's serious ! I thought postgres had pl/java ? From pgsql-performance-owner@postgresql.org Mon Jan 10 20:34:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4C1B93A5768 for ; Mon, 10 Jan 2005 20:34: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 36845-04 for ; Mon, 10 Jan 2005 20:34:32 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 6F4363A573A for ; Mon, 10 Jan 2005 20:34:31 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so87564wri for ; Mon, 10 Jan 2005 12:34: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=WHW2jvNnrBW6Hao3OJWhYw9eLTzlbaWKAp6tJdseHlqiVAaakHu5nWDjnzCSZE3feNC/kOJ1VHR3ol3S7eB4HmFJKz5AR7c1j3w9xrKkuidBjJ4neB62A0X52MKPWS3Q7R/aJ+vvr7BeghD5BtUWx7fBGKh45nVB4lHC1cT1FJI= Received: by 10.54.44.78 with SMTP id r78mr200188wrr; Mon, 10 Jan 2005 12:34:31 -0800 (PST) Received: by 10.54.11.6 with HTTP; Mon, 10 Jan 2005 12:34:31 -0800 (PST) Message-ID: <37d451f70501101234621beee1@mail.gmail.com> Date: Mon, 10 Jan 2005 14:34:31 -0600 From: Rosser Schwarz Reply-To: Rosser Schwarz To: Gary Doades Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Cc: pgsql-performance@postgresql.org In-Reply-To: <41E2E19D.1000903@gpdnet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> 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: 200501/112 X-Sequence-Number: 9802 while you weren't looking, Gary Doades wrote: > The .NET Runtime will be a part of the next MS SQLServer engine. It won't be long before someone writes a procedural language binding to PostgreSQL for Parrot [1]. That should offer us a handful or six more languages that can be used, including BASIC, Ruby and Scheme, Perl (5 and 6), Python and TCL for more or less free, and ... wait for it, BrainF***. IIRC, people have talked about porting C# to Parrot, as well. /rls [1] The new VM for Perl 6, &c: http://www.parrotcode.org -- :wq From pgsql-performance-owner@postgresql.org Mon Jan 10 20:46:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D28C53A5652 for ; Mon, 10 Jan 2005 20: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 37651-09 for ; Mon, 10 Jan 2005 20:46:38 +0000 (GMT) Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id BDF163A5721 for ; Mon, 10 Jan 2005 20:46:39 +0000 (GMT) Received: from [192.168.1.2] (unknown [192.168.1.2]) by server.gpdnet.co.uk (Postfix) with ESMTP id 435CA3AAC68 for ; Mon, 10 Jan 2005 20:50:05 +0000 (GMT) Message-ID: <41E2E93F.3080104@gpdnet.co.uk> Date: Mon, 10 Jan 2005 20:44:47 +0000 From: Gary Doades 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: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <37d451f70501101234621beee1@mail.gmail.com> In-Reply-To: <37d451f70501101234621beee1@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/113 X-Sequence-Number: 9803 Rosser Schwarz wrote: > while you weren't looking, Gary Doades wrote: > > >>The .NET Runtime will be a part of the next MS SQLServer engine. > > > It won't be long before someone writes a procedural language binding > to PostgreSQL for Parrot [1]. That should offer us a handful or six > more languages that can be used, including BASIC, Ruby and Scheme, > Perl (5 and 6), Python and TCL for more or less free, and ... wait for > it, BrainF***. > > IIRC, people have talked about porting C# to Parrot, as well. > Or perhaps get the mono engine in there somewhere to pick up another dozen or so languages supported by .NET and mono...... Cheers, Gary. From pgsql-performance-owner@postgresql.org Mon Jan 10 21:31:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A33C3A5728 for ; Mon, 10 Jan 2005 21:31: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 43931-03 for ; Mon, 10 Jan 2005 21:31:45 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id B3A693A5599 for ; Mon, 10 Jan 2005 21:31:45 +0000 (GMT) Received: (qmail 24874 invoked from network); 10 Jan 2005 21:31:14 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 10 Jan 2005 21:31:14 -0000 Message-ID: <41E2F43C.5020702@fastcrypt.com> Date: Mon, 10 Jan 2005 16:31:40 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= Cc: Gary Doades , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> 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.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/114 X-Sequence-Number: 9804 I'm curious, why do you think that's serious ? What do you really expect to do in the stored procedure ? Anything of consequence will seriously degrade performance if you select it in say a million rows. Pierre-Fr�d�ric Caillaud wrote: >> The .NET Runtime will be a part of the next MS SQLServer engine. You >> will be able to have C# as a pl in the database engine with the next >> version of MSSQL. That certainly will be something to think about. > > > Ah, well, if it's C# (or even VB.NET) then it's serious ! > I thought postgres had pl/java ? > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Mon Jan 10 21:58:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E7323A570B for ; Mon, 10 Jan 2005 21:58: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 46615-04 for ; Mon, 10 Jan 2005 21:57:46 +0000 (GMT) Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id 0D3443A5599 for ; Mon, 10 Jan 2005 21:57:47 +0000 (GMT) Received: from [192.168.1.2] (unknown [192.168.1.2]) by server.gpdnet.co.uk (Postfix) with ESMTP id E58503AAC68 for ; Mon, 10 Jan 2005 22:01:14 +0000 (GMT) Message-ID: <41E2F9ED.1070206@gpdnet.co.uk> Date: Mon, 10 Jan 2005 21:55:57 +0000 From: Gary Doades 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: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <41E2F43C.5020702@fastcrypt.com> In-Reply-To: <41E2F43C.5020702@fastcrypt.com> 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/115 X-Sequence-Number: 9805 Dave Cramer wrote: > I'm curious, why do you think that's serious ? What do you really expect > to do in the stored procedure ? Anything of consequence will seriously > degrade performance if you select it in say a million rows. > I'm not sure what you mean by "select it in a million rows". I would expect to write a procedure within the database engine to select a million rows, process them and return the result to the client. Very efficient. Cheers, Gary. From pgsql-performance-owner@postgresql.org Mon Jan 10 23:30:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7982B3A57BD for ; Mon, 10 Jan 2005 23:29: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 56961-09 for ; Mon, 10 Jan 2005 23:29:50 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id E0A5F3A57B0 for ; Mon, 10 Jan 2005 23:29:52 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 2798F1C908; Mon, 10 Jan 2005 17:29:52 -0600 (CST) Date: Mon, 10 Jan 2005 17:29:52 -0600 From: "Jim C. Nasby" To: alex@neteconomist.com Cc: Frank Wiles , Yann Michel , gpd@gpdnet.co.uk, pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-ID: <20050110232952.GG67721@decibel.org> References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33c6269f050110094646897c3e@mail.gmail.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.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/116 X-Sequence-Number: 9806 On Mon, Jan 10, 2005 at 12:46:01PM -0500, Alex Turner wrote: > You sir are correct! You can't use perl in MS-SQL or Oracle ;). On the other hand, PL/SQL is incredibly powerful, especially combined with all the tools/utilities that come with Oracle. I think you'd be hard-pressed to find too many real-world examples where you could do something with a PostgreSQL procedural language that you couldn't do with PL/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 Tue Jan 11 00:50:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 267963A5734 for ; Tue, 11 Jan 2005 00:50: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 65996-10 for ; Tue, 11 Jan 2005 00:50:03 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2CC4C3A57E5 for ; Tue, 11 Jan 2005 00:50:05 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B7A7B313EB; Tue, 11 Jan 2005 01:50:04 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Mon, 10 Jan 2005 18:57:25 -0500 Organization: cbbrowne Computing Inc Lines: 17 Message-ID: References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 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.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:kd2XN8qaTWQ+5sMHAQczhUFTuq0= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.085 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/118 X-Sequence-Number: 9808 Oops! lists@boutiquenumerique.com (Pierre-Fr�d�ric Caillaud) was seen spray-painting on a wall: >> The .NET Runtime will be a part of the next MS SQLServer engine. You >> will be able to have C# as a pl in the database engine with the next >> version of MSSQL. That certainly will be something to think about. > > Ah, well, if it's C# (or even VB.NET) then it's serious ! > I thought postgres had pl/java ? Someone's working on pl/Mono... -- "cbbrowne","@","gmail.com" http://cbbrowne.com/info/slony.html "... the open research model is justified. There is a passage in the Bible (John 8:32, and on a plaque in CIA HQ), "And ye shall know the truth, and the truth shall set ye free." -- Dave Dittrich From pgsql-performance-owner@postgresql.org Tue Jan 11 00:05:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06E833A57DF for ; Tue, 11 Jan 2005 00:04: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 62450-03 for ; Tue, 11 Jan 2005 00:04:40 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 301863A57D0 for ; Tue, 11 Jan 2005 00:04:42 +0000 (GMT) Received: (qmail 26426 invoked from network); 11 Jan 2005 00:04:11 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 11 Jan 2005 00:04:11 -0000 Message-ID: <41E31815.4030908@fastcrypt.com> Date: Mon, 10 Jan 2005 19:04:37 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gary Doades Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <41E2F43C.5020702@fastcrypt.com> <41E2F9ED.1070206@gpdnet.co.uk> In-Reply-To: <41E2F9ED.1070206@gpdnet.co.uk> 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.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/117 X-Sequence-Number: 9807 Ok, so one use case is to select a large number of rows and do some non-trivial operation on them. I can see where getting the rows inside the server process ( ie some procedural language ) thereby reducing the round trip overhead would be beneficial. However how do you deal with the lack of control ? For instance what happens if you run out of memory while doing this ? I'm not sure about other DB'S but if you crash the procedural language inside postgres you will bring the server down. It would seem to me that any non-trivial operation would be better handled outside the server process, even if it costs you the round trip. Dave Gary Doades wrote: > Dave Cramer wrote: > >> I'm curious, why do you think that's serious ? What do you really >> expect to do in the stored procedure ? Anything of consequence will >> seriously degrade performance if you select it in say a million rows. >> > > I'm not sure what you mean by "select it in a million rows". I would > expect to write a procedure within the database engine to select a > million rows, process them and return the result to the client. Very > efficient. > > Cheers, > Gary. > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Tue Jan 11 01:24:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2B6EA3A5805 for ; Tue, 11 Jan 2005 01:24: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 72120-02 for ; Tue, 11 Jan 2005 01:24:05 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 34E543A5803 for ; Tue, 11 Jan 2005 01:24:07 +0000 (GMT) Received: (qmail 8856 invoked from network); 11 Jan 2005 02:24:13 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 11 Jan 2005 02:24:13 +0100 To: pg@fastcrypt.com Cc: "Gary Doades" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <41E2F43C.5020702@fastcrypt.com> Message-ID: Date: Tue, 11 Jan 2005 02:24:47 +0100 From: PFC 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: <41E2F43C.5020702@fastcrypt.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: 200501/119 X-Sequence-Number: 9809 > I'm curious, why do you think that's serious ? What do you really expect Simply because I don't like VB non .NET, but C# is a much much better language, and even VB.NET is decent. > to do in the stored procedure ? Anything of consequence will seriously > degrade performance if you select it in say a million rows. Well, if such a thing needed to be done, like processing a lot of rows to yield a small result set, it certainly should be done inside the server, but as another poster said, being really careful about memory usage. But, that was not my original idea ; I find that even for small functions plsql is a bit ugly compared to the usual suspects like Python and others ; unfortunately I think there is overhead in converting the native postgres datatype to their other language counterparts, which is why I did not try them (yet). From pgsql-performance-owner@postgresql.org Tue Jan 11 02:43:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F6433A5842 for ; Tue, 11 Jan 2005 02:42: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 80895-02 for ; Tue, 11 Jan 2005 02:42:10 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.206]) by svr1.postgresql.org (Postfix) with ESMTP id 7D8AD3A585C for ; Tue, 11 Jan 2005 02:42:12 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id g11so151902rne for ; Mon, 10 Jan 2005 18:42:13 -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=H7AUimr7odVWhwTxsqFmGWNV44Dna2qhxUvLkC84eUzjeKaToT9KkuEmNGgGz7lvbzHyU4bAgQeI7FwuN0TdaoKY0UteLwIkmqHPok7JY95uw7kokIVUBUhVTnNFh2LnbbVTbl4qfoS9FfIli31F7A8VghMJsjcN5ibkwQMmJMs= Received: by 10.38.125.7 with SMTP id x7mr251403rnc; Mon, 10 Jan 2005 18:42:13 -0800 (PST) Received: by 10.38.151.34 with HTTP; Mon, 10 Jan 2005 18:42:13 -0800 (PST) Message-ID: <59b2d39b05011018421680264b@mail.gmail.com> Date: Mon, 10 Jan 2005 18:42:13 -0800 From: Miles Keaton Reply-To: Miles Keaton To: pgsql-performance@postgresql.org Subject: which dual-CPU hardware/OS is fastest for PostgreSQL? 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: 200501/120 X-Sequence-Number: 9810 I'm sorry if there's a URL out there answering this, but I couldn't find it. For those of us that need the best performance possible out of a dedicated dual-CPU PostgreSQL server, what is recommended? AMD64/Opteron or i386/Xeon? Linux or FreeBSD or _?_ I'm assuming hardware RAID 10 on 15k SCSI drives is fastest disk performance. Any hardware-comparison benchmarks out there showing the results for different PostgreSQL setups? Thanks! From pgsql-performance-owner@postgresql.org Tue Jan 11 03:46:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9ACE93A584A for ; Tue, 11 Jan 2005 03:44: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 89657-01 for ; Tue, 11 Jan 2005 03:44:25 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 514713A5695 for ; Tue, 11 Jan 2005 03:44: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 j0B3iHQ0005008; Mon, 10 Jan 2005 19:44:25 -0800 Message-ID: <41E34BA2.2040502@commandprompt.com> Date: Mon, 10 Jan 2005 19:44:34 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Miles Keaton Cc: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <59b2d39b05011018421680264b@mail.gmail.com> In-Reply-To: <59b2d39b05011018421680264b@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------080603070407020904020904" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.039 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/121 X-Sequence-Number: 9811 This is a multi-part message in MIME format. --------------080603070407020904020904 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Miles Keaton wrote: >I'm sorry if there's a URL out there answering this, but I couldn't find it. > >For those of us that need the best performance possible out of a >dedicated dual-CPU PostgreSQL server, what is recommended? > >AMD64/Opteron or i386/Xeon? > > AMD64/Opteron >Linux or FreeBSD or _?_ > > This is a religious question :) >I'm assuming hardware RAID 10 on 15k SCSI drives is fastest disk performance. > > And many, many disks -- yes. Sincerely, Joshua D. Drake >Any hardware-comparison benchmarks out there showing the results for >different PostgreSQL setups? > >Thanks! > >---------------------------(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 --------------080603070407020904020904 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 --------------080603070407020904020904-- From pgsql-performance-owner@postgresql.org Tue Jan 11 04:04:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9DD7A3A5851 for ; Tue, 11 Jan 2005 04: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 90309-09 for ; Tue, 11 Jan 2005 04:04:41 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id B17373A57AD for ; Tue, 11 Jan 2005 04:04:40 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 41DB13158F; Tue, 11 Jan 2005 05:04:39 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Mon, 10 Jan 2005 23:04:20 -0500 Organization: cbbrowne Computing Inc Lines: 61 Message-ID: References: <59b2d39b05011018421680264b@mail.gmail.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 (Corporate Culture, linux) Cancel-Lock: sha1:Z1W6VL2SgQAOwJhB30+vNJnmqNI= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.323 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/122 X-Sequence-Number: 9812 Quoth mileskeaton@gmail.com (Miles Keaton): > I'm sorry if there's a URL out there answering this, but I couldn't > find it. > > For those of us that need the best performance possible out of a > dedicated dual-CPU PostgreSQL server, what is recommended? > > AMD64/Opteron or i386/Xeon? Xeon sux pretty bad... > Linux or FreeBSD or _?_ The killer question won't be of what OS is "faster," but rather of what OS better supports the fastest hardware you can get your hands on. We tried doing some FreeBSD benchmarking on a quad-Opteron box, only to discover that the fibrechannel controller worked in what amounted to a "PAE-like" mode where it only talked DMA in a 32 bit manner. We might have found a more suitable controller, given time that was not available. A while back I tried to do some FreeBSD benchmarking on a quad-Xeon box with 8GB of RAM. I couldn't find _any_ RAID controller compatible with that configuration, so FreeBSD wasn't usable on that hardware unless I told the box to ignore half the RAM. There lies the rub of the problem: you need to make sure all the vital components are able to run "full blast" in order to maximize performance. The really high end SCSI controllers may only have supported drivers for some specific set of OSes, and it seems to be pretty easy to put together boxes where one or another component leaps into the "That Doesn't Work!" category. > I'm assuming hardware RAID 10 on 15k SCSI drives is fastest disk > performance. RAID controllers tend to use i960 or StrongARM CPUs that run at speeds that _aren't_ all that impressive. With software RAID, you can take advantage of the _enormous_ increases in the speed of the main CPU. I don't know so much about FreeBSD's handling of this, but on Linux, there's pretty strong indication that _SOFTWARE_ RAID is faster than hardware RAID. It has the further merit that you're not dependent on some disk formatting scheme that is only compatible with the model of RAID controller that you've got, where if the controller breaks down, you likely have to rebuild the whole array from scratch and your data is toast. The assumptions change if you're looking at really high end disk arrays, but that's certainly another story. -- (format nil "~S@~S" "cbbrowne" "acm.org") http://linuxfinances.info/info/finances.html Real Programmers are surprised when the odometers in their cars don't turn from 99999 to A0000. From pgsql-performance-owner@postgresql.org Tue Jan 11 04:26:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C83243A585A for ; Tue, 11 Jan 2005 04:25: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 92578-10 for ; Tue, 11 Jan 2005 04:25:08 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 437463A5873 for ; Tue, 11 Jan 2005 04:25:07 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id E0F5D3158F; Tue, 11 Jan 2005 05:25:06 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: 11 Jan 2005 04:25:04 GMT Organization: cbbrowne Computing Inc Lines: 52 Message-ID: <34h2p0F4bbv8sU3@individual.net> References: <59b2d39b05011018421680264b@mail.gmail.com> X-Draft-From: ("nntp+wolfe:pgsql.performance" 457) 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.327 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/123 X-Sequence-Number: 9813 Xeon sux pretty bad... > Linux or FreeBSD or _?_ The killer question won't be of what OS is "faster," but rather of what OS better supports the fastest hardware you can get your hands on. We tried doing some FreeBSD benchmarking on a quad-Opteron box, only to discover that the fibrechannel controller worked in what amounted to a "PAE-like" mode where it only talked DMA in a 32 bit manner. We might have found a more suitable controller, given time that was not available. A while back I tried to do some FreeBSD benchmarking on a quad-Xeon box with 8GB of RAM. I couldn't find _any_ RAID controller compatible with that configuration, so FreeBSD wasn't usable on that hardware unless I told the box to ignore half the RAM. There lies the rub of the problem: you need to make sure all the vital components are able to run "full blast" in order to maximize performance. The really high end SCSI controllers may only have supported drivers for some specific set of OSes, and it seems to be pretty easy to put together boxes where one or another component leaps into the "That Doesn't Work!" category. > I'm assuming hardware RAID 10 on 15k SCSI drives is fastest disk > performance. RAID controllers tend to use i960 or StrongARM CPUs that run at speeds that _aren't_ all that impressive. With software RAID, you can take advantage of the _enormous_ increases in the speed of the main CPU. I don't know so much about FreeBSD's handling of this, but on Linux, there's pretty strong indication that _SOFTWARE_ RAID is faster than hardware RAID. It has the further merit that you're not dependent on some disk formatting scheme that is only compatible with the model of RAID controller that you've got, where if the controller breaks down, you likely have to rebuild the whole array from scratch and your data is toast. The assumptions change if you're looking at really high end disk arrays, but that's certainly another story. -- (format nil "~S@~S" "cbbrowne" "acm.org") http://linuxfinances.info/info/finances.html Real Programmers are surprised when the odometers in their cars don't turn from 99999 to A0000. From pgsql-performance-owner@postgresql.org Tue Jan 11 04:31:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DA4D43A586C for ; Tue, 11 Jan 2005 04:31: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 94777-02 for ; Tue, 11 Jan 2005 04:31:09 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 260A33A573D for ; Tue, 11 Jan 2005 04:31:09 +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 j0B4V5Q0007447; Mon, 10 Jan 2005 20:31:06 -0800 Message-ID: <41E3569A.4030102@commandprompt.com> Date: Mon, 10 Jan 2005 20:31:22 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <59b2d39b05011018421680264b@mail.gmail.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------040301030800010906080008" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.039 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/124 X-Sequence-Number: 9814 This is a multi-part message in MIME format. --------------040301030800010906080008 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > >RAID controllers tend to use i960 or StrongARM CPUs that run at speeds >that _aren't_ all that impressive. With software RAID, you can take >advantage of the _enormous_ increases in the speed of the main CPU. > >I don't know so much about FreeBSD's handling of this, but on Linux, >there's pretty strong indication that _SOFTWARE_ RAID is faster than >hardware RAID. > > Unless something has changed though, you can't run raid 10 with linux software raid and raid 5 sucks for heavy writes. J >It has the further merit that you're not dependent on some disk >formatting scheme that is only compatible with the model of RAID >controller that you've got, where if the controller breaks down, you >likely have to rebuild the whole array from scratch and your data is >toast. > >The assumptions change if you're looking at really high end disk >arrays, but that's certainly another story. > > -- 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 --------------040301030800010906080008 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 --------------040301030800010906080008-- From pgsql-performance-owner@postgresql.org Tue Jan 11 06:35:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 72C403A5888 for ; Tue, 11 Jan 2005 06:35: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 15629-04 for ; Tue, 11 Jan 2005 06:35:55 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id DD51C3A5880 for ; Tue, 11 Jan 2005 06:35: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 6891732; Mon, 10 Jan 2005 22:37:35 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Mon, 10 Jan 2005 22:35:18 -0800 User-Agent: KMail/1.6.2 Cc: Christopher Browne References: <59b2d39b05011018421680264b@mail.gmail.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: <200501102235.18887.josh@agliodbs.com> 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: 200501/125 X-Sequence-Number: 9815 Chris, > I don't know so much about FreeBSD's handling of this, but on Linux, > there's pretty strong indication that _SOFTWARE_ RAID is faster than > hardware RAID. Certainly better than an Adaptec. But not necessarily better than a medium-end RAID card, like an LSI. It really depends on the quality of the controller. Also, expected concurrent activity should influence you. On a dedicated database server, you'll seldom max out the CPU but will often max of the disk, so the CPU required by software RAID is "free". However, if you have a Web/PG/E-mail box which frequently hits 100% CPU, then even a lower-end RAID card can be beneficial simply by taking load off the CPU. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 11 07:39:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8B8883A55CB for ; Tue, 11 Jan 2005 07:39: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 30815-02 for ; Tue, 11 Jan 2005 07:39:11 +0000 (GMT) Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id 940593A55BA for ; Tue, 11 Jan 2005 07:39:09 +0000 (GMT) Received: from [192.168.1.2] (unknown [192.168.1.2]) by server.gpdnet.co.uk (Postfix) with ESMTP id C1E913AAD6E for ; Tue, 11 Jan 2005 07:42:38 +0000 (GMT) Message-ID: <41E38231.5090301@gpdnet.co.uk> Date: Tue, 11 Jan 2005 07:37:21 +0000 From: Gary Doades 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: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <41E2F43C.5020702@fastcrypt.com> <41E2F9ED.1070206@gpdnet.co.uk> <41E31815.4030908@fastcrypt.com> In-Reply-To: <41E31815.4030908@fastcrypt.com> 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.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/126 X-Sequence-Number: 9816 Dave Cramer wrote: > Ok, so one use case is to select a large number of rows and do some > non-trivial operation on them. > I can see where getting the rows inside the server process ( ie some > procedural language ) thereby reducing the round trip overhead would be > beneficial. However how do you deal with the lack of control ? For > instance what happens if you run out of memory while doing this ? I'm > not sure about other DB'S but if you crash the procedural language > inside postgres you will bring the server down. > > It would seem to me that any non-trivial operation would be better > handled outside the server process, even if it costs you the round trip. Since a .NET language is operating effectively inside a VM it is pretty much impossible to bring down the server that way. Only a bug in the .NET runtime itself will do that. The C# try/catch/finally with .NET global execption last chance handlers will ensure the server and your code is well protected. Cheers, Gary. From pgsql-performance-owner@postgresql.org Fri Jan 14 06:44:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 651C13A5607 for ; Tue, 11 Jan 2005 09:24: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 50600-04 for ; Tue, 11 Jan 2005 09:24:05 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A12C73A55F9 for ; Tue, 11 Jan 2005 09:24:06 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4A0553158F; Tue, 11 Jan 2005 10:24:06 +0100 (MET) From: "Pete de Zwart" X-Newsgroups: pgsql.performance Subject: Best filesystem for PostgreSQL Database Cluster under Linux Date: Tue, 11 Jan 2005 20:23:25 +1100 Organization: Froob Networks X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original Lines: 24 Message-ID: <41e39b04$0$96857$c30e37c6@ken-reader.news.telstra.net> 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: 200501/176 X-Sequence-Number: 9866 Greetings to one and all, I've been trying to find some information on selecting an optimal filesystem setup for a volume that will only contain a PostgreSQL Database Cluster under Linux. Searching through the mailing list archive showed some promising statistics on the various filesystems available to Linux, ranging from ext2 through reiserfs and xfs. I have come to understand that PostgreSQLs Write Ahead Logging (WAL) performs a lot of the journal functionality provided by the majoirty of contemporary filesystems and that having both WAL and filesystem journalling can degrade performance. Could anyone point me in the right direction so that I can read up some more on this issue to discern which filesystem to choose and how to tune both the FS and PostgreSQL so that they can compliment each other? I've attempted to find this information via the FAQ, Google and the mailing list archives but have lucked out for the moment. Regards, Pete de Zwart. From pgsql-performance-owner@postgresql.org Tue Jan 11 10:14:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DC403A575C for ; Tue, 11 Jan 2005 10:14: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 58973-06 for ; Tue, 11 Jan 2005 10:14:15 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id 7739F3A5679 for ; Tue, 11 Jan 2005 10:14:16 +0000 (GMT) Received: from trofast.sesse.net ([129.241.93.32]) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CoJ2U-0002qP-58 for pgsql-performance@postgresql.org; Tue, 11 Jan 2005 11:14:15 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1CoJ2T-0002MQ-00 for ; Tue, 11 Jan 2005 11:14:13 +0100 Date: Tue, 11 Jan 2005 11:14:13 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Message-ID: <20050111101413.GB7789@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <59b2d39b05011018421680264b@mail.gmail.com> <41E3569A.4030102@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <41E3569A.4030102@commandprompt.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: 200501/127 X-Sequence-Number: 9817 On Mon, Jan 10, 2005 at 08:31:22PM -0800, Joshua D. Drake wrote: > Unless something has changed though, you can't run raid 10 > with linux software raid Hm, why not? What stops you from making two RAID-0 devices and mirroring those? (Or the other way round, I can never remember :-) ) /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Fri Jan 14 06:44:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 489E03A57C3 for ; Tue, 11 Jan 2005 10:16: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 59896-01 for ; Tue, 11 Jan 2005 10:16:40 +0000 (GMT) Received: from zoidberg.portrix.net (mail.portrix.net [212.202.157.208]) by svr1.postgresql.org (Postfix) with ESMTP id EC4CD3A5679 for ; Tue, 11 Jan 2005 10:16:40 +0000 (GMT) Received: from [192.168.42.205] (port-212-202-157-193.static.qsc.de [212.202.157.193]) (authenticated bits=0) by zoidberg.portrix.net (8.12.3/8.12.3/Debian-7.1) with ESMTP id j0BAGWjV007944; Tue, 11 Jan 2005 11:16:33 +0100 Message-ID: <41E3A780.3020505@portrix.net> Date: Tue, 11 Jan 2005 11:16:32 +0100 From: Jan Dittmer User-Agent: Mozilla Thunderbird 0.9 (X11/20041124) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Joshua D. Drake" Cc: Christopher Browne , pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <59b2d39b05011018421680264b@mail.gmail.com> <41E3569A.4030102@commandprompt.com> In-Reply-To: <41E3569A.4030102@commandprompt.com> X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/175 X-Sequence-Number: 9865 Joshua D. Drake wrote: >>RAID controllers tend to use i960 or StrongARM CPUs that run at speeds >>that _aren't_ all that impressive. With software RAID, you can take >>advantage of the _enormous_ increases in the speed of the main CPU. >> >>I don't know so much about FreeBSD's handling of this, but on Linux, >>there's pretty strong indication that _SOFTWARE_ RAID is faster than >>hardware RAID. >> >> > > Unless something has changed though, you can't run raid 10 > with linux software raid and raid 5 sucks for heavy writes. You could always do raid 1 over raid 0, with newer kernels (2.6ish) there is even a dedicated raid10 driver. Jan From pgsql-performance-owner@postgresql.org Tue Jan 11 10:24:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A6FF63A504F for ; Tue, 11 Jan 2005 10:24: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 60183-10 for ; Tue, 11 Jan 2005 10:24:25 +0000 (GMT) Received: from svarog.thaico.si (p0f.net [193.77.154.190]) by svr1.postgresql.org (Postfix) with ESMTP id 9849A3A575E for ; Tue, 11 Jan 2005 10:24:26 +0000 (GMT) Received: from lunik.p0f.net ([192.168.50.128]) by svarog.thaico.si with esmtp (Exim 3.32 #1 (Debian)) id 1CoJCK-0001UM-00 for ; Tue, 11 Jan 2005 11:24:24 +0100 Received: from lunik.p0f.net (localhost [127.0.0.1]) by lunik.p0f.net (8.12.10/8.12.10) with ESMTP id j0BATLSw004140 for ; Tue, 11 Jan 2005 11:29:21 +0100 Received: (from gregab@localhost) by lunik.p0f.net (8.12.10/8.12.10/Submit) id j0BATLAN004139 for pgsql-performance@postgresql.org; Tue, 11 Jan 2005 11:29:21 +0100 Date: Tue, 11 Jan 2005 11:29:20 +0100 From: Grega Bremec To: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Message-ID: <20050111102920.GA1165@lunik.p0f.net> References: <59b2d39b05011018421680264b@mail.gmail.com> <41E3569A.4030102@commandprompt.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline In-Reply-To: <41E3569A.4030102@commandprompt.com> User-Agent: Mutt/1.4.1i Organization: p0f X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.232 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL X-Spam-Level: * X-Archive-Number: 200501/128 X-Sequence-Number: 9818 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =2E..and on Mon, Jan 10, 2005 at 08:31:22PM -0800, Joshua D. Drake used the= keyboard: >=20 > > > >RAID controllers tend to use i960 or StrongARM CPUs that run at speeds > >that _aren't_ all that impressive. With software RAID, you can take > >advantage of the _enormous_ increases in the speed of the main CPU. > > > >I don't know so much about FreeBSD's handling of this, but on Linux, > >there's pretty strong indication that _SOFTWARE_ RAID is faster than > >hardware RAID. > >=20 > > > Unless something has changed though, you can't run raid 10 > with linux software raid and raid 5 sucks for heavy writes. >=20 > J Hello, Joshua. Things have changed. :) =46rom 2.6.10's drivers/md/Kconfig: config MD_RAID10 tristate "RAID-10 (mirrored striping) mode (EXPERIMENTAL)" depends on BLK_DEV_MD && EXPERIMENTAL ---help--- RAID-10 provides a combination of striping (RAID-0) and mirroring (RAID-1) with easier configuration and more flexable layout. Unlike RAID-0, but like RAID-1, RAID-10 requires all devices to be the same size (or atleast, only as much as the smallest device will be used). RAID-10 provides a variety of layouts that provide different leve= ls of redundancy and performance. RAID-10 requires mdadm-1.7.0 or later, available at: ftp://ftp.kernel.org/pub/linux/utils/raid/mdadm/ There is a problem, however, that may render software RAID non-viable though. According to one of my benchmarks, it makes up for an up to 10% increase in system time consumed under full loads, so if the original poster's application is going to be CPU-bound, which might be the case, as he is looking for a machine that's strong on the CPU side, that may be the "too much" bit. Of course, if Opteron is being chosen for the increase in the amount of memory it can address, this is not the issue. HTH, --=20 Grega Bremec gregab at p0f dot net --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQFB46qAfu4IwuB3+XoRAnbjAJ96ArUF8i1A+6eYg/ZR1EJOsuFS/QCffs+t aacgdcKXFNqO1XfMLRljkOA= =o0l8 -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz-- From pgsql-performance-owner@postgresql.org Tue Jan 11 11:47:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A31A3A5770 for ; Tue, 11 Jan 2005 11: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 73922-01 for ; Tue, 11 Jan 2005 11:47:00 +0000 (GMT) Received: from druid.net (druid.net [216.126.72.98]) by svr1.postgresql.org (Postfix) with ESMTP id 3873A3A546B for ; Tue, 11 Jan 2005 11:47:02 +0000 (GMT) Received: from imp.druid.net (imp [216.126.72.111]) by druid.net (Postfix) with SMTP id 8C9BA1A44; Tue, 11 Jan 2005 06:47:04 -0500 (EST) Date: Tue, 11 Jan 2005 06:46:36 -0500 From: "D'Arcy J.M. Cain" To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Message-Id: <20050111064636.2b37c6c7.darcy@druid.net> In-Reply-To: <34h2p0F4bbv8sU3@individual.net> References: <59b2d39b05011018421680264b@mail.gmail.com> <34h2p0F4bbv8sU3@individual.net> X-Mailer: Sylpheed version 1.0.0beta3 (GTK+ 1.2.10; i386--netbsdelf) 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.186 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/129 X-Sequence-Number: 9819 On 11 Jan 2005 04:25:04 GMT Christopher Browne wrote: > Xeon sux pretty bad... > > > Linux or FreeBSD or _?_ > > The killer question won't be of what OS is "faster," but rather of > what OS better supports the fastest hardware you can get your hands > on. Well, if multiple OSs work on the hardware you like, there is nothing wrong with selecting the fastest among them of course. As for Linux or FreeBSD, you may also want to consider NetBSD. It seems that with the latest releases of both, NetBSD outperforms FreeBSD in at least one benchmark. http://www.feyrer.de/NetBSD/gmcgarry/ The benchmarks were run on a single processor but you can always run the benchmark on whatever hardware you select - assuming that it runs both. Isn't there also a PostgreSQL specific benchmark available? -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. From pgsql-performance-owner@postgresql.org Tue Jan 11 13:50:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42F283A5768 for ; Tue, 11 Jan 2005 13:50: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 90030-09 for ; Tue, 11 Jan 2005 13:50:02 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 76CF83A566A for ; Tue, 11 Jan 2005 13:50:05 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9308B31933; Tue, 11 Jan 2005 14:50:05 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Best filesystem for PostgreSQL Database Cluster under Linux Date: Tue, 11 Jan 2005 08:15:10 -0500 Organization: cbbrowne Computing Inc Lines: 48 Message-ID: References: <41e39b04$0$96857$c30e37c6@ken-reader.news.telstra.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:ETUYPAQIvu++yV9phycqb/uKpfE= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.089 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/132 X-Sequence-Number: 9822 After a long battle with technology, "Pete de Zwart" , an earthling, wrote: > Greetings to one and all, > > I've been trying to find some information on selecting an optimal > filesystem setup for a volume that will only contain a PostgreSQL Database > Cluster under Linux. Searching through the mailing list archive showed some > promising statistics on the various filesystems available to Linux, ranging > from ext2 through reiserfs and xfs. > > I have come to understand that PostgreSQLs Write Ahead Logging > (WAL) performs a lot of the journal functionality provided by the > majoirty of contemporary filesystems and that having both WAL and > filesystem journalling can degrade performance. > > Could anyone point me in the right direction so that I can read > up some more on this issue to discern which filesystem to choose and > how to tune both the FS and PostgreSQL so that they can compliment > each other? I've attempted to find this information via the FAQ, > Google and the mailing list archives but have lucked out for the > moment. Your understanding of the impact of filesystem journalling isn't entirely correct. In the cases of interest, journalling is done on metadata, not on the contents of files, with the result that there isn't really that much overlap between the two forms of "journalling" that are taking place. I did some benchmarking last year that compared, on a write-heavy load, ext3, XFS, and JFS. I found that ext3 was materially (if memory serves, 15%) slower than the others, and that there was a persistent _slight_ (a couple percent) advantage to JFS over XFS. This _isn't_ highly material, particularly considering that I was working with a 100% Write load, whereas "real world" work is likely to have more of a mixture. If you have reason to consider one filesystem or another better supported by your distribution vendor, THAT is a much more important reason to pick a particular filesystem than 'raw speed.' -- output = ("cbbrowne" "@" "cbbrowne.com") http://cbbrowne.com/info/fs.html Rules of the Evil Overlord #138. "The passageways to and within my domain will be well-lit with fluorescent lighting. Regrettably, the spooky atmosphere will be lost, but my security patrols will be more effective." From pgsql-performance-owner@postgresql.org Tue Jan 11 13:35:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D31F3A565A for ; Tue, 11 Jan 2005 13:35: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 87978-10 for ; Tue, 11 Jan 2005 13:35:16 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 03E5B3A57BC for ; Tue, 11 Jan 2005 13:35:18 +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: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Tue, 11 Jan 2005 08:33:09 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] which dual-CPU hardware/OS is fastest for PostgreSQL? Thread-Index: AcT3iI4l4YPbYeLJQo6nR23p1KZVUAAV93Qw From: "Merlin Moncure" To: "Miles Keaton" Cc: 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: 200501/130 X-Sequence-Number: 9820 > Subject: [PERFORM] which dual-CPU hardware/OS is fastest for PostgreSQL? >=20 > I'm sorry if there's a URL out there answering this, but I couldn't find > it. >=20 > For those of us that need the best performance possible out of a > dedicated dual-CPU PostgreSQL server, what is recommended? >=20 > AMD64/Opteron or i386/Xeon? >=20 > Linux or FreeBSD or _?_ >=20 > I'm assuming hardware RAID 10 on 15k SCSI drives is fastest disk > performance. >=20 > Any hardware-comparison benchmarks out there showing the results for > different PostgreSQL setups? My recommendation would be: 2 way or 4 way Opteron depending on needs (looking on a price for 4-way? Go here: http://www.swt.com/qo3.html). Go no less than Opteron 246. Tyan motherboard Serial ATA controller by 3ware (their latest escalade series size for your needs) (if money is no object, go scsi). Make sure you pick up the bbu. Redhat Linux FC3 x86-64 Good memory (DDR400 registered, at least)...lots of it. You can get a two way rackmount for under 4000$. You can get a 4-way for under 10k$. Make sure you pick up a rackmount case that has a serial ATA backplane that supports led status light for disk drives, and make sure you get the right riser, heh. =20 Merlin From pgsql-performance-owner@postgresql.org Tue Jan 11 13:42:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D2FB63A58DE for ; Tue, 11 Jan 2005 13:41: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 89465-05 for ; Tue, 11 Jan 2005 13:41:46 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 0D64A3A58B5 for ; Tue, 11 Jan 2005 13:41:48 +0000 (GMT) Received: (qmail 6585 invoked from network); 11 Jan 2005 13:41:17 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 11 Jan 2005 13:41:17 -0000 Message-ID: <41E3D796.1010503@fastcrypt.com> Date: Tue, 11 Jan 2005 08:41:42 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Gary Doades Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <41E2F43C.5020702@fastcrypt.com> <41E2F9ED.1070206@gpdnet.co.uk> <41E31815.4030908@fastcrypt.com> <41E38231.5090301@gpdnet.co.uk> In-Reply-To: <41E38231.5090301@gpdnet.co.uk> 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.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/131 X-Sequence-Number: 9821 I understand that but I have seen VM's crash. This does bring up another point. Since postgresql is not threaded a .NET pl would require a separate VM for each connection (unless you can share the vm ?). One of the java pl's (pl-j) for postgres has dealt with this issue. For a hundred connections that's a hundred .NET vm's or java vm's. Is the .NET VM shareable ? Dave Gary Doades wrote: > Dave Cramer wrote: > >> Ok, so one use case is to select a large number of rows and do some >> non-trivial operation on them. >> I can see where getting the rows inside the server process ( ie some >> procedural language ) thereby reducing the round trip overhead would >> be beneficial. However how do you deal with the lack of control ? For >> instance what happens if you run out of memory while doing this ? I'm >> not sure about other DB'S but if you crash the procedural language >> inside postgres you will bring the server down. >> >> It would seem to me that any non-trivial operation would be better >> handled outside the server process, even if it costs you the round trip. > > > Since a .NET language is operating effectively inside a VM it is > pretty much impossible to bring down the server that way. Only a bug > in the .NET runtime itself will do that. The C# try/catch/finally with > .NET global execption last chance handlers will ensure the server and > your code is well protected. > > Cheers, > Gary. > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Tue Jan 11 13:58:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A2BC83A5768 for ; Tue, 11 Jan 2005 13:58: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 91071-09 for ; Tue, 11 Jan 2005 13:58:32 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by svr1.postgresql.org (Postfix) with ESMTP id 59D743A551A for ; Tue, 11 Jan 2005 13:58:34 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so182325wri for ; Tue, 11 Jan 2005 05:58:35 -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=MW6k9a8CYtHYQjMaiCtH52dnP2KvtZd8JQPe4UfcXBR3vv9zN4u7JYxXKzZdZklv0xq3mMR82L2mYr/vARGuv/6xr47dATKuE+nQAIF8ykPdhX/u1ScAToOpHVVebyyALxJP++efV/ulfGonkffYIDLzgGoo75TmHcLcz/ebQXo= Received: by 10.54.8.5 with SMTP id 5mr78200wrh; Tue, 11 Jan 2005 05:58:34 -0800 (PST) Received: by 10.54.11.6 with HTTP; Tue, 11 Jan 2005 05:58:34 -0800 (PST) Message-ID: <37d451f7050111055846c26085@mail.gmail.com> Date: Tue, 11 Jan 2005 07:58:34 -0600 From: Rosser Schwarz Reply-To: Rosser Schwarz To: Merlin Moncure Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Cc: Miles Keaton , pgsql-performance@postgresql.org In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/133 X-Sequence-Number: 9823 while you weren't looking, Merlin Moncure wrote: > 2 way or 4 way Opteron depending on needs (looking on a price for 4-way? > Go here: http://www.swt.com/qo3.html). Try also the Appro 1U 4-way Opteron server, at: http://www.appro.com/product/server_1142h.asp I specced a 4-way 842 (1.6 GHz: little to none of our db work is CPU bound; there's just a lot of it going on at once) with 32G core for within delta of what SWT wants /just/ for the 32G -- the price of the box itself and anything else atop that. Stepping up to a faster CPU should increase the cost directly in line with the retail price for the silicon. We haven't yet ordered the machine (and the quote was from early last month, so their prices will have fluctuated) and consequently, I can't comment on their quality. Their default warranty is three years, "rapid exchange", though, and they offer on-site service for only nominally more, IIRC. Some slightly more than cursory googling hasn't turned up anything overly negative, either. As a 1U, the box has no appreciable storage of its own but we're shopping for a competent, non bank-breaking fibre setup right now, so that's not an issue for our situation. While on the subject, anyone here have anything to say about JMR fibre raid cabinets? (Fibre-to-fibre, not fibre-to-SATA or the like.) /rls -- :wq From pgsql-performance-owner@postgresql.org Tue Jan 11 14:23:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C0323A5900 for ; Tue, 11 Jan 2005 14: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 94813-01 for ; Tue, 11 Jan 2005 14:23:36 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 6C0D43A5915 for ; Tue, 11 Jan 2005 14:23:38 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so402973wra for ; Tue, 11 Jan 2005 06:23:39 -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=Bl99Rs9cpy1cBdB+8a8j66zRCftuPVGCwduNRlY1LQi4DfIk7C7xx2xZeiFo/Fhn2UdHS/gQCOdTeBkBVW0nshysbtYRHYrhZYMy6nSFMRWwc0+giE9pA+wIdfhgIOkZ5yN9Ub4ETskZ0NJMeKKZmfEnMqElzQ6xbzbBGM1ysQw= Received: by 10.54.30.6 with SMTP id d6mr175520wrd; Tue, 11 Jan 2005 06:23:39 -0800 (PST) Received: by 10.54.18.72 with HTTP; Tue, 11 Jan 2005 06:23:38 -0800 (PST) Message-ID: <33c6269f05011106235da6723e@mail.gmail.com> Date: Tue, 11 Jan 2005 09:23:38 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: "Jim C. Nasby" Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Cc: Frank Wiles , Yann Michel , gpd@gpdnet.co.uk, pgsql-performance@postgresql.org In-Reply-To: <20050110232952.GG67721@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <20050110232952.GG67721@decibel.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/134 X-Sequence-Number: 9824 Connect to an external data system using a socket and propagate data changes using a trigger... I've had to do this, and it sucks to be stuck in Oracle! Alex Turner NetEconomist On Mon, 10 Jan 2005 17:29:52 -0600, Jim C. Nasby wrote: > On Mon, Jan 10, 2005 at 12:46:01PM -0500, Alex Turner wrote: > > You sir are correct! You can't use perl in MS-SQL or Oracle ;). > > On the other hand, PL/SQL is incredibly powerful, especially combined > with all the tools/utilities that come with Oracle. I think you'd be > hard-pressed to find too many real-world examples where you could do > something with a PostgreSQL procedural language that you couldn't do > with PL/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?" > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Tue Jan 11 14:31:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1916A3A5768 for ; Tue, 11 Jan 2005 14:31: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 95188-03 for ; Tue, 11 Jan 2005 14:30:55 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 9E9253A551A for ; Tue, 11 Jan 2005 14:30:57 +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 1CoN2s-0001aD-00; Tue, 11 Jan 2005 09:30:54 -0500 To: Rosser Schwarz Cc: Merlin Moncure , Miles Keaton , pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> <37d451f7050111055846c26085@mail.gmail.com> In-Reply-To: <37d451f7050111055846c26085@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 11 Jan 2005 09:30:53 -0500 Message-ID: <8765242g2q.fsf@stark.xeocode.com> Lines: 11 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: 200501/135 X-Sequence-Number: 9825 Rosser Schwarz writes: > Try also the Appro 1U 4-way Opteron server, at: > http://www.appro.com/product/server_1142h.asp Back in the day, we used to have problems with our 1U dual pentiums. We attributed it to heat accelerating failure. I would fear four opterons in 1U would be damned hard to cool effectively, no? -- greg From pgsql-performance-owner@postgresql.org Tue Jan 11 14:34:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E6CB03A5900 for ; Tue, 11 Jan 2005 14:34: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 95971-02 for ; Tue, 11 Jan 2005 14:34:12 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 8A59F3A590F for ; Tue, 11 Jan 2005 14:34:14 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so404362wra for ; Tue, 11 Jan 2005 06:34:15 -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=JT9xno0bRMbJwW7Dzr51xx3pxyz2Q91WnBKJfZXuFoEH4rj8Az8U3DLdJE66m64BWPjC0+d0c4p2i59dGHn5jeC8qj7oJ4ohBnIBSKhI1Yfj7jgmbopTcULLyx4Yc/z5Fjp4VmlmqhZitHA8GJ/UR+dthp71kFDGwVi7KyF/fIY= Received: by 10.54.26.74 with SMTP id 74mr168647wrz; Tue, 11 Jan 2005 06:34:15 -0800 (PST) Received: by 10.54.18.72 with HTTP; Tue, 11 Jan 2005 06:34:15 -0800 (PST) Message-ID: <33c6269f0501110634707a8f4f@mail.gmail.com> Date: Tue, 11 Jan 2005 09:34:15 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Merlin Moncure Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Cc: Miles Keaton , pgsql-performance@postgresql.org In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> 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: 200501/136 X-Sequence-Number: 9826 $4000 is not going to get you much disk - If you buy components from the cheapest source I know (newegg.com) you end up around $5k with 14x36gig Raptor SATA drives and a 4U chasis with a 14xSATA built in back plane packing 2x9500S AMCC Escalade RAID cards, which are supported in Linux, 4Gig RAM and 2xOpteron 242. If you are not CPU bound, there isn't much point going to 246. If you want SCSI, then you will be paying more. Check out rackmountmart.com for Chasises, they have a nice 5U that has a 24xSATA backplane (We will be acquiring this in the next few weeks). If you really want to go nuts, they have an 8U with 40xSATA backplane. Alex Turner NetEconomist On Tue, 11 Jan 2005 08:33:09 -0500, Merlin Moncure wrote: > > Subject: [PERFORM] which dual-CPU hardware/OS is fastest for > PostgreSQL? > > > > I'm sorry if there's a URL out there answering this, but I couldn't > find > > it. > > > > For those of us that need the best performance possible out of a > > dedicated dual-CPU PostgreSQL server, what is recommended? > > > > AMD64/Opteron or i386/Xeon? > > > > Linux or FreeBSD or _?_ > > > > I'm assuming hardware RAID 10 on 15k SCSI drives is fastest disk > > performance. > > > > Any hardware-comparison benchmarks out there showing the results for > > different PostgreSQL setups? > > My recommendation would be: > 2 way or 4 way Opteron depending on needs (looking on a price for 4-way? > Go here: http://www.swt.com/qo3.html). Go no less than Opteron 246. > Tyan motherboard > Serial ATA controller by 3ware (their latest escalade series size for > your needs) (if money is no object, go scsi). Make sure you pick up the > bbu. > Redhat Linux FC3 x86-64 > Good memory (DDR400 registered, at least)...lots of it. > > You can get a two way rackmount for under 4000$. You can get a 4-way > for under 10k$. Make sure you pick up a rackmount case that has a > serial ATA backplane that supports led status light for disk drives, and > make sure you get the right riser, heh. > > Merlin > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Tue Jan 11 14:45:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2A0CE3A5928 for ; Tue, 11 Jan 2005 14: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 98394-04 for ; Tue, 11 Jan 2005 14:45:04 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 34AD43A58D1 for ; Tue, 11 Jan 2005 14:45:07 +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: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Tue, 11 Jan 2005 09:44:21 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75A3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] which dual-CPU hardware/OS is fastest for PostgreSQL? Thread-Index: AcT36oV/If5bB4S3TkquoLHwk3SXxgAAL4Iw From: "Merlin Moncure" To: Cc: 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: 200501/137 X-Sequence-Number: 9827 > $4000 is not going to get you much disk - If you buy components from > the cheapest source I know (newegg.com) you end up around $5k with > 14x36gig Raptor SATA drives and a 4U chasis with a 14xSATA built in > back plane packing 2x9500S AMCC Escalade RAID cards, which are > supported in Linux, 4Gig RAM and 2xOpteron 242. If you are not CPU > bound, there isn't much point going to 246. If you want SCSI, then > you will be paying more. Check out rackmountmart.com for Chasises, > they have a nice 5U that has a 24xSATA backplane (We will be acquiring > this in the next few weeks). If you really want to go nuts, they have > an 8U with 40xSATA backplane. >=20 > Alex Turner > NetEconomist heh, our apps do tend to be CPU bound. Generally, I think the extra CPU horsepower is worth the investment until you get to the really high end cpus. I definitely agree with all your hardware choices though...seems like you've hit the 'magic formula'. Merlin From pgsql-performance-owner@postgresql.org Tue Jan 11 14:52:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DF7A93A592D for ; Tue, 11 Jan 2005 14:52: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 99510-05 for ; Tue, 11 Jan 2005 14:52:12 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by svr1.postgresql.org (Postfix) with ESMTP id A066A3A57C4 for ; Tue, 11 Jan 2005 14:52:09 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so189033wri for ; Tue, 11 Jan 2005 06:52:10 -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=bYzYRcE+4j9yb2Xj2EFG2CUI0hZyir1jMkim5jJj4b3R5XEtknGao/B8TUYafFam/dWnGzC3H2oebu1kSG/Lct4yNW5lFcMWROtuJnmpGjASC4xTNJyatijR/w9AzHS33wibiBM+uiAeCstG5g8BT5W/nIpNn36eUe76gWMqikg= Received: by 10.54.6.60 with SMTP id 60mr482815wrf; Tue, 11 Jan 2005 06:52:10 -0800 (PST) Received: by 10.54.11.6 with HTTP; Tue, 11 Jan 2005 06:52:10 -0800 (PST) Message-ID: <37d451f7050111065243fc660@mail.gmail.com> Date: Tue, 11 Jan 2005 08:52:10 -0600 From: Rosser Schwarz Reply-To: Rosser Schwarz To: Greg Stark Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Cc: Merlin Moncure , Miles Keaton , pgsql-performance@postgresql.org In-Reply-To: <8765242g2q.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A2@Herge.rcsinc.local> <37d451f7050111055846c26085@mail.gmail.com> <8765242g2q.fsf@stark.xeocode.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: 200501/138 X-Sequence-Number: 9828 while you weren't looking, Greg Stark wrote: > Back in the day, we used to have problems with our 1U dual pentiums. We > attributed it to heat accelerating failure. I would fear four opterons in 1U > would be damned hard to cool effectively, no? Opterons actually run pretty coolly, comparatively. If it's a big concern, you can always drop a few more clams for the low-voltage versions -- available in 1.4 and 2.0 GHz flavors, and of which I've heard several accounts of their being run successfully /without/ active cooling -- or punt until later this year, when they ship Winchester core Opterons (90nm SOI -- the current, uniprocessor silicon fabbed with that process has some 3W heat dissipation idle, ~30W under full load; as a point of contrast, current 90nm P4s have 34W idle dissipation, and some 100W peak). We have a number of 1U machines (P4s, I believe), and a Dell blade server (six or seven P3 machines in a 3U cabinet) as our webservers, and none of them seem to have any trouble with heat. That's actually a bigger deal than it might first seem, given how frighteningly crammed with crap our machine room is. /rls -- :wq From pgsql-performance-owner@postgresql.org Tue Jan 11 14:55:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 958533A574C; Tue, 11 Jan 2005 14:55: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 00363-07; Tue, 11 Jan 2005 14:55:27 +0000 (GMT) Received: from dfw-gate3.raytheon.com (dfw-gate3.raytheon.com [199.46.199.232]) by svr1.postgresql.org (Postfix) with ESMTP id 5A38E3A58E1; Tue, 11 Jan 2005 14:55:07 +0000 (GMT) Received: from ds02c01.directory.ray.com (ds02c01.directory.ray.com [147.25.138.115]) by dfw-gate3.raytheon.com (8.12.10/8.12.10) with ESMTP id j0BEswDA005460; Tue, 11 Jan 2005 08:54:58 -0600 (CST) Received: from ds02c01 (localhost [127.0.0.1]) by ds02c01.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j0BEsvvB005875; Tue, 11 Jan 2005 14:54:58 GMT Received: from ds02c01.directory.ray.com with LMTP by ds02c01 (2.0.6/sieved-2-0-build-559); Tue, 11 Jan 2005 14:54:56 +0000 Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com [151.168.145.35]) by ds02c01.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j0BEscKi005684 sender Richard_D_Levine@raytheon.com; Tue, 11 Jan 2005 14:54:38 GMT Subject: Re: PostgreSQL vs. Oracle vs. Microsoft To: "Jim C. Nasby" Cc: alex@neteconomist.com, Frank Wiles , gpd@gpdnet.co.uk, pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org, Yann Michel X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001 Message-ID: From: Richard_D_Levine@raytheon.com Date: Tue, 11 Jan 2005 09:54:37 -0500 X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, 2004) at 01/11/2005 09:54:38 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-SPAM: 0.00 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.181 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200501/139 X-Sequence-Number: 9829 Jim wrote: you'd be hard-pressed to find too many real-world examples where you could do something with a PostgreSQL procedural language that you couldn't do with PL/SQL. Rick mumbled: You can't get it for nothing! %) "Jim C. Nasby" To: alex@neteconomist.com Sent by: cc: Frank Wiles , Yann Michel , pgsql-performance-owner@pos gpd@gpdnet.co.uk, pgsql-performance@postgresql.org tgresql.org Subject: Re: [PERFORM] PostgreSQL vs. Oracle vs. Microsoft 01/10/2005 06:29 PM On Mon, Jan 10, 2005 at 12:46:01PM -0500, Alex Turner wrote: > You sir are correct! You can't use perl in MS-SQL or Oracle ;). On the other hand, PL/SQL is incredibly powerful, especially combined with all the tools/utilities that come with Oracle. I think you'd be hard-pressed to find too many real-world examples where you could do something with a PostgreSQL procedural language that you couldn't do with PL/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?" ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Tue Jan 11 15:39:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D3D543A5982 for ; Tue, 11 Jan 2005 15:39: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 07710-10 for ; Tue, 11 Jan 2005 15:39:13 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id B44C03A5970 for ; Tue, 11 Jan 2005 15:39:03 +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 1CoO6o-00029S-00; Tue, 11 Jan 2005 10:39:02 -0500 To: "Merlin Moncure" Cc: , Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A3@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75A3@Herge.rcsinc.local> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 11 Jan 2005 10:39:01 -0500 Message-ID: <87zmzg0ycq.fsf@stark.xeocode.com> Lines: 25 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: 200501/140 X-Sequence-Number: 9830 "Merlin Moncure" writes: > heh, our apps do tend to be CPU bound. Generally, I think the extra CPU > horsepower is worth the investment until you get to the really high end > cpus. I find that while most applications I work with shouldn't be cpu intensive they do seem end up being cpu bound quite frequently. What happens is that 90% of the workload has a working set that fits in RAM. So the system ends up being bound by the memory bus speed. That appears exactly the same as cpu-bound, though I'm unclear whether increasing the cpu clock will help. It's quite possible to have this situation at the same time as other queries are i/o bound. It's quite common to have 95% of your workload be frequently executed fast queries on commonly accessed data and 5% be bigger data warehouse style queries that need to do large sequential reads. Incidentally, the same was true for Oracle on Solaris. If we found excessive cpu use typically meant some frequently executed query was using a sequential scan on a small table. Small enough to fit in RAM but large enough to consume lots of cycles reading it. -- greg From pgsql-performance-owner@postgresql.org Tue Jan 11 16:01:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06B583A596F for ; Tue, 11 Jan 2005 16: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 12038-07 for ; Tue, 11 Jan 2005 16:00:47 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 6F2B73A595F for ; Tue, 11 Jan 2005 16:00:47 +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 j0BG0hQ0022220; Tue, 11 Jan 2005 08:00:43 -0800 Message-ID: <41E3F83C.7070305@commandprompt.com> Date: Tue, 11 Jan 2005 08:01:00 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Steinar H. Gunderson" Cc: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <59b2d39b05011018421680264b@mail.gmail.com> <41E3569A.4030102@commandprompt.com> <20050111101413.GB7789@uio.no> In-Reply-To: <20050111101413.GB7789@uio.no> Content-Type: multipart/mixed; boundary="------------050401050105090102040401" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/141 X-Sequence-Number: 9831 This is a multi-part message in MIME format. --------------050401050105090102040401 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Steinar H. Gunderson wrote: >On Mon, Jan 10, 2005 at 08:31:22PM -0800, Joshua D. Drake wrote: > > >>Unless something has changed though, you can't run raid 10 >>with linux software raid >> >> > >Hm, why not? What stops you from making two RAID-0 devices and mirroring >those? (Or the other way round, I can never remember :-) ) > > O.k. that seems totally wrong ;) but yes your correct you could probably do it. Sincerely, Josuha D. Drake >/* Steinar */ > > -- 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 --------------050401050105090102040401 Content-Type: text/x-vcard; charset=utf-8; name="jd.vcf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="jd.vcf" YmVnaW46dmNhcmQNCmZuOkpvc2h1YSBEcmFrZQ0KbjpEcmFrZTtKb3NodWENCm9yZzpDb21t YW5kIFByb21wdCwgSW5jLg0KYWRyOjs7UE8gQm94IDIxNSA7Q2FzY2FkZSBMb2NrcztPUjs5 NzAxNDtVUw0KZW1haWw7aW50ZXJuZXQ6amRAY29tbWFuZHByb21wdC5jb20NCnRpdGxlOkNv bnN1bHRhbnQNCnRlbDt3b3JrOjUwMy02NjctNDU2NA0KdGVsO2ZheDo1MDMtMjEwLTAzMzQN CngtbW96aWxsYS1odG1sOkZBTFNFDQp1cmw6aHR0cDovL3d3dy5jb21tYW5kcHJvbXB0LmNv bQ0KdmVyc2lvbjoyLjENCmVuZDp2Y2FyZA0KDQo= --------------050401050105090102040401-- From pgsql-performance-owner@postgresql.org Tue Jan 11 18:02:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66D5E3A5A2A for ; Tue, 11 Jan 2005 18:02: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 47309-03 for ; Tue, 11 Jan 2005 18:02:21 +0000 (GMT) Received: from server.gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id A4D4D3A59F4 for ; Tue, 11 Jan 2005 18:02:20 +0000 (GMT) Received: from [192.168.1.2] (unknown [192.168.1.2]) by server.gpdnet.co.uk (Postfix) with ESMTP id 0AAD63AAD53 for ; Tue, 11 Jan 2005 18:05:53 +0000 (GMT) Message-ID: <41E414AD.5020702@gpdnet.co.uk> Date: Tue, 11 Jan 2005 18:02:21 +0000 From: Gary Doades User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E22F04.103@gpdnet.co.uk> <33c6269f05011008074b33b812@mail.gmail.com> <20050110173307.GA18357@zong.spline.inf.fu-berlin.de> <20050110114200.76e9a51d.frank@wiles.org> <33c6269f050110094646897c3e@mail.gmail.com> <41E2E19D.1000903@gpdnet.co.uk> <41E2F43C.5020702@fastcrypt.com> <41E2F9ED.1070206@gpdnet.co.uk> <41E31815.4030908@fastcrypt.com> <41E38231.5090301@gpdnet.co.uk> <41E3D796.1010503@fastcrypt.com> In-Reply-To: <41E3D796.1010503@fastcrypt.com> 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.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/142 X-Sequence-Number: 9832 Dave Cramer wrote: > I understand that but I have seen VM's crash. > > This does bring up another point. Since postgresql is not threaded a > .NET pl would require a separate VM for each connection (unless you can > share the vm ?). One of the java pl's (pl-j) for postgres has dealt > with this issue. > For a hundred connections that's a hundred .NET vm's or java vm's. > > Is the .NET VM shareable ? > In Windows, most certainly. Not sure about mono. Cheers, Gary. From pgsql-admin-owner@postgresql.org Tue Jan 11 18:05:28 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06AC73A5A4C; Tue, 11 Jan 2005 18:05: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 47415-10; Tue, 11 Jan 2005 18:05:08 +0000 (GMT) Received: from leda.steelsun.com (dsl093-240-204.ral1.dsl.speakeasy.net [66.93.240.204]) by svr1.postgresql.org (Postfix) with ESMTP id F19363A59B4; Tue, 11 Jan 2005 18:05:06 +0000 (GMT) Received: from leda.steelsun.com (localhost [127.0.0.1]) by leda.steelsun.com (8.13.1/8.12.8) with ESMTP id j0BI55Wq002177; Tue, 11 Jan 2005 13:05:05 -0500 Received: from localhost (cfowler@localhost) by leda.steelsun.com (8.13.1/8.12.11/Submit) with ESMTP id j0BI54XJ002174; Tue, 11 Jan 2005 13:05:05 -0500 X-Authentication-Warning: leda.steelsun.com: cfowler owned process doing -bs Date: Tue, 11 Jan 2005 13:05:04 -0500 (EST) From: Christian Fowler X-X-Sender: cfowler@leda.steelsun.com To: postgresql performance list , pgsql-admin list Subject: Assimilation of these "versus" and hardware threads Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/64 X-Sequence-Number: 15923 All of these recent threads about fastest hardware and "who's better than who" has inspired me to create a new website: http://www.dbtuning.org I snipped a few bits from recent posts to get some pages started - hope the innocent don't mind. It's a bit postgres biased at the moment, since well, so am I (though FireBird is now mounting a strong showing...) This site uses a wiki so anyone interested can make contributions. We are all short on time, so I would love any help. I haven't entered any hardware info yet. I'll also take a minute to plug a postgres saavy open-source project used for this site - http://www.tikipro.org - It's a very flexible web framework with a very powerful and extendible CMS engine. It just hit Alpha 4, and we hope to go beta very soon. If you have feedback (or bugs), please send me a note. (and of course dbtuning is running on postgres ;-) [ \ / [ >X< Christian Fowler | spider AT viovio.com [ / \ http://www.viovio.com | http://www.tikipro.org From pgsql-admin-owner@postgresql.org Tue Jan 11 19:33:28 2005 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD38B3A5A50; Tue, 11 Jan 2005 19:33: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 68198-02; Tue, 11 Jan 2005 19:33:03 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id A72123A5A43; Tue, 11 Jan 2005 19:33:01 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6894272; Tue, 11 Jan 2005 11:34:41 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Christian Fowler Subject: Re: [PERFORM] Assimilation of these "versus" and hardware threads Date: Tue, 11 Jan 2005 11:36:44 -0800 User-Agent: KMail/1.7.1 Cc: postgresql performance list , pgsql-admin list References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501111136.44726.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: 200501/66 X-Sequence-Number: 15925 People: > All of these recent threads about fastest hardware and "who's better than > who" has inspired me to create a new website: > > http://www.dbtuning.org Well, time to plug my web site, too, I guess: http://www.powerpostgresql.com I've got a configuration primer up there, and the 8.0 Annotated .Conf file will be coming this week. That web site runs on Framewerk, a PostgreSQL-based CMS developed by our own Gavin Roy. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 14 06:47:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A5DA43A5F41 for ; Thu, 13 Jan 2005 05:09: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 47967-01 for ; Thu, 13 Jan 2005 05:09:15 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 66FC83A5EFB for ; Thu, 13 Jan 2005 05:09:15 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 677FB31960; Thu, 13 Jan 2005 06:09:14 +0100 (MET) From: "Pete de Zwart" X-Newsgroups: pgsql.performance References: <41e39b04$0$96857$c30e37c6@ken-reader.news.telstra.net> Subject: Re: Best filesystem for PostgreSQL Database Cluster under Linux Date: Wed, 12 Jan 2005 07:25:43 +1100 Organization: Froob Networks X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original Lines: 47 Message-ID: <41e4364a$0$96874$c30e37c6@ken-reader.news.telstra.net> To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.336 tagged_above=0 required=5 tests=AWL, DATE_IN_PAST_24_48, PRIORITY_NO_NAME X-Spam-Level: * X-Archive-Number: 200501/179 X-Sequence-Number: 9869 Thanks for the info. I managed to pull out some archived posts to this list from the PostgreSQL web site about this issue which have helped a bit. Unfortunatly, the FS has been chosen before considering the impact of it on I/O for PostgreSQL. As the Cluster is sitting on it's on 200GB IDE drive for the moment and the system is partially live, it's not feasable to change the underlying file system without great pain and suffering. In the great fsync debates that I've seen, the pervasive opinion about journalling file systems under Linux and PostgreSQL is to have the filesystem mount option data=writeback, assuming that fsync in PostgreSQL will handle coherency of the file data and the FS will handle metadata. This is all academic to a point, as tuning the FS will get a small improvement on I/O compared to the improvement potential of moving to SCSI/FCAL, that and getting more memory. Regards, Pete de Zwart. "Christopher Browne" wrote in message news:m3zmzgayzl.fsf@knuth.knuth.cbbrowne.com... > Your understanding of the impact of filesystem journalling isn't > entirely correct. In the cases of interest, journalling is done on > metadata, not on the contents of files, with the result that there > isn't really that much overlap between the two forms of "journalling" > that are taking place. > > I did some benchmarking last year that compared, on a write-heavy > load, ext3, XFS, and JFS. > > I found that ext3 was materially (if memory serves, 15%) slower than > the others, and that there was a persistent _slight_ (a couple > percent) advantage to JFS over XFS. > > This _isn't_ highly material, particularly considering that I was > working with a 100% Write load, whereas "real world" work is likely to > have more of a mixture. > > If you have reason to consider one filesystem or another better > supported by your distribution vendor, THAT is a much more important > reason to pick a particular filesystem than 'raw speed.' From pgsql-performance-owner@postgresql.org Tue Jan 11 20:53:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E79C33A5A4A for ; Tue, 11 Jan 2005 20:53: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 79126-06 for ; Tue, 11 Jan 2005 20:53:10 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 36B873A5A2A for ; Tue, 11 Jan 2005 20:53:09 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6894600; Tue, 11 Jan 2005 12:54:49 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: [ADMIN] Assimilation of these "versus" and hardware threads Date: Tue, 11 Jan 2005 12:52:29 -0800 User-Agent: KMail/1.6.2 Cc: "Matthew T. O'Connor" References: <200501111136.44726.josh@agliodbs.com> <41E43230.8090207@tocr.com> In-Reply-To: <41E43230.8090207@tocr.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501111252.29942.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/145 X-Sequence-Number: 9835 Matt, > I had one comment on the pg_autovacuum section. Near the bottom it > lists some of it's limitations, and I want to clarify the 1st one: "Does > not reset the transaction counter". I assume this is talking about the > xid wraparound problem? If so, then that bullet can be removed. > pg_autovacuum does check for xid wraparound and perform a database wide > vacuum analyze when it's needed. Keen. That's an 8.0 fix? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 14 06:44:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ADCE73A5AB0 for ; Tue, 11 Jan 2005 21:42: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 84461-09 for ; Tue, 11 Jan 2005 21:42:54 +0000 (GMT) Received: from outbound.mailhop.org (outbound.mailhop.org [63.208.196.171]) by svr1.postgresql.org (Postfix) with ESMTP id 5C88E3A5A82 for ; Tue, 11 Jan 2005 21:42:55 +0000 (GMT) Received: from ool-4350c7ad.dyn.optonline.net ([67.80.199.173] helo=[192.168.0.66]) by outbound.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.42) id 1CoTmx-000FgJ-5J; Tue, 11 Jan 2005 16:42:55 -0500 Message-ID: <41E448D7.5030005@tocr.com> Date: Tue, 11 Jan 2005 16:44:55 -0500 From: "Matthew T. O'Connor" User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: [ADMIN] Assimilation of these "versus" and hardware References: <200501111136.44726.josh@agliodbs.com> <41E43230.8090207@tocr.com> <200501111252.29942.josh@agliodbs.com> In-Reply-To: <200501111252.29942.josh@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mail-Handler: MailHop Outbound by DynDNS.org X-Originating-IP: 67.80.199.173 X-Report-Abuse-To: abuse@dyndns.org (see http://www.mailhop.org/outbound/abuse.html for abuse reporting information) X-MHO-User: zeut X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/177 X-Sequence-Number: 9867 Josh Berkus wrote: >Matt, > > >>I had one comment on the pg_autovacuum section. Near the bottom it >>lists some of it's limitations, and I want to clarify the 1st one: "Does >>not reset the transaction counter". I assume this is talking about the >>xid wraparound problem? If so, then that bullet can be removed. >>pg_autovacuum does check for xid wraparound and perform a database wide >>vacuum analyze when it's needed. >> >> > >Keen. That's an 8.0 fix? > Nope, been there since before 7.4 was released. From pgsql-performance-owner@postgresql.org Wed Jan 12 06:55:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 168DA3A5C1D for ; Wed, 12 Jan 2005 06:55: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 54385-06 for ; Wed, 12 Jan 2005 06:54:51 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id CA57A3A5C0D for ; Wed, 12 Jan 2005 06:54:50 +0000 (GMT) Received: (qmail 19134 invoked from network); 12 Jan 2005 03:49:49 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 12 Jan 2005 03:49:49 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 18373-45 for ; Wed, 12 Jan 2005 10:49:47 +0700 (ICT) Received: (qmail 18977 invoked from network); 12 Jan 2005 03:49:28 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 12 Jan 2005 03:49:28 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Wed, 12 Jan 2005 10:49:28 +0700 Message-ID: <1105501768.41e49e484d779@webmail.moph.go.th> Date: Wed, 12 Jan 2005 10:49:28 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Subject: Increasing RAM for more than 4 Gb. using postgresql MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/146 X-Sequence-Number: 9836 I wonder if I would like to increase more RAM from 4 Gb. to 6 Gb. [which I hope to increase more performance ] and I now I used RH 9 and Pgsql 7.3.2 ON DUAL Xeon 3.0 server thay has the limtation of 4 Gb. ram, I should use which OS between FC 2-3 or redhat EL 3 [which was claimed to support 64 Gb.ram] .May I use FC 2 [which is freely downloaded] with 6 Gb. and PGsql 7.4 ? Amrit Thailand From pgsql-performance-owner@postgresql.org Wed Jan 12 11:02:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 376523A5983 for ; Wed, 12 Jan 2005 11:02: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 97526-09 for ; Wed, 12 Jan 2005 11:01:59 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id DC88E3A5C32 for ; Wed, 12 Jan 2005 11:02:01 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so316774wri for ; Wed, 12 Jan 2005 03:02:00 -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=lDnBiZMq+w2H+eFw4NNyGWI7Ir4fxLllJfHZjZTHfCeaCM+ps+RWNzWpZLTwjerzMRhfOGiIhwcziyD4dvO7caTP++kRaD0iO/YqI8BGxckkqcHLsGri0us2z/liOXoderjfir8a4og3IGiKTx43TXaazTfBRKvidrqjPuzMfEc= Received: by 10.54.14.37 with SMTP id 37mr63823wrn; Wed, 12 Jan 2005 03:02:00 -0800 (PST) Received: by 10.54.4.50 with HTTP; Wed, 12 Jan 2005 03:02:00 -0800 (PST) Message-ID: <1eae200b050112030256483e37@mail.gmail.com> Date: Wed, 12 Jan 2005 12:02:00 +0100 From: Martin Tedjawardhana Reply-To: Martin Tedjawardhana To: "amrit@health2.moph.go.th" Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Cc: PGsql-performance In-Reply-To: <1105501768.41e49e484d779@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1105501768.41e49e484d779@webmail.moph.go.th> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.082 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, TO_ADDRESS_EQ_REAL X-Spam-Level: * X-Archive-Number: 200501/147 X-Sequence-Number: 9837 Is that 4GB limit a hardware limitation? If it is, then there is not much you can do except upgrading the server. If the server is capable of handling more than 4GB of ram then you can just upgrade the kernel and enable high memory support (up to 64GB of memory in kernel 2.6.9). There is no need to migrate your distro, but if you do I recommend upgrading your Pgsql too. Martin On Wed, 12 Jan 2005 10:49:28 +0700, amrit@health2.moph.go.th wrote: > I wonder if I would like to increase more RAM from 4 Gb. to 6 Gb. [which I hope > to increase more performance ] and I now I used RH 9 and Pgsql 7.3.2 ON DUAL > Xeon 3.0 server thay has the limtation of 4 Gb. ram, I should use which OS > between FC 2-3 or redhat EL 3 [which was claimed to support 64 Gb.ram] .May I > use FC 2 [which is freely downloaded] with 6 Gb. and PGsql 7.4 ? > Amrit > Thailand > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Fri Jan 14 06:44:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 119A53A5CB4 for ; Wed, 12 Jan 2005 12:40: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 11153-10 for ; Wed, 12 Jan 2005 12:40:04 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id 0B4523A51E2 for ; Wed, 12 Jan 2005 12:40:06 +0000 (GMT) Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j0CCe3SX006700; Wed, 12 Jan 2005 23:40:03 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id j0CCe3mj006697; Wed, 12 Jan 2005 23:40:03 +1100 Date: Wed, 12 Jan 2005 23:40:03 +1100 (EST) From: Gavin Sherry To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql In-Reply-To: <1105501768.41e49e484d779@webmail.moph.go.th> Message-ID: References: <1105501768.41e49e484d779@webmail.moph.go.th> 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.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/178 X-Sequence-Number: 9868 On Wed, 12 Jan 2005 amrit@health2.moph.go.th wrote: > I wonder if I would like to increase more RAM from 4 Gb. to 6 Gb. [which I hope > to increase more performance ] and I now I used RH 9 and Pgsql 7.3.2 ON DUAL > Xeon 3.0 server thay has the limtation of 4 Gb. ram, I should use which OS > between FC 2-3 or redhat EL 3 [which was claimed to support 64 Gb.ram] .May I > use FC 2 [which is freely downloaded] with 6 Gb. and PGsql 7.4 ? > Amrit > Thailand Try 7.4 before the memory upgrade. If you still have performance issues, try optimising your queries. As I mentioned before, you can join the #postgresql channel on irc.freenode.net and we can assist. Gavin From pgsql-performance-owner@postgresql.org Wed Jan 12 12:45:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8856F3A5CAB for ; Wed, 12 Jan 2005 12:45: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 12715-05 for ; Wed, 12 Jan 2005 12:44:53 +0000 (GMT) Received: from linuxworld.com.au (unknown [203.34.46.50]) by svr1.postgresql.org (Postfix) with ESMTP id 6DA063A5C7D for ; Wed, 12 Jan 2005 12:44:54 +0000 (GMT) Received: from linuxworld.com.au (IDENT:swm@localhost.localdomain [127.0.0.1]) by linuxworld.com.au (8.13.2/8.13.2) with ESMTP id j0CCitGR006739; Wed, 12 Jan 2005 23:44:55 +1100 Received: from localhost (swm@localhost) by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id j0CCitrf006736; Wed, 12 Jan 2005 23:44:55 +1100 X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs Date: Wed, 12 Jan 2005 23:44:55 +1100 (EST) From: Gavin Sherry X-X-Sender: swm@linuxworld.com.au To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql In-Reply-To: <1105501768.41e49e484d779@webmail.moph.go.th> Message-ID: References: <1105501768.41e49e484d779@webmail.moph.go.th> 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.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/148 X-Sequence-Number: 9838 On Wed, 12 Jan 2005 amrit@health2.moph.go.th wrote: > I wonder if I would like to increase more RAM from 4 Gb. to 6 Gb. [which I hope > to increase more performance ] and I now I used RH 9 and Pgsql 7.3.2 ON DUAL > Xeon 3.0 server thay has the limtation of 4 Gb. ram, I should use which OS > between FC 2-3 or redhat EL 3 [which was claimed to support 64 Gb.ram] .May I > use FC 2 [which is freely downloaded] with 6 Gb. and PGsql 7.4 ? There is no problem with free Linux distros handling > 4 GB of memory. The problem is that 32 hardware must make use of some less than efficient mechanisms to be able to address the memory. So, try 7.4 before the memory upgrade. If you still have performance issues, try optimising your queries. As I mentioned before, you can join the #postgresql channel on irc.freenode.net and we can assist. Gavin > Amrit > Thailand Gavin From pgsql-performance-owner@postgresql.org Wed Jan 12 14:46:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8937D3A5CB4 for ; Wed, 12 Jan 2005 14:46: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 25607-03 for ; Wed, 12 Jan 2005 14:45:50 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id E53E93A5CD4 for ; Wed, 12 Jan 2005 14:45:46 +0000 (GMT) Received: (qmail 840 invoked from network); 12 Jan 2005 14:48:34 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 12 Jan 2005 14:48:34 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 32368-25 for ; Wed, 12 Jan 2005 21:48:33 +0700 (ICT) Received: (qmail 832 invoked from network); 12 Jan 2005 14:48:33 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 12 Jan 2005 14:48:33 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Wed, 12 Jan 2005 21:48:33 +0700 Message-ID: <1105541313.41e538c110c38@webmail.moph.go.th> Date: Wed, 12 Jan 2005 21:48:33 +0700 From: amrit@health2.moph.go.th To: Gavin Sherry Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/149 X-Sequence-Number: 9839 > There is no problem with free Linux distros handling > 4 GB of memory. The > problem is that 32 hardware must make use of some less than efficient > mechanisms to be able to address the memory. > > So, try 7.4 before the memory upgrade. If you still have performance issues, > try optimising your queries. As I mentioned before, you can join the > #postgresql channel on irc.freenode.net and we can assist. Yes , of course I must try to upgrade PGsql to 7.4 and may be OS to FC 2-3 too. My server products are intel based [mainboard , CPU ,Case , Power supply ,RAID Network card] dual Xeon 32 bit 3.0 Ghz which I consulted Thai intel supervisor and they told me that increasing the ram for more than 4 Gb. may be possible depending on the OS. I ask the programmer who wrote that huge query and they told me that it was the query generated by Delphi 6.0 component and not written by themselve. Amrit Thailand From pgsql-performance-owner@postgresql.org Wed Jan 12 15:19:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3CE8A3A5CF8 for ; Wed, 12 Jan 2005 15:19: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 29195-06 for ; Wed, 12 Jan 2005 15:19:05 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by svr1.postgresql.org (Postfix) with ESMTP id 2F8B33A5CEE for ; Wed, 12 Jan 2005 15:19:06 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so344917wri for ; Wed, 12 Jan 2005 07:19: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=CM1UAOcRtunoRM7Z/wK8RvackV/80SIn7BC3hcWHnRNKUSWO6bqHHeR4AxMGQy9pKHO/NwoDidCtAxXFCRjA6Nf7UW9Nr6U4kB5QzLt6R0UBaMqD7/vpw9q785Jnomf58D45c57Q8g1NZOStEHCzmirfLxXYSWsjd7TQ7jq+JmI= Received: by 10.54.3.2 with SMTP id 2mr127237wrc; Wed, 12 Jan 2005 07:19:06 -0800 (PST) Received: by 10.54.4.50 with HTTP; Wed, 12 Jan 2005 07:19:06 -0800 (PST) Message-ID: <1eae200b05011207191f2efd01@mail.gmail.com> Date: Wed, 12 Jan 2005 16:19:06 +0100 From: Martin Tedjawardhana Reply-To: Martin Tedjawardhana To: "amrit@health2.moph.go.th" Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Cc: Gavin Sherry , PGsql-performance In-Reply-To: <1105541313.41e538c110c38@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105541313.41e538c110c38@webmail.moph.go.th> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.023 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP, TO_ADDRESS_EQ_REAL X-Spam-Level: * X-Archive-Number: 200501/150 X-Sequence-Number: 9840 > Yes , of course I must try to upgrade PGsql to 7.4 and may be OS to FC 2-3 too. > My server products are intel based [mainboard , CPU ,Case , Power supply ,RAID > Network card] dual Xeon 32 bit 3.0 Ghz which I consulted Thai intel supervisor > and they told me that increasing the ram for more than 4 Gb. may be possible > depending on the OS. I never tried FC before, but I recommend using Debian (with custom kernel) or if you have the patience: Gentoo. Those are "strictly business" distros, no unnecesary stuffs running after installation. Providing a good base for you to focus on performance tweaks. Others may have different opinions, though... From pgsql-performance-owner@postgresql.org Wed Jan 12 16:58:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 17A4D3A5D5E for ; Wed, 12 Jan 2005 16:57: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 44371-02 for ; Wed, 12 Jan 2005 16:57:52 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id C19393A5D32 for ; Wed, 12 Jan 2005 16:57:48 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so579300wra for ; Wed, 12 Jan 2005 08:57:47 -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=HLfw12p9cs51qoJGMlSvRI3R1ruGY82KEem1p49/tNf8SQFQfkvOz134e4aml0GOWmH331QQmeeP77MATgSKpukEJNVpibqAzas4EKs3XOiWs/Cywbrwh3FZTeV/QWUTdL7hYuclq5T7Po/6EL8JjGqdwXJg3p5DHm37pqMGMu8= Received: by 10.54.50.57 with SMTP id x57mr522047wrx; Wed, 12 Jan 2005 08:57:47 -0800 (PST) Received: by 10.54.18.72 with HTTP; Wed, 12 Jan 2005 08:57:47 -0800 (PST) Message-ID: <33c6269f050112085763aff4a6@mail.gmail.com> Date: Wed, 12 Jan 2005 11:57:47 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Greg Stark Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Cc: Merlin Moncure , pgsql-performance@postgresql.org In-Reply-To: <87zmzg0ycq.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A3@Herge.rcsinc.local> <87zmzg0ycq.fsf@stark.xeocode.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: 200501/151 X-Sequence-Number: 9841 Infact the cache hit ratio that Oracle suggests is the minimum good value is 95%. Anything below that is bad news. The reason is pretty obvious - RAM transfer speed is around 3.2G/sec these days, whilst even the best array isn't going to give more than 400MB/sec, and that's not even starting to talk about seek time. anything below 90% is not going to keep even the best disc hardware saturated. I know that our dataset is 99% cached, and therefore better CPUs/better RAM has a huge impact on overall performance. Alex Turner NetEconomist On 11 Jan 2005 10:39:01 -0500, Greg Stark wrote: > > "Merlin Moncure" writes: > > > heh, our apps do tend to be CPU bound. Generally, I think the extra CPU > > horsepower is worth the investment until you get to the really high end > > cpus. > > I find that while most applications I work with shouldn't be cpu intensive > they do seem end up being cpu bound quite frequently. What happens is that 90% > of the workload has a working set that fits in RAM. So the system ends up > being bound by the memory bus speed. That appears exactly the same as > cpu-bound, though I'm unclear whether increasing the cpu clock will help. > > It's quite possible to have this situation at the same time as other queries > are i/o bound. It's quite common to have 95% of your workload be frequently > executed fast queries on commonly accessed data and 5% be bigger data > warehouse style queries that need to do large sequential reads. > > Incidentally, the same was true for Oracle on Solaris. If we found excessive > cpu use typically meant some frequently executed query was using a sequential > scan on a small table. Small enough to fit in RAM but large enough to consume > lots of cycles reading it. > > -- > greg > > From pgsql-performance-owner@postgresql.org Wed Jan 12 17:25:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C83D03A5D79 for ; Wed, 12 Jan 2005 17:25: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 49312-01 for ; Wed, 12 Jan 2005 17:25:28 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 8AC193A5D76 for ; Wed, 12 Jan 2005 17:25:27 +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 1ComFI-0002c2-00; Wed, 12 Jan 2005 12:25:24 -0500 To: alex@neteconomist.com Cc: Greg Stark , Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A3@Herge.rcsinc.local> <87zmzg0ycq.fsf@stark.xeocode.com> <33c6269f050112085763aff4a6@mail.gmail.com> In-Reply-To: <33c6269f050112085763aff4a6@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 12 Jan 2005 12:25:23 -0500 Message-ID: <87y8eyzhj0.fsf@stark.xeocode.com> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at 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: 200501/152 X-Sequence-Number: 9842 Alex Turner writes: > Infact the cache hit ratio that Oracle suggests is the minimum good > value is 95%. Anything below that is bad news. Well that seems very workload dependent. No amount of cache is going to be able to achieve that for a DSS system chugging sequentially through terabytes of data. Whereas for OLTP systems I would wouldn't be surprised to see upwards of 99% hit rate. Note that a high cache hit rate can also be a sign of a problem. After all, it means the same data is being accessed repeatedly which implicitly means something is being done inefficiently. For an SQL database it could mean the query plans are suboptimal. On several occasions we found Oracle behaving poorly despite excellent cache hit rates because it was doing a sequential scan of a moderately sized table instead of an index lookup. The table was small enough to fit in RAM but large enough to consume a significant amount of cpu, especially with the query being run thousands of times per minute. -- greg From pgsql-performance-owner@postgresql.org Wed Jan 12 17:36:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E50633A5D62 for ; Wed, 12 Jan 2005 17:36: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 50812-01 for ; Wed, 12 Jan 2005 17:36:46 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 0B5CD3A5D52 for ; Wed, 12 Jan 2005 17:36:46 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so585782wra for ; Wed, 12 Jan 2005 09:36: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=F/m90/DOIWf+T91cnDe8/1cEZKrVp1H9+FNzlLQtZeABc690430Dyl31AbAAUqk9SUew3IJPmeCxi83EoHl3BBExV1hleWKCnlvSMKXk9QCWhgLJNfbT8MSgDsLccDrk/8fh5kyrcS3psKhU+S9SHHN7TLZ8zY7U5tUwJcTsAr4= Received: by 10.54.36.60 with SMTP id j60mr286980wrj; Wed, 12 Jan 2005 09:36:45 -0800 (PST) Received: by 10.54.18.72 with HTTP; Wed, 12 Jan 2005 09:36:45 -0800 (PST) Message-ID: <33c6269f0501120936525abaee@mail.gmail.com> Date: Wed, 12 Jan 2005 12:36:45 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Greg Stark Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Cc: Merlin Moncure , pgsql-performance@postgresql.org In-Reply-To: <87y8eyzhj0.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75A3@Herge.rcsinc.local> <87zmzg0ycq.fsf@stark.xeocode.com> <33c6269f050112085763aff4a6@mail.gmail.com> <87y8eyzhj0.fsf@stark.xeocode.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/153 X-Sequence-Number: 9843 No - I agree - Analysis cache hit rate as a single indicator is dangerous. You can easily increase cache hit rate by de-optimizing a good query so it uses more CPU cylces, and therefore has a higher cache hit rate. All information has to be taken as a whole when performing optimization on a system. Cache hit rate is just one factor. For data warehousing, it's obviously that you are going to have a lower cache hit rate because you are often performing scans across large data sets that will never fit in memory. But for most system, not necesarily just OLTP, a high cache hit ratio is acheivable. Cache hit ratio is just one small indication of performance. Relating to that - How to extract this kind of information from postgresql? Is there a way to get the cache hti ratio, or determine the worst 10 queries in a database? Alex Turner NetEconomist On 12 Jan 2005 12:25:23 -0500, Greg Stark wrote: > > Alex Turner writes: > > > Infact the cache hit ratio that Oracle suggests is the minimum good > > value is 95%. Anything below that is bad news. > > Well that seems very workload dependent. No amount of cache is going to be > able to achieve that for a DSS system chugging sequentially through terabytes > of data. Whereas for OLTP systems I would wouldn't be surprised to see upwards > of 99% hit rate. > > Note that a high cache hit rate can also be a sign of a problem. After all, it > means the same data is being accessed repeatedly which implicitly means > something is being done inefficiently. For an SQL database it could mean the > query plans are suboptimal. > > On several occasions we found Oracle behaving poorly despite excellent cache > hit rates because it was doing a sequential scan of a moderately sized table > instead of an index lookup. The table was small enough to fit in RAM but large > enough to consume a significant amount of cpu, especially with the query being > run thousands of times per minute. > > -- > greg > > From pgsql-performance-owner@postgresql.org Wed Jan 12 22:25:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0FE583A506D for ; Wed, 12 Jan 2005 22:25: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 88062-02 for ; Wed, 12 Jan 2005 22:25:06 +0000 (GMT) Received: from web13124.mail.yahoo.com (web13124.mail.yahoo.com [216.136.174.142]) by svr1.postgresql.org (Postfix) with SMTP id 371673A4A21 for ; Wed, 12 Jan 2005 22:25:07 +0000 (GMT) Received: (qmail 32086 invoked by uid 60001); 12 Jan 2005 22:25: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=SN8c+IjiyCbb6yr/GDz4t9w+YG0TJSZZ7t4iMCPwPEJFahXf1wVlcHsR+/1BoLqF9qlsQLVcdVh7d3P7EM9ibSB9VeXY45B+uxjJlOFax96KaYlhuypIyXIggAjN8Z9U285FOUuf+SyMCz46e69FEwZkZDtZ/L7fBW94aVHaf18= ; Message-ID: <20050112222506.32084.qmail@web13124.mail.yahoo.com> Received: from [63.78.249.254] by web13124.mail.yahoo.com via HTTP; Wed, 12 Jan 2005 14:25:06 PST Date: Wed, 12 Jan 2005 14:25:06 -0800 (PST) From: Litao Wu Subject: Postgres Optimizer is not smart enough? 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.28 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/154 X-Sequence-Number: 9844 Hi All, Here is my test comparison between Postgres (7.3.2) optimizer vs Oracle (10g) optimizer. It seems to me that Postgres optimizer is not smart enough. Did I miss anything? Thanks, In Postgres: ============ drop table test; create table test ( module character varying(50), action_deny integer, created timestamp with time zone, customer_id integer, domain character varying(255)); create or replace function insert_rows () returns integer as ' BEGIN for i in 1 .. 500000 loop insert into test values (i, 2, now(), 100, i); end loop; return 1; END; ' LANGUAGE 'plpgsql'; select insert_rows(); create index test_id1 on test (customer_id, created, domain); analyze test; explain analyze SELECT module, sum(action_deny) FROM test WHERE created >= ('now'::timestamptz - '1 day'::interval) AND customer_id='100' AND domain='100' GROUP BY module; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=3.12..3.13 rows=1 width=9) (actual time=91.05..91.05 rows=1 loops=1) -> Group (cost=3.12..3.12 rows=1 width=9) (actual time=91.04..91.04 rows=1 loops=1) -> Sort (cost=3.12..3.12 rows=1 width=9) (actual time=91.03..91.03 rows=1 loops=1) Sort Key: module -> Index Scan using test_id1 on test (cost=0.00..3.11 rows=1 width=9) (actual time=0.03..91.00 rows=1 loops=1) Index Cond: ((customer_id = 100) AND (created >= '2005-01-11 14:48:44.832552-07'::timestamp with time zone) AND ("domain" = '100'::character varying)) Total runtime: 91.13 msec (7 rows) create index test_id2 on test(domain); analyze test; explain analyze SELECT module, sum(action_deny) FROM test WHERE created >= ('now'::timestamptz - '1 day'::interval) AND customer_id='100' AND domain='100' GROUP BY module; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=3.12..3.13 rows=1 width=9) (actual time=90.30..90.30 rows=1 loops=1) -> Group (cost=3.12..3.12 rows=1 width=9) (actual time=90.29..90.30 rows=1 loops=1) -> Sort (cost=3.12..3.12 rows=1 width=9) (actual time=90.29..90.29 rows=1 loops=1) Sort Key: module -> Index Scan using test_id1 on test (cost=0.00..3.11 rows=1 width=9) (actual time=0.03..90.25 rows=1 loops=1) Index Cond: ((customer_id = 100) AND (created >= '2005-01-11 14:51:09.555974-07'::timestamp with time zone) AND ("domain" = '100'::character varying)) Total runtime: 90.38 msec (7 rows) WHY PG STILL CHOOSE INDEX test_id1??? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ BECAUSE QUERY WILL RUN MUCH FASTER USING test_id2!!! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop index test_id1; explain analyze SELECT module, sum(action_deny) FROM test WHERE created >= ('now'::timestamptz - '1 day'::interval) AND customer_id='100' AND domain='100' GROUP BY module; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=3.12..3.13 rows=1 width=9) (actual time=0.08..0.08 rows=1 loops=1) -> Group (cost=3.12..3.13 rows=1 width=9) (actual time=0.08..0.08 rows=1 loops=1) -> Sort (cost=3.12..3.13 rows=1 width=9) (actual time=0.07..0.07 rows=1 loops=1) Sort Key: module -> Index Scan using test_id2 on test (cost=0.00..3.11 rows=1 width=9) (actual time=0.04..0.05 rows=1 loops=1) Index Cond: ("domain" = '100'::character varying) Filter: ((created >= '2005-01-11 14:53:58.806364-07'::timestamp with time zone) AND (customer_id = 100)) Total runtime: 0.14 msec (8 rows) In Oracle: ========== drop table test; create table test ( module character varying(50), action_deny integer, created timestamp with time zone, customer_id integer, domain character varying(255)); begin for i in 1..500000 loop insert into test values (i, 2, current_timestamp, 100, i); end loop; end; / create index test_id1 on test (customer_id, created, domain); analyze table test compute statistics; set autot on set timing on SELECT module, sum(action_deny) FROM test WHERE created >= (current_timestamp - interval '1' day) AND customer_id=100 AND domain='100' GROUP BY module / MODULE SUM(ACTION_DENY) -------------------------------------------------- ---------------- 100 2 Elapsed: 00:00:00.67 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=25 Card=1 Bytes=29 ) 1 0 SORT (GROUP BY) (Cost=25 Card=1 Bytes=29) 2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TEST' (TABLE) (Cost=24 Card=1 Bytes=29) 3 2 INDEX (RANGE SCAN) OF 'TEST_ID1' (INDEX) (Cost=23 Card =4500) Statistics ---------------------------------------------------------- 1 recursive calls 0 db block gets 2292 consistent gets 2291 physical reads 0 redo size 461 bytes sent via SQL*Net to client 508 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 1 rows processed create index test_id2 on test (domain); SELECT module, sum(action_deny) FROM test WHERE created >= (current_timestamp - interval '1' day) AND customer_id=100 AND domain='100' GROUP BY module / MODULE SUM(ACTION_DENY) -------------------------------------------------- ---------------- 100 2 Elapsed: 00:00:00.03 Execution Plan ---------------------------------------------------------- 0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=5 Card=1 Bytes=29) 1 0 SORT (GROUP BY) (Cost=5 Card=1 Bytes=29) 2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TEST' (TABLE) (Cost=4 Card=1 Bytes=29) 3 2 INDEX (RANGE SCAN) OF 'TEST_ID2' (INDEX) (Cost=3 Card= 1) Statistics ---------------------------------------------------------- 0 recursive calls 0 db block gets 4 consistent gets 0 physical reads 0 redo size 461 bytes sent via SQL*Net to client 508 bytes received via SQL*Net from client 2 SQL*Net roundtrips to/from client 1 sorts (memory) 0 sorts (disk) 1 rows processed __________________________________ Do you Yahoo!? All your favorites on one personal page � Try My Yahoo! http://my.yahoo.com From pgsql-performance-owner@postgresql.org Wed Jan 12 22:56:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4B0933A4E28 for ; Wed, 12 Jan 2005 22:55: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 91540-08 for ; Wed, 12 Jan 2005 22:55:47 +0000 (GMT) Received: from ms-smtp-03-eri0.ohiordc.rr.com (ms-smtp-03-smtplb.ohiordc.rr.com [65.24.5.137]) by svr1.postgresql.org (Postfix) with ESMTP id 4C8033A5E45 for ; Wed, 12 Jan 2005 22:55:48 +0000 (GMT) Received: from enzo.mascari.com (dhcp065-024-156-214.columbus.rr.com [65.24.156.214]) by ms-smtp-03-eri0.ohiordc.rr.com (8.12.10/8.12.7) with ESMTP id j0CMtjwZ017674; Wed, 12 Jan 2005 17:55:45 -0500 (EST) Received: from [192.168.2.8] (mercedes.mascari.com [192.168.2.8]) by enzo.mascari.com (8.12.8/8.12.8) with ESMTP id j0CMtfnj013168; Wed, 12 Jan 2005 17:55:41 -0500 Message-ID: <41E5AAEB.2070706@mascari.com> Date: Wed, 12 Jan 2005 17:55:39 -0500 From: Mike Mascari User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Litao Wu Cc: pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> In-Reply-To: <20050112222506.32084.qmail@web13124.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mascari-MailScanner-Information: Please contact the ISP for more information X-Mascari-MailScanner: Found to be clean X-Mascari-MailScanner-SpamCheck: not spam, SpamAssassin (score=0, required 6, autolearn=not spam) X-MailScanner-From: mascarm@mascari.com X-Virus-Scanned: Symantec AntiVirus Scan Engine 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: 200501/155 X-Sequence-Number: 9845 Litao Wu wrote: > Hi All, > > Here is my test comparison between Postgres (7.3.2) > optimizer vs Oracle (10g) optimizer. > > It seems to me that Postgres optimizer is not smart > enough. > > Did I miss anything? Yeah, 7.4. 7.3.2 is *ancient*. Here's output from 7.4: [test@ferrari] explain analyze test-# SELECT module, sum(action_deny) test-# FROM test test-# WHERE created >= ('now'::timestamptz - '1 test'# day'::interval) AND customer_id='100' test-# AND domain='100' test-# GROUP BY module; QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=5.69..5.69 rows=1 width=13) (actual time=715.058..715.060 rows=1 loops=1) -> Index Scan using test_id1 on test (cost=0.00..5.68 rows=1 width=13) (actual time=0.688..690.459 rows=1 loops=1) Index Cond: ((customer_id = 100) AND (created >= '2005-01-11 17:52:22.364145-05'::timestamp with time zone) AND (("domain")::text = '100'::text)) Total runtime: 717.546 ms (4 rows) [test@ferrari] create index test_id2 on test(domain); CREATE INDEX [test@ferrari] analyze test; ANALYZE [test@ferrari] [test@ferrari] explain analyze test-# SELECT module, sum(action_deny) test-# FROM test test-# WHERE created >= ('now'::timestamptz - '1 test'# day'::interval) AND customer_id='100' test-# AND domain='100' test-# GROUP BY module; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ HashAggregate (cost=5.68..5.69 rows=1 width=13) (actual time=10.778..10.780 rows=1 loops=1) -> Index Scan using test_id2 on test (cost=0.00..5.68 rows=1 width=13) (actual time=10.702..10.721 rows=1 loops=1) Index Cond: (("domain")::text = '100'::text) Filter: ((created >= '2005-01-11 17:53:16.720749-05'::timestamp with time zone) AND (customer_id = 100)) Total runtime: 11.039 ms (5 rows) [test@ferrari] select version(); PostgreSQL 7.4.5 on i686-pc-linux-gnu, compiled by GCC i686-pc-linux-gnu-gcc (GCC) 3.4.0 20040204 (prerelease) (1 row) Hope that helps, Mike Mascari From pgsql-performance-owner@postgresql.org Wed Jan 12 23:10:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 630743A5E10 for ; Wed, 12 Jan 2005 23:10: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 93034-07 for ; Wed, 12 Jan 2005 23:10:13 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 3FB1E3A4652 for ; Wed, 12 Jan 2005 23:10:14 +0000 (GMT) Received: (qmail 442 invoked from network); 12 Jan 2005 23:10:11 -0000 Received: from 218-101-12-250.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.250) by 0 with SMTP; 12 Jan 2005 23:10:11 -0000 Message-ID: <41E5AF3F.2080100@coretech.co.nz> Date: Thu, 13 Jan 2005 12:14:07 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Litao Wu Cc: pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> In-Reply-To: <20050112222506.32084.qmail@web13124.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/156 X-Sequence-Number: 9846 Litao Wu Wrote: > explain analyze > SELECT module, sum(action_deny) > FROM test > WHERE created >= ('now'::timestamptz - '1 > day'::interval) AND customer_id='100' > AND domain='100' > GROUP BY module; Here is my output for this query: QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=3.03..3.03 rows=1 width=13) (actual time=0.132..0.135 rows=1 loops=1) -> Index Scan using test_id2 on test (cost=0.00..3.02 rows=1 width=13) (actual time=0.085..0.096 rows=1 loops=1) Index Cond: (("domain")::text = '100'::text) Filter: ((created >= ('2005-01-13 11:57:34.673833+13'::timestamp with time zone - '1 day'::interval)) AND (customer_id = 100)) Total runtime: 0.337 ms (5 rows) Time: 8.424 ms The version is: PostgreSQL 8.0.0rc5 on i386-unknown-freebsd5.3, compiled by GCC gcc (GCC) 3.4.2 [FreeBSD] 20040728 I have random_page_cost = 0.8 in my postgresql.conf. Setting it back to the default (4) results in a plan using test_id1. A little experimentation showed that for my system random_page_cost=1 was where it changed from using test_id1 to test_id2. So changing this parameter may be helpful. I happen to have some debugging code enabled for the optimizer, and the issue appears to be that the costs of paths using these indexes are quite similar, so are quite sensitive to (some) parameter values. regards Mark P.s : 7.3.2 is quite old. From pgsql-performance-owner@postgresql.org Thu Jan 13 00:50:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 20E383A5E4C for ; Thu, 13 Jan 2005 00:50: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 04333-08 for ; Thu, 13 Jan 2005 00:50:07 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 602383A4FDA for ; Thu, 13 Jan 2005 00:50:08 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Thu, 13 Jan 2005 00:50:07 Z Subject: Re: Postgres Optimizer is not smart enough? From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Mark Kirkwood Cc: pgsql-performance@postgresql.org In-Reply-To: <41E5AF3F.2080100@coretech.co.nz> References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> <41E5AF3F.2080100@coretech.co.nz> Content-Type: text/plain Date: Thu, 13 Jan 2005 00:50:16 +0000 Message-Id: <1105577416.5220.50.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: 200501/157 X-Sequence-Number: 9847 On Thu, 2005-01-13 at 12:14 +1300, Mark Kirkwood wrote: [snip some explains] > > I have random_page_cost = 0.8 in my postgresql.conf. Setting it back to > the default (4) results in a plan using test_id1. it is not rational to have random_page_cost < 1. if you see improvement with such a setting, it is as likely that something else is wrong, such as higher statistic targets needed, or a much too low effective_cache setting. gnari From pgsql-performance-owner@postgresql.org Thu Jan 13 01:29:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F3D543A5E8E for ; Thu, 13 Jan 2005 01:28: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 08819-04 for ; Thu, 13 Jan 2005 01:28:31 +0000 (GMT) Received: from biglumber.com (biglumber.com [207.228.252.42]) by svr1.postgresql.org (Postfix) with SMTP id EC91D3A5E97 for ; Thu, 13 Jan 2005 01:28:32 +0000 (GMT) Received: (qmail 5265 invoked from network); 13 Jan 2005 01:28:32 -0000 Received: from unknown (HELO localhost) (207.228.252.42) by 0 with SMTP; 13 Jan 2005 01:28:32 -0000 From: "Greg Sabino Mullane" To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft X-PGP-Key: 2529 DF6A B8F7 9407 E944 45B4 BC9B 9067 1496 4AC8 X-Request-PGP: http://www.biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 In-Reply-To: <33c6269f05011008074b33b812@mail.gmail.com> Date: Thu, 13 Jan 2005 01:28:32 -0000 X-Mailer: JoyMail 1.48 Message-ID: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/158 X-Sequence-Number: 9848 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > Oracle is not that expensive - standard one can be got for $149/user > or $5k/CPU, and for most applications, the features in standard one > are fine. Don't forget your support contract cost, as well as licenses for each of your servers: development, testing, QA, etc. Is it really as "cheap" as 5K? I've heard that for any fairly modern system, it's much more, but that may be wrong. - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200501122029 http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8 -----BEGIN PGP SIGNATURE----- iD8DBQFB5c8gvJuQZxSWSsgRAhRzAKDeWZ9LE2etLspiAiFCG8OeeEGoHwCgoLhb crxreFQ2LNVjAp24beDMK5g= =C59m -----END PGP SIGNATURE----- From pgsql-performance-owner@postgresql.org Thu Jan 13 02:07:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 75BC83A5E82 for ; Thu, 13 Jan 2005 02:07: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 13486-06 for ; Thu, 13 Jan 2005 02:07:16 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 8AE983A5E6F for ; Thu, 13 Jan 2005 02:07:17 +0000 (GMT) Received: (qmail 8333 invoked from network); 13 Jan 2005 02:07:17 -0000 Received: from 218-101-12-250.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.250) by 0 with SMTP; 13 Jan 2005 02:07:17 -0000 Message-ID: <41E5D8C0.5080304@coretech.co.nz> Date: Thu, 13 Jan 2005 15:11:12 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Ragnar_Hafsta=F0?= Cc: pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> <41E5AF3F.2080100@coretech.co.nz> <1105577416.5220.50.camel@localhost.localdomain> In-Reply-To: <1105577416.5220.50.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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: 200501/159 X-Sequence-Number: 9849 Ragnar Hafsta� wrote: > > > > it is not rational to have random_page_cost < 1. > I agree, in theory one should never *need* to set it < 1. However in cases when the optimizers understanding of things is a little off, compensation may be required to achieve better plans (e.g. encouraging index scans on data with funny distributions or collelations). > if you see improvement with such a setting, it is as likely that > something else is wrong, such as higher statistic targets needed, > or a much too low effective_cache setting. > Altho this is good advice, it is not always sufficient. For instance I have my effective_cache_size=20000. Now the machine has 512Mb ram and right now cache+buf+free is about 100M, and shared_buffers=2000. So in fact I probably have it a bit high :-). Increasing stats target will either make the situation better or worse - a better sample of data is obtained for analysis, but this is not *guaranteed* to lead to a faster execution plan, even if in general/usually it does. cheers Mark From pgsql-performance-owner@postgresql.org Thu Jan 13 02:40:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 786243A5EE6 for ; Thu, 13 Jan 2005 02:39: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 17300-07 for ; Thu, 13 Jan 2005 02:39:33 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D0F0F3A5EBF for ; Thu, 13 Jan 2005 02:39:36 +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 j0D2dX0E004338; Wed, 12 Jan 2005 21:39:33 -0500 (EST) To: Mark Kirkwood Cc: Litao Wu , pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? In-reply-to: <41E5AF3F.2080100@coretech.co.nz> References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> <41E5AF3F.2080100@coretech.co.nz> Comments: In-reply-to Mark Kirkwood message dated "Thu, 13 Jan 2005 12:14:07 +1300" Date: Wed, 12 Jan 2005 21:39:33 -0500 Message-ID: <4337.1105583973@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: 200501/160 X-Sequence-Number: 9850 Mark Kirkwood writes: > I happen to have some debugging code enabled for the optimizer, and the > issue appears to be that the costs of paths using these indexes are > quite similar, so are quite sensitive to (some) parameter values. They'll be exactly the same, actually, as long as the thing predicts exactly one row retrieved. So it's quasi-random which plan you get. btcostestimate needs to be improved to understand that in multicolumn index searches with inequality conditions, we may have to scan through tuples that don't meet all the qualifications. It's not accounting for that cost at the moment, which is why the estimates are the same. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jan 13 06:51:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4E833A5F0D for ; Thu, 13 Jan 2005 06:51: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 71155-01 for ; Thu, 13 Jan 2005 06:51:25 +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 9A9B23A5EE6 for ; Thu, 13 Jan 2005 06:51:25 +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 2484868; Wed, 12 Jan 2005 23:53:09 -0800 Message-ID: <41E61A6C.4020203@joeconway.com> Date: Wed, 12 Jan 2005 22:51:24 -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: Greg Sabino Mullane Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: In-Reply-To: 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: 200501/161 X-Sequence-Number: 9851 Greg Sabino Mullane wrote: > Don't forget your support contract cost, as well as licenses for each > of your servers: development, testing, QA, etc. > > Is it really as "cheap" as 5K? I've heard that for any fairly modern > system, it's much more, but that may be wrong. > Sort of -- see: http://oraclestore.oracle.com/OA_HTML/ibeCCtpSctDspRte.jsp?section=15105 "It is available on single server systems supporting up to a maximum of 2 CPUs" Also note that most industrial strength features (like table partitioning, RAC, OLAP, Enterprise Manager plugins, etc, etc) are high priced options (mostly $10K to $20K per CPU) and they can only be used with the Enterprise edition (which is $40K/CPU *not* $2.5K/CPU). http://oraclestore.oracle.com/OA_HTML/ibeCCtpSctDspRte.jsp?section=10103 And you are correct, they expect to be paid for each dev, test, and QA machine too. The $5K edition is just there to get you hooked ;-) By the time you add up what you really want/need, figure you'll spend a couple of orders of magnatude higher, and then > 20% per year for ongoing maintenance/upgrades/support. Joe From pgsql-performance-owner@postgresql.org Thu Jan 13 08:34:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CDF5F3A509B for ; Thu, 13 Jan 2005 08:34: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 92187-06 for ; Thu, 13 Jan 2005 08:34:34 +0000 (GMT) Received: from ew.mimos.my (ew.mimos.my [192.228.129.34]) by svr1.postgresql.org (Postfix) with ESMTP id 3E6F93A4F5D for ; Thu, 13 Jan 2005 08:34:34 +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 j0D8YVsP024332 for ; Thu, 13 Jan 2005 16:34:32 +0800 (MYT) (envelope-from hasnulfadhly.h@mimos.my) Message-ID: <41E63294.9040605@mimos.my> Date: Thu, 13 Jan 2005 16:34:28 +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: Performance delay Content-Type: text/plain; charset=us-ascii; 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.065 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/162 X-Sequence-Number: 9852 Hi, just want to share with all of you a wierd thing that i found when i tested it. i was doing a query that will call a function long2ip to convert bigint to ips. so the query looks something like this. select id, long2ip(srcip), long2ip(dstip) from sometable where timestamp between timestamp '01-10-2005' and timestamp '01-10-2005 23:59' order by id limit 30; for your info, there are about 300k rows for that timeframe. it cost me about 57+ secs to get the list. which is about the same if i query select id, long2ip(srcip), long2ip(dstip) from sometable where timestamp between timestamp '01-10-2005' and timestamp '01-10-2005 23:59' it will cost me about 57+ secs also. Now if i did this select id,long2ip(srcip), long2ip(dstip) from ( * from sometable where timestamp between timestamp '01-10-2005' and timestamp '01-10-2005 23:59' order by id limit 30) as t; it will cost me about 3+ secs Anyone knows why this is the case? Hasnul From pgsql-performance-owner@postgresql.org Thu Jan 13 08:58:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E52DD3A4275 for ; Thu, 13 Jan 2005 08:58: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 96317-06 for ; Thu, 13 Jan 2005 08:58:22 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id DC4EB3A2585 for ; Thu, 13 Jan 2005 08:58:23 +0000 (GMT) Received: (qmail 21041 invoked from network); 13 Jan 2005 08:58:21 -0000 Received: from 218-101-12-250.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.250) by 0 with SMTP; 13 Jan 2005 08:58:21 -0000 Message-ID: <41E63917.2070906@coretech.co.nz> Date: Thu, 13 Jan 2005 22:02:15 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Litao Wu , pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> <41E5AF3F.2080100@coretech.co.nz> <4337.1105583973@sss.pgh.pa.us> In-Reply-To: <4337.1105583973@sss.pgh.pa.us> 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: 200501/163 X-Sequence-Number: 9853 Tom Lane wrote: > Mark Kirkwood writes: > the costs of paths using these indexes are >>quite similar, so are quite sensitive to (some) parameter values. > > > They'll be exactly the same, actually, as long as the thing predicts > exactly one row retrieved. So it's quasi-random which plan you get. > > btcostestimate needs to be improved to understand that in multicolumn > index searches with inequality conditions, we may have to scan through > tuples that don't meet all the qualifications. It's not accounting for > that cost at the moment, which is why the estimates are the same. > I see some small differences in the numbers - I am thinking that these are due to the calculations etc in cost_index(). e.g: create_index_paths : index oid 12616389 (test_id2) cost_index : cost=2.839112 (startup_cost=0.000000 run_cost=2.839112) : tuples=1.000000 cpu_per_tuple=0.017500 : selectivity=0.000002 : run_index_tot_cost=2.003500 run_io_cost=0.818112) create_index_paths : index oid 12616388 (test_id1) cost_index : cost=2.933462 (startup_cost=0.002500 run_cost=2.930962) : tuples=1.000000 cpu_per_tuple=0.010000 : selectivity=0.000002 : run_index_tot_cost=2.008500 run_io_cost=0.912462 Where: run_index_tot_cost=indexTotalCost - indexStartupCost; run_io_cost=max_IO_cost + csquared * (min_IO_cost - max_IO_cost) selectivity=indexSelectivity Hmmm ... so it's only the selectivity that is the same (sourced from index->amcostestimate which I am guessing points to btcostestimate), is that correct? cheers Mark From pgsql-performance-owner@postgresql.org Thu Jan 13 11:02:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC91B3A4F6C for ; Thu, 13 Jan 2005 11:02: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 18214-02 for ; Thu, 13 Jan 2005 11:02:07 +0000 (GMT) Received: from anchor-post-32.mail.demon.net (anchor-post-32.mail.demon.net [194.217.242.90]) by svr1.postgresql.org (Postfix) with ESMTP id 2CCE93A2585 for ; Thu, 13 Jan 2005 11:02:09 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-32.mail.demon.net with esmtp (Exim 4.42) id 1Cp2jw-0001Q1-7z; Thu, 13 Jan 2005 11:02:08 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id A64A816996; Thu, 13 Jan 2005 11:02:07 +0000 (GMT) Message-ID: <41E6552C.3020801@archonet.com> Date: Thu, 13 Jan 2005 11:02:04 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hasnul Fadhly bin Hasan Cc: pgsql-performance@postgresql.org Subject: Re: Performance delay References: <41E63294.9040605@mimos.my> In-Reply-To: <41E63294.9040605@mimos.my> 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.074 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/164 X-Sequence-Number: 9854 Hasnul Fadhly bin Hasan wrote: > Hi, > > just want to share with all of you a wierd thing that i found when i > tested it. > > i was doing a query that will call a function long2ip to convert bigint > to ips. > > so the query looks something like this. > > select id, long2ip(srcip), long2ip(dstip) from sometable > where timestamp between timestamp '01-10-2005' and timestamp '01-10-2005 > 23:59' order by id limit 30; > > for your info, there are about 300k rows for that timeframe. > > it cost me about 57+ secs to get the list. > > which is about the same if i query > select id, long2ip(srcip), long2ip(dstip) from sometable > where timestamp between timestamp '01-10-2005' and timestamp '01-10-2005 > 23:59' > > it will cost me about 57+ secs also. > > Now if i did this > select id,long2ip(srcip), long2ip(dstip) from ( > * from sometable > where timestamp between timestamp '01-10-2005' and timestamp '01-10-2005 > 23:59' order by id limit 30) as t; > > it will cost me about 3+ secs The difference will be that in the final case you only make 30 calls to long2ip() whereas in the first two you call it 300,000 times and then throw away most of them. Try running EXPLAIN ANALYSE ... for both - that will show how PG is planning the query. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 13 11:14:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 37D413A5C31 for ; Thu, 13 Jan 2005 11:14: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 21199-01 for ; Thu, 13 Jan 2005 11:14:18 +0000 (GMT) Received: from ew.mimos.my (ew.mimos.my [192.228.129.34]) by svr1.postgresql.org (Postfix) with ESMTP id 39B233A4F1F for ; Thu, 13 Jan 2005 11:14:19 +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 j0DBEEsP078887; Thu, 13 Jan 2005 19:14:14 +0800 (MYT) (envelope-from hasnulfadhly.h@mimos.my) Message-ID: <41E65802.5070400@mimos.my> Date: Thu, 13 Jan 2005 19:14:10 +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: Richard Huxton Cc: pgsql-performance@postgresql.org Subject: Re: Performance delay References: <41E63294.9040605@mimos.my> <41E6552C.3020801@archonet.com> In-Reply-To: <41E6552C.3020801@archonet.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.063 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/165 X-Sequence-Number: 9855 Hi Richard, Thanks for the reply.. is that the case? i thought it would comply to the where condition first.. and after that it will format the output to what we want.. Hasnul Richard Huxton wrote: > Hasnul Fadhly bin Hasan wrote: > >> Hi, >> >> just want to share with all of you a wierd thing that i found when i >> tested it. >> >> i was doing a query that will call a function long2ip to convert >> bigint to ips. >> >> so the query looks something like this. >> >> select id, long2ip(srcip), long2ip(dstip) from sometable >> where timestamp between timestamp '01-10-2005' and timestamp >> '01-10-2005 23:59' order by id limit 30; >> >> for your info, there are about 300k rows for that timeframe. >> >> it cost me about 57+ secs to get the list. >> >> which is about the same if i query >> select id, long2ip(srcip), long2ip(dstip) from sometable >> where timestamp between timestamp '01-10-2005' and timestamp >> '01-10-2005 23:59' >> >> it will cost me about 57+ secs also. >> >> Now if i did this >> select id,long2ip(srcip), long2ip(dstip) from ( >> * from sometable >> where timestamp between timestamp '01-10-2005' and timestamp >> '01-10-2005 23:59' order by id limit 30) as t; >> >> it will cost me about 3+ secs > > > The difference will be that in the final case you only make 30 calls > to long2ip() whereas in the first two you call it 300,000 times and > then throw away most of them. > Try running EXPLAIN ANALYSE ... for both - that will show how PG is > planning the query. > -- > Richard Huxton > Archonet Ltd > > From pgsql-performance-owner@postgresql.org Thu Jan 13 12:15:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 58DAC3A5DC4 for ; Thu, 13 Jan 2005 12:15: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 33485-09 for ; Thu, 13 Jan 2005 12:15:28 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 563E83A5DD8 for ; Thu, 13 Jan 2005 12:15:29 +0000 (GMT) Received: (qmail 21895 invoked from network); 13 Jan 2005 13:15:35 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 13 Jan 2005 13:15:35 +0100 Date: Thu, 13 Jan 2005 13:16:19 +0100 To: pgsql-performance@postgresql.org Subject: MOVE command References: <41E63294.9040605@mimos.my> <41E6552C.3020801@archonet.com> <41E65802.5070400@mimos.my> From: PFC 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: <41E65802.5070400@mimos.my> 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: 200501/166 X-Sequence-Number: 9856 Hello, Here I'm implementing a session management, which has a connections table partitioned between active and archived connections. A connection represents a connection between a user and a chatroom. I use partitioning for performance reasons. The active table contains all the data for the active session : user_id, chatroom_id, session start time, and other information. The archive table contains just the user_id, chatroom_id, session start and end time, for logging purposes, and for displaying on the site, which user was logged to which chatroom and from when to when. Thus, when a user disconnects from a chatroom, I must move one row from the active to the archive table. This poses no problem as there is a UNIQUE index (iser_id,chatroom_id) so I select the row FOR UPDATE, insert it in the archive table, then delete it. Now, when a user logs out from the site, or when his session is purged by the auto-expiration cron job, I must also expire ALL his open chatroom connections. INSERT INTO archive (...) SELECT ... FROM active WHERE user_id = ...; DELETE FROM active WHERE user_id = ...; Now, if the user inserts a connection between the two queries above, the thing will fail (the connection will just be deleted). I know that there are many ways to do it right : - LOCK the table in exclusive mode - use an additional primary key on the active table which is not related to the user_id and the chatroom_id, select the id's of the sessions to expire in a temporary table, and use that - use an extra field in the table to mark that the rows are being processed - use transaction isolation level SERIALIZABLE However, all these methods somehow don't feel right, and as this is an often encountered problem, I'd really like to have a sql command, say MOVE, or SELECT AND DELETE, whatever, which acts like a SELECT, returning the rows, but deleting them as well. Then I'd just do INSERT INTO archive (...) SELECT ... AND DELETE FROM active WHERE user_id = ...; which would have the following advantages : - No worries about locks : - less chance of bugs - higher performance because locks have to be waited on, by definition - No need to do the request twice (so, it is twice as fast !) - Simplicity and elegance There would be an hidden bonus, that if you acquire locks, you better COMMIT the transaction as soon as possible to release them, whereas here, you can happily continue in the transaction. I think this command would make a nice cousin to the also very popular INSERT... OR UPDATE which tries to insert a row, and if it exists, UPDATES it instead of inserting it ! What do you think ? From pgsql-performance-owner@postgresql.org Thu Jan 13 13:45:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 84C553A5941 for ; Thu, 13 Jan 2005 13:45: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 45099-05 for ; Thu, 13 Jan 2005 13:45:06 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id CD8623A44A9 for ; Thu, 13 Jan 2005 13:45:09 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 2DDA91C8FE; Thu, 13 Jan 2005 07:45:09 -0600 (CST) Date: Thu, 13 Jan 2005 07:45:09 -0600 From: "Jim C. Nasby" To: Hasnul Fadhly bin Hasan Cc: Richard Huxton , pgsql-performance@postgresql.org Subject: Re: Performance delay Message-ID: <20050113134509.GG67721@decibel.org> References: <41E63294.9040605@mimos.my> <41E6552C.3020801@archonet.com> <41E65802.5070400@mimos.my> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41E65802.5070400@mimos.my> 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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/167 X-Sequence-Number: 9857 On Thu, Jan 13, 2005 at 07:14:10PM +0800, Hasnul Fadhly bin Hasan wrote: > Hi Richard, > > Thanks for the reply.. is that the case? i thought it would comply to > the where condition first.. > and after that it will format the output to what we want.. That is in fact exactly what it's doing. The second query is faster not because of the where clause, but because of the limit clause. The first query builds a list of id, long2ip(srcip), long2ip(dstip) for the timestamp range, then it orders that list and gives you the first 30. The second query builds a list of everything from sometable for the timestamp range, orders it, keeps the first 30, THEN in calculates long2ip based on that list of 30 items. > Hasnul > > Richard Huxton wrote: > > >Hasnul Fadhly bin Hasan wrote: > > > >>Hi, > >> > >>just want to share with all of you a wierd thing that i found when i > >>tested it. > >> > >>i was doing a query that will call a function long2ip to convert > >>bigint to ips. > >> > >>so the query looks something like this. > >> > >>select id, long2ip(srcip), long2ip(dstip) from sometable > >>where timestamp between timestamp '01-10-2005' and timestamp > >>'01-10-2005 23:59' order by id limit 30; > >> > >>for your info, there are about 300k rows for that timeframe. > >> > >>it cost me about 57+ secs to get the list. > >> > >>which is about the same if i query > >>select id, long2ip(srcip), long2ip(dstip) from sometable > >>where timestamp between timestamp '01-10-2005' and timestamp > >>'01-10-2005 23:59' > >> > >>it will cost me about 57+ secs also. > >> > >>Now if i did this > >>select id,long2ip(srcip), long2ip(dstip) from ( > >>* from sometable > >>where timestamp between timestamp '01-10-2005' and timestamp > >>'01-10-2005 23:59' order by id limit 30) as t; > >> > >>it will cost me about 3+ secs > > > > > >The difference will be that in the final case you only make 30 calls > >to long2ip() whereas in the first two you call it 300,000 times and > >then throw away most of them. > >Try running EXPLAIN ANALYSE ... for both - that will show how PG is > >planning the query. > >-- > > Richard Huxton > > Archonet Ltd > > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- 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 Thu Jan 13 14:35:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D8A83A4E89 for ; Thu, 13 Jan 2005 14:35: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 51570-01 for ; Thu, 13 Jan 2005 14:35:26 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by svr1.postgresql.org (Postfix) with ESMTP id 79BAA3A449A for ; Thu, 13 Jan 2005 14:35:28 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so57915wra for ; Thu, 13 Jan 2005 06:35:29 -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=uXyUklsCpxxOYZCxl4MOU9wmfEjpVX7wAlhcHrLMlJvhkQqGpuy8i+tfZ97JTunSndCow3SXyrug0hPpwfibKwECSpP9Yf7tMk+egVO3Yjp/WQ/KJzazCx8wIJoj4m3/hGCBYgHPq6dsxxQiqnlc3ABEq4eD+Zoe54Z3EXtgF2o= Received: by 10.54.26.65 with SMTP id 65mr1873wrz; Thu, 13 Jan 2005 06:35:29 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 13 Jan 2005 06:35:29 -0800 (PST) Message-ID: <33c6269f05011306352b54067f@mail.gmail.com> Date: Thu, 13 Jan 2005 09:35:29 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Joe Conway Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Cc: Greg Sabino Mullane , pgsql-performance@postgresql.org In-Reply-To: <41E61A6C.4020203@joeconway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41E61A6C.4020203@joeconway.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: 200501/168 X-Sequence-Number: 9858 This is somewhat correct, and somewhat unfair - bear in mind that Postgresql doesn't have the equivalent features of Oracle enterprise edition including RAC and Enterprise Manager. You can use Oracle Personal edition for development, or pay a per head cost of $149/user for your dev group for standard one, which if you have a small team isn't really that much. If you want commercial support for Postgresql, you must also pay for that too. It's $5k/CPU for standard one edition, so $10k for a dual CPU box. Upgrades are free - once you have an Oracle license it is pretty much good for any version on your platform with your number of CPUs. I'm not advocating that people switch to Oracle at all, It's still much more expensive than Postgresql, and for most small and medium applications Postgresql is much easier to manage and maintain. I would just like to make sure people get their facts straight. I worked for a company that selected MS SQL Server because it was 'cheaper' than Oracle, when infact with the correct Oracle pricing, Oracle was cheaper, and had superior features. I would have prefered that they use Postgresql, which for the project in question would have been more appropriate and cost much less in hardware and software requirements, but they had to have 'Industry Standard'. Oracle ended up costing <$10k with licenses at $149 ea for 25 users, and the support contract wasn't that much of a bear - I can't remember exactly how much, I think it was around $1800/yr. Alex Turner NetEconomist -- Remember, what most consider 'convential wisdom' is neither wise nor the convention. Don't speculate, educate. On Wed, 12 Jan 2005 22:51:24 -0800, Joe Conway wrote: > Greg Sabino Mullane wrote: > > Don't forget your support contract cost, as well as licenses for each > > of your servers: development, testing, QA, etc. > > > > Is it really as "cheap" as 5K? I've heard that for any fairly modern > > system, it's much more, but that may be wrong. > > > > Sort of -- see: > http://oraclestore.oracle.com/OA_HTML/ibeCCtpSctDspRte.jsp?section=15105 > "It is available on single server systems supporting up to a maximum > of 2 CPUs" > > Also note that most industrial strength features (like table > partitioning, RAC, OLAP, Enterprise Manager plugins, etc, etc) are high > priced options (mostly $10K to $20K per CPU) and they can only be used > with the Enterprise edition (which is $40K/CPU *not* $2.5K/CPU). > http://oraclestore.oracle.com/OA_HTML/ibeCCtpSctDspRte.jsp?section=10103 > > And you are correct, they expect to be paid for each dev, test, and QA > machine too. > > The $5K edition is just there to get you hooked ;-) By the time you add > up what you really want/need, figure you'll spend a couple of orders of > magnatude higher, and then > 20% per year for ongoing > maintenance/upgrades/support. > > Joe > > ---------------------------(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 Jan 13 14:56:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 616853A2585 for ; Thu, 13 Jan 2005 14:56: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 54875-01 for ; Thu, 13 Jan 2005 14:56:49 +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 EEF703A573A for ; Thu, 13 Jan 2005 14:56:52 +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 2485497; Thu, 13 Jan 2005 07:58:36 -0800 Message-ID: <41E68C34.4050704@joeconway.com> Date: Thu, 13 Jan 2005 06:56:52 -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: alex@neteconomist.com Cc: Greg Sabino Mullane , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E61A6C.4020203@joeconway.com> <33c6269f05011306352b54067f@mail.gmail.com> In-Reply-To: <33c6269f05011306352b54067f@mail.gmail.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.047 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/169 X-Sequence-Number: 9859 Alex Turner wrote: > I'm not advocating that people switch to Oracle at all, It's still > much more expensive than Postgresql, and for most small and medium > applications Postgresql is much easier to manage and maintain. I > would just like to make sure people get their facts straight. I > worked for a company that selected MS SQL Server because it was > 'cheaper' than Oracle, when infact with the correct Oracle pricing, > Oracle was cheaper, and had superior features. I would have prefered > that they use Postgresql, which for the project in question would have > been more appropriate and cost much less in hardware and software > requirements, but they had to have 'Industry Standard'. Oracle ended > up costing <$10k with licenses at $149 ea for 25 users, and the > support contract wasn't that much of a bear - I can't remember exactly > how much, I think it was around $1800/yr. My facts were straight, and they come from firsthand experience. The point is, it is easy to get trapped into thinking to yourself, "great, I can get a dual CPU oracle server for ~$10K, that's not too bad...". But then later you figure out you really need table partitioning or RAC, and suddenly you have to jump directly to multiple 6 figures. The entry level Oracle pricing is mainly a marketing gimmick -- it is intended to get you hooked. Also note that the per named user license scheme is subject to per CPU minimums that guarantee you'll never spend less than half the per CPU price. Oracle's licensing is so complex that there are businesses out there that subsist solely on helping companies figure it out to save money, and they take a cut of the savings. Oracle's own account reps had a hard time answering this question -- does a hyperthreaded Intel CPU count as 1 or 2 CPUs from a licensing standpoint? We were eventually told 1, but that the decision was "subject to change in the future". Joe From pgsql-performance-owner@postgresql.org Thu Jan 13 15:24:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 336DD3A2585 for ; Thu, 13 Jan 2005 15:24: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 57452-04 for ; Thu, 13 Jan 2005 15:24: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 9E8E23A517C for ; Thu, 13 Jan 2005 15:24: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 j0DFOCGb009157; Thu, 13 Jan 2005 10:24:12 -0500 (EST) To: Mark Kirkwood Cc: Litao Wu , pgsql-performance@postgresql.org Subject: Re: Postgres Optimizer is not smart enough? In-reply-to: <41E63917.2070906@coretech.co.nz> References: <20050112222506.32084.qmail@web13124.mail.yahoo.com> <41E5AF3F.2080100@coretech.co.nz> <4337.1105583973@sss.pgh.pa.us> <41E63917.2070906@coretech.co.nz> Comments: In-reply-to Mark Kirkwood message dated "Thu, 13 Jan 2005 22:02:15 +1300" Date: Thu, 13 Jan 2005 10:24:11 -0500 Message-ID: <9156.1105629851@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: 200501/170 X-Sequence-Number: 9860 Mark Kirkwood writes: > Hmmm ... so it's only the selectivity that is the same (sourced from > index->amcostestimate which I am guessing points to btcostestimate), is > that correct? No, the point is that btcostestimate will compute not only the same selectivities but the identical index access cost values, because it thinks that only one index entry will be fetched in both cases. It needs to account for the fact that the inequality condition will cause a scan over a larger range of the index than is actually returned. See _bt_preprocess_keys() and _bt_checkkeys(). The small differences you are showing have to do with different assumptions about where the now() function will get evaluated (once per row or once at scan start). That's not the effect that I'm worried about. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jan 13 16:42:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42A473A4E7E for ; Thu, 13 Jan 2005 16:34: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 65301-09 for ; Thu, 13 Jan 2005 16:34:15 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7C62B3A455F for ; Thu, 13 Jan 2005 16:34:14 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 8DFF331988; Thu, 13 Jan 2005 17:34:12 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Date: Thu, 13 Jan 2005 08:32:49 -0800 Organization: Hub.Org Networking Services Lines: 14 Message-ID: References: <1105501768.41e49e484d779@webmail.moph.go.th> 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.5) Gecko/20041217 X-Accept-Language: en-us, en In-Reply-To: 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: 200501/171 X-Sequence-Number: 9861 Gavin Sherry wrote: > There is no problem with free Linux distros handling > 4 GB of memory. The > problem is that 32 hardware must make use of some less than efficient > mechanisms to be able to address the memory. The theshold for using PAE is actually far lower than 4GB. 4GB is the total memory address space -- split that in half for 2GB for userspace, 2GB for kernel. The OS cache resides in kernel space -- after you take alway the memory allocation for devices, you're left with a window of roughly 900MB. Since the optimal state is to allocate a small amount of memory to Postgres and leave a huge chunk to the OS cache, this means you are already hitting the PAE penalty at 1.5GB of memory. From pgsql-performance-owner@postgresql.org Thu Jan 13 20:24:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BA8823A5A4A for ; Thu, 13 Jan 2005 18:43: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 85261-01 for ; Thu, 13 Jan 2005 18:43:31 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 8C9F83A597E for ; Thu, 13 Jan 2005 18:43:31 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so94073wra for ; Thu, 13 Jan 2005 10:43: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=rgxkpaKveF6cUJfkdGH2U5Un99PCo7gcSU9z1q0597WUDpcQ4ypjykKFHRPnVwoPTfij0wz+rq3WTgoZsNifZnFzzkuPiJWETbopwHP98xtyzalXYmeg16riEO9tCsIVDQ76XnwG5W3fosq/1P4ZiUG6EBPqK7XwYqRveymrMgA= Received: by 10.54.30.58 with SMTP id d58mr99435wrd; Thu, 13 Jan 2005 10:43:31 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 13 Jan 2005 10:43:30 -0800 (PST) Message-ID: <33c6269f05011310432d35b71b@mail.gmail.com> Date: Thu, 13 Jan 2005 13:43:30 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Joe Conway Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Cc: Greg Sabino Mullane , pgsql-performance@postgresql.org In-Reply-To: <41E68C34.4050704@joeconway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41E61A6C.4020203@joeconway.com> <33c6269f05011306352b54067f@mail.gmail.com> <41E68C34.4050704@joeconway.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: 200501/173 X-Sequence-Number: 9863 Joe, I appreciate your information, but it's not valid. Most people don't need RAC or table partitioning. Many of the features in Oracle EE are just not available in Postgresql at all, and many aren't available in any version of SQL Server (table partitioning, bitmap indexes and others). If you want all the wiz-bang features, you have to pay the wiz-bang price. Just because Oracle reps are a little clueless sometimes doesn't mean that the product pricing sucks. The minimum user requirement for standard one is 5 users. 5*149=$745, much less than half the price of a dual or single CPU config. I'm sorry that you had a bad experience with Oracle, but Oracle is a fine product, that is available for not alot of $$ if you are willing to use a bit of elbow grease to learn how it works and don't need enterprise features, which many other database product simply don't have, or work very poorly. Alex Turner NetEconomist On Thu, 13 Jan 2005 06:56:52 -0800, Joe Conway wrote: > Alex Turner wrote: > > I'm not advocating that people switch to Oracle at all, It's still > > much more expensive than Postgresql, and for most small and medium > > applications Postgresql is much easier to manage and maintain. I > > would just like to make sure people get their facts straight. I > > worked for a company that selected MS SQL Server because it was > > 'cheaper' than Oracle, when infact with the correct Oracle pricing, > > Oracle was cheaper, and had superior features. I would have prefered > > that they use Postgresql, which for the project in question would have > > been more appropriate and cost much less in hardware and software > > requirements, but they had to have 'Industry Standard'. Oracle ended > > up costing <$10k with licenses at $149 ea for 25 users, and the > > support contract wasn't that much of a bear - I can't remember exactly > > how much, I think it was around $1800/yr. > > My facts were straight, and they come from firsthand experience. The > point is, it is easy to get trapped into thinking to yourself, "great, I > can get a dual CPU oracle server for ~$10K, that's not too bad...". But > then later you figure out you really need table partitioning or RAC, and > suddenly you have to jump directly to multiple 6 figures. The entry > level Oracle pricing is mainly a marketing gimmick -- it is intended to > get you hooked. > > Also note that the per named user license scheme is subject to per CPU > minimums that guarantee you'll never spend less than half the per CPU > price. Oracle's licensing is so complex that there are businesses out > there that subsist solely on helping companies figure it out to save > money, and they take a cut of the savings. Oracle's own account reps had > a hard time answering this question -- does a hyperthreaded Intel CPU > count as 1 or 2 CPUs from a licensing standpoint? We were eventually > told 1, but that the decision was "subject to change in the future". > > Joe > > From pgsql-performance-owner@postgresql.org Thu Jan 13 20:19:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CAB093A6067 for ; Thu, 13 Jan 2005 20:05: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 98770-08 for ; Thu, 13 Jan 2005 20:05:04 +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 C0BC23A602E for ; Thu, 13 Jan 2005 20:04:47 +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 2486315; Thu, 13 Jan 2005 13:06:30 -0800 Message-ID: <41E6D45E.6050904@joeconway.com> Date: Thu, 13 Jan 2005 12:04:46 -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: alex@neteconomist.com Cc: Greg Sabino Mullane , pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41E61A6C.4020203@joeconway.com> <33c6269f05011306352b54067f@mail.gmail.com> <41E68C34.4050704@joeconway.com> <33c6269f05011310432d35b71b@mail.gmail.com> In-Reply-To: <33c6269f05011310432d35b71b@mail.gmail.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.048 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/172 X-Sequence-Number: 9862 Alex Turner wrote: > I appreciate your information, but it's not valid. Most people don't > need RAC or table partitioning. From a small company perspective, maybe, but not in the least invalid for larger companies. > Many of the features in Oracle EE are just not available in Postgresql at all, and many aren't available in > any version of SQL Server (table partitioning, bitmap indexes and > others). I never claimed otherwise. I said the low end product gets you hooked. Once you're hooked, you'll start to wish for all the wiz-bang features -- after all, that's why you picked Oracle in the first place. > Just because Oracle reps are a little clueless > sometimes doesn't mean that the product pricing sucks. > The minimum user requirement for standard one is 5 users. 5*149=$745, > much less than half the price of a dual or single CPU config. And what happens once you need a quad server? > I'm sorry that you had a bad experience with Oracle, but Oracle is a > fine product, that is available for not alot of $$ if you are willing > to use a bit of elbow grease to learn how it works and don't need > enterprise features, which many other database product simply don't > have, or work very poorly. I never said I had a "bad experience" with Oracle. I pointed out the gotchas. We have several large Oracle boxes running, several MSSQL, and several Postgres -- they all have their strengths and weaknesses. Nuff said -- this thread is way off topic now... Joe From pgsql-performance-owner@postgresql.org Fri Jan 14 03:38:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9023C3A5A5E for ; Fri, 14 Jan 2005 03:35: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 92336-01 for ; Fri, 14 Jan 2005 03:35:00 +0000 (GMT) Received: from tomts13-srv.bellnexxia.net (tomts13-srv.bellnexxia.net [209.226.175.34]) by svr1.postgresql.org (Postfix) with ESMTP id EB8E63A536F for ; Fri, 14 Jan 2005 03:34:58 +0000 (GMT) Received: from [70.48.36.251] by tomts13-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050114033457.IUBY1899.tomts13-srv.bellnexxia.net@[70.48.36.251]> for ; Thu, 13 Jan 2005 22:34:57 -0500 Message-ID: <41E73D00.6030206@alteeve.com> Date: Thu, 13 Jan 2005 22:31:12 -0500 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: sum of all values 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: 200501/174 X-Sequence-Number: 9864 Hi all, Is there a fast(er) way to get the sum of all integer values for a certain condition over many thousands of rows? What I am currently doing is this (which takes ~5-10sec.): SELECT SUM (a.file_size) FROM file_info_1 a, file_set_1 b WHERE a.file_name=b.fs_name AND a.file_parent_dir=b.fs_parent_dir AND a.file_type=b.fs_type AND b.fs_backup='t'; I need to keep parts of the data in two tables. I currently use 'file_name/fs_name', 'file_parent_dir/fs_parent_dir' and 'file_type/fs_type' to match the entries in the two tables. The 'file_info_#' table is frequently dropped and re-created so this was the only way I could think to match the data. I am hoping that maybe there is something I can do differently that will return this value a lot faster (ideally within a second). I know that this is heavily dependant on the system underneath but the program is designed for Joe/Jane User so I am trying to do what I can in the script and within my DB calls to make this as efficient as possible. I realise that my goal may not be viable. Here are the schemas, in case they help: tle-bu=> \d file_info_1 Table "public.file_info_1" Column | Type | Modifiers -----------------+---------+---------------------------- file_acc_time | bigint | not null file_group_name | text | not null file_group_uid | integer | not null file_mod_time | bigint | not null file_name | text | not null file_parent_dir | text | not null file_perm | text | not null file_size | bigint | not null file_type | text | not null default 'f'::text file_user_name | text | not null file_user_uid | integer | not null Indexes: "file_info_1_display_idx" btree (file_parent_dir, file_name, file_type) "file_info_1_search_idx" btree (file_parent_dir, file_name, file_type) tle-bu=> \d file_set_1 Table "public.file_set_1" Column | Type | Modifiers ---------------+---------+---------------------------- fs_backup | boolean | not null default true fs_display | boolean | not null default false fs_name | text | not null fs_parent_dir | text | not null fs_restore | boolean | not null default false fs_type | text | not null default 'f'::text Indexes: "file_set_1_sync_idx" btree (fs_parent_dir, fs_name, fs_type) Thanks all! Madison From pgsql-performance-owner@postgresql.org Fri Jan 14 09:11:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 319AF3A19E3 for ; Fri, 14 Jan 2005 09:11: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 37653-06 for ; Fri, 14 Jan 2005 09:11:14 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 0EDE93A18A8 for ; Fri, 14 Jan 2005 09:11:15 +0000 (GMT) Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) by www.postgresql.com (Postfix) with ESMTP id 0B7E0739E11 for ; Fri, 14 Jan 2005 05:56:01 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id D27B254230; Fri, 14 Jan 2005 13:55:29 +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 31057-04; Fri, 14 Jan 2005 13:55:29 +0800 (WST) Received: from mapping12 (dsl-202-173-155-79.vic.westnet.com.au [202.173.155.79]) by vscan01.westnet.com.au (Postfix) with ESMTP id 862838C882; Fri, 14 Jan 2005 13:55:23 +0800 (WST) From: "Benjamin Wragg" To: Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Fri, 14 Jan 2005 16:52:42 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Thread-Index: AcT3qCrtiwv5R7NKRw6JMj+N43OFVACUPeEQ In-Reply-To: <200501102235.18887.josh@agliodbs.com> Message-Id: <20050114055523.862838C882@vscan01.westnet.com.au> 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: 200501/180 X-Sequence-Number: 9870 Hi, From what I've been reading on the list for the last few months, adaptec isn't that good when it comes to RAID controllers, but LSI keeps popping = up. Is there any particual models that are recommended as I'm in the market = for two new servers both with RAID controllers. The server specs I'm = thinking are as follows: Box 1=20 Fedora 64bit core 3 4 GB RAM (2GB per CPU) 2 x Opteron CPU ??? Tyan K8S LSI=AE 53C1030 U320 SCSI controller Dual-channel=20 Box 2 Fedora 64bit core 3 2 GB RAM (1GB per CPU) 2 x Opteron CPU ??? Tyan K8S LSI=AE 53C1030 U320 SCSI controller Dual-channel=20 This motherboard has can "Connects to PCI-X Bridge A, LSI=AE ZCR (Zero = Channel RAID) support (SCSI Interface Steering Logic)". I believe this means I = can get a LSI MegaRAID 320-0 which a few have mentioned on the list (http://www.lsilogic.com/products/megaraid/scsi_320_0.html). It supports RAID 10 and supports battery backed cache. Anyone had any experience = with this?=20 Any other particular controller that people recommend? From what I've = been reading RAID 10 and battery backed cache sound like things I need. :) Thanks, Benjamin Wragg -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh Berkus Sent: Tuesday, 11 January 2005 5:35 PM To: pgsql-performance@postgresql.org Cc: Christopher Browne Subject: Re: [PERFORM] which dual-CPU hardware/OS is fastest for = PostgreSQL? Chris, > I don't know so much about FreeBSD's handling of this, but on Linux,=20 > there's pretty strong indication that _SOFTWARE_ RAID is faster than=20 > hardware RAID. Certainly better than an Adaptec. But not necessarily better than a medium-end RAID card, like an LSI. It really depends on the quality of = the controller. Also, expected concurrent activity should influence you. On a = dedicated=20 database server, you'll seldom max out the CPU but will often max of the = disk, so the CPU required by software RAID is "free". However, if you = have a Web/PG/E-mail box which frequently hits 100% CPU, then even a = lower-end RAID card can be beneficial simply by taking load off the CPU. -- Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005 =20 --=20 No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.11 - Release Date: 12/01/2005 =20 From pgsql-performance-owner@postgresql.org Fri Jan 14 09:39:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A243F3A1923 for ; Fri, 14 Jan 2005 09:39: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 43361-01 for ; Fri, 14 Jan 2005 09:39:31 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id BF4723A18F5 for ; Fri, 14 Jan 2005 09:39:32 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1CpNvT-0003lf-DD; Fri, 14 Jan 2005 09:39:28 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5156716571; Fri, 14 Jan 2005 09:39:26 +0000 (GMT) Message-ID: <41E7934E.2080509@archonet.com> Date: Fri, 14 Jan 2005 09:39:26 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Madison Kelly Cc: pgsql-performance@postgresql.org Subject: Re: sum of all values References: <41E73D00.6030206@alteeve.com> In-Reply-To: <41E73D00.6030206@alteeve.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.077 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/181 X-Sequence-Number: 9871 Madison Kelly wrote: > Hi all, > > Is there a fast(er) way to get the sum of all integer values for a > certain condition over many thousands of rows? What I am currently doing > is this (which takes ~5-10sec.): OK, I'm assuming you've configured PG to your satisfaction and this is the only query giving you problems. > SELECT SUM (a.file_size) FROM file_info_1 a, file_set_1 b WHERE > a.file_name=b.fs_name AND a.file_parent_dir=b.fs_parent_dir AND > a.file_type=b.fs_type AND b.fs_backup='t'; You'll want to run EXPLAIN ANALYSE SELECT SUM... and post the output of that, although the query looks straightforward enough. > Here are the schemas, in case they help: > > tle-bu=> \d file_info_1 Table "public.file_info_1" > Column | Type | Modifiers > -----------------+---------+---------------------------- > file_acc_time | bigint | not null > file_group_name | text | not null > file_group_uid | integer | not null > file_mod_time | bigint | not null > file_name | text | not null > file_parent_dir | text | not null > file_perm | text | not null > file_size | bigint | not null > file_type | text | not null default 'f'::text > file_user_name | text | not null > file_user_uid | integer | not null > Indexes: > "file_info_1_display_idx" btree (file_parent_dir, file_name, file_type) > "file_info_1_search_idx" btree (file_parent_dir, file_name, file_type) > > tle-bu=> \d file_set_1 Table "public.file_set_1" > Column | Type | Modifiers > ---------------+---------+---------------------------- > fs_backup | boolean | not null default true > fs_display | boolean | not null default false > fs_name | text | not null > fs_parent_dir | text | not null > fs_restore | boolean | not null default false > fs_type | text | not null default 'f'::text > Indexes: > "file_set_1_sync_idx" btree (fs_parent_dir, fs_name, fs_type) 1. WHERE ARE YOUR PRIMARY KEYS??? 2. Why do you have two identical indexes on file_info_1 3. WHERE ARE YOUR PRIMARY KEYS??? 4. Am I right in thinking that always, file_name==fs_name (i.e. they represent the same piece of information) and if so, why are you storing it twice? Same for _parent_dir too 5. file_type/fs_type are being held as unbounded text? Not an index into some lookup table or a varchar(N)? Can you explain what you're trying to do here - it might be you want to alter your database design. -- Richard Huxton Archonet Ltd From pgsql-novice-owner@postgresql.org Fri Jan 14 14:39:46 2005 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 8506C3A1A56 for ; Fri, 14 Jan 2005 14:39: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 73383-09 for ; Fri, 14 Jan 2005 14:39:28 +0000 (GMT) Received: from web51307.mail.yahoo.com (web51307.mail.yahoo.com [206.190.38.173]) by svr1.postgresql.org (Postfix) with SMTP id 14CD93A1A0F for ; Fri, 14 Jan 2005 14:39:30 +0000 (GMT) Received: (qmail 13468 invoked by uid 60001); 14 Jan 2005 14:39:30 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=Rbov7KR0F3WUy9RBy3rruUwnRw4Z9pRp/5+Ae6lSLQ1YGmlZY+0HYTP8z1xQ8ZwOdbtCFJGu1rK/EV80Qy8nOxDPM5B5tS9675Db5wy4Vvurbg3xS1uaiOUFhNd9jP01a1Hcs8v+pWy/jnWIG0xwXhKthwnjQPIPYqm+cBfrFhk= ; Message-ID: <20050114143930.13466.qmail@web51307.mail.yahoo.com> Received: from [65.218.182.242] by web51307.mail.yahoo.com via HTTP; Fri, 14 Jan 2005 06:39:30 PST Date: Fri, 14 Jan 2005 06:39:30 -0800 (PST) From: sarlav kumar Subject: query optimization help To: pgsqlnovice , pgsqlperform MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-625005588-1105713570=:13342" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.457 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/117 X-Sequence-Number: 11969 --0-625005588-1105713570=:13342 Content-Type: text/plain; charset=us-ascii Hi All, I have the following query to generate a report grouped by "states". SELECT distinct upper(cd.state) as mystate, SUM(d.amount) as total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + COALESCE(mp.buyer_fee,0)) as total_fee FROM data d left JOIN customerdata cd ON d.uid = cd.uid LEFT JOIN merchant_purchase mp ON d.id = mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 ) AND lower(cd.country) = 'us' AND date_part('year',d.time)= 2004 GROUP BY myst ate ORDER BY mystate; mystate | total_amount | total_fee ---------+--------------+----------- | 3695 | 0 AR | 3000 | 0 AZ | 1399 | 0 CA | 113100 | 6242 FL | 121191 | 9796 GA | 34826876 | 478888 GEORGIA | 57990 | 3500 IEIE | 114000 | 4849 MD | 20000 | 1158 MI | 906447 | 0 NY | 8000 | 600 PA | 6200 | 375 SC | 25000 | 600 TN | 1443681 | 1124 | 13300 | 0 (15 rows) If you notice, my problem in this query is that the records for GA, GEORGIA appear separately. But what I want to do is to have them combined to a single entry with their values summed up . Initially we had accepted both formats as input for the state field. Also, there are some invalid entries for the state field (like the "IEIE" and null values), which appear because the input for state was not validated initially. These entries have to be eliminated from the report.This query did not take a long time to complete, but did not meet the needs for the report. So, the query was rewritten to the following query which takes nearly 7-8 mins to complete on our test database: SELECT (SELECT DISTINCT pc.state FROM postalcode pc WHERE UPPER(cd.state) IN (pc.state, pc.state_code)) as mystate, SUM(d.amount) as total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + COALESCE(mp.buyer_fee,0)) as total_fee FROM data d JOIN customerdata cd ON d.uid = cd.uid LEFT JOIN merchant_purchase mp ON d.id = mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 ) AND lower(cd.country) = 'us' AND date_part('year', d.time) = 2004 GROUP BY mystate ORDER BY mystate; mystate | total_amount | total_fee ----------------+--------------+----------- ARIZONA | 1399 | 0 ARKANSAS | 3000 | 0 CALIFORNIA | 113100 | 6242 FLORIDA | 121191 | 9796 GEORGIA | 34884866 | 482388 MARYLAND | 20000 | 1158 MICHIGAN | 906447 | 0 NEW YORK | 8000 | 600 PENNSYLVANIA | 6200 | 375 SOUTH CAROLINA | 25000 | 600 TENNESSEE | 1443681 | 1124 | 130995 | 4849 Here is the explain analyze of this query: QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- Aggregate (cost=1226.57..1226.58 rows=1 width=38) (actual time=362355.58..362372.09 rows=12 loops=1) -> Group (cost=1226.57..1226.57 rows=1 width=38) (actual time=362355.54..362367.73 rows=2197 loops=1) -> Sort (cost=1226.57..1226.57 rows=1 width=38) (actual time=362355.53..362356.96 rows=2197 loops=1) Sort Key: (subplan) -> Nested Loop (cost=0.00..1226.56 rows=1 width=38) (actual time=166.11..362321.46 rows=2197 loops=1) -> Nested Loop (cost=0.00..1220.53 rows=1 width=26) (actual time=1.68..361.32 rows=2115 loops=1) -> Seq Scan on customerdata cd (cost=0.00..274.32 rows=31 width=10) (actual time=0.04..29.87 rows=3303 loops=1) Filter: (lower((country)::text) = 'us'::text) -> Index Scan using data_uid_idx on data d (cost=0.00..30.08 rows=1 width=16) (actual time=0.04..0.09 rows=1 loops=3303) Index Cond: (d.uid = "outer".uid) Filter: (((what = 26) OR (what = 0) OR (what = 15)) AND ((flags = 1) OR (flags = 9) OR (flags = 10) OR (flags = 12)) AND (date_part('year'::text, "time") = 2004::double precision)) -> Index Scan using merchant_purchase_data_idx on merchant_purchase mp (cost=0.00..6.01 rows=1 width=12) (actual time=0.05..0.05 rows=1 loops=2115) Index Cond: ("outer".id = mp.data_id) SubPlan -> Unique (cost=2237.12..2243.22 rows=122 width=13) (actual time=161.25..164.68 rows=1 loops=2197) -> Sort (cost=2237.12..2240.17 rows=1220 width=13) (actual time=161.21..161.88 rows=1033 loops=2197) Sort Key: state -> Seq Scan on postalcode pc (cost=0.00..2174.56 rows=1220 width=13) (actual time=35.79..148.33 rows=1033 loops=2197) Filter: ((upper(($0)::text) = (state)::text) OR (upper(($0)::text) = (state_code)::text)) Total runtime: 362372.57 msec The postalcode table is used in the query to validate the states and to combine the entries like GA and GEORGIA. \d postalcode Table "public.postalcode" Column | Type | Modifiers ------------+-----------------------+------------------------------------------------------------ id | integer | not null default nextval('public.postalcode_id_seq'::text) country | character(2) | state | character varying(30) | zipcode | character varying(20) | city | character varying(50) | city_alias | character varying(20) | state_code | character varying(2) | Indexes: postalcode_country_key unique btree (country, state_code, zipcode), postalcode_state_code_idx btree (state_code), postalcode_state_idx btree (state) The postalcode table has 70328 rows! Can some one please help me optimize this query? Thanks, Saranya --------------------------------- Do you Yahoo!? Yahoo! Mail - You care about security. So do we. --0-625005588-1105713570=:13342 Content-Type: text/html; charset=us-ascii
Hi All,
 
I have the following query to generate a report grouped by "states".
 
SELECT distinct upper(cd.state) as mystate, SUM(d.amount) as total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + COALESCE(mp.buyer_fee,0)) as total_fee FROM data d left JOIN customerdata cd ON d.uid = cd.uid LEFT JOIN merchant_purchase mp ON d.id = mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 ) AND lower(cd.country) = 'us' AND date_part('year',d.time)= 2004 GROUP BY myst
ate ORDER BY mystate;

 mystate | total_amount | total_fee
---------+--------------+-----------
         |         3695 |         0
 AR      |         3000 |         0
 AZ      |         1399 |         0
 CA      |       113100 |      6242
 FL      |       121191 |      9796
 GA      |     34826876 |    478888
 GEORGIA |        57990 |   &nbs p;  3500
 IEIE    |       114000 |      4849
 MD      |        20000 |      1158
 MI      |       906447 |         0
 NY      |         8000 |       600
 PA      |         6200 |       375
 SC      |        25000 |       600
 TN      |      1443681 |      1124
         |        13300 |         0
(15 rows)
If you notice, my problem in this query is that the records for GA, GEORGIA appear separately. But what I want to do is  to have them combined to a single entry with their values summed up . Initially we had accepted both formats as input for the state field. Also, there are some invalid entries for the state field (like the "IEIE" and null values), which appear because the input for state was not validated initially. These entries have to be eliminated from the report.This query did not take a long time to complete, but did not meet the needs for the report.
 
So, the query was rewritten to the following query which takes nearly 7-8 mins to complete on our test database:
 
SELECT (SELECT DISTINCT pc.state FROM postalcode pc WHERE UPPER(cd.state) IN (pc.state, pc.state_code)) as mystate, SUM(d.amount) as total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + COALESCE(mp.buyer_fee,0)) as total_fee FROM data d JOIN customerdata cd ON d.uid = cd.uid LEFT JOIN merchant_purchase mp ON d.id = mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 ) AND lower(cd.country) = 'us' AND date_part('year', d.time) = 2004 GROUP BY mystate ORDER BY mystate;
    mystate     | total_amount | total_fee
----------------+--------------+-----------
 ARIZONA        |         1399 |         0
 ARKANSAS       |         3000 |         0
 CALIFORNIA     |       113100 |      6242
 FLORIDA        |       121191 |      9796
 GEORGIA        |     34884866 |    482388
 MARYLAND       |        20000 |      1158
 MICHIGAN       |       906447 |         0
 NEW YORK       |         8000 |       600
 PENNSYLVANIA   |         6200 |       375
 SOUTH CAROLINA |        25000 |       600
 TENNESSEE      |      1443681 |      1124
                |       130995 |      4849
 
Here is the explain analyze of this query:
  QUERY PLAN                                                                                                     
----------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=1226.57..1226.58 rows=1 width=38) (actual time=362355.58..362372.09 rows=12 loops=1)
   ->  Group  (cost=1226.57..1226.57 rows=1 width=38) (actual time=362355.54..362367.73 rows=2197 loops=1)
         ->  Sort  (cost=1226.57..1226.57 rows=1 width=38) (actual time=362355.53..362356.96 rows=2197 loops=1)
               Sort Key: (subplan)
               ->  Nested Loop  (cost=0.00..1226.56 rows=1 width=38) (actual time=166.11..362321.46 rows=2197 loops=1)
                     ->  Nested Loop  (cost=0.00..1220.53 rows=1 width=26) (actual time=1.68..361.32 rows=2115 loops=1)
                           ->  Seq Scan on customerdata cd  (cost=0.00..274.32 ro ws=31 width=10) (actual time=0.04..29.87 rows=3303 loops=1)
                                 Filter: (lower((country)::text) = 'us'::text)
                           ->  Index Scan using data_uid_idx on data d  (cost=0.00..30.08 rows=1 width=16) (actual time=0.04..0.09 rows=1 loops=3303)
                                 Index Cond: (d.uid = "outer".uid)
                                 Filter: (((what = 26) OR (what = 0) OR (what = 15)) AND ((flags = 1) OR (flags = 9) OR (flags = 10) OR (flags = 12)) AND (date_part('year'::text, "time") = 2004::double precision))
                     ->  Index Scan using merchant_purchase_data_idx on merchant_purchase mp  (cost=0.00..6.01 rows=1 width=12) (actual time=0.05..0.05 rows=1 loops=2115)
                           Index Cond: ("outer".id = mp.data_id)
                     SubPlan
                       ->  Unique  (cost=2237.12..2243.22 rows=122 width=13) (actual time=161.25..164.68 rows=1 loops=2197)
                             ->  Sort  (cost=2237.12..2240.17 rows=1220 width=13) (actual time=161.21..161.88 rows=1033 loops=2197)
                                   Sort Key: state
                                   ->  Seq Scan on postalcode pc  (cost=0.00..2174.56 rows=1220 width=13) (actual time=35.79..148.33 rows=1033 loops=2197)
                                         Filter: ((upper(($0)::text) = (state)::text) OR (upper(($0)::text) = (state_code)::text))
 Total runtime: 362372.57 msec
 
 
The postalcode table is used in the query to validate the states and to combine the entries like GA and GEORGIA.
\d postalcode
                                    Table "public.postalcode"
   Column   |         Type          |                         Modifiers                         
------------+-----------------------+------------------------------------------------------------
 id         | integer               | not null default nextval('public.postalcode_id_seq'::text)
 country    | character(2)          |
 state      | character varying(30) |
 zipcode    | character varying(20) |
 city       | character varying(50) |
 city_alias | character varying(20) |
 state_code | character varying(2)  |
Indexes: postalcode_country_key unique btree (country, state_code, zipcode),
         postalcode_state_code_idx btree (state_code),
         postalcode_state_idx btree (state)
 
The postalcode table has 70328 rows!
 
Can some one please help me optimize this query?
 
Thanks,
Saranya


Do you Yahoo!?
Yahoo! Mail - You care about security. So do we. --0-625005588-1105713570=:13342-- From pgsql-performance-owner@postgresql.org Fri Jan 14 15:05:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 65ABA3A1A92 for ; Fri, 14 Jan 2005 15:05: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 76993-02 for ; Fri, 14 Jan 2005 15:05:31 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id B5EF03A1A99 for ; Fri, 14 Jan 2005 15:05:31 +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: query optimization help Date: Fri, 14 Jan 2005 10:04:49 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75B3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] query optimization help Thread-Index: AcT6SBBZllifslAjTuCYJgQRnxJRCgAAStJw From: "Merlin Moncure" To: "sarlav kumar" Cc: "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: 200501/183 X-Sequence-Number: 9873 Please post in plaintext, not html where possible. Your group by clause was 'myst'...was that supposed to be mystate? Her is something you might try...use the original query form and create = a function which resolves the state code from the input data...you are = already doing that with upper. So, create function get_state_code(text) returns char(2) as=20 $$ select case when len($1) =3D 2=20 then upper($1) else lookup_state_code($1) end; $$ language sql stable; lookup_state_code is a similar function which is boils down to a select = from a lookup table. Or, you could make a giant cast statement (when = GEORGIA then GA, etc). and now your function becomes IMMUTABLE and = should execute very fast. Just make sure all the states are spelled = correct in the original table via domain constraint. Merlin -----Original Message----- From: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of sarlav = kumar Sent: Friday, January 14, 2005 9:40 AM To: pgsqlnovice; pgsqlperform Subject: [PERFORM] query optimization help Hi All, =A0 I have the following query to generate a report grouped by "states". =A0 SELECT distinct upper(cd.state) as mystate, SUM(d.amount) as = total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + = COALESCE(mp.buyer_fee,0)) as total_fee FROM data d left JOIN = customerdata cd ON d.uid =3D cd.uid LEFT JOIN merchant_purchase mp ON = d.id =3D mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 = ) AND lower(cd.country) =3D 'us' AND date_part('year',d.time)=3D 2004 = GROUP BY myst ate ORDER BY mystate; From pgsql-novice-owner@postgresql.org Fri Jan 14 15:27:19 2005 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 810993A1A45 for ; Fri, 14 Jan 2005 15:27: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 77708-10 for ; Fri, 14 Jan 2005 15:27:04 +0000 (GMT) Received: from web51304.mail.yahoo.com (web51304.mail.yahoo.com [206.190.38.170]) by svr1.postgresql.org (Postfix) with SMTP id 034C33A1991 for ; Fri, 14 Jan 2005 15:27:06 +0000 (GMT) Received: (qmail 89392 invoked by uid 60001); 14 Jan 2005 15:27: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=JBRuvvdeXZrIiuJ58q3huX7200YGedufT9XA7LkjopjqRGiqlrXtiXTgg7BwMrVsPj4eZCuIhDZTAzc6o7IHppI3cdOeYk11diRcz8a8luXNWxfQWFMHdY0PYloTubv0/lZ7fpZPXj0Mhki26fnc1SgzDO+GFahc5rU/B93Q1iY= ; Message-ID: <20050114152707.89390.qmail@web51304.mail.yahoo.com> Received: from [65.218.182.242] by web51304.mail.yahoo.com via HTTP; Fri, 14 Jan 2005 07:27:06 PST Date: Fri, 14 Jan 2005 07:27:06 -0800 (PST) From: sarlav kumar Subject: Re: [PERFORM] query optimization help To: pgsqlnovice , pgsqlperform In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75B3@Herge.rcsinc.local> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1162276892-1105716426=:89316" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.686 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/118 X-Sequence-Number: 11970 --0-1162276892-1105716426=:89316 Content-Type: text/plain; charset=us-ascii Hi, Thanks for the help. I actually got around with it by doing the following. I created a temporary table: create table statesnew as select distinct state,state_code from postalcode where lower(country)='us'; And then changed the query to : SELECT (SELECT sn.state FROM statesnew sn WHERE UPPER(cd.state) IN (sn.state, sn.state_code)) as mystate, SUM(d.amount) as total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + COALESCE(mp.buyer_fee,0)) as total_fee FROM data d JOIN customerdata cd ON d.uid = cd.uid LEFT JOIN merchant_purchase mp ON d.id = mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 ) AND lower(cd.country ) = 'us' AND date_part('year', d.time) = 2004 GROUP BY mystate ORDER BY mystate; This worked well, as it reduced the number of entries it had to search from. I am not sure how to use the function you have written. Can you give me pointers on that? Thanks, Saranya Merlin Moncure wrote: Please post in plaintext, not html where possible. Your group by clause was 'myst'...was that supposed to be mystate? Yes, It is mystate. It continues on the next line:) Her is something you might try...use the original query form and create a function which resolves the state code from the input data...you are already doing that with upper. So, create function get_state_code(text) returns char(2) as $$ select case when len($1) = 2 then upper($1) else lookup_state_code($1) end; $$ language sql stable; lookup_state_code is a similar function which is boils down to a select from a lookup table. Or, you could make a giant cast statement (when GEORGIA then GA, etc). and now your function becomes IMMUTABLE and should execute very fast. Just make sure all the states are spelled correct in the original table via domain constraint. Merlin __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --0-1162276892-1105716426=:89316 Content-Type: text/html; charset=us-ascii
Hi,
 
Thanks for the help. I actually got around with it by doing the following.
I created a temporary table:
 
create table statesnew as select distinct state,state_code from postalcode where lower(country)='us';
 
And then changed the query to :
 
SELECT (SELECT sn.state FROM statesnew sn WHERE UPPER(cd.state) IN (sn.state, sn.state_code)) as mystate, SUM(d.amount) as total_amount, SUM(COALESCE(d.fee,0) + COALESCE(mp.seller_fee, 0) + COALESCE(mp.buyer_fee,0)) as total_fee FROM data d JOIN customerdata cd ON d.uid = cd.uid LEFT JOIN merchant_purchase mp ON d.id = mp.data_id WHERE d.what IN (26,0, 15) AND d.flags IN (1,9,10,12 ) AND lower(cd.country
) = 'us' AND date_part('year', d.time) = 2004 GROUP BY mystate ORDER BY mystate;
 
This worked well, as it reduced the number of entries it had to search from.
 
I am not sure how to use the function you have written. Can you give me pointers on that?
 
Thanks,
Saranya
 


Merlin Moncure <merlin.moncure@rcsonline.com> wrote:

Please post in plaintext, not html where possible.
Your group by clause was 'myst'...was that supposed to be mystate?

Yes, It is mystate. It continues on the next line:)


Her is something you might try...use the original query form and create a function which resolves the state code from the input data...you are already doing that with upper.

So,

create function get_state_code(text) returns char(2) as
$$
select case when len($1) = 2
then upper($1)
else lookup_state_code($1)
end;
$$
language sql stable;

lookup_state_code is a similar function which is boils down to a select from a lookup table. Or, you could make a giant cast statement (when GEORGIA then GA, etc). and now your function becomes IMMUTABLE and should execute very fast. Just make sure all the states are spelled correct in the original table via domain constraint.

Merlin



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com --0-1162276892-1105716426=:89316-- From pgsql-performance-owner@postgresql.org Fri Jan 14 15:41:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1338D3A1A56 for ; Fri, 14 Jan 2005 15:41: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 79981-07 for ; Fri, 14 Jan 2005 15:41:27 +0000 (GMT) Received: from tomts10-srv.bellnexxia.net (tomts10.bellnexxia.net [209.226.175.54]) by svr1.postgresql.org (Postfix) with ESMTP id A3F133A18CE for ; Fri, 14 Jan 2005 15:41:27 +0000 (GMT) Received: from [70.48.36.251] by tomts10-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050114154127.XUUR19622.tomts10-srv.bellnexxia.net@[70.48.36.251]> for ; Fri, 14 Jan 2005 10:41:27 -0500 Message-ID: <41E7E742.4060607@alteeve.com> Date: Fri, 14 Jan 2005 10:37:38 -0500 From: Madison Kelly User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: sum of all values References: <41E73D00.6030206@alteeve.com> <41E7934E.2080509@archonet.com> In-Reply-To: <41E7934E.2080509@archonet.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/185 X-Sequence-Number: 9875 Richard Huxton wrote: > Madison Kelly wrote: > >> Hi all, >> >> Is there a fast(er) way to get the sum of all integer values for a >> certain condition over many thousands of rows? What I am currently >> doing is this (which takes ~5-10sec.): > > > OK, I'm assuming you've configured PG to your satisfaction and this is > the only query giving you problems. This is a program for general consumption (hopefully... eventually...) so I want to leave the psql config alone. Once I am happier with the program I will try different tuning options and write a faq though I expect 9 out of 10 users won't read it. >> SELECT SUM (a.file_size) FROM file_info_1 a, file_set_1 b WHERE >> a.file_name=b.fs_name AND a.file_parent_dir=b.fs_parent_dir AND >> a.file_type=b.fs_type AND b.fs_backup='t'; > > > You'll want to run EXPLAIN ANALYSE SELECT SUM... and post the output of > that, although the query looks straightforward enough. tle-bu=> EXPLAIN ANALYZE SELECT SUM (a.file_size) FROM file_info_1 a, file_set_1 b WHERE a.file_name=b.fs_name AND a.file_parent_dir=b.fs_parent_dir AND a.file_type=b.fs_type AND b.fs_backup='t'; QUERY PLAN ---------------------------------------------------------------- Aggregate (cost=2202.54..2202.54 rows=1 width=8) (actual time=5078.744..5078.748 rows=1 loops=1) -> Merge Join (cost=724.94..2202.51 rows=11 width=8) (actual time=3281.677..4969.719 rows=12828 loops=1) Merge Cond: (("outer".file_parent_dir = "inner".fs_parent_dir) AND ("outer".file_name = "inner".fs_name) AND ("outer".file_type = "inner".fs_type)) -> Index Scan using file_info_1_search_idx on file_info_1 a (cost=0.00..1317.11 rows=12828 width=104) (actual time=0.042..116.825 rows=12828 loops=1) -> Sort (cost=724.94..740.97 rows=6414 width=96) (actual time=3281.516..3350.640 rows=12828 loops=1) Sort Key: b.fs_parent_dir, b.fs_name, b.fs_type -> Seq Scan on file_set_1 b (cost=0.00..319.35 rows=6414 width=96) (actual time=0.029..129.129 rows=12828 loops=1) Filter: (fs_backup = true) Total runtime: 5080.729 ms (9 rows) >> Here are the schemas, in case they help: >> >> tle-bu=> \d file_info_1 Table "public.file_info_1" >> Column | Type | Modifiers >> -----------------+---------+---------------------------- >> file_acc_time | bigint | not null >> file_group_name | text | not null >> file_group_uid | integer | not null >> file_mod_time | bigint | not null >> file_name | text | not null >> file_parent_dir | text | not null >> file_perm | text | not null >> file_size | bigint | not null >> file_type | text | not null default 'f'::text >> file_user_name | text | not null >> file_user_uid | integer | not null >> Indexes: >> "file_info_1_display_idx" btree (file_parent_dir, file_name, >> file_type) >> "file_info_1_search_idx" btree (file_parent_dir, file_name, >> file_type) >> >> tle-bu=> \d file_set_1 Table "public.file_set_1" >> Column | Type | Modifiers >> ---------------+---------+---------------------------- >> fs_backup | boolean | not null default true >> fs_display | boolean | not null default false >> fs_name | text | not null >> fs_parent_dir | text | not null >> fs_restore | boolean | not null default false >> fs_type | text | not null default 'f'::text >> Indexes: >> "file_set_1_sync_idx" btree (fs_parent_dir, fs_name, fs_type) > > > 1. WHERE ARE YOUR PRIMARY KEYS??? > 2. Why do you have two identical indexes on file_info_1 > 3. WHERE ARE YOUR PRIMARY KEYS??? > 4. Am I right in thinking that always, file_name==fs_name (i.e. they > represent the same piece of information) and if so, why are you storing > it twice? Same for _parent_dir too > 5. file_type/fs_type are being held as unbounded text? Not an index into > some lookup table or a varchar(N)? > > Can you explain what you're trying to do here - it might be you want to > alter your database design. > -- > Richard Huxton > Archonet Ltd This is where I have to admit my novice level of knowledge. Until now I have been more concerned with "making it work". It is only now that I have finished (more or less) the program that I have started going back and trying to find ways to speed it up. I have not used postgres (or perl or anything) before this program. I hope my questions aren't too basic. ^.^; I keep hearing about Primary Keys but I can't say that I know what they are or how they are used. If I do understand, it is a way to reference another table's entry (using a foreign key)? The two matching indexes is a typo in my program that I hadn't noticed, I'll fix that asap. Here is what the database is used for: This is a backup program and I use the DB to store extended information on all selected files and directories on a partition. Each partition has it's own 'file_info_#' and 'file_set_#' tables where '#' matches the ID stored for that partition in the DB in another table. The 'file_info_#' table stored the data that can change such as file size, last modified/accessed, owing user and group and so forth. The 'file_set_#' table stores the flags that say to include or exclude it from a backup/restore job and whether it has been selected for display in the file browser. In the first iteration I -used- to have the data in a single table and I identified the partition with a column called 'file_in_id' (or something similar). As I looked at each file on the system I would do a db call to see if the entry existed and if so, update it and if not, insert it. This was horribly slow though so I decided to break out into the schema above. With the schema above what I do now is just drop the 'file_info_#' table, recreate the table and matching indexes and then do a mass 'COPY' of all the file info on the partition. After this is done I read in the new data from the reloaded 'file_info_#' table and sync the data in 'file_set_#' which removes entries no longer in 'file_info_#', adds new ones matching the parent's values and leaves the existing entries alone. I found droping the table and re-creating it a lot faster than a 'DELETE FROM' call and it also seems to have made 'VACUUM FULL' a lot faster. Thank you very much for your feedback! I hope I haven't done something -too- foolish. :p If I have, I will change it. Madison From pgsql-performance-owner@postgresql.org Fri Jan 14 15:52:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB2ED3A1A65 for ; Fri, 14 Jan 2005 15:51: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 80995-08 for ; Fri, 14 Jan 2005 15:51:46 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by svr1.postgresql.org (Postfix) with ESMTP id 102203A1A20 for ; Fri, 14 Jan 2005 15:51:49 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so214673wra for ; Fri, 14 Jan 2005 07:51:50 -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=b+ucK/21FsHCbRtM9j2OGy4nm1HKFjbl7MXNHxQsPmiZnkW9uDbkIvMlwDD3dkpUsd2Egb+VeC5cLMsGhzfV5VvMpkVS39fgZ4pF5TPEr1Ph1KKlY+u7EPhj9Rt1WJwd5pYEklkAh76P3tPhTOMm8G6oeZTiLkfzjIL4gfiSfAg= Received: by 10.54.41.12 with SMTP id o12mr29633wro; Fri, 14 Jan 2005 07:51:50 -0800 (PST) Received: by 10.54.18.72 with HTTP; Fri, 14 Jan 2005 07:51:50 -0800 (PST) Message-ID: <33c6269f050114075179a035cf@mail.gmail.com> Date: Fri, 14 Jan 2005 10:51:50 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Pete de Zwart Subject: Re: Best filesystem for PostgreSQL Database Cluster under Linux Cc: pgsql-performance@postgresql.org In-Reply-To: <41e4364a$0$96874$c30e37c6@ken-reader.news.telstra.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41e39b04$0$96857$c30e37c6@ken-reader.news.telstra.net> <41e4364a$0$96874$c30e37c6@ken-reader.news.telstra.net> 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: 200501/186 X-Sequence-Number: 9876 On Wed, 12 Jan 2005 07:25:43 +1100, Pete de Zwart wrote: [snip] > improvement on I/O compared to the improvement potential of moving to > SCSI/FCAL, that and getting more memory. > I would like to ask the question that continues to loom large over all DBAs. SCSI, FCAL and SATA, which works best. Most FCAL loops have a speed limit of either 1Gbps or 2Gbps. This is only 100MB/sec or 200MB/sec. U320 SCSI can handle 320MB/sec and the AMCC (formerly 3Ware) SATA Raid cards show throughput over 400MB/sec with good IOs/sec on PCI-X. I am not prepared to stand by whilst someone makes a sideways claim that SCSI or FCAL is implicitly going to give better performance than anything else. It will depend on your data set, and how you configure your drives, and how good your controller is. We have a Compaq Smart Array controler with a 3 drive RAID 5 than can't break 10MB/sec write on a Bonnie++ benchmark. This is virtualy the slowest system in our datacenter, but has a modern controler and 10k disks, whilst our PATA systems manage much better throughput. (Yes I know that MB/sec is not the only speed measure, it also does badly on IO/sec). Alex Turner NetEconomist From pgsql-performance-owner@postgresql.org Fri Jan 14 15:58:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 01B293A18A7 for ; Fri, 14 Jan 2005 15:58: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 82181-03 for ; Fri, 14 Jan 2005 15:58:27 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192]) by svr1.postgresql.org (Postfix) with ESMTP id 7B69F3A1A0F for ; Fri, 14 Jan 2005 15:58:29 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so215758wra for ; Fri, 14 Jan 2005 07:58: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=B2uywHNYLNAI9NyJtEJenpAhrA8BKhGrjfMjPydRsBWCi+cFSARG1W6zN8SUz5wdBqlk8HUmFgnSKJTZCBEHivKMmM+0knajcLz5Gvx+uYa1p6HD2kKYF95TjYFgNgH04kusTivG2h9JbH5KatQu8NIGRALP43VoGoTGubE3hNo= Received: by 10.54.41.78 with SMTP id o78mr44946wro; Fri, 14 Jan 2005 07:58:30 -0800 (PST) Received: by 10.54.18.72 with HTTP; Fri, 14 Jan 2005 07:58:30 -0800 (PST) Message-ID: <33c6269f050114075842f07f35@mail.gmail.com> Date: Fri, 14 Jan 2005 10:58:30 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Benjamin Wragg Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Cc: pgsql-performance@postgresql.org In-Reply-To: <20050114055523.862838C882@vscan01.westnet.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable References: <200501102235.18887.josh@agliodbs.com> <20050114055523.862838C882@vscan01.westnet.com.au> 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: 200501/187 X-Sequence-Number: 9877 Without starting too much controvesy I hope, I would seriously recommend you evaluate the AMCC Escalade 9500S SATA controller. It has many of the features of a SCSI controler, but works with cheaper drives, and for half the price or many SCSI controlers (9500S-8MI goes for abour $500). See http://plexq.com/~aturner/3ware.pdf for their 4 way, 8 way and 12 way RAID benchmarks including RAID 0, RAID 5 and RAID 10. If others have similar data, I would be very interested to see how it stacks up against other RAID controllers. Alex Turner NetEconomist On Fri, 14 Jan 2005 16:52:42 +1100, Benjamin Wragg wrot= e: > Hi, >=20 > From what I've been reading on the list for the last few months, adaptec > isn't that good when it comes to RAID controllers, but LSI keeps popping = up. > Is there any particual models that are recommended as I'm in the market f= or > two new servers both with RAID controllers. The server specs I'm thinking > are as follows: >=20 > Box 1 > Fedora 64bit core 3 > 4 GB RAM (2GB per CPU) > 2 x Opteron CPU ??? > Tyan K8S > LSI=AE 53C1030 U320 SCSI controller Dual-channel >=20 > Box 2 > Fedora 64bit core 3 > 2 GB RAM (1GB per CPU) > 2 x Opteron CPU ??? > Tyan K8S > LSI=AE 53C1030 U320 SCSI controller Dual-channel >=20 > This motherboard has can "Connects to PCI-X Bridge A, LSI=AE ZCR (Zero Ch= annel > RAID) support (SCSI Interface Steering Logic)". I believe this means I ca= n > get a LSI MegaRAID 320-0 which a few have mentioned on the list > (http://www.lsilogic.com/products/megaraid/scsi_320_0.html). It supports > RAID 10 and supports battery backed cache. Anyone had any experience with > this? >=20 > Any other particular controller that people recommend? From what I've bee= n > reading RAID 10 and battery backed cache sound like things I need. :) >=20 > Thanks, >=20 > Benjamin Wragg >=20 > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Josh Berkus > Sent: Tuesday, 11 January 2005 5:35 PM > To: pgsql-performance@postgresql.org > Cc: Christopher Browne > Subject: Re: [PERFORM] which dual-CPU hardware/OS is fastest for PostgreS= QL? >=20 > Chris, >=20 > > I don't know so much about FreeBSD's handling of this, but on Linux, > > there's pretty strong indication that _SOFTWARE_ RAID is faster than > > hardware RAID. >=20 > Certainly better than an Adaptec. But not necessarily better than a > medium-end RAID card, like an LSI. It really depends on the quality of t= he > controller. >=20 > Also, expected concurrent activity should influence you. On a dedicate= d > database server, you'll seldom max out the CPU but will often max of the > disk, so the CPU required by software RAID is "free". However, if you h= ave >=20 > a Web/PG/E-mail box which frequently hits 100% CPU, then even a lower-end > RAID card can be beneficial simply by taking load off the CPU. >=20 > -- > Josh Berkus > Aglio Database Solutions > San Francisco >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >=20 > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.6.10 - Release Date: 10/01/2005 >=20 > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.6.11 - Release Date: 12/01/2005 >=20 >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Fri Jan 14 16:29:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D76C3A1AC1 for ; Fri, 14 Jan 2005 16:29: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 86055-05 for ; Fri, 14 Jan 2005 16:29:33 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 5D5263A18A7 for ; Fri, 14 Jan 2005 16:29:32 +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 1CpUK8-0000se-00; Fri, 14 Jan 2005 11:29:21 -0500 To: Jan Dittmer Cc: "Joshua D. Drake" , Christopher Browne , pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <59b2d39b05011018421680264b@mail.gmail.com> <41E3569A.4030102@commandprompt.com> <41E3A780.3020505@portrix.net> In-Reply-To: <41E3A780.3020505@portrix.net> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 14 Jan 2005 11:29:20 -0500 Message-ID: <87is60ug7z.fsf@stark.xeocode.com> Lines: 19 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.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/188 X-Sequence-Number: 9878 Jan Dittmer writes: > You could always do raid 1 over raid 0, with newer kernels (2.6ish) > there is even a dedicated raid10 driver. Aren't you much better off doing raid 0 over raid 1? With raid 1 over raid 0 you're mirroring two stripe sets. That means if any drive from the first stripe set goes you lose the whole side of the mirror. If any drive of the second stripe set goes you lost your array. Even if they're not the same position in the array. If you do raid 0 over raid 1 then you're striping a series of mirrored drives. So if any drive fails you only lose that drive from the stripe set. If another drive fails then you're ok as long as it isn't the specific drive that was paired with the first failed drive. -- greg From pgsql-performance-owner@postgresql.org Fri Jan 14 17:24:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E588D3A1CFF for ; Fri, 14 Jan 2005 17:24: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 91506-10 for ; Fri, 14 Jan 2005 17:24:10 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 6E65D3A1CDB for ; Fri, 14 Jan 2005 17:24:07 +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: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Fri, 14 Jan 2005 12:22:50 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75B4@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] which dual-CPU hardware/OS is fastest for PostgreSQL? Thread-Index: AcT6U2v5HWVRPRb3T3+kQlDt0QTVZwACS6Sg From: "Merlin Moncure" To: Cc: 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: 200501/189 X-Sequence-Number: 9879 Alex wrote: > Without starting too much controvesy I hope, I would seriously > recommend you evaluate the AMCC Escalade 9500S SATA controller. It > has many of the features of a SCSI controler, but works with cheaper > drives, and for half the price or many SCSI controlers (9500S-8MI goes > for abour $500). See http://plexq.com/~aturner/3ware.pdf for their 4 > way, 8 way and 12 way RAID benchmarks including RAID 0, RAID 5 and > RAID 10. If others have similar data, I would be very interested to > see how it stacks up against other RAID controllers. At the risk of shaming myself with another 'me too' post, I'd like to say that my experiences back this up 100%. The Escalade controllers are excellent and the Raptor drives are fast and reliable (so far). With the money saved from going SCSI, instead of a RAID 5 a 10 could be built for roughly the same price and capacity, guess which array is going to be faster? I think the danger about SATA is that many SATA components are not server quality, so you have to be more careful about what you buy. For example, you can't just assume your SATA backplane has hot swap lights (got bit by this one myself, heh). =20 Merlin From pgsql-performance-owner@postgresql.org Fri Jan 14 17:37:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 29F4C3A1CDB for ; Fri, 14 Jan 2005 17: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 92774-09 for ; Fri, 14 Jan 2005 17:37:05 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 3F1563A1AE8 for ; Fri, 14 Jan 2005 17:37:05 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6907223; Fri, 14 Jan 2005 09:38:46 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Fri, 14 Jan 2005 09:36:08 -0800 User-Agent: KMail/1.6.2 Cc: "Merlin Moncure" , References: <6EE64EF3AB31D5448D0007DD34EEB3412A75B4@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75B4@Herge.rcsinc.local> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501140936.08654.josh@agliodbs.com> 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: 200501/190 X-Sequence-Number: 9880 Merlin, > I think the danger about SATA is that many SATA components are not > server quality, so you have to be more careful about what you buy. For > example, you can't just assume your SATA backplane has hot swap lights > (got bit by this one myself, heh). Yeah, that's my big problem with anything IDE. My personal experience of failure rates for IDE drives, for example, is about 1 out of 10 fails in service before it's a year old; SCSI has been more like 1 out of 50. Also, while I've seen benchmarks like Escalade's, my real-world experience has been that the full bi-directional r/w of SCSI means that it takes 2 SATA drives to equal one SCSI drive in a heavy r/w application. However, ODSL is all SCSI so I don't have any numbers to back that up. But one of my clients needs a new docs server, so maybe I can give an Escalade a spin. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 14 18:34:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46EF63A1AF3 for ; Fri, 14 Jan 2005 18:34: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 00642-01 for ; Fri, 14 Jan 2005 18:33:46 +0000 (GMT) Received: from smtp05.mrf.mail.rcn.net (smtp05.mrf.mail.rcn.net [207.172.4.64]) by svr1.postgresql.org (Postfix) with ESMTP id 598073A1A7D for ; Fri, 14 Jan 2005 18:33:46 +0000 (GMT) Received: from 24-148-30-138.lem-bsr1.chi-lem.il.cable.rcn.com (HELO [192.168.1.102]) (24.148.30.138) by smtp05.mrf.mail.rcn.net with ESMTP; 14 Jan 2005 13:34:36 -0500 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== X-IronPort-AV: i="3.88,125,1102309200"; d="scan'208"; a="1129507:sNHT19550024" From: Adrian Holovaty To: pgsql-performance@postgresql.org Subject: Index on a function and SELECT DISTINCT Date: Fri, 14 Jan 2005 12:32:12 -0600 User-Agent: KMail/1.7.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501141232.13139.postgresql@holovaty.com> X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/191 X-Sequence-Number: 9881 If I have this table, function and index in Postgres 7.3.6 ... """ CREATE TABLE news_stories ( id serial primary key NOT NULL, pub_date timestamp with time zone NOT NULL, ... ) CREATE OR REPLACE FUNCTION get_year_trunc(timestamp with time zone) returns timestamp with time zone AS 'SELECT date_trunc(\'year\',$1);' LANGUAGE 'SQL' IMMUTABLE; CREATE INDEX news_stories_pub_date_year_trunc ON news_stories( get_year_trunc(pub_date) ); """ ...why does this query not use the index? db=# EXPLAIN SELECT DISTINCT get_year_trunc(pub_date) FROM news_stories; QUERY PLAN --------------------------------------------------------------------------------- Unique (cost=59597.31..61311.13 rows=3768 width=8) -> Sort (cost=59597.31..60454.22 rows=342764 width=8) Sort Key: date_trunc('year'::text, pub_date) -> Seq Scan on news_stories (cost=0.00..23390.55 rows=342764 width=8) (4 rows) The query is noticably slow (2 seconds) on a database with 150,000+ records. How can I speed it up? Thanks, Adrian From pgsql-performance-owner@postgresql.org Fri Jan 14 18:34:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AF8E3A1D17 for ; Fri, 14 Jan 2005 18:34: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 99609-10 for ; Fri, 14 Jan 2005 18:34:27 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id B385E3A1D0E for ; Fri, 14 Jan 2005 18:34:27 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1CpWH7-000Pai-E8; Fri, 14 Jan 2005 18:34:26 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 874A61625D; Fri, 14 Jan 2005 18:34:11 +0000 (GMT) Message-ID: <41E810A6.7040101@archonet.com> Date: Fri, 14 Jan 2005 18:34:14 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Madison Kelly Cc: pgsql-performance@postgresql.org Subject: Re: sum of all values References: <41E73D00.6030206@alteeve.com> <41E7934E.2080509@archonet.com> <41E7E742.4060607@alteeve.com> In-Reply-To: <41E7E742.4060607@alteeve.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.076 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/192 X-Sequence-Number: 9882 Madison Kelly wrote: > Richard Huxton wrote: > >> Madison Kelly wrote: >> >>> Hi all, >>> >>> Is there a fast(er) way to get the sum of all integer values for a >>> certain condition over many thousands of rows? What I am currently >>> doing is this (which takes ~5-10sec.): >> >> OK, I'm assuming you've configured PG to your satisfaction and this is >> the only query giving you problems. > > This is a program for general consumption (hopefully... eventually...) > so I want to leave the psql config alone. Once I am happier with the > program I will try different tuning options and write a faq though I > expect 9 out of 10 users won't read it. PostgreSQL is not FireFox, and you can't expect it to work efficiently without doing at least some configuration. The settings to support 100 simultaneous connections on a dual-Opteron with 8GB RAM are not the same as on a single-user laptop. Take half an hour to read through the performance-tuning guide here: http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html >>> SELECT SUM (a.file_size) FROM file_info_1 a, file_set_1 b WHERE >>> a.file_name=b.fs_name AND a.file_parent_dir=b.fs_parent_dir AND >>> a.file_type=b.fs_type AND b.fs_backup='t'; >> >> You'll want to run EXPLAIN ANALYSE SELECT SUM... and post the output >> of that, although the query looks straightforward enough. > > tle-bu=> EXPLAIN ANALYZE SELECT SUM (a.file_size) FROM file_info_1 a, > file_set_1 b WHERE a.file_name=b.fs_name AND > a.file_parent_dir=b.fs_parent_dir AND a.file_type=b.fs_type AND > b.fs_backup='t'; > > QUERY PLAN > ---------------------------------------------------------------- > Aggregate (cost=2202.54..2202.54 rows=1 width=8) (actual > time=5078.744..5078.748 rows=1 loops=1) > -> Merge Join (cost=724.94..2202.51 rows=11 width=8) (actual > time=3281.677..4969.719 rows=12828 loops=1) > Merge Cond: (("outer".file_parent_dir = "inner".fs_parent_dir) > AND ("outer".file_name = "inner".fs_name) AND ("outer".file_type = > "inner".fs_type)) > -> Index Scan using file_info_1_search_idx on file_info_1 a > (cost=0.00..1317.11 rows=12828 width=104) (actual time=0.042..116.825 > rows=12828 loops=1) > -> Sort (cost=724.94..740.97 rows=6414 width=96) (actual > time=3281.516..3350.640 rows=12828 loops=1) > Sort Key: b.fs_parent_dir, b.fs_name, b.fs_type > -> Seq Scan on file_set_1 b (cost=0.00..319.35 > rows=6414 width=96) (actual time=0.029..129.129 rows=12828 loops=1) > Filter: (fs_backup = true) > Total runtime: 5080.729 ms Well, it's slow, but that's probably your settings. Run VACUUM ANALYSE on the tables though, it looks like you've got default statistics (It's expecting exactly 1/2 the fs_backup values to be true - 6414 out of 12828). >>> Here are the schemas, in case they help: >>> >>> tle-bu=> \d file_info_1 Table "public.file_info_1" >>> Column | Type | Modifiers >>> -----------------+---------+---------------------------- >>> file_acc_time | bigint | not null >>> file_group_name | text | not null >>> file_group_uid | integer | not null >>> file_mod_time | bigint | not null >>> file_name | text | not null >>> file_parent_dir | text | not null >>> file_perm | text | not null >>> file_size | bigint | not null >>> file_type | text | not null default 'f'::text >>> file_user_name | text | not null >>> file_user_uid | integer | not null >>> Indexes: >>> "file_info_1_display_idx" btree (file_parent_dir, file_name, >>> file_type) >>> "file_info_1_search_idx" btree (file_parent_dir, file_name, >>> file_type) >>> >>> tle-bu=> \d file_set_1 Table "public.file_set_1" >>> Column | Type | Modifiers >>> ---------------+---------+---------------------------- >>> fs_backup | boolean | not null default true >>> fs_display | boolean | not null default false >>> fs_name | text | not null >>> fs_parent_dir | text | not null >>> fs_restore | boolean | not null default false >>> fs_type | text | not null default 'f'::text >>> Indexes: >>> "file_set_1_sync_idx" btree (fs_parent_dir, fs_name, fs_type) >> >> >> >> 1. WHERE ARE YOUR PRIMARY KEYS??? >> 2. Why do you have two identical indexes on file_info_1 >> 3. WHERE ARE YOUR PRIMARY KEYS??? >> 4. Am I right in thinking that always, file_name==fs_name (i.e. they >> represent the same piece of information) and if so, why are you >> storing it twice? Same for _parent_dir too >> 5. file_type/fs_type are being held as unbounded text? Not an index >> into some lookup table or a varchar(N)? >> >> Can you explain what you're trying to do here - it might be you want >> to alter your database design. >> -- >> Richard Huxton >> Archonet Ltd > > This is where I have to admit my novice level of knowledge. Until now > I have been more concerned with "making it work". It is only now that I > have finished (more or less) the program that I have started going back > and trying to find ways to speed it up. I have not used postgres (or > perl or anything) before this program. I hope my questions aren't too > basic. ^.^; There's a rule of thumb about throwing the first version of anything away. This could well be the time to apply that. I'd recommend getting book, "An Introduction to Database Systems" by "C.J.Date". It's not an SQL or "Learn X in 24 hours" but there's plenty of those about and you've managed to pick up SQL/Perl already. It will explain relational theory and why it's useful to you. > I keep hearing about Primary Keys but I can't say that I know what > they are or how they are used. If I do understand, it is a way to > reference another table's entry (using a foreign key)? The two matching > indexes is a typo in my program that I hadn't noticed, I'll fix that asap. OK - here are a few rules-of-thumb you might find useful until you've read the book. 1. Every piece of information should be represented explicitly. If there is an order for your data, it should be based on values already present, or introduce an explicit "sort_order" column. 2. Every piece of information (row) should be uniquely identifiable. The column value(s) that uniquely identify a row are known as a key. If there are several keys pick one - that is your "primary key". 3. Every non-key column in a table should depend on the key and nothing but the key. 4. Avoid repeating information - you can do this by following points 2,3. 5. Avoid inconsistencies - again 2,3 will help here. Looking at file_info_1, you have no primary key. This means you can have two rows with the same (file_parent_dir, file_name) - probably not what you want. Since these uniquely identify a file on a partition (afaik), you could make them your primary key. Also, you have two columns user_uid, user_name. If user_uid is the file's owner and user_name is their name then user_name doesn't depend on the primary key, but on user_uid. If one file has uid=123 and name="Fred" then *all* files with uid=123 will have an owner with name "Fred". So - this goes into a separate table: CREATE TABLE user_details ( uid int4 NOT NULL UNIQUE, name text, PRIMARY KEY (uid) ); Then, in file_info_1 you remove user_name, and make user_uid reference user_details.uid so that you can't enter an invalid user number. If you need the name, just join the two tables on user_uid=uid. The term "foreign key" is used because you're referencing the key of a "foreign" table. > Here is what the database is used for: > > This is a backup program and I use the DB to store extended > information on all selected files and directories on a partition. Each > partition has it's own 'file_info_#' and 'file_set_#' tables where '#' > matches the ID stored for that partition in the DB in another table. > > The 'file_info_#' table stored the data that can change such as file > size, last modified/accessed, owing user and group and so forth. The > 'file_set_#' table stores the flags that say to include or exclude it > from a backup/restore job and whether it has been selected for display > in the file browser. I don't see how you'd flag a whole directory for backup with what you've got, but maybe I'm missing something. I'd separate the information into three tables: file_core (id, path, name) file_details (id, size, last_mod, etc) file_backup (id, backup_flag, display_flag, etc) Define file_core.id as a SERIAL (auto-generated number) and make it the primary key. Define a unique constraint on file_core.(path,name). This lets you have a simple number referencing file_core from the other two tables. Now, if I file gets updated you only alter file_details, and if the user decides to flag more/less files then you only change file_backup. > In the first iteration I -used- to have the data in a single table and > I identified the partition with a column called 'file_in_id' (or > something similar). As I looked at each file on the system I would do a > db call to see if the entry existed and if so, update it and if not, > insert it. This was horribly slow though so I decided to break out into > the schema above. Probably the wrong choice. Keep your design clean and simple for as long as you can, only mangle it once you know you've hit the limitations of the database server. It might be you hit that, but since you haven't done any tuning, probably not. > With the schema above what I do now is just drop the 'file_info_#' > table, recreate the table and matching indexes and then do a mass 'COPY' > of all the file info on the partition. After this is done I read in the > new data from the reloaded 'file_info_#' table and sync the data in > 'file_set_#' which removes entries no longer in 'file_info_#', adds new > ones matching the parent's values and leaves the existing entries alone. > > I found droping the table and re-creating it a lot faster than a > 'DELETE FROM' call and it also seems to have made 'VACUUM FULL' a lot > faster. The VACUUM FULL is faster because it's not doing anything - the new data is in a brand new table. Make sure you ANALYSE the new table though. > Thank you very much for your feedback! I hope I haven't done something > -too- foolish. :p If I have, I will change it. No foolishness, just inexperience. Go forth and get some books that cover relational theory. A day spent on the principles will save you a week of work later. Good Luck! -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Jan 14 18:47:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC4133A1D17 for ; Fri, 14 Jan 2005 18:47: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 01990-06 for ; Fri, 14 Jan 2005 18:47:40 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 3307E3A1D43 for ; Fri, 14 Jan 2005 18:47:40 +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 1CpWTv-0001jN-00; Fri, 14 Jan 2005 13:47:35 -0500 To: Josh Berkus Cc: pgsql-performance@postgresql.org, "Merlin Moncure" , Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75B4@Herge.rcsinc.local> <200501140936.08654.josh@agliodbs.com> In-Reply-To: <200501140936.08654.josh@agliodbs.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 14 Jan 2005 13:47:34 -0500 Message-ID: <874qhjvoe1.fsf@stark.xeocode.com> Lines: 30 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.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/193 X-Sequence-Number: 9883 Josh Berkus writes: > Merlin, > > > I think the danger about SATA is that many SATA components are not > > server quality, so you have to be more careful about what you buy. For > > example, you can't just assume your SATA backplane has hot swap lights > > (got bit by this one myself, heh). > > Yeah, that's my big problem with anything IDE. My personal experience of > failure rates for IDE drives, for example, is about 1 out of 10 fails in > service before it's a year old; SCSI has been more like 1 out of 50. Um. I'm pretty sure the actual hardware is just the same stuff. It's just the interface electronics that change. > Also, while I've seen benchmarks like Escalade's, my real-world experience has > been that the full bi-directional r/w of SCSI means that it takes 2 SATA > drives to equal one SCSI drive in a heavy r/w application. However, ODSL is > all SCSI so I don't have any numbers to back that up. Do we know that these SATA/IDE controllers and drives don't "lie" about fsync the way most IDE drives do? Does the controller just automatically disable the write caching entirely? I don't recall, did someone have a program that tested the write latency of a drive to test this? -- greg From pgsql-performance-owner@postgresql.org Fri Jan 14 19:47:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 581A63A1ED7 for ; Fri, 14 Jan 2005 19:47: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 08133-04 for ; Fri, 14 Jan 2005 19:47:02 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id AD1A73A1D98 for ; Fri, 14 Jan 2005 19:47:02 +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: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? Date: Fri, 14 Jan 2005 14:46:17 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75B5@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] which dual-CPU hardware/OS is fastest for PostgreSQL? Thread-Index: AcT6aYYc4yeKjZnCSt6+6yp99AjtkwAB8UlA From: "Merlin Moncure" To: Cc: , "Merlin Moncure" 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: 200501/194 X-Sequence-Number: 9884 Greg wrote: > Josh Berkus writes: >=20 > > Merlin, > > > > > I think the danger about SATA is that many SATA components are not > > > server quality, so you have to be more careful about what you buy. > For > > > example, you can't just assume your SATA backplane has hot swap lights > > > (got bit by this one myself, heh). > > > > Yeah, that's my big problem with anything IDE. My personal experience > of > > failure rates for IDE drives, for example, is about 1 out of 10 fails in > > service before it's a year old; SCSI has been more like 1 out of 50. >=20 > Um. I'm pretty sure the actual hardware is just the same stuff. It's just > the > interface electronics that change. >=20 > > Also, while I've seen benchmarks like Escalade's, my real-world > experience has > > been that the full bi-directional r/w of SCSI means that it takes 2 SATA > > drives to equal one SCSI drive in a heavy r/w application. However, > ODSL is > > all SCSI so I don't have any numbers to back that up. >=20 > Do we know that these SATA/IDE controllers and drives don't "lie" about > fsync > the way most IDE drives do? Does the controller just automatically disable > the > write caching entirely? >=20 > I don't recall, did someone have a program that tested the write latency > of a > drive to test this? >=20 > -- > greg The Escalades, at least, work the way they are supposed to. The raid controller supports write back/write through. Thus, you can leave fsync on in pg with decent performance (not as good as fsync=3Doff, though) = and count on the bbu to cover you in the event of a power failure. Our internal testing here confirmed the controller and the disks sync when you tell them to (namely escalade/raptor). Merlin From pgsql-performance-owner@postgresql.org Sat Jan 15 02:45:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 365BE3A2015 for ; Fri, 14 Jan 2005 23:35: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 34029-08 for ; Fri, 14 Jan 2005 23:34:52 +0000 (GMT) Received: from zoidberg.portrix.net (mail.portrix.net [212.202.157.208]) by svr1.postgresql.org (Postfix) with ESMTP id C22CE3A25A4 for ; Fri, 14 Jan 2005 23:34:53 +0000 (GMT) Received: from [127.0.0.1] (fry.portrix.net [212.202.157.213]) (authenticated bits=0) by zoidberg.portrix.net (8.12.3/8.12.3/Debian-7.1) with ESMTP id j0ENYdjV024779 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Sat, 15 Jan 2005 00:34:42 +0100 Message-ID: <41E856A7.6080804@portrix.net> Date: Sat, 15 Jan 2005 00:32:55 +0100 From: Jan Dittmer Organization: portrix.net GmbH User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041124 Thunderbird/0.9 Mnenhy/0.6.0.104 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: "Joshua D. Drake" , Christopher Browne , pgsql-performance@postgresql.org Subject: Re: which dual-CPU hardware/OS is fastest for PostgreSQL? References: <59b2d39b05011018421680264b@mail.gmail.com> <41E3569A.4030102@commandprompt.com> <41E3A780.3020505@portrix.net> <87is60ug7z.fsf@stark.xeocode.com> In-Reply-To: <87is60ug7z.fsf@stark.xeocode.com> X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/195 X-Sequence-Number: 9885 Greg Stark wrote: > Jan Dittmer writes: > > >>You could always do raid 1 over raid 0, with newer kernels (2.6ish) >>there is even a dedicated raid10 driver. > > > Aren't you much better off doing raid 0 over raid 1? > > With raid 1 over raid 0 you're mirroring two stripe sets. That means if any > drive from the first stripe set goes you lose the whole side of the mirror. If > any drive of the second stripe set goes you lost your array. Even if they're > not the same position in the array. > > If you do raid 0 over raid 1 then you're striping a series of mirrored drives. > So if any drive fails you only lose that drive from the stripe set. If another > drive fails then you're ok as long as it isn't the specific drive that was > paired with the first failed drive. Ever heart of Murphy? :-) But of course you're right - I tend to mix up the raid levels... Jan From pgsql-performance-owner@postgresql.org Sat Jan 15 20:24:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D2F2F3A18B5 for ; Sat, 15 Jan 2005 20:24: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 50133-10 for ; Sat, 15 Jan 2005 20:24:14 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id C22F03A2CF7 for ; Sat, 15 Jan 2005 20:24:14 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6911214 for pgsql-performance@postgresql.org; Sat, 15 Jan 2005 12:25:53 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Subject: IN() Optimization issue in 8.0rc5 Date: Sat, 15 Jan 2005 12:23:10 -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: <200501151223.10372.josh@agliodbs.com> 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: 200501/196 X-Sequence-Number: 9886 Tom, Hmmm ... I'm seeing an issue with IN() optimization -- or rather the lack of it -- in 8.0rc5. It seems to me that this worked better in 7.4, although I've not been able to load this particular database and test dm=# explain dm-# SELECT personid FROM mr.person_attributes_old dm-# WHERE personid NOT IN (SELECT personid FROM mr.person_attributes); QUERY PLAN ----------------------------------------------------------------------------------- Seq Scan on person_attributes_old (cost=0.00..3226144059.85 rows=235732 width=4) Filter: (NOT (subplan)) SubPlan -> Seq Scan on person_attributes (cost=0.00..12671.07 rows=405807 width=4) (4 rows) dm=# explain select pao.personid from mr.person_attributes_old pao dm-# left outer join mr.person_attributes p on pao.personid = p.personid dm-# where p.personid is null; QUERY PLAN --------------------------------------------------------------------------------------------------------------- Merge Left Join (cost=0.00..34281.83 rows=471464 width=4) Merge Cond: ("outer".personid = "inner".personid) Filter: ("inner".personid IS NULL) -> Index Scan using idx_opa_person on person_attributes_old pao (cost=0.00..13789.29 rows=471464 width=4) -> Index Scan using idx_pa_person on person_attributes p (cost=0.00..14968.25 rows=405807 width=4) (5 rows) It seems like the planner ought to recognize that the first form of the query is optimizable into the 2nd form, and that I've seen it do so in 7.4. However, *no* amount of manipulation of query parameters I did on the 1st form of the query were successful in getting the planner to recognize that it could use indexes for the IN() form of the query. Thoughts? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sat Jan 15 20:53:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EE0853A2CF0 for ; Sat, 15 Jan 2005 20:53: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 52678-09 for ; Sat, 15 Jan 2005 20:53: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 DB2183A2C9F for ; Sat, 15 Jan 2005 20:53:39 +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 j0FKrbYg011486; Sat, 15 Jan 2005 15:53:37 -0500 (EST) To: Josh Berkus Cc: pgsql-performance@postgresql.org Subject: Re: IN() Optimization issue in 8.0rc5 In-reply-to: <200501151223.10372.josh@agliodbs.com> References: <200501151223.10372.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Sat, 15 Jan 2005 12:23:10 -0800" Date: Sat, 15 Jan 2005 15:53:37 -0500 Message-ID: <11485.1105822417@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: 200501/197 X-Sequence-Number: 9887 Josh Berkus writes: > dm=# explain > dm-# SELECT personid FROM mr.person_attributes_old > dm-# WHERE personid NOT IN (SELECT > personid FROM mr.person_attributes); > QUERY PLAN > ----------------------------------------------------------------------------------- > Seq Scan on person_attributes_old (cost=0.00..3226144059.85 rows=235732 > width=4) > Filter: (NOT (subplan)) > SubPlan > -> Seq Scan on person_attributes (cost=0.00..12671.07 rows=405807 > width=4) > (4 rows) Hmm. What you want for a NOT IN is for it to say Filter: (NOT (hashed subplan)) which you are not getting. What's the datatypes of the two personid columns? Is the 400k-row estimate for person_attributes reasonable? Maybe you need to increase work_mem (nee sort_mem) to allow a 400k-row hash table? regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jan 15 21:33:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E7A8F3A2CF7 for ; Sat, 15 Jan 2005 21:33: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 58132-04 for ; Sat, 15 Jan 2005 21:33:30 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 44B7D3A2CF6 for ; Sat, 15 Jan 2005 21:33:31 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6911389; Sat, 15 Jan 2005 13:35:11 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: IN() Optimization issue in 8.0rc5 Date: Sat, 15 Jan 2005 13:32:27 -0800 User-Agent: KMail/1.6.2 Cc: Tom Lane References: <200501151223.10372.josh@agliodbs.com> <11485.1105822417@sss.pgh.pa.us> In-Reply-To: <11485.1105822417@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200501151332.27896.josh@agliodbs.com> 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: 200501/198 X-Sequence-Number: 9888 Tom, > Hmm. What you want for a NOT IN is for it to say > Filter: (NOT (hashed subplan)) > which you are not getting. What's the datatypes of the two personid > columns? INT > Is the 400k-row estimate for person_attributes reasonable? Yes, the estimates are completely accurate. > Maybe you need to increase work_mem (nee sort_mem) to allow a > 400k-row hash table? Aha, that's it. I thought I'd already set that, but apparently it was a different session. Fixed. Thanks! -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sun Jan 16 12:00:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A704E3A1993 for ; Sun, 16 Jan 2005 12:00: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 26647-07 for ; Sun, 16 Jan 2005 12:00:40 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 402303A19BC for ; Sun, 16 Jan 2005 12:00:41 +0000 (GMT) Received: (qmail 14098 invoked from network); 16 Jan 2005 01:03:27 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 16 Jan 2005 01:03:27 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 13750-47 for ; Sun, 16 Jan 2005 08:03:24 +0700 (ICT) Received: (qmail 13719 invoked from network); 16 Jan 2005 01:02:47 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 16 Jan 2005 01:02:47 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Sun, 16 Jan 2005 08:02:46 +0700 Message-ID: <1105837366.41e9bd36c7de9@webmail.moph.go.th> Date: Sun, 16 Jan 2005 08:02:46 +0700 From: amrit@health2.moph.go.th To: William Yu Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/199 X-Sequence-Number: 9889 > The theshold for using PAE is actually far lower than 4GB. 4GB is the > total memory address space -- split that in half for 2GB for userspace, > 2GB for kernel. The OS cache resides in kernel space -- after you take > alway the memory allocation for devices, you're left with a window of > roughly 900MB. I set shammax = [root@data3 /]# cat < /proc/sys/kernel/shmmax 4000000000 shmall = [root@data3 /]# cat < /proc/sys/kernel/shmall 134217728 Is that ok for 4 Gb. mechine? > Since the optimal state is to allocate a small amount of memory to > Postgres and leave a huge chunk to the OS cache, this means you are > already hitting the PAE penalty at 1.5GB of memory. > How could I chang this hitting? Thanks Amrit Thailand From pgsql-performance-owner@postgresql.org Sun Jan 16 17:46:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A1AA53A1AD5 for ; Sun, 16 Jan 2005 17:46: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 56443-02 for ; Sun, 16 Jan 2005 17:45:56 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id C8BB03A1A9E for ; Sun, 16 Jan 2005 17:45:56 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6914170; Sun, 16 Jan 2005 09:47:35 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Date: Sun, 16 Jan 2005 09:44:47 -0800 User-Agent: KMail/1.6.2 Cc: William Yu References: <1105501768.41e49e484d779@webmail.moph.go.th> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501160944.47511.josh@agliodbs.com> 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: 200501/200 X-Sequence-Number: 9890 William, > The theshold for using PAE is actually far lower than 4GB. 4GB is the > total memory address space -- split that in half for 2GB for userspace, > 2GB for kernel. The OS cache resides in kernel space -- after you take > alway the memory allocation for devices, you're left with a window of > roughly 900MB. I'm curious, how do you get 1.1GB for memory allocation for devices? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jan 17 15:29:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1194D3A3D79 for ; Mon, 17 Jan 2005 15:29: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 13809-02 for ; Mon, 17 Jan 2005 15:29:26 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id 8D1193A3D72 for ; Mon, 17 Jan 2005 15:29:26 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0HFTND00361 for ; Mon, 17 Jan 2005 17:29:23 +0200 (EET) Message-ID: <41EBDBBB.3070301@faith.digsys.bg> Date: Mon, 17 Jan 2005 17:37:31 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Performance problem from migrating between versions! Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/201 X-Sequence-Number: 9891 Hi, I have the following problem. A week ago we've migrated from PGv7.2.3 to 7.4.6. There were a lot of things in the apps to chenge but we made them. But one query doesn't want to run. In the old PGv7.2.3 it passes for 10 min. In the new one it gaves: DBD::Pg::st execute failed: ERROR: out of memory So the Server was not upgrated or preconfigured, so I suppose that the problem is somewhere in the configuration of the Postgres. Here I post the query and the explain. I can't post the explain analyze, because:))... the query can't execute:) I also post the result of SHOW ALL to give a view of the server configuration. Thanks in advance for all sugestions. Kaloyan Iliev SHOW ALL name setting add_missing_from on australian_timezones off authentication_timeout 60 check_function_bodies on checkpoint_segments 16 checkpoint_timeout 300 checkpoint_warning 30 client_encoding SQL_ASCII client_min_messages notice commit_delay 0 commit_siblings 5 cpu_index_tuple_cost 0.001 cpu_operator_cost 0.0025 cpu_tuple_cost 0.01 DateStyle ISO, DMY db_user_namespace off deadlock_timeout 1000 debug_pretty_print off debug_print_parse off debug_print_plan off debug_print_rewritten off default_statistics_target 10 default_transaction_isolation read committed default_transaction_read_only off dynamic_library_path $libdir effective_cache_size 13000 enable_hashagg on enable_hashjoin on enable_indexscan on enable_mergejoin on enable_nestloop on enable_seqscan on enable_sort on enable_tidscan on explain_pretty_print on extra_float_digits 0 from_collapse_limit 8 fsync on geqo on geqo_effort 1 geqo_generations 0 geqo_pool_size 0 geqo_selection_bias 2 geqo_threshold 11 join_collapse_limit 8 krb_server_keyfile unset lc_collate C lc_ctype CP1251 lc_messages C lc_monetary C lc_numeric C lc_time C log_connections off log_duration off log_error_verbosity default log_executor_stats off log_hostname off log_min_duration_statement -1 log_min_error_statement panic log_min_messages notice log_parser_stats off log_pid off log_planner_stats off log_source_port off log_statement off log_statement_stats off log_timestamp on max_connections 256 max_expr_depth 10000 max_files_per_process 1000 max_fsm_pages 20000 max_fsm_relations 1000 max_locks_per_transaction 64 password_encryption on port 5432 pre_auth_delay 0 preload_libraries unset random_page_cost 4 regex_flavor advanced rendezvous_name unset search_path $user,public server_encoding SQL_ASCII server_version 7.4.6 shared_buffers 1000 silent_mode off sort_mem 1024 sql_inheritance off ssl off statement_timeout 0 stats_block_level on stats_command_string on stats_reset_on_server_start off stats_row_level on stats_start_collector on superuser_reserved_connections 2 syslog 0 syslog_facility LOCAL0 syslog_ident postgres tcpip_socket on TimeZone unknown trace_notify off transaction_isolation read committed transaction_read_only off transform_null_equals off unix_socket_directory unset unix_socket_group unset unix_socket_permissions 511 vacuum_mem 8192 virtual_host unset wal_buffers 8 wal_debug 0 wal_sync_method fsync zero_damaged_pages off (113 rows) And now the query: explain select UNPAID.ino, I.idate, round(UNPAID.saldo - ( select round(coalesce(sum(total),0),5) from invoices I1 where I1.iino = I.ino AND I1.istatus = 0 AND I1.itype = 2 ) ,2) AS saldo, C.name AS client_name, SC.branch AS client_branch, I.total, I.nomenclature_no AS nom, I.subnom_no AS subnom, OF.description AS office, coalesce((select 1.2 * sum(AD.bgl_amount)::float / AC.amount from acc_clients AC, config C, acc_debts AD, debts_desc D where C.office = OF.officeid AND not AC.credit AND AC.ino = I.ino AND AC.transact_no = AD.transact_no AND AD.credit AND AD.debtid = D.debtid AND C.confid = D.refid AND C.oid = (select max(oid) from config where confid=D.refid ) group by AC.amount ),0) AS perc, 1 from invoices I, offices OF, ( select nomenclature_no, subnom_no, ino, sum(saldo) as saldo from ( select nomenclature_no, subnom_no, ino, round(sum(saldo_sign(not credit)*amount),5) AS saldo from acc_clients group by ino, nomenclature_no, subnom_no UNION ALL select c.nomenclature_no, c.subnom_no, c.ino, round(COALESCE(sum(p.bgl_amount), 0),5) AS saldo from acc_clients c, acc_payments p where c.transact_no = p.transact_no AND p.fisc_status = 4 group by c.ino, c.nomenclature_no, c.subnom_no ) TTUNPAID group by ino, nomenclature_no, subnom_no ) UNPAID, clients C, subnom SC where I.idate >= '01-01-2004' AND I.idate <= '01-01-2005' AND UNPAID.ino = I.ino AND I.istatus = 0 AND I.itype <> 2 AND I.nomenclature_no = C.nomenclature_no AND I.nomenclature_no = SC.nomenclature_no AND I.subnom_no = SC.subnom_no union all select UNPAID.ino, I.idate, round(UNPAID.saldo - ( select round(coalesce(sum(total),0),5) from invoices I1 where I1.iino = I.ino AND I1.istatus = 0 AND I1.itype = 2 ) ,2) AS saldo, C.name AS client_name, SC.branch AS client_branch, I.total, I.nomenclature_no AS nom, I.subnom_no AS subnom, '����������' AS office, coalesce((select 1.2 * sum(AD.bgl_amount)::float / AC.amount from acc_clients AC, acc_debts AD, debts_desc D where not AC.credit AND AC.ino = I.ino AND AC.transact_no = AD.transact_no AND AD.credit AND AD.debtid = D.debtid AND D.refid is null group by AC.amount ),0) AS perc, 1 from invoices I, ( select nomenclature_no, subnom_no, ino, round(sum(saldo_sign(not credit)*amount),5) AS saldo from acc_clients group by ino, nomenclature_no, subnom_no ) UNPAID, clients C, subnom SC where I.idate >= '01-01-2004' AND I.idate <= '01-01-2005' AND UNPAID.ino = I.ino AND I.istatus = 0 AND I.itype <> 2 AND I.nomenclature_no = C.nomenclature_no AND I.nomenclature_no = SC.nomenclature_no AND exists (select 1 from acc_clients AC, acc_debts AD, debts_desc DD where AC.ino = I.ino AND AD.transact_no = AC.transact_no AND AD.debtid = DD.debtid AND DD.refid is null ) AND I.subnom_no = SC.subnom_no order by office, ino DESC QUERY PLAN Sort (cost=453579405.72..453585516.16 rows=2444177 width=108) Sort Key: office, ino -> Append (cost=93725.37..452807307.33 rows=2444177 width=108) -> Subquery Scan "*SELECT* 1" (cost=93725.37..447433349.67 rows=2418773 width=108) -> Nested Loop (cost=93725.37..447409161.94 rows=2418773 width=108) -> Merge Join (cost=93723.86..101789.54 rows=50867 width=94) Merge Cond: ("outer".ino = "inner".ino) -> Subquery Scan unpaid (cost=82961.98..89647.68 rows=267428 width=36) -> GroupAggregate (cost=82961.98..86973.40 rows=267428 width=44) -> Sort (cost=82961.98..83630.55 rows=267428 width=44) Sort Key: ino, nomenclature_no, subnom_no -> Subquery Scan ttunpaid (cost=35143.93..49845.48 rows=267428 width=44) -> Append (cost=35143.93..47171.20 rows=267428 width=21) -> Subquery Scan "*SELECT* 1" (cost=35143.93..44492.88 rows=267113 width=21) -> GroupAggregate (cost=35143.93..41821.75 rows=267113 width=21) -> Sort (cost=35143.93..35811.71 rows=267113 width=21) Sort Key: ino, nomenclature_no, subnom_no -> Seq Scan on acc_clients (cost=0.00..4758.13 rows=267113 width=21) -> Subquery Scan "*SELECT* 2" (cost=2672.80..2678.32 rows=315 width=20) -> HashAggregate (cost=2672.80..2675.17 rows=315 width=20) -> Nested Loop (cost=0.00..2669.65 rows=315 width=20) -> Index Scan using acc_payments_fisc_status_idx on acc_payments p (cost=0.00..892.52 rows=315 width=12) Index Cond: (fisc_status = 4) -> Index Scan using acc_clients_transact_no_uidx on acc_clients c (cost=0.00..5.63 rows=1 width=16) Index Cond: (c.transact_no = "outer".transact_no) -> Sort (cost=10761.89..10817.21 rows=22128 width=58) Sort Key: i.ino -> Hash Join (cost=1774.86..8710.88 rows=22128 width=58) Hash Cond: (("outer".nomenclature_no = "inner".nomenclature_no) AND ("outer".subnom_no = "inner".subnom_no)) -> Seq Scan on invoices i (cost=0.00..5556.52 rows=22292 width=24) Filter: ((idate >= '2004-01-01'::date) AND (idate <= '2005-01-01'::date) AND (istatus = 0) AND (itype <> 2)) -> Hash (cost=1592.90..1592.90 rows=13193 width=46) -> Hash Join (cost=577.25..1592.90 rows=13193 width=46) Hash Cond: ("outer".nomenclature_no = "inner".nomenclature_no) -> Seq Scan on subnom sc (cost=0.00..393.93 rows=13193 width=19) -> Hash (cost=463.20..463.20 rows=12820 width=27) -> Seq Scan on clients c (cost=0.00..463.20 rows=12820 width=27) -> Materialize (cost=1.51..2.02 rows=51 width=14) -> Seq Scan on offices "of" (cost=0.00..1.51 rows=51 width=14) SubPlan -> HashAggregate (cost=179.30..179.31 rows=1 width=19) -> Nested Loop (cost=0.00..179.30 rows=1 width=19) Join Filter: ("inner".oid = (subplan)) -> Nested Loop (cost=0.00..77.57 rows=2 width=23) -> Nested Loop (cost=0.00..66.58 rows=2 width=23) -> Index Scan using acc_clients_ino on acc_clients ac (cost=0.00..25.47 rows=4 width=12) Index Cond: (ino = $0) Filter: (NOT credit) -> Index Scan using acc_debts_transact_no_idx on acc_debts ad (cost=0.00..9.71 rows=45 width=19) Index Cond: ("outer".transact_no = ad.transact_no) Filter: credit -> Index Scan using debts_desc_pkey on debts_desc d (cost=0.00..5.48 rows=1 width=8) Index Cond: ("outer".debtid = d.debtid) -> Index Scan using config_confid_idx on config c (cost=0.00..25.42 rows=1 width=8) Index Cond: (c.confid = "outer".refid) Filter: (office = $2) SubPlan -> Aggregate (cost=25.43..25.43 rows=1 width=4) -> Index Scan using config_confid_idx on config (cost=0.00..25.40 rows=9 width=4) Index Cond: (confid = $1) -> Aggregate (cost=5.59..5.59 rows=1 width=8) -> Index Scan using invoices_iino_idx on invoices i1 (cost=0.00..5.58 rows=1 width=8) Index Cond: (iino = $0) Filter: ((istatus = 0) AND (itype = 2)) -> Subquery Scan "*SELECT* 2" (cost=3250111.65..5373957.66 rows=25404 width=94) -> Merge Join (cost=3250111.65..5373703.62 rows=25404 width=94) Merge Cond: ("outer".ino = "inner".ino) -> Subquery Scan unpaid (cost=35143.93..44492.88 rows=267113 width=36) -> GroupAggregate (cost=35143.93..41821.75 rows=267113 width=21) -> Sort (cost=35143.93..35811.71 rows=267113 width=21) Sort Key: ino, nomenclature_no, subnom_no -> Seq Scan on acc_clients (cost=0.00..4758.13 rows=267113 width=21) -> Sort (cost=3214967.73..3214995.39 rows=11064 width=58) Sort Key: i.ino -> Hash Join (cost=3212283.98..3214224.58 rows=11064 width=58) Hash Cond: ("outer".nomenclature_no = "inner".nomenclature_no) -> Merge Join (cost=3211706.73..3213082.65 rows=11867 width=39) Merge Cond: ("outer".nomenclature_no = "inner".nomenclature_no) Join Filter: ("inner".subnom_no = "outer".subnom_no) -> Index Scan using subnom_nom_idx on subnom sc (cost=0.00..1135.01 rows=13193 width=19) -> Sort (cost=3211706.73..3211734.59 rows=11146 width=24) Sort Key: i.nomenclature_no -> Index Scan using invoices_idate_idx on invoices i (cost=0.00..3210957.48 rows=11146 width=24) Index Cond: ((idate >= '2004-01-01'::date) AND (idate <= '2005-01-01'::date)) Filter: ((istatus = 0) AND (itype <> 2) AND (subplan)) SubPlan -> Nested Loop (cost=0.00..140.00 rows=1 width=0) -> Nested Loop (cost=0.00..101.54 rows=7 width=4) -> Index Scan using acc_clients_ino on acc_clients ac (cost=0.00..25.47 rows=7 width=4) Index Cond: (ino = $0) -> Index Scan using acc_debts_transact_no_idx on acc_debts ad (cost=0.00..9.71 rows=93 width=8) Index Cond: (ad.transact_no = "outer".transact_no) -> Index Scan using debts_desc_pkey on debts_desc dd (cost=0.00..5.48 rows=1 width=4) Index Cond: ("outer".debtid = dd.debtid) Filter: (refid IS NULL) -> Hash (cost=463.20..463.20 rows=12820 width=27) -> Seq Scan on clients c (cost=0.00..463.20 rows=12820 width=27) SubPlan -> HashAggregate (cost=77.58..77.59 rows=1 width=19) -> Nested Loop (cost=0.00..77.57 rows=1 width=19) -> Nested Loop (cost=0.00..66.58 rows=2 width=23) -> Index Scan using acc_clients_ino on acc_clients ac (cost=0.00..25.47 rows=4 width=12) Index Cond: (ino = $0) Filter: (NOT credit) -> Index Scan using acc_debts_transact_no_idx on acc_debts ad (cost=0.00..9.71 rows=45 width=19) Index Cond: ("outer".transact_no = ad.transact_no) Filter: credit -> Index Scan using debts_desc_pkey on debts_desc d (cost=0.00..5.48 rows=1 width=4) Index Cond: ("outer".debtid = d.debtid) Filter: (refid IS NULL) -> Aggregate (cost=5.59..5.59 rows=1 width=8) -> Index Scan using invoices_iino_idx on invoices i1 (cost=0.00..5.58 rows=1 width=8) Index Cond: (iino = $0) Filter: ((istatus = 0) AND (itype = 2)) (114 rows) From pgsql-performance-owner@postgresql.org Mon Jan 17 16:08:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DDC8C3A3D58 for ; Mon, 17 Jan 2005 16: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 19503-04 for ; Mon, 17 Jan 2005 16:08:08 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 62B573A3D32 for ; Mon, 17 Jan 2005 16:08:07 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j0HG8uYf032346; Mon, 17 Jan 2005 10:08:56 -0600 Date: Mon, 17 Jan 2005 10:09:42 -0600 From: Frank Wiles To: Adrian Holovaty Cc: pgsql-performance@postgresql.org Subject: Re: Index on a function and SELECT DISTINCT Message-Id: <20050117100942.692be97a.frank@wiles.org> In-Reply-To: <200501141232.13139.postgresql@holovaty.com> References: <200501141232.13139.postgresql@holovaty.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: 200501/202 X-Sequence-Number: 9892 On Fri, 14 Jan 2005 12:32:12 -0600 Adrian Holovaty wrote: > If I have this table, function and index in Postgres 7.3.6 ... > > """ > CREATE TABLE news_stories ( > id serial primary key NOT NULL, > pub_date timestamp with time zone NOT NULL, > ... > ) > CREATE OR REPLACE FUNCTION get_year_trunc(timestamp with time zone) > returns timestamp with time zone AS 'SELECT date_trunc(\'year\',$1);' > LANGUAGE 'SQL' IMMUTABLE; > CREATE INDEX news_stories_pub_date_year_trunc ON > news_stories( get_year_trunc(pub_date) ); > """ > > ...why does this query not use the index? > > db=# EXPLAIN SELECT DISTINCT get_year_trunc(pub_date) FROM > news_stories; > QUERY PLAN > --------------------------------------------------------------------- > ------------ > Unique (cost=59597.31..61311.13 rows=3768 width=8) > -> Sort (cost=59597.31..60454.22 rows=342764 width=8) > Sort Key: date_trunc('year'::text, pub_date) > -> Seq Scan on news_stories (cost=0.00..23390.55 > rows=342764 > width=8) > (4 rows) > > The query is noticably slow (2 seconds) on a database with 150,000+ > records. How can I speed it up? It's doing a sequence scan because you're not limiting the query in the FROM clause. No point in using an index when you're asking for the entire table. :) --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Mon Jan 17 16:14:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46E1D3A3DB4 for ; Mon, 17 Jan 2005 16:14: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 20019-08 for ; Mon, 17 Jan 2005 16:14:19 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id F0AE23A3DB2 for ; Mon, 17 Jan 2005 16:14:18 +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 j0HGD09Y002254; Mon, 17 Jan 2005 11:13:00 -0500 (EST) To: Kaloyan Iliev Iliev Cc: pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! In-reply-to: <41EBDBBB.3070301@faith.digsys.bg> References: <41EBDBBB.3070301@faith.digsys.bg> Comments: In-reply-to Kaloyan Iliev Iliev message dated "Mon, 17 Jan 2005 17:37:31 +0200" Date: Mon, 17 Jan 2005 11:13:00 -0500 Message-ID: <2253.1105978380@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: 200501/203 X-Sequence-Number: 9893 Kaloyan Iliev Iliev writes: > I have the following problem. A week ago we've migrated from PGv7.2.3 to > 7.4.6. There were a lot of things in the apps to chenge but we made > them. But one query doesn't want to run. In the old PGv7.2.3 it passes > for 10 min. In the new one it gaves: > DBD::Pg::st execute failed: ERROR: out of memory Does setting enable_hashagg to OFF fix it? regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jan 17 16:58:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A1AC33A3CE3 for ; Mon, 17 Jan 2005 16:58: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 25500-08 for ; Mon, 17 Jan 2005 16:58:37 +0000 (GMT) Received: from ar-sd.net (unknown [82.77.155.72]) by svr1.postgresql.org (Postfix) with ESMTP id 91D823A3D58 for ; Mon, 17 Jan 2005 16:58:35 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id E9C6C212E2 for ; Mon, 17 Jan 2005 18:54:27 +0200 (EET) Received: from ar-sd.net ([127.0.0.1]) by localhost (linz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02866-08 for ; Mon, 17 Jan 2005 18:54:27 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id B64951A9E4 for ; Mon, 17 Jan 2005 18:54:26 +0200 (EET) Message-ID: <016801c4fcb5$cb36e8b0$0b00a8c0@forge> From: "Andrei Bintintan" To: Subject: Optimizing this count query Date: Mon, 17 Jan 2005 18:58:09 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0160_01C4FCC6.7CA02250" 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 ar-sd.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/204 X-Sequence-Number: 9894 This is a multi-part message in MIME format. ------=_NextPart_000_0160_01C4FCC6.7CA02250 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi to all,=20 I have a query which counts how many elements I have in the database. SELECT count(o.id) FROM orders o INNER JOIN report r ON o.id=3Dr.id_order INNER JOIN status s ON o.id_status=3Ds.id INNER JOIN contact c ON o.id_ag=3Dc.id INNER JOIN endkunde e ON o.id_endkunde=3De.id INNER JOIN zufriden z ON r.id_zufriden=3Dz.id INNER JOIN plannung v ON v.id=3Do.id_plannung INNER JOIN mpsworker w ON v.id_worker=3Dw.id INNER JOIN person p ON p.id =3D w.id_person WHERE o.id_status>3=20 In the tables are not quite so many rows (~ 100000). I keep the joins because in the where clause there can be also other = search elemens which are searched in the other tables.=20 Now the id_status from the orders table (>3) can be 4 or 6. The = id_status=3D6 has the most bigger percentage (4 =3D 10%, 6 =3D 70% and = the rest are other statuses < 4). I think this is why the planner uses=20 I'm asking how can I improve the execution time of this query, because = these tables are always increasing. And this count sometimes takes more = than 10 secs and I need to run this count very offen. Best regards,=20 Andy. The explain: Aggregate (cost=3D37931.33..37931.33 rows=3D1 width=3D4) -> Hash Join (cost=3D27277.86..37828.45 rows=3D41154 width=3D4) Hash Cond: ("outer".id_person =3D "inner".id) -> Hash Join (cost=3D27269.79..37100.18 rows=3D41153 = width=3D8) Hash Cond: ("outer".id_worker =3D "inner".id) -> Hash Join (cost=3D27268.28..36378.50 rows=3D41152 = width=3D8) Hash Cond: ("outer".id_endkunde =3D "inner".id) -> Hash Join (cost=3D25759.54..33326.98 = rows=3D41151 width=3D12) Hash Cond: ("outer".id_ag =3D "inner".id) -> Hash Join (cost=3D25587.07..32331.51 = rows=3D41150 width=3D16) Hash Cond: ("outer".id_status =3D = "inner".id) -> Hash Join = (cost=3D25586.00..31713.18 rows=3D41150 width=3D20) Hash Cond: ("outer".id_zufriden = =3D "inner".id) -> Hash Join = (cost=3D25584.85..31094.78 rows=3D41150 width=3D24) Hash Cond: = ("outer".id_plannung =3D "inner".id) -> Hash Join = (cost=3D24135.60..27869.53 rows=3D41149 width=3D24) Hash Cond: ("outer".id = =3D "inner".id_order) -> Seq Scan on orders = o (cost=3D0.00..2058.54 rows=3D42527 width=3D20) Filter: = (id_status > 3) -> Hash = (cost=3D23860.48..23860.48 rows=3D42848 width=3D8) -> Seq Scan on = report r (cost=3D0.00..23860.48 rows=3D42848 width=3D8) -> Hash = (cost=3D1050.80..1050.80 rows=3D62180 width=3D8) -> Seq Scan on = plannung v (cost=3D0.00..1050.80 rows=3D62180 width=3D8) -> Hash (cost=3D1.12..1.12 = rows=3D12 width=3D4) -> Seq Scan on zufriden z = (cost=3D0.00..1.12 rows=3D12 width=3D4) -> Hash (cost=3D1.06..1.06 rows=3D6 = width=3D4) -> Seq Scan on status s = (cost=3D0.00..1.06 rows=3D6 width=3D4) -> Hash (cost=3D161.57..161.57 rows=3D4357 = width=3D4) -> Seq Scan on contact c = (cost=3D0.00..161.57 rows=3D4357 width=3D4) -> Hash (cost=3D1245.99..1245.99 rows=3D44299 = width=3D4) -> Seq Scan on endkunde e = (cost=3D0.00..1245.99 rows=3D44299 width=3D4) -> Hash (cost=3D1.41..1.41 rows=3D41 width=3D8) -> Seq Scan on mpsworker w (cost=3D0.00..1.41 = rows=3D41 width=3D8) -> Hash (cost=3D7.66..7.66 rows=3D166 width=3D4) -> Seq Scan on person p (cost=3D0.00..7.66 rows=3D166 = width=3D4) ------=_NextPart_000_0160_01C4FCC6.7CA02250 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi to=20 all,
 
I have a query which counts how many elements I have = in the=20 database.
 
SELECT count(o.id) FROM orders=20 o
      INNER JOIN report r ON=20 o.id=3Dr.id_order
      INNER JOIN = status s ON=20 o.id_status=3Ds.id
      INNER JOIN = contact c ON=20 o.id_ag=3Dc.id
      INNER JOIN = endkunde e ON=20 o.id_endkunde=3De.id
      INNER JOIN = zufriden z=20 ON r.id_zufriden=3Dz.id
      INNER = JOIN plannung=20 v ON v.id=3Do.id_plannung
      INNER = JOIN=20 mpsworker w ON = v.id_worker=3Dw.id
      INNER=20 JOIN person p ON p.id =3D = w.id_person
      WHERE=20 o.id_status>3
 
In the tables are not quite so many = rows (~=20 100000).
 
I keep the joins because in the where = clause there=20 can be also other search elemens which are searched in the other tables. =
Now the id_status from the orders table = (>3) can=20 be 4 or 6. The id_status=3D6 has the most bigger percentage (4 =3D = 10%, 6 =3D 70%=20 and the rest are other statuses < 4). I think this is why the planner = uses=20
 
I'm asking how can I improve the = execution time of=20 this query, because these tables are always increasing. And this count = sometimes=20 takes more than 10 secs and I need to run this count very = offen.
 
Best regards,
Andy.
 
 
The explain:
Aggregate  = (cost=3D37931.33..37931.33 rows=3D1=20 width=3D4)
  ->  Hash Join  = (cost=3D27277.86..37828.45=20 rows=3D41154 width=3D4)
        = Hash Cond:=20 ("outer".id_person =3D = "inner".id)
       =20 ->  Hash Join  (cost=3D27269.79..37100.18 rows=3D41153=20 width=3D8)
          = ;   =20 Hash Cond: ("outer".id_worker =3D=20 "inner".id)
         &nbs= p;   =20 ->  Hash Join  (cost=3D27268.28..36378.50 rows=3D41152=20 width=3D8)
          = ;         =20 Hash Cond: ("outer".id_endkunde =3D=20 "inner".id)
         &nbs= p;         =20 ->  Hash Join  (cost=3D25759.54..33326.98 rows=3D41151=20 width=3D12)
         &nbs= p;            = ;   =20 Hash Cond: ("outer".id_ag =3D=20 "inner".id)
         &nbs= p;            = ;   =20 ->  Hash Join  (cost=3D25587.07..32331.51 rows=3D41150=20 width=3D16)
         &nbs= p;            = ;         =20 Hash Cond: ("outer".id_status =3D=20 "inner".id)
         &nbs= p;            = ;         =20 ->  Hash Join  (cost=3D25586.00..31713.18 rows=3D41150=20 width=3D20)
         &nbs= p;            = ;            =    =20 Hash Cond: ("outer".id_zufriden =3D=20 "inner".id)
         &nbs= p;            = ;            =    =20 ->  Hash Join  (cost=3D25584.85..31094.78 rows=3D41150=20 width=3D24)
         &nbs= p;            = ;            =          =20 Hash Cond: ("outer".id_plannung =3D=20 "inner".id)
         &nbs= p;            = ;            =          =20 ->  Hash Join  (cost=3D24135.60..27869.53 rows=3D41149=20 width=3D24)
         &nbs= p;            = ;            =             &= nbsp;  =20 Hash Cond: ("outer".id =3D=20 "inner".id_order)
        &nbs= p;            = ;            =             &= nbsp;   =20 ->  Seq Scan on orders o  (cost=3D0.00..2058.54 = rows=3D42527=20 width=3D20)
         &nbs= p;            = ;            =             &= nbsp;        =20 Filter: (id_status >=20 3)
           &= nbsp;           &n= bsp;           &nb= sp;           &nbs= p; =20 ->  Hash  (cost=3D23860.48..23860.48 rows=3D42848=20 width=3D8)
          = ;            =             &= nbsp;           &n= bsp;        =20 ->  Seq Scan on report r  (cost=3D0.00..23860.48 = rows=3D42848=20 width=3D8)
          = ;            =             &= nbsp;        =20 ->  Hash  (cost=3D1050.80..1050.80 rows=3D62180=20 width=3D8)
          = ;            =             &= nbsp;           &n= bsp;  =20 ->  Seq Scan on plannung v  (cost=3D0.00..1050.80 = rows=3D62180=20 width=3D8)
          = ;            =             &= nbsp;  =20 ->  Hash  (cost=3D1.12..1.12 rows=3D12=20 width=3D4)
          = ;            =             &= nbsp;        =20 ->  Seq Scan on zufriden z  (cost=3D0.00..1.12 rows=3D12=20 width=3D4)
          = ;            =          =20 ->  Hash  (cost=3D1.06..1.06 rows=3D6=20 width=3D4)
          = ;            =             &= nbsp;  =20 ->  Seq Scan on status s  (cost=3D0.00..1.06 rows=3D6=20 width=3D4)
          = ;            =    =20 ->  Hash  (cost=3D161.57..161.57 rows=3D4357=20 width=3D4)
          = ;            =          =20 ->  Seq Scan on contact c  (cost=3D0.00..161.57 rows=3D4357 = width=3D4)
          = ;         =20 ->  Hash  (cost=3D1245.99..1245.99 rows=3D44299=20 width=3D4)
          = ;            =    =20 ->  Seq Scan on endkunde e  (cost=3D0.00..1245.99 = rows=3D44299=20 width=3D4)
          = ;   =20 ->  Hash  (cost=3D1.41..1.41 rows=3D41=20 width=3D8)
          = ;         =20 ->  Seq Scan on mpsworker w  (cost=3D0.00..1.41 rows=3D41=20 width=3D8)
        ->  = Hash =20 (cost=3D7.66..7.66 rows=3D166=20 width=3D4)
          = ;   =20 ->  Seq Scan on person p  (cost=3D0.00..7.66 rows=3D166=20 width=3D4)
------=_NextPart_000_0160_01C4FCC6.7CA02250-- From pgsql-performance-owner@postgresql.org Mon Jan 17 17:43:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0BFFD3A3D80 for ; Mon, 17 Jan 2005 17:43: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 31464-03 for ; Mon, 17 Jan 2005 17:43:19 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id AA6D23A3DD3 for ; Mon, 17 Jan 2005 17:43:16 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 51253313CD; Mon, 17 Jan 2005 18:43:14 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Date: Mon, 17 Jan 2005 09:43:10 -0800 Organization: Hub.Org Networking Services Lines: 21 Message-ID: References: <1105501768.41e49e484d779@webmail.moph.go.th> <200501160944.47511.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <200501160944.47511.josh@agliodbs.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: 200501/205 X-Sequence-Number: 9895 I inferred this from reading up on the compressed vm project. It can be higher or lower depending on what devices you have in your system -- however, I've read messages from kernel hackers saying Linux is very aggressive in reserving memory space for devices because it must be allocated at boottime. Josh Berkus wrote: > William, > > >>The theshold for using PAE is actually far lower than 4GB. 4GB is the >>total memory address space -- split that in half for 2GB for userspace, >>2GB for kernel. The OS cache resides in kernel space -- after you take >>alway the memory allocation for devices, you're left with a window of >>roughly 900MB. > > > I'm curious, how do you get 1.1GB for memory allocation for devices? > From pgsql-performance-owner@postgresql.org Mon Jan 17 17:43:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E06F83A3DD4 for ; Mon, 17 Jan 2005 17:43: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 30828-10 for ; Mon, 17 Jan 2005 17:43:52 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1A2493A3D88 for ; Mon, 17 Jan 2005 17:43:53 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4AD39313CD; Mon, 17 Jan 2005 18:43:52 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Date: Mon, 17 Jan 2005 09:43:51 -0800 Organization: Hub.Org Networking Services Lines: 9 Message-ID: References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <1105837366.41e9bd36c7de9@webmail.moph.go.th> 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: 200501/206 X-Sequence-Number: 9896 amrit@health2.moph.go.th wrote: >>Since the optimal state is to allocate a small amount of memory to >>Postgres and leave a huge chunk to the OS cache, this means you are >>already hitting the PAE penalty at 1.5GB of memory. >> > > How could I chang this hitting? Upgrade to 64-bit processors + 64-bit linux. From pgsql-performance-owner@postgresql.org Mon Jan 17 17:56:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AEA73A3D1A for ; Mon, 17 Jan 2005 17:56: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 32622-04 for ; Mon, 17 Jan 2005 17:56:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 33ADF3A2165 for ; Mon, 17 Jan 2005 17:56:07 +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 j0HHtnqJ003852; Mon, 17 Jan 2005 12:55:50 -0500 (EST) To: "Andrei Bintintan" Cc: pgsql-performance@postgresql.org Subject: Re: Optimizing this count query In-reply-to: <016801c4fcb5$cb36e8b0$0b00a8c0@forge> References: <016801c4fcb5$cb36e8b0$0b00a8c0@forge> Comments: In-reply-to "Andrei Bintintan" message dated "Mon, 17 Jan 2005 18:58:09 +0200" Date: Mon, 17 Jan 2005 12:55:49 -0500 Message-ID: <3851.1105984549@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: 200501/208 X-Sequence-Number: 9898 "Andrei Bintintan" writes: > SELECT count(o.id) FROM orders o > INNER JOIN report r ON o.id=r.id_order > INNER JOIN status s ON o.id_status=s.id > INNER JOIN contact c ON o.id_ag=c.id > INNER JOIN endkunde e ON o.id_endkunde=e.id > INNER JOIN zufriden z ON r.id_zufriden=z.id > INNER JOIN plannung v ON v.id=o.id_plannung > INNER JOIN mpsworker w ON v.id_worker=w.id > INNER JOIN person p ON p.id = w.id_person > WHERE o.id_status>3 > I'm asking how can I improve the execution time of this query, because = > these tables are always increasing. And this count sometimes takes more = > than 10 secs and I need to run this count very offen. Unless you've increased the default value of join_collapse_limit, this construction will be forcing the join order; see http://www.postgresql.org/docs/7.4/static/explicit-joins.html I'm not sure if you can improve the join order at all --- since you only showed EXPLAIN and not EXPLAIN ANALYZE, it's hard to be sure whether any of the steps are producing large intermediate results. But it's something to look into. You should also ask yourself if you need to be joining so many tables at all. The planner seems to think that only the o/r join is really going to affect the result row count. I can't tell if it's right or not, but if this is a star schema and the other seven tables are just detail tables, you don't need them in order to obtain a count. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jan 17 18:01:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D85B23A3DCE for ; Mon, 17 Jan 2005 18:01: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 33273-02 for ; Mon, 17 Jan 2005 18:01:01 +0000 (GMT) Received: from smtp05.mrf.mail.rcn.net (smtp05.mrf.mail.rcn.net [207.172.4.64]) by svr1.postgresql.org (Postfix) with ESMTP id 90B8B3A3DD5 for ; Mon, 17 Jan 2005 18:01:00 +0000 (GMT) Received: from 207-229-189-211.lem-bsr1.chi-lem.il.cable.rcn.com (HELO [192.168.1.101]) (207.229.189.211) by smtp05.mrf.mail.rcn.net with ESMTP; 17 Jan 2005 13:02:33 -0500 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== X-IronPort-AV: i="3.88,132,1102309200"; d="scan'208"; a="1402092:sNHT62107506" From: Adrian Holovaty To: pgsql-performance@postgresql.org Subject: Re: Index on a function and SELECT DISTINCT Date: Mon, 17 Jan 2005 11:59:24 -0600 User-Agent: KMail/1.7.2 References: <200501141232.13139.postgresql@holovaty.com> <20050117100942.692be97a.frank@wiles.org> In-Reply-To: <20050117100942.692be97a.frank@wiles.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501171159.24797.postgresql@holovaty.com> X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/209 X-Sequence-Number: 9899 Frank Wiles wrote: > Adrian Holovaty wrote: > > If I have this table, function and index in Postgres 7.3.6 ... > > > > """ > > CREATE TABLE news_stories ( > > id serial primary key NOT NULL, > > pub_date timestamp with time zone NOT NULL, > > ... > > ) > > CREATE OR REPLACE FUNCTION get_year_trunc(timestamp with time zone) > > returns timestamp with time zone AS 'SELECT date_trunc(\'year\',$1);' > > LANGUAGE 'SQL' IMMUTABLE; > > CREATE INDEX news_stories_pub_date_year_trunc ON > > news_stories( get_year_trunc(pub_date) ); > > """ > > > > ...why does this query not use the index? > > > > db=# EXPLAIN SELECT DISTINCT get_year_trunc(pub_date) FROM > > news_stories; > > QUERY PLAN > > --------------------------------------------------------------------- > > ------------ > > Unique (cost=59597.31..61311.13 rows=3768 width=8) > > -> Sort (cost=59597.31..60454.22 rows=342764 width=8) > > Sort Key: date_trunc('year'::text, pub_date) > > -> Seq Scan on news_stories (cost=0.00..23390.55 > > rows=342764 > > width=8) > > (4 rows) > > > > The query is noticably slow (2 seconds) on a database with 150,000+ > > records. How can I speed it up? > > It's doing a sequence scan because you're not limiting the query in > the FROM clause. No point in using an index when you're asking for > the entire table. :) Ah, that makes sense. So is there a way to optimize SELECT DISTINCT queries that have no WHERE clause? Adrian From pgsql-performance-owner@postgresql.org Mon Jan 17 17:54:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 15C153A3DD5 for ; Mon, 17 Jan 2005 17:54: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 32675-03 for ; Mon, 17 Jan 2005 17:54:44 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id AB9B93A3D88 for ; Mon, 17 Jan 2005 17:54:42 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0HHsVD01043; Mon, 17 Jan 2005 19:54:31 +0200 (EET) Message-ID: <41EBFDBF.9040105@faith.digsys.bg> Date: Mon, 17 Jan 2005 20:02:39 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! References: <41EBDBBB.3070301@faith.digsys.bg> <2253.1105978380@sss.pgh.pa.us> In-Reply-To: <2253.1105978380@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.068 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/207 X-Sequence-Number: 9897 Thanks, It worked. I have read in the docs what this "enable_hashagg" do, but I couldn't understand it. What does it change? From the Doc: ------- enable_hashagg (boolean) Enables or disables the query planner's use of hashed aggregation plan types. The default is on. This is used for debugging the query planner. -------- How it is used to debug the query planner? And why it lower the mem usage? Thank you in advance. Kaloyan Iliev Tom Lane wrote: >Kaloyan Iliev Iliev writes: > > >>I have the following problem. A week ago we've migrated from PGv7.2.3 to >>7.4.6. There were a lot of things in the apps to chenge but we made >>them. But one query doesn't want to run. In the old PGv7.2.3 it passes >>for 10 min. In the new one it gaves: >>DBD::Pg::st execute failed: ERROR: out of memory >> >> > >Does setting enable_hashagg to OFF fix it? > > regards, tom lane > > > > From pgsql-performance-owner@postgresql.org Mon Jan 17 18:08:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0818B3A3DC2 for ; Mon, 17 Jan 2005 18:08: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 34638-02 for ; Mon, 17 Jan 2005 18:08: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 EFF1B3A3D7B for ; Mon, 17 Jan 2005 18:08:37 +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 j0HI7Ku1003958; Mon, 17 Jan 2005 13:07:20 -0500 (EST) To: Kaloyan Iliev Iliev Cc: pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! In-reply-to: <41EBFDBF.9040105@faith.digsys.bg> References: <41EBDBBB.3070301@faith.digsys.bg> <2253.1105978380@sss.pgh.pa.us> <41EBFDBF.9040105@faith.digsys.bg> Comments: In-reply-to Kaloyan Iliev Iliev message dated "Mon, 17 Jan 2005 20:02:39 +0200" Date: Mon, 17 Jan 2005 13:07:20 -0500 Message-ID: <3957.1105985240@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: 200501/211 X-Sequence-Number: 9901 Kaloyan Iliev Iliev writes: > It worked. I have read in the docs what this "enable_hashagg" do, but I > couldn't understand it. What does it change? Your original 7.4 query plan has several HashAgg steps in it, which are doing aggregate/GROUP BY operations. The planner thinks that they will use only nominal amounts of memory because there are only a few distinct groups in each case. Evidently that is wrong and at least one of them is dealing with so many groups as to run out of memory. So the next question is have you ANALYZEd all of these tables recently? I wouldn't recommend turning off hashagg as a permanent solution, it was just a quickie to verify my suspicion of where the memory was going. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jan 17 18:07:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B15D33A3DF9 for ; Mon, 17 Jan 2005 18:07: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 34147-06 for ; Mon, 17 Jan 2005 18:07:31 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id B4C9E3A3DC5 for ; Mon, 17 Jan 2005 18:07:30 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0HI7MD01153; Mon, 17 Jan 2005 20:07:22 +0200 (EET) Message-ID: <41EC00C3.2040608@faith.digsys.bg> Date: Mon, 17 Jan 2005 20:15:31 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! References: <41EBDBBB.3070301@faith.digsys.bg> <2253.1105978380@sss.pgh.pa.us> In-Reply-To: <2253.1105978380@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------090402010803010000010803" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.133 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/210 X-Sequence-Number: 9900 This is a multi-part message in MIME format. --------------090402010803010000010803 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, I am asking the prev. question because there is no change in the query plan (as far as I see) but the mem usage decreases from 258M to 16M. Kaloyan Iliev Tom Lane wrote: >Kaloyan Iliev Iliev writes: > > >>I have the following problem. A week ago we've migrated from PGv7.2.3 to >>7.4.6. There were a lot of things in the apps to chenge but we made >>them. But one query doesn't want to run. In the old PGv7.2.3 it passes >>for 10 min. In the new one it gaves: >>DBD::Pg::st execute failed: ERROR: out of memory >> >> > >Does setting enable_hashagg to OFF fix it? > > regards, tom lane > > > > --------------090402010803010000010803 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,

I am asking the prev. question because there is no change in the query plan (as far as I see) but the mem usage decreases from 258M to 16M.

Kaloyan Iliev

Tom Lane wrote:
Kaloyan Iliev Iliev <news1@faith.digsys.bg> writes:
  
I have the following problem. A week ago we've migrated from PGv7.2.3 to 
7.4.6. There were a lot of things in the apps to chenge but we made 
them. But one query doesn't want to run. In the old PGv7.2.3 it passes 
for 10 min. In the new one it gaves:
DBD::Pg::st execute failed: ERROR:  out of memory
    

Does setting enable_hashagg to OFF fix it?

			regards, tom lane


  
--------------090402010803010000010803-- From pgsql-performance-owner@postgresql.org Mon Jan 17 18:20:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 480533A3E24 for ; Mon, 17 Jan 2005 18:16: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 35921-06 for ; Mon, 17 Jan 2005 18:16:44 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id F0CDA3A3DFE for ; Mon, 17 Jan 2005 18:16:44 +0000 (GMT) Received: (qmail 25865 invoked from network); 17 Jan 2005 19:16:52 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 17 Jan 2005 19:16:52 +0100 To: "Adrian Holovaty" , pgsql-performance@postgresql.org Subject: Re: Index on a function and SELECT DISTINCT References: <200501141232.13139.postgresql@holovaty.com> <20050117100942.692be97a.frank@wiles.org> <200501171159.24797.postgresql@holovaty.com> Message-ID: Date: Mon, 17 Jan 2005 19:17:57 +0100 From: PFC 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: <200501171159.24797.postgresql@holovaty.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.105 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200501/212 X-Sequence-Number: 9902 Try : EXPLAIN SELECT get_year_trunc(pub_date) as foo FROM ... GROUP BY foo Apart from that, you could use a materialized view... >> > db=# EXPLAIN SELECT DISTINCT get_year_trunc(pub_date) FROM > Ah, that makes sense. So is there a way to optimize SELECT DISTINCT > queries > that have no WHERE clause? > > Adrian > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > From pgsql-performance-owner@postgresql.org Mon Jan 17 18:49:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4B6033A3D02 for ; Mon, 17 Jan 2005 18:49: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 40620-09 for ; Mon, 17 Jan 2005 18:49:15 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id 902BB3A3E0E for ; Mon, 17 Jan 2005 18:49:12 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0HIn1D01349; Mon, 17 Jan 2005 20:49:01 +0200 (EET) Message-ID: <41EC0A86.5090001@faith.digsys.bg> Date: Mon, 17 Jan 2005 20:57:10 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! References: <41EBDBBB.3070301@faith.digsys.bg> <2253.1105978380@sss.pgh.pa.us> <41EBFDBF.9040105@faith.digsys.bg> <3957.1105985240@sss.pgh.pa.us> In-Reply-To: <3957.1105985240@sss.pgh.pa.us> 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.071 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/213 X-Sequence-Number: 9903 Tom Lane wrote: >I wouldn't recommend turning off hashagg as a permanent solution, it >was just a quickie to verify my suspicion of where the memory was going. > > > Hi, How to understant the upper sentence? I shouldn't turn "hashagg" off permanently for this query or for the entire database. For now I turn it off for this query, so it can work. If I shouldn't, then what should I do? Will ANALYZE resove this? Kaloyan Iliev From pgsql-performance-owner@postgresql.org Mon Jan 17 19:25:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E0243A3E64 for ; Mon, 17 Jan 2005 19:25: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 45044-07 for ; Mon, 17 Jan 2005 19:25:02 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id BE9863A3DF6 for ; Mon, 17 Jan 2005 19:25:03 +0000 (GMT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j0HJNkF4009251; Mon, 17 Jan 2005 14:23:47 -0500 (EST) To: Kaloyan Iliev Iliev Cc: pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! In-reply-to: <41EC0A86.5090001@faith.digsys.bg> References: <41EBDBBB.3070301@faith.digsys.bg> <2253.1105978380@sss.pgh.pa.us> <41EBFDBF.9040105@faith.digsys.bg> <3957.1105985240@sss.pgh.pa.us> <41EC0A86.5090001@faith.digsys.bg> Comments: In-reply-to Kaloyan Iliev Iliev message dated "Mon, 17 Jan 2005 20:57:10 +0200" Date: Mon, 17 Jan 2005 14:23:46 -0500 Message-ID: <9250.1105989826@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: 200501/214 X-Sequence-Number: 9904 Kaloyan Iliev Iliev writes: > Will ANALYZE resove this? Try it and find out. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jan 17 23:15:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B7C2E3A3DF0 for ; Mon, 17 Jan 2005 23:15: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 79218-06 for ; Mon, 17 Jan 2005 23:14:48 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 0F01D3A3EF9 for ; Mon, 17 Jan 2005 23:14:48 +0000 (GMT) Received: (qmail 16512 invoked from network); 17 Jan 2005 23:17:30 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 17 Jan 2005 23:17:30 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 14774-63 for ; Tue, 18 Jan 2005 06:17:29 +0700 (ICT) Received: (qmail 16503 invoked from network); 17 Jan 2005 23:17:29 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 17 Jan 2005 23:17:29 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Tue, 18 Jan 2005 06:17:29 +0700 Message-ID: <1106003849.41ec4789089f1@webmail.moph.go.th> Date: Tue, 18 Jan 2005 06:17:29 +0700 From: amrit@health2.moph.go.th To: William Yu Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/215 X-Sequence-Number: 9905 > >>Since the optimal state is to allocate a small amount of memory to > >>Postgres and leave a huge chunk to the OS cache, this means you are > >>already hitting the PAE penalty at 1.5GB of memory. > >> > > > > How could I change this hitting? > > Upgrade to 64-bit processors + 64-bit linux. Does the PAE help linux in handling the memory of more than 4 Gb limit in 32 bit archetech ? My intel server board could handle the mem of 12 Gb [according to intel spec.] and if I use Fedora C2 with PAE , will it useless for mem of more than >4Gb.? Any comment please? Amrit Thailand From pgsql-performance-owner@postgresql.org Mon Jan 17 23:36:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EC90F3A3FE0 for ; Mon, 17 Jan 2005 23:36: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 81545-08 for ; Mon, 17 Jan 2005 23:35:55 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 48F4E3A3F93 for ; Mon, 17 Jan 2005 23:35:56 +0000 (GMT) Received: (qmail 24421 invoked from network); 17 Jan 2005 23:35:21 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 17 Jan 2005 23:35:21 -0000 Message-ID: <41EC4C03.9020407@fastcrypt.com> Date: Mon, 17 Jan 2005 18:36:35 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: William Yu , PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> In-Reply-To: <1106003849.41ec4789089f1@webmail.moph.go.th> Content-Type: multipart/alternative; boundary="------------040902030305060607050601" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.08 tagged_above=0 required=5 tests=AWL, HTML_40_50, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/216 X-Sequence-Number: 9906 This is a multi-part message in MIME format. --------------040902030305060607050601 Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit Amrit, It's not useless, it's just not optimal. All operating systems, FC2, FC3, .... will have the same problem with greater than 4G of memory on a 32 bit processor. The *only* way to avoid this is to go to a 64 bit processor (opteron) and then for greater performance use a linux distribution compiled for a 64bit processor. Have you identified and optimized the queries, are you sure you need more memory? Dave amrit@health2.moph.go.th wrote: >>>>Since the optimal state is to allocate a small amount of memory to >>>>Postgres and leave a huge chunk to the OS cache, this means you are >>>>already hitting the PAE penalty at 1.5GB of memory. >>>> >>>> >>>> >>>How could I change this hitting? >>> >>> >>Upgrade to 64-bit processors + 64-bit linux. >> >> > >Does the PAE help linux in handling the memory of more than 4 Gb limit in 32 bit >archetech ? My intel server board could handle the mem of 12 Gb [according to >intel spec.] and if I use Fedora C2 with PAE , will it useless for mem of more >than >4Gb.? > >Any comment please? >Amrit >Thailand > > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 --------------040902030305060607050601 Content-Type: text/html; charset=TIS-620 Content-Transfer-Encoding: 7bit Amrit,

It's not useless, it's just not optimal.

All operating systems, FC2, FC3, .... will have the same problem with
greater than 4G of memory on a 32 bit processor.

The *only* way to avoid this is to go to a 64 bit processor (opteron) and then
for greater performance use a linux distribution compiled for a 64bit processor.

Have you identified and optimized the queries, are you sure you need more memory?

Dave

amrit@health2.moph.go.th wrote:
Since the optimal state is to allocate a small amount of memory to
Postgres and leave a huge chunk to the OS cache, this means you are
already hitting the PAE penalty at 1.5GB of memory.

        
How could I change this hitting?
      
Upgrade to 64-bit processors + 64-bit linux.
    

Does the PAE help linux in handling the memory of more than 4 Gb limit in 32 bit
archetech ? My intel server board could handle the mem of 12 Gb [according to
intel spec.] and if I use Fedora C2 with PAE , will it useless for mem of more
than >4Gb.?

Any comment please?
Amrit
Thailand


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


  

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
--------------040902030305060607050601-- From pgsql-performance-owner@postgresql.org Tue Jan 18 00:13:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E02EE3A3FB3 for ; Tue, 18 Jan 2005 00:12: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 86252-08 for ; Tue, 18 Jan 2005 00:12:51 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 5A1AE3A3F0C for ; Tue, 18 Jan 2005 00:12:52 +0000 (GMT) Received: (qmail 28882 invoked from network); 18 Jan 2005 00:12:48 -0000 Received: from 218-101-12-245.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.245) by 0 with SMTP; 18 Jan 2005 00:12:48 -0000 Message-ID: <41EC556F.6030604@coretech.co.nz> Date: Tue, 18 Jan 2005 13:16:47 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: William Yu , PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> In-Reply-To: <1106003849.41ec4789089f1@webmail.moph.go.th> 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: 200501/217 X-Sequence-Number: 9907 amrit@health2.moph.go.th wrote: > > Does the PAE help linux in handling the memory of more than 4 Gb limit in 32 bit > archetech ? My intel server board could handle the mem of 12 Gb [according to > intel spec.] and if I use Fedora C2 with PAE , will it useless for mem of more > than >4Gb.? > > Any comment please? > I understand that the 2.6.* kernels are much better at large memory support (with respect to performance issues), so unless you have a 64-bit machine lying around - this is probably worth a try. You may need to build a new kernel with the various parameters : CONFIG_NOHIGHMEM CONFIG_HIGHMEM4G CONFIG_HIGHMEM64G set appropriately (or even upgrade to the latest 2.6.10). I would expect that some research and experimentation will be required to get the best out of it - (e.g. the 'bounce buffers' issue). regards Mark From pgsql-performance-owner@postgresql.org Tue Jan 18 02:33:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DE4F3A4030 for ; Tue, 18 Jan 2005 02: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 04139-08 for ; Tue, 18 Jan 2005 02:32:30 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 418E13A401F for ; Tue, 18 Jan 2005 02:32:32 +0000 (GMT) Received: (qmail 6128 invoked from network); 18 Jan 2005 02:35:15 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 18 Jan 2005 02:35:15 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 04245-31 for ; Tue, 18 Jan 2005 09:35:13 +0700 (ICT) Received: (qmail 6113 invoked from network); 18 Jan 2005 02:35:13 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 18 Jan 2005 02:35:13 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Tue, 18 Jan 2005 09:35:12 +0700 Message-ID: <1106015712.41ec75e0e1e7f@webmail.moph.go.th> Date: Tue, 18 Jan 2005 09:35:12 +0700 From: amrit@health2.moph.go.th To: Mark Kirkwood Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> <41EC556F.6030604@coretech.co.nz> In-Reply-To: <41EC556F.6030604@coretech.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/218 X-Sequence-Number: 9908 > I understand that the 2.6.* kernels are much better at large memory > support (with respect to performance issues), so unless you have a > 64-bit machine lying around - this is probably worth a try. > > You may need to build a new kernel with the various parameters : > > CONFIG_NOHIGHMEM > CONFIG_HIGHMEM4G > CONFIG_HIGHMEM64G > > set appropriately (or even upgrade to the latest 2.6.10). I would expect > that some research and experimentation will be required to get the best > out of it - (e.g. the 'bounce buffers' issue). In the standard rpm FC 2-3 with a newly install server , would it automatically detect and config it if I use the mechine with > 4 Gb [6Gb.] or should I manually config it? Amrit Thailand From pgsql-performance-owner@postgresql.org Tue Jan 18 02:41:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 823A33A4054 for ; Tue, 18 Jan 2005 02:38: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 05449-06 for ; Tue, 18 Jan 2005 02:38:38 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 8752D3A403B for ; Tue, 18 Jan 2005 02:38:40 +0000 (GMT) Received: (qmail 3112 invoked from network); 18 Jan 2005 02:38:40 -0000 Received: from 218-101-12-245.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.245) by 0 with SMTP; 18 Jan 2005 02:38:40 -0000 Message-ID: <41EC779E.7020804@coretech.co.nz> Date: Tue, 18 Jan 2005 15:42:38 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> <41EC556F.6030604@coretech.co.nz> <1106015712.41ec75e0e1e7f@webmail.moph.go.th> In-Reply-To: <1106015712.41ec75e0e1e7f@webmail.moph.go.th> 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: 200501/219 X-Sequence-Number: 9909 amrit@health2.moph.go.th wrote: > > In the standard rpm FC 2-3 with a newly install server , would it automatically > detect and config it if I use the mechine with > 4 Gb [6Gb.] or should I > manually config it? > Amrit > Thailand Good question. I dont have FC2-3 here to check. I recommend firing off a question to fedora-list@redhat.com (you need to subscribe first): http://www.redhat.com/mailman/listinfo/fedora-list best wishes Mark From pgsql-performance-owner@postgresql.org Tue Jan 18 03:06:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 089333A4057 for ; Tue, 18 Jan 2005 03:03: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 11080-02 for ; Tue, 18 Jan 2005 03:03:18 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id B740D3A401F for ; Tue, 18 Jan 2005 03:03:19 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 8226C3196B; Tue, 18 Jan 2005 04:03:19 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Date: Mon, 17 Jan 2005 19:03:18 -0800 Organization: Hub.Org Networking Services Lines: 33 Message-ID: References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> <41EC556F.6030604@coretech.co.nz> <1106015712.41ec75e0e1e7f@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <1106015712.41ec75e0e1e7f@webmail.moph.go.th> 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: 200501/220 X-Sequence-Number: 9910 My experience is RH9 auto detected machines >= 2GB of RAM and installs the PAE bigmem kernel by default. I'm pretty sure the FC2/3 installer will do the same. amrit@health2.moph.go.th wrote: >>I understand that the 2.6.* kernels are much better at large memory >>support (with respect to performance issues), so unless you have a >>64-bit machine lying around - this is probably worth a try. >> >>You may need to build a new kernel with the various parameters : >> >>CONFIG_NOHIGHMEM >>CONFIG_HIGHMEM4G >>CONFIG_HIGHMEM64G >> >>set appropriately (or even upgrade to the latest 2.6.10). I would expect >>that some research and experimentation will be required to get the best >>out of it - (e.g. the 'bounce buffers' issue). > > > In the standard rpm FC 2-3 with a newly install server , would it automatically > detect and config it if I use the mechine with > 4 Gb [6Gb.] or should I > manually config it? > Amrit > Thailand > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Tue Jan 18 07:49:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 668AB3A428C for ; Tue, 18 Jan 2005 07: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 62897-04 for ; Tue, 18 Jan 2005 07:48:50 +0000 (GMT) Received: from ar-sd.net (unknown [82.77.155.72]) by svr1.postgresql.org (Postfix) with ESMTP id E1E683A4287 for ; Tue, 18 Jan 2005 07:48:49 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id C9B72163A6; Tue, 18 Jan 2005 09:44:35 +0200 (EET) Received: from ar-sd.net ([127.0.0.1]) by localhost (linz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06731-06; Tue, 18 Jan 2005 09:44:32 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id BA271E998; Tue, 18 Jan 2005 09:44:31 +0200 (EET) Message-ID: <002801c4fd32$2617c2a0$0b00a8c0@forge> From: "Andrei Bintintan" To: "Tom Lane" Cc: References: <016801c4fcb5$cb36e8b0$0b00a8c0@forge> <3851.1105984549@sss.pgh.pa.us> Subject: Re: Optimizing this count query Date: Tue, 18 Jan 2005 09:48:47 +0200 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 ar-sd.net 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: 200501/221 X-Sequence-Number: 9911 I have to do all the joins because in the where cause I can also have other conditions that are related to the other tables. For example: ....WHERE o.id_status>3 AND o.id_ag=72 AND v.id_worker=5 AND z.id=10. Now if these search functions are IN then the query runs faster. One thing I could do at this point is not to make the join if that table is not needed in the where clause. This is the explain analize for the first query. Aggregate (cost=37182.56..37182.56 rows=1 width=4) (actual time=3032.126..3032.126 rows=1 loops=1) -> Hash Join (cost=27279.22..37079.68 rows=41154 width=4) (actual time=662.600..2999.845 rows=42835 loops=1) Hash Cond: ("outer".id_endkunde = "inner".id) -> Hash Join (cost=25770.48..34068.10 rows=41153 width=8) (actual time=561.112..2444.574 rows=42835 loops=1) Hash Cond: ("outer".id_worker = "inner".id) -> Hash Join (cost=25759.54..33326.98 rows=41151 width=12) (actual time=560.514..2361.776 rows=42835 loops=1) Hash Cond: ("outer".id_ag = "inner".id) -> Hash Join (cost=25587.07..32331.51 rows=41150 width=16) (actual time=551.505..2240.217 rows=42835 loops=1) Hash Cond: ("outer".id_status = "inner".id) -> Hash Join (cost=25586.00..31713.18 rows=41150 width=20) (actual time=551.418..2150.224 rows=42835 loops=1) Hash Cond: ("outer".id_zufriden = "inner".id) -> Hash Join (cost=25584.85..31094.78 rows=41150 width=24) (actual time=551.341..2057.142 rows=42835 loops=1) Hash Cond: ("outer".id_plannung = "inner".id) -> Hash Join (cost=24135.60..27869.53 rows=41149 width=24) (actual time=415.189..1162.429 rows=42835 loops=1) Hash Cond: ("outer".id = "inner".id_order) -> Seq Scan on orders o (cost=0.00..2058.54 rows=42527 width=20) (actual time=0.046..93.692 rows=42835 loops=1) Filter: (id_status > 3) -> Hash (cost=23860.48..23860.48 rows=42848 width=8) (actual time=414.923..414.923 rows=0 loops=1) -> Seq Scan on report r (cost=0.00..23860.48 rows=42848 width=8) (actual time=282.905..371.401 rows=42848 loops=1) -> Hash (cost=1050.80..1050.80 rows=62180 width=8) (actual time=133.505..133.505 rows=0 loops=1) -> Seq Scan on plannung v (cost=0.00..1050.80 rows=62180 width=8) (actual time=0.034..73.048 rows=62180 loops=1) -> Hash (cost=1.12..1.12 rows=12 width=4) (actual time=0.048..0.048 rows=0 loops=1) -> Seq Scan on zufriden z (cost=0.00..1.12 rows=12 width=4) (actual time=0.027..0.040 rows=12 loops=1) -> Hash (cost=1.06..1.06 rows=6 width=4) (actual time=0.045..0.045 rows=0 loops=1) -> Seq Scan on status s (cost=0.00..1.06 rows=6 width=4) (actual time=0.032..0.037 rows=6 loops=1) -> Hash (cost=161.57..161.57 rows=4357 width=4) (actual time=8.973..8.973 rows=0 loops=1) -> Seq Scan on contact c (cost=0.00..161.57 rows=4357 width=4) (actual time=0.032..5.902 rows=4357 loops=1) -> Hash (cost=10.84..10.84 rows=42 width=4) (actual time=0.557..0.557 rows=0 loops=1) -> Hash Join (cost=1.51..10.84 rows=42 width=4) (actual time=0.182..0.523 rows=41 loops=1) Hash Cond: ("outer".id = "inner".id_person) -> Seq Scan on person p (cost=0.00..7.66 rows=166 width=4) (actual time=0.027..0.216 rows=166 loops=1) -> Hash (cost=1.41..1.41 rows=41 width=8) (actual time=0.125..0.125 rows=0 loops=1) -> Seq Scan on mpsworker w (cost=0.00..1.41 rows=41 width=8) (actual time=0.038..0.086 rows=41 loops=1) -> Hash (cost=1245.99..1245.99 rows=44299 width=4) (actual time=101.257..101.257 rows=0 loops=1) -> Seq Scan on endkunde e (cost=0.00..1245.99 rows=44299 width=4) (actual time=0.050..59.641 rows=44301 loops=1) Total runtime: 3033.230 ms Thanks for help. Andy. ----- Original Message ----- From: "Tom Lane" To: "Andrei Bintintan" Cc: Sent: Monday, January 17, 2005 7:55 PM Subject: Re: [PERFORM] Optimizing this count query > "Andrei Bintintan" writes: >> SELECT count(o.id) FROM orders o >> INNER JOIN report r ON o.id=r.id_order >> INNER JOIN status s ON o.id_status=s.id >> INNER JOIN contact c ON o.id_ag=c.id >> INNER JOIN endkunde e ON o.id_endkunde=e.id >> INNER JOIN zufriden z ON r.id_zufriden=z.id >> INNER JOIN plannung v ON v.id=o.id_plannung >> INNER JOIN mpsworker w ON v.id_worker=w.id >> INNER JOIN person p ON p.id = w.id_person >> WHERE o.id_status>3 > >> I'm asking how can I improve the execution time of this query, because = >> these tables are always increasing. And this count sometimes takes more = >> than 10 secs and I need to run this count very offen. > > Unless you've increased the default value of join_collapse_limit, this > construction will be forcing the join order; see > http://www.postgresql.org/docs/7.4/static/explicit-joins.html > > I'm not sure if you can improve the join order at all --- since you only > showed EXPLAIN and not EXPLAIN ANALYZE, it's hard to be sure whether any > of the steps are producing large intermediate results. But it's > something to look into. > > You should also ask yourself if you need to be joining so many tables at > all. The planner seems to think that only the o/r join is really going > to affect the result row count. I can't tell if it's right or not, but > if this is a star schema and the other seven tables are just detail > tables, you don't need them in order to obtain a count. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > From pgsql-performance-owner@postgresql.org Fri Jan 21 04:46:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 46DAB3A1CFE for ; Tue, 18 Jan 2005 10:39: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 86345-10 for ; Tue, 18 Jan 2005 10:39:11 +0000 (GMT) Received: from druid.net (druid.net [216.126.72.98]) by svr1.postgresql.org (Postfix) with ESMTP id 670A33A1AC7 for ; Tue, 18 Jan 2005 10:39:12 +0000 (GMT) Received: from imp.druid.net (imp [216.126.72.111]) by druid.net (Postfix) with SMTP id 0921B1A55; Tue, 18 Jan 2005 05:39:12 -0500 (EST) Date: Tue, 18 Jan 2005 05:38:42 -0500 From: "D'Arcy J.M. Cain" To: pg@fastcrypt.com Cc: amrit@health2.moph.go.th, wyu@talisys.com, pgsql-performance@postgresql.org Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Message-Id: <20050118053842.4c519be3.darcy@NetBSD.org> In-Reply-To: <41EC4C03.9020407@fastcrypt.com> References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> <41EC4C03.9020407@fastcrypt.com> Reply-To: darcy@NetBSD.org Organization: The NetBSD Project X-Mailer: Sylpheed version 1.0.0beta3 (GTK+ 1.2.10; i386--netbsdelf) 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: 200501/365 X-Sequence-Number: 10055 On Mon, 17 Jan 2005 18:36:35 -0500 Dave Cramer wrote: > The *only* way to avoid this is to go to a 64 bit processor (opteron) > and then > for greater performance use a linux distribution compiled for a 64bit > processor. Or NetBSD (http://www.NetBSD.org/) which has been 64 bit clean since 1995 and has had the Opteron port integrated in its main tree (not as patches to or a separate tree) since April 2003. -- D'Arcy J.M. Cain http://www.NetBSD.org/ From pgsql-performance-owner@postgresql.org Tue Jan 18 12:00:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A82153A1D6C for ; Tue, 18 Jan 2005 12:00: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 97054-03 for ; Tue, 18 Jan 2005 12:00:31 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by svr1.postgresql.org (Postfix) with ESMTP id 3DF4F3A19EC for ; Tue, 18 Jan 2005 12:00:33 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so1035107wri for ; Tue, 18 Jan 2005 04:00:33 -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=uUdNSuT7GtAeyz7Lt3CRD3opwEhGaJ9CVwOyINMQgzgVae27EM5p7yjoAFWZGynA1uefnaEZ1TFwYUl7i+5mrSJQXmsJbdTwgf181uGD6GabDElj0nJjrFjYpXNksYmp/CblLvcIGNlqVVvoQGSlFk7hwrcsUKcV1m0rE9uVDDI= Received: by 10.54.21.37 with SMTP id 37mr7614wru; Tue, 18 Jan 2005 04:00:33 -0800 (PST) Received: by 10.54.4.50 with HTTP; Tue, 18 Jan 2005 04:00:33 -0800 (PST) Message-ID: <1eae200b05011804005a550a03@mail.gmail.com> Date: Tue, 18 Jan 2005 13:00:33 +0100 From: Martin Tedjawardhana Reply-To: Martin Tedjawardhana To: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql In-Reply-To: <1106015712.41ec75e0e1e7f@webmail.moph.go.th> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1105501768.41e49e484d779@webmail.moph.go.th> <1105837366.41e9bd36c7de9@webmail.moph.go.th> <1106003849.41ec4789089f1@webmail.moph.go.th> <41EC556F.6030604@coretech.co.nz> <1106015712.41ec75e0e1e7f@webmail.moph.go.th> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.74 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/222 X-Sequence-Number: 9912 Why dont you just grab the latest stable kernel from kernel.org, customize it, compile it and the see what happens? On Tue, 18 Jan 2005 09:35:12 +0700, amrit@health2.moph.go.th wrote: > > I understand that the 2.6.* kernels are much better at large memory > > support (with respect to performance issues), so unless you have a > > 64-bit machine lying around - this is probably worth a try. > > > > You may need to build a new kernel with the various parameters : > > > > CONFIG_NOHIGHMEM > > CONFIG_HIGHMEM4G > > CONFIG_HIGHMEM64G > > > > set appropriately (or even upgrade to the latest 2.6.10). I would expect > > that some research and experimentation will be required to get the best > > out of it - (e.g. the 'bounce buffers' issue). > > In the standard rpm FC 2-3 with a newly install server , would it automatically > detect and config it if I use the mechine with > 4 Gb [6Gb.] or should I > manually config it? > Amrit > Thailand > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Tue Jan 18 13:05:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3CB4B3A18A8 for ; Tue, 18 Jan 2005 13:05: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 10260-07 for ; Tue, 18 Jan 2005 13:04:57 +0000 (GMT) Received: from pfepb.post.tele.dk (pfepb.post.tele.dk [195.41.46.236]) by svr1.postgresql.org (Postfix) with ESMTP id 84B713A18A7 for ; Tue, 18 Jan 2005 13:04:57 +0000 (GMT) Received: from freedom (0x535b8898.taanxx1.adsl-dhcp.tele.dk [83.91.136.152]) by pfepb.post.tele.dk (Postfix) with SMTP id 44F2A5EE065; Tue, 18 Jan 2005 14:04:51 +0100 (CET) Message-ID: <011901c4fd5e$4b465470$63070080@freedom> From: "Nicolai Petri (lists)" To: "William Yu" , References: <1105501768.41e49e484d779@webmail.moph.go.th> <200501160944.47511.josh@agliodbs.com> Subject: Re: Increasing RAM for more than 4 Gb. using postgresql Date: Tue, 18 Jan 2005 14:04:45 +0100 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: 200501/223 X-Sequence-Number: 9913 This must be a linux'ism because to my knowledge FreeBSD does not keep the os-cache mapped into the kernel address space unless it have active objects associated with the data. And FreeBSD also have a default split of 3GB userspace and 1GB. kernelspace when running with a default configuration. Linux people might want to try other os'es to compare the performance. Best regards, Nicolai Petri Ps. Sorry for my lame MS mailer - quoting is not something it knows how to do. :) ----- Original Message ----- From: "William Yu" >I inferred this from reading up on the compressed vm project. It can be >higher or lower depending on what devices you have in your system -- > however, I've read messages from kernel hackers saying Linux is very > aggressive in reserving memory space for devices because it must be > allocated at boottime. > > > > Josh Berkus wrote: >> William, >> >> >>>The theshold for using PAE is actually far lower than 4GB. 4GB is the >>>total memory address space -- split that in half for 2GB for userspace, >>>2GB for kernel. The OS cache resides in kernel space -- after you take >>>alway the memory allocation for devices, you're left with a window of >>>roughly 900MB. >> >> >> I'm curious, how do you get 1.1GB for memory allocation for devices? >> From pgsql-performance-owner@postgresql.org Tue Jan 18 13:35:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7CC7F3A18BF for ; Tue, 18 Jan 2005 13:35: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 15003-03 for ; Tue, 18 Jan 2005 13:35:15 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id 0D1383A18C6 for ; Tue, 18 Jan 2005 13:35:15 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0IDYrD10043; Tue, 18 Jan 2005 15:34:53 +0200 (EET) Message-ID: <41ED126F.7090206@faith.digsys.bg> Date: Tue, 18 Jan 2005 15:43:11 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Performance problem from migrating between versions! References: <41EBDBBB.3070301@faith.digsys.bg> <2253.1105978380@sss.pgh.pa.us> <41EBFDBF.9040105@faith.digsys.bg> <3957.1105985240@sss.pgh.pa.us> <41EC0A86.5090001@faith.digsys.bg> <9250.1105989826@sss.pgh.pa.us> In-Reply-To: <9250.1105989826@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------030804060902090508010807" 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, HTML_50_60, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/224 X-Sequence-Number: 9914 This is a multi-part message in MIME format. --------------030804060902090508010807 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, I try it and it doesn't resolve the problem:( So, now what? To leave it that way for this query or .... There must be permanent solution because if other queries behave like that? Kaloyan Iliev Tom Lane wrote: >Kaloyan Iliev Iliev writes: > > >>Will ANALYZE resove this? >> >> > >Try it and find out. > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 8: explain analyze is your friend > > > > --------------030804060902090508010807 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Hi,

I try it and it doesn't resolve the problem:(
So, now what? To leave it that way for this query or .... There must be permanent solution because if other queries behave like that?

Kaloyan Iliev


Tom Lane wrote:
Kaloyan Iliev Iliev <news1@faith.digsys.bg> writes:
  
Will ANALYZE resove this?
    

Try it and find out.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


  
--------------030804060902090508010807-- From pgsql-performance-owner@postgresql.org Wed Jan 19 09:15:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 03F7E3A2D4A for ; Wed, 19 Jan 2005 09:15: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 57121-01 for ; Wed, 19 Jan 2005 09:14:58 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 15D2C3A2CAB for ; Wed, 19 Jan 2005 09:14:57 +0000 (GMT) Received: (qmail 25375 invoked from network); 18 Jan 2005 17:10:36 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 18 Jan 2005 17:10:36 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 24688-55 for ; Wed, 19 Jan 2005 00:10:35 +0700 (ICT) Received: (qmail 28000 invoked from network); 18 Jan 2005 14:38:26 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 18 Jan 2005 14:38:26 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Tue, 18 Jan 2005 21:38:26 +0700 Message-ID: <1106059106.41ed1f6296062@webmail.moph.go.th> Date: Tue, 18 Jan 2005 21:38:26 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <200501160944.47511.josh@agliodbs.com> <011901c4fd5e$4b465470$63070080@freedom> In-Reply-To: <011901c4fd5e$4b465470$63070080@freedom> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/229 X-Sequence-Number: 9919 I would like to upgrade both OS kernel and PGsql version , so in my opinion the best way to handle it is to *backup* the data in .tar and use a newly install 2.6 OS linux [ from 2.4.9] with build in PGsql 7.4.6 rpm[ from 7.3.2] and may up the ram to 6 GB. and *restore* the data again. I wonder whether the PAE [physical address ext.] will be put in place and could I use the RAM for more than 4 Gb. Does any one have different idea ? Since upgrade to Operon 64 Bit needs a lot of money , I may postpone it for a couple while. Any comment ,please. Amrit Thailand From pgsql-performance-owner@postgresql.org Fri Jan 21 04:44:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EA9113A2995 for ; Tue, 18 Jan 2005 21:32: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 73575-04 for ; Tue, 18 Jan 2005 21:32:21 +0000 (GMT) Received: from asia.telenet-ops.be (asia.telenet-ops.be [195.130.132.59]) by svr1.postgresql.org (Postfix) with ESMTP id A5B1E3A2957 for ; Tue, 18 Jan 2005 21:32:21 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by asia.telenet-ops.be (Postfix) with SMTP id 635F72240B1 for ; Tue, 18 Jan 2005 22:32:18 +0100 (MET) Received: from Bolletje (d54C2921B.access.telenet.be [84.194.146.27]) by asia.telenet-ops.be (Postfix) with ESMTP id 3F1CE22401E for ; Tue, 18 Jan 2005 22:32:18 +0100 (MET) Reply-To: From: "Matt Casters" To: Subject: DWH on Postgresql Date: Tue, 18 Jan 2005 22:32:14 +0100 Organization: i-Bridge bvba MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0000_01C4FDAD.8EF7F1C0" X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcT9pSzCtxMdfL50SImWlq07kPMM8A== Message-Id: <20050118213218.3F1CE22401E@asia.telenet-ops.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.778 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_60_70, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200501/364 X-Sequence-Number: 10054 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C4FDAD.8EF7F1C0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I have the go ahead of a customer to do some testing on Postgresql in a couple of weeks as a replacement for Oracle. The reason for the test is that the number of users of the warehouse is going to increase and this will have a serious impact on licencing costs. (I bet that sounds familiar) We're running a medium sized data warehouse on a Solaris box (4CPU, 8Gb RAM) on Oracle. Basically we have 2 large fact tables to deal with: one going for 400M rows, the other will be hitting 1B rows soon. (around 250Gb of data) My questions to the list are: has this sort of thing been attempted before? If so, what where the results? I've been reading up on partitioned tabes on pgsql, will the performance benefit will be comparable to Oracle partitioned tables? What are the gotchas? Should I be testing on 8 or the 7 version? Thanks in advance for any help you may have, I'll do my best to keep pgsql-performance up to date on the results. Best regards, Matt ___________________________________________ Matt Casters i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 OKEGEM, Belgium Tel. 054/25.01.37 GSM 0486/97.29.37 ------=_NextPart_000_0000_01C4FDAD.8EF7F1C0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi,
 
I have = the go ahead=20 of a customer to do some testing on Postgresql in a couple of weeks as a = replacement for Oracle.
The = reason for the=20 test is that the number of users of the warehouse is going to increase = and this=20 will have a serious impact on licencing costs. (I bet that sounds=20 familiar)
 
We're running a medium = sized data=20 warehouse on a Solaris box (4CPU, 8Gb RAM) on Oracle.
Basically we have 2 large fact tables=20 to deal with: one going for 400M rows, the other will = be=20 hitting 1B rows soon.
(around 250Gb of=20 data)
 
My = questions to the=20 list are: has this sort of thing been attempted before? If so, what = where=20 the results?
I've = been reading up=20 on partitioned tabes on pgsql, will the performance benefit will be = comparable=20 to Oracle partitioned tables?
What = are the=20 gotchas?  Should I be testing on 8 or the 7 = version?
 
Thanks = in=20 advance for any help you may have, I'll do my best to keep=20 pgsql-performance up to date on the results.
 
Best=20 regards,
 
Matt
___________________________________________
Matt Casters
i-Bridge bvba, http://www.kettle.be
Fonteinstraat 70, = 9400 OKEGEM, Belgium
Tel. = 054/25.01.37
GSM = 0486/97.29.37
 
 
------=_NextPart_000_0000_01C4FDAD.8EF7F1C0-- From pgsql-performance-owner@postgresql.org Tue Jan 18 22:03:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAF643A298E for ; Tue, 18 Jan 2005 22:03: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 76164-08 for ; Tue, 18 Jan 2005 22:03:47 +0000 (GMT) Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) by svr1.postgresql.org (Postfix) with ESMTP id B40483A29A4 for ; Tue, 18 Jan 2005 22:03:47 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 1DD79C727 for ; Wed, 19 Jan 2005 06:03:45 +0800 (WST) Received: from vscan02.westnet.com.au ([127.0.0.1]) by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15923-15 for ; Wed, 19 Jan 2005 06:03:45 +0800 (WST) Received: from mapping12 (dsl-202-173-155-79.vic.westnet.com.au [202.173.155.79]) by vscan02.westnet.com.au (Postfix) with ESMTP id 83426C153 for ; Wed, 19 Jan 2005 06:03:44 +0800 (WST) From: "Benjamin Wragg" To: Subject: Disk configuration Date: Wed, 19 Jan 2005 09:03:44 +1100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0043_01C4FE05.C7780640" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 thread-index: AcT9qZOEaKOHl7TYQE2pRyMpIuYWZw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-Id: <20050118220344.83426C153@vscan02.westnet.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.192 tagged_above=0 required=5 tests=AWL, HTML_60_70, HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML X-Spam-Level: X-Archive-Number: 200501/225 X-Sequence-Number: 9915 This is a multi-part message in MIME format. ------=_NextPart_000_0043_01C4FE05.C7780640 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: 7bit I just wanted to bounce off the list the best way to configure disks for a postgresql server. My gut feeling is as follows: Keep the OS and postgresql install on seperate disks to the postgresql /data directory? Is a single hard disk drive acceptable for the OS and postgresql program, or will this create a bottle neck? Would a multi disk array be more appropriate? Cheers, Benjamin Wragg -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 ------=_NextPart_000_0043_01C4FE05.C7780640 Content-Type: text/html; charset="windows-1250" Content-Transfer-Encoding: quoted-printable
I just = wanted to=20 bounce off the list the best way to configure disks for a postgresql = server.=20 My gut=20 feeling is as follows:
 
Keep = the OS and=20 postgresql install on seperate disks to the postgresql /data=20 directory?
Is a = single hard=20 disk drive acceptable for the OS and postgresql program, or will this = create a=20 bottle neck? Would a multi disk array be more = appropriate?
 
Cheers,
 
Benjamin=20 Wragg

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: = 17/01/2005

------=_NextPart_000_0043_01C4FE05.C7780640-- From pgsql-performance-owner@postgresql.org Tue Jan 18 22:45:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4D4803A2B99 for ; Tue, 18 Jan 2005 22:45: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 81089-07 for ; Tue, 18 Jan 2005 22:45:28 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id C4CC83A2C1B for ; Tue, 18 Jan 2005 22:45:29 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6923037; Tue, 18 Jan 2005 14:47:09 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Benjamin Wragg" Subject: Re: Disk configuration Date: Tue, 18 Jan 2005 14:49:21 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <20050118220344.83426C153@vscan02.westnet.com.au> In-Reply-To: <20050118220344.83426C153@vscan02.westnet.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501181449.21224.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/226 X-Sequence-Number: 9916 Benjamin, > I just wanted to bounce off the list the best way to configure disks for a > postgresql server. My gut feeling is as follows: > > Keep the OS and postgresql install on seperate disks to the postgresql > /data directory? > Is a single hard disk drive acceptable for the OS and postgresql program, > or will this create a bottle neck? Would a multi disk array be more > appropriate? All of this depends heavily on your database size, read/write balance, and transaction volume. For example, the PostgreSQL Press list runs fine on my single-drive IDE laptop (1 user, < 2mb database) but I wouldn't run the DBT2 (high-volume OLTP test) on it. More info? -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 18 22:49:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C68693A29B0 for ; Tue, 18 Jan 2005 22:49: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 82187-03 for ; Tue, 18 Jan 2005 22:49:27 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id E52D33A295C for ; Tue, 18 Jan 2005 22:49:29 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id BE06568015 for ; Tue, 18 Jan 2005 16:47:30 -0600 (CST) Message-ID: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> From: "Kevin Schroeder" To: Subject: Swapping on Solaris Date: Tue, 18 Jan 2005 16:49:35 -0600 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-Archive-Number: 200501/227 X-Sequence-Number: 9917 Hello, I'm running PostgreSQL on a Solaris 8 system with 2GB of RAM and I'm having some difficulty getting PostgreSQL to use the available RAM. My RAM settings in postgresql.conf are shared_buffers = 8192 # min 16, at least max_connections*2, 8KB each sort_mem = 131072 # min 64, size in KB vacuum_mem = 131072 # min 1024, size in KB Ignoring the fact that the sort and vacuum numbers are really high, this is what Solaris shows me when running top: Memory: 2048M real, 1376M free, 491M swap in use, 2955M swap free For some reason I have 1.25GB of free RAM but PostgreSQL seems compelled to swap to the hard drive rather than use that RAM. I have the shared buffers set as high as the Solaris kernel will let me. I also know that Solaris will cache frequently used files in RAM, thereby lowering the amount of RAM available to an application, but my understanding is that Solaris will dump that cache if an application or the kernel itself requires it. The system has about 1,000 active email users using unix mailboxes which could what is keeping the database from exploiting as much RAM as available but my primary concern is to allow PostgreSQL to use as much RAM as it requires without swapping. What can I do to force the system to allow PostgreSQL to do this? Regards, Kevin Schroeder From pgsql-performance-owner@postgresql.org Wed Jan 19 07:37:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A02C33A2B22 for ; Wed, 19 Jan 2005 07:37: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 42102-06 for ; Wed, 19 Jan 2005 07:37:02 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id C03F63A25A3 for ; Wed, 19 Jan 2005 07:37:01 +0000 (GMT) Received: (qmail 2778 invoked from network); 19 Jan 2005 07:36:56 -0000 Received: from 218-101-12-253.paradise.net.nz (HELO ?192.168.1.11?) (218.101.12.253) by 0 with SMTP; 19 Jan 2005 07:36:56 -0000 Message-ID: <41EE0F05.9080901@coretech.co.nz> Date: Wed, 19 Jan 2005 20:40:53 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Schroeder Cc: pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> In-Reply-To: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> 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: 200501/228 X-Sequence-Number: 9918 Kevin Schroeder wrote: > > > Ignoring the fact that the sort and vacuum numbers are really high, this > is what Solaris shows me when running top: > > Memory: 2048M real, 1376M free, 491M swap in use, 2955M swap free > Maybe check the swap usage with 'swap -l' which reports reliably if any (device or file) swap is actually used. I think Solaris 'top' does some strange accounting to calculate the 'swap in use' value (like including used memory). It looks to me like you are using no (device or file) swap at all, and have 1.3G of real memory free, so could in fact give Postgres more of it :-) regards Mark From pgsql-performance-owner@postgresql.org Wed Jan 19 09:57:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EAA063A2BF1 for ; Wed, 19 Jan 2005 09:57: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 60376-03 for ; Wed, 19 Jan 2005 09:57:13 +0000 (GMT) Received: from zeus.linuxsystems.be (zeus.linuxsystems.be [213.193.231.130]) by svr1.postgresql.org (Postfix) with ESMTP id DB2FC3A2B9E for ; Wed, 19 Jan 2005 09:57:11 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id 6F2A63B07F1 for ; Wed, 19 Jan 2005 10:57:10 +0100 (CET) Received: from zeus.linuxsystems.be ([127.0.0.1]) by localhost (zeus [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 10608-09 for ; Wed, 19 Jan 2005 10:57:10 +0100 (CET) Received: from webmail.linuxsystems.be (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id 29D3B3B041A for ; Wed, 19 Jan 2005 10:57:10 +0100 (CET) Received: from 193.190.212.113 (SquirrelMail authenticated user matt.ibridge.be); by webmail.linuxsystems.be with HTTP; Wed, 19 Jan 2005 10:57:10 +0100 (CET) Message-ID: <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> In-Reply-To: <41EE0F05.9080901@coretech.co.nz> References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> Date: Wed, 19 Jan 2005 10:57:10 +0100 (CET) Subject: Re: Swapping on Solaris From: "Matt Casters" To: pgsql-performance@postgresql.org Reply-To: Matt.Casters@advalvas.be User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at linuxsystems.be X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.75 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200501/230 X-Sequence-Number: 9920 > Kevin Schroeder wrote: > It looks to me like you are using no (device or file) swap at all, and > have 1.3G of real memory free, so could in fact give Postgres more of it :-) > Indeed. If you DO run into trouble after giving Postgres more RAM, use the vmstat command. You can use this command like "vmstat 10". (ignore the first line) Keep an eye on the "pi" and "po" parameters. (kilobytes paged in and out) HTH, Matt ------ Matt Casters i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 From pgsql-performance-owner@postgresql.org Wed Jan 19 11:12:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0DFEE3A3E51 for ; Wed, 19 Jan 2005 11:12: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 68443-10 for ; Wed, 19 Jan 2005 11:12:28 +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 AEAAD3A3E24 for ; Wed, 19 Jan 2005 11:12:29 +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 1CrDjv-000Ijn-Hy; Wed, 19 Jan 2005 11:11:08 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id C8D3B1592D; Wed, 19 Jan 2005 11:12:19 +0000 (GMT) Message-ID: <41EE4091.9040902@archonet.com> Date: Wed, 19 Jan 2005 11:12:17 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <200501160944.47511.josh@agliodbs.com> <011901c4fd5e$4b465470$63070080@freedom> <1106059106.41ed1f6296062@webmail.moph.go.th> In-Reply-To: <1106059106.41ed1f6296062@webmail.moph.go.th> Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit 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: 200501/231 X-Sequence-Number: 9921 amrit@health2.moph.go.th wrote: > I would like to upgrade both OS kernel and PGsql version , so in my opinion the > best way to handle it is to *backup* the data in .tar Just remember if you're going from 7.3.2 => 7.4.x or 8.0 then you'll need to use pg_dump not just tar up the directories. If you do use tar, remember to backup *all* the directories. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Jan 19 13:40:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E252F3A40B6 for ; Wed, 19 Jan 2005 13:40: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 85567-03 for ; Wed, 19 Jan 2005 13:40:25 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 960813A3F1D for ; Wed, 19 Jan 2005 13:40:24 +0000 (GMT) Received: (qmail 12503 invoked from network); 19 Jan 2005 13:39:46 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 19 Jan 2005 13:39:46 -0000 Message-ID: <41EE6389.8020303@fastcrypt.com> Date: Wed, 19 Jan 2005 08:41:29 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard Huxton Cc: amrit@health2.moph.go.th, PGsql-performance Subject: Re: Increasing RAM for more than 4 Gb. using postgresql References: <1105501768.41e49e484d779@webmail.moph.go.th> <200501160944.47511.josh@agliodbs.com> <011901c4fd5e$4b465470$63070080@freedom> <1106059106.41ed1f6296062@webmail.moph.go.th> <41EE4091.9040902@archonet.com> In-Reply-To: <41EE4091.9040902@archonet.com> Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/232 X-Sequence-Number: 9922 You can *not* go from any major release to another major release using any kind of file backup. Please use pg_dump. Additionally there are known issues dumping and restoring from 7.3 -> 7.4 if you use the default copy command. Use the pg_dump --inserts option. I would still tar the directory just in case you *have* to fall back to 7.3 for some reason (Better safe than sorry ) Dave Richard Huxton wrote: > amrit@health2.moph.go.th wrote: > >> I would like to upgrade both OS kernel and PGsql version , so in my >> opinion the >> best way to handle it is to *backup* the data in .tar > > > Just remember if you're going from 7.3.2 => 7.4.x or 8.0 then you'll > need to use pg_dump not just tar up the directories. If you do use > tar, remember to backup *all* the directories. > > -- > Richard Huxton > Archonet Ltd > > ---------------------------(end of broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if > your > joining column's datatypes do not match > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 From pgsql-performance-owner@postgresql.org Wed Jan 19 13:52:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4915A3A4276 for ; Wed, 19 Jan 2005 13:52: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 86575-08 for ; Wed, 19 Jan 2005 13:52:05 +0000 (GMT) Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 915E83A41F0 for ; Wed, 19 Jan 2005 13:52:01 +0000 (GMT) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j0JDpuOw023191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Jan 2005 08:51:57 -0500 (EST) X-Rentec: external Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id j0JDpupN028618; Wed, 19 Jan 2005 08:51:56 -0500 (EST) Message-ID: <41EE65FC.2000909@rentec.com> Date: Wed, 19 Jan 2005 08:51:56 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: Kevin Schroeder , pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> In-Reply-To: <41EE0F05.9080901@coretech.co.nz> 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: 200501/233 X-Sequence-Number: 9923 Mark Kirkwood wrote: > Kevin Schroeder wrote: > >> >> >> Ignoring the fact that the sort and vacuum numbers are really high, >> this is what Solaris shows me when running top: >> >> Memory: 2048M real, 1376M free, 491M swap in use, 2955M swap free >> > Maybe check the swap usage with 'swap -l' which reports reliably if any > (device or file) swap is actually used. > > I think Solaris 'top' does some strange accounting to calculate the > 'swap in use' value (like including used memory). > > It looks to me like you are using no (device or file) swap at all, and > have 1.3G of real memory free, so could in fact give Postgres more of > it :-) I suspect that "free" memory is in fact being used for the file system cache. There were some changes in the meaning of "free" in Solaris 8 and 9. The memstat command gives a nice picture of memory usage on the system. I don't think memstat came with Solaris 8, but you can get it from solarisinternals.com. The Solaris Internals book is an excellent read as well; it explains all of this in gory detail. Note that files in /tmp are usually in a tmpfs file system. These files may be the usage of swap that you're seeing (as they will be paged out on an active system with some memory pressure) Finally, just as everyone suggests upgrading to newer postgresql releases, you probably want to get to a newer Solaris release. -- Alan From pgsql-performance-owner@postgresql.org Wed Jan 19 15:20:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D5C513A420D for ; Wed, 19 Jan 2005 14:31: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 93288-02 for ; Wed, 19 Jan 2005 14:31:11 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 8986B3A4244 for ; Wed, 19 Jan 2005 14:31:11 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id C662E68015 for ; Wed, 19 Jan 2005 08:29:09 -0600 (CST) Message-ID: <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" Cc: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 08:31:17 -0600 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-Archive-Number: 200501/236 X-Sequence-Number: 9926 I suspect that the memory is being used to cache files as well since the email boxes are using unix mailboxes, for the time being. With people checking their email sometimes once per minute I can see why Solaris would want to cache those files. Perhaps my question would be more appropriate to a Solaris mailing list since what I really want to do is get Solaris to simply allow PostgreSQL to use more RAM and reduce the amount of RAM used for file caching. I would have thought that Solaris gives some deference to a running application that's being swapped than for a file cache. Is there any way to set custom parameters on Solaris' file-caching behavior to allow PostgreSQL to use more physical RAM? I will also check out memstat. It's not on my system, but I'll get it from the site you noted. Thanks Kevin ----- Original Message ----- From: "Alan Stange" Cc: "Kevin Schroeder" ; Sent: Wednesday, January 19, 2005 7:51 AM Subject: Re: [PERFORM] Swapping on Solaris > Mark Kirkwood wrote: > >> Kevin Schroeder wrote: >> >>> >>> >>> Ignoring the fact that the sort and vacuum numbers are really high, this >>> is what Solaris shows me when running top: >>> >>> Memory: 2048M real, 1376M free, 491M swap in use, 2955M swap free >>> >> Maybe check the swap usage with 'swap -l' which reports reliably if any >> (device or file) swap is actually used. >> >> I think Solaris 'top' does some strange accounting to calculate the >> 'swap in use' value (like including used memory). >> >> It looks to me like you are using no (device or file) swap at all, and >> have 1.3G of real memory free, so could in fact give Postgres more of it >> :-) > > I suspect that "free" memory is in fact being used for the file system > cache. There were some changes in the meaning of "free" in Solaris 8 and > 9. The memstat command gives a nice picture of memory usage on the > system. I don't think memstat came with Solaris 8, but you can get it > from solarisinternals.com. The Solaris Internals book is an excellent > read as well; it explains all of this in gory detail. > Note that files in /tmp are usually in a tmpfs file system. These files > may be the usage of swap that you're seeing (as they will be paged out on > an active system with some memory pressure) > > Finally, just as everyone suggests upgrading to newer postgresql releases, > you probably want to get to a newer Solaris release. > -- Alan > > > From pgsql-performance-owner@postgresql.org Wed Jan 19 14:54:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F2B23A429B for ; Wed, 19 Jan 2005 14:52: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 95750-06 for ; Wed, 19 Jan 2005 14:52:19 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 287223A42B3 for ; Wed, 19 Jan 2005 14:52:21 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id 6970A68015 for ; Wed, 19 Jan 2005 08:50:20 -0600 (CST) Message-ID: <010c01c4fe36$7ecba1a0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" To: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 08:52:28 -0600 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-Archive-Number: 200501/234 X-Sequence-Number: 9924 po and pi are relatively low, but do pick up when there's an increase in activity. I am seeing a lot of "minor faults", though. vmstat -S 5 reports [9:38am]# vmstat -S 5 procs memory page disk faults cpu r b w swap free si so pi po fr de sr s0 s1 s3 -- in sy cs us sy id 0 0 0 3235616 1414536 0 0 303 11 10 0 0 6 24 0 0 13 192 461 17 11 72 1 0 0 3004376 1274912 0 0 0 0 0 0 0 3 16 0 0 494 1147 441 52 25 23 494 in faults 1147 sy faults Generally faults are a bad thing. Is that the case here? Kevin ----- Original Message ----- From: "Matt Casters" To: Sent: Wednesday, January 19, 2005 3:57 AM Subject: Re: [PERFORM] Swapping on Solaris > Kevin Schroeder wrote: > It looks to me like you are using no (device or file) swap at all, and > have 1.3G of real memory free, so could in fact give Postgres more of it > :-) > Indeed. If you DO run into trouble after giving Postgres more RAM, use the vmstat command. You can use this command like "vmstat 10". (ignore the first line) Keep an eye on the "pi" and "po" parameters. (kilobytes paged in and out) HTH, Matt ------ Matt Casters i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 ---------------------------(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 Wed Jan 19 15:18:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 909393A420D for ; Wed, 19 Jan 2005 14:57: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 96518-03 for ; Wed, 19 Jan 2005 14:57:14 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 8B3163A42A7 for ; Wed, 19 Jan 2005 14:57:14 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id 6797D68015 for ; Wed, 19 Jan 2005 08:55:15 -0600 (CST) Message-ID: <011f01c4fe37$2ea10f20$0200a8c0@WORKSTATION> From: "Kevin Schroeder" To: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 08:57:23 -0600 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-Archive-Number: 200501/235 X-Sequence-Number: 9925 I take that back. There actually is some paging going on. I ran sar -g 5 10 and when a request was made (totally about 10 DB queries) my pgout/s jumped to 5.8 and my ppgout/s jumped to 121.8. pgfree/s also jumped to 121.80. Kevin ----- Original Message ----- From: "Matt Casters" To: Sent: Wednesday, January 19, 2005 3:57 AM Subject: Re: [PERFORM] Swapping on Solaris > Kevin Schroeder wrote: > It looks to me like you are using no (device or file) swap at all, and > have 1.3G of real memory free, so could in fact give Postgres more of it > :-) > Indeed. If you DO run into trouble after giving Postgres more RAM, use the vmstat command. You can use this command like "vmstat 10". (ignore the first line) Keep an eye on the "pi" and "po" parameters. (kilobytes paged in and out) HTH, Matt ------ Matt Casters i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 ---------------------------(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 Wed Jan 19 15:45:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 503613A427D for ; Wed, 19 Jan 2005 15: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 97095-10 for ; Wed, 19 Jan 2005 15:09:02 +0000 (GMT) Received: from COLSWEEPER.cranel.com (newmail.cranel.com [66.192.200.227]) by svr1.postgresql.org (Postfix) with ESMTP id BF8333A4169 for ; Wed, 19 Jan 2005 15:09:01 +0000 (GMT) Received: from colmail01.cranel.local (colmail01.cranel.local) by COLSWEEPER.cranel.com (Content Technologies SMTPRS 4.3.14) with ESMTP id ; Wed, 19 Jan 2005 10:06:52 -0500 Received: from [192.168.11.134] (192.168.11.134 [192.168.11.134]) by colmail01.cranel.local with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id DD74VHV4; Wed, 19 Jan 2005 10:08:11 -0500 Message-ID: <41EE77C1.1010900@cranel.com> Date: Wed, 19 Jan 2005 10:07:45 -0500 From: Greg Spiegelberg Organization: Cranel, Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 X-Accept-Language: en-us, en MIME-Version: 1.0 To: stange@rentec.com Cc: Kevin Schroeder , pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> In-Reply-To: <41EE65FC.2000909@rentec.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 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/239 X-Sequence-Number: 9929 Alan Stange wrote: > > Note that files in /tmp are usually in a tmpfs file system. These > files may be the usage of swap that you're seeing (as they will be paged > out on an active system with some memory pressure) You can do a couple things with /tmp. Create a separate file system for it so it will have zero impact on swap and use the "noatime" mount option. Alternatively, limit the size of /tmp using the mount option "size=MBm" replacing "MB" with the size you want it to be in MBytes. If your application uses /tmp heavily, be sure to put it on a speedy, local LUN. > Finally, just as everyone suggests upgrading to newer postgresql > releases, you probably want to get to a newer Solaris release. If you really want to avoid swapping I'd suggest tuning your database first with swap turned off and put it under a "normal" load while watching both top and vmstat. When you're happy with it, turn swap back on for those "heavy" load times and move on. Greg -- Greg Spiegelberg Product Development Manager Cranel, Incorporated. Phone: 614.318.4314 Fax: 614.431.8388 Email: gspiegelberg@cranel.com Technology. Integrity. Focus. From pgsql-performance-owner@postgresql.org Wed Jan 19 15:41:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9224C3A3F06 for ; Wed, 19 Jan 2005 15:17: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 97837-08 for ; Wed, 19 Jan 2005 15:16:57 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 5D32C3A4280 for ; Wed, 19 Jan 2005 15:16:57 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id B8B7E68015 for ; Wed, 19 Jan 2005 09:14:55 -0600 (CST) Message-ID: <013301c4fe39$ee326e90$0200a8c0@WORKSTATION> From: "Kevin Schroeder" Cc: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <41EE77C1.1010900@cranel.com> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 09:17:03 -0600 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-Archive-Number: 200501/237 X-Sequence-Number: 9927 /tmp doesn't seem to be much of a problem. I have about 1k worth of data in there and 72k in /var/tmp. Would turning swap off help in tuning the database in this regard? top is reporting that there's 1.25GB of RAM free on a 2GB system so, in my estimation, there's no need for PostgreSQL to be swapped unless that free memory is Solaris caching files in RAM. Kevin ----- Original Message ----- From: "Greg Spiegelberg" To: Cc: "Kevin Schroeder" ; Sent: Wednesday, January 19, 2005 9:07 AM Subject: Re: [PERFORM] Swapping on Solaris > Alan Stange wrote: >> >> Note that files in /tmp are usually in a tmpfs file system. These files >> may be the usage of swap that you're seeing (as they will be paged out on >> an active system with some memory pressure) > > You can do a couple things with /tmp. Create a separate file system > for it so it will have zero impact on swap and use the "noatime" mount > option. Alternatively, limit the size of /tmp using the mount option > "size=MBm" replacing "MB" with the size you want it to be in MBytes. If > your application uses /tmp heavily, be sure to put it on a speedy, > local LUN. > > >> Finally, just as everyone suggests upgrading to newer postgresql >> releases, you probably want to get to a newer Solaris release. > > If you really want to avoid swapping I'd suggest tuning your database > first with swap turned off and put it under a "normal" load while > watching both top and vmstat. When you're happy with it, turn swap > back on for those "heavy" load times and move on. > > Greg > > -- > Greg Spiegelberg > Product Development Manager > Cranel, Incorporated. > Phone: 614.318.4314 > Fax: 614.431.8388 > Email: gspiegelberg@cranel.com > Technology. Integrity. Focus. > > > > From pgsql-performance-owner@postgresql.org Wed Jan 19 15:43:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 057A73A41A6 for ; Wed, 19 Jan 2005 15:30: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 01441-02 for ; Wed, 19 Jan 2005 15:30:40 +0000 (GMT) Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 0C2A33A4163 for ; Wed, 19 Jan 2005 15:30:40 +0000 (GMT) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j0JFUXU2027289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Jan 2005 10:30:34 -0500 (EST) X-Rentec: external Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id j0JFUX2e005393; Wed, 19 Jan 2005 10:30:33 -0500 (EST) Message-ID: <41EE7D19.4060503@rentec.com> Date: Wed, 19 Jan 2005 10:30:33 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Schroeder Cc: pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> In-Reply-To: <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> 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: 200501/238 X-Sequence-Number: 9928 Kevin Schroeder wrote: > I suspect that the memory is being used to cache files as well since > the email boxes are using unix mailboxes, for the time being. With > people checking their email sometimes once per minute I can see why > Solaris would want to cache those files. Perhaps my question would be > more appropriate to a Solaris mailing list since what I really want to > do is get Solaris to simply allow PostgreSQL to use more RAM and > reduce the amount of RAM used for file caching. I would have thought > that Solaris gives some deference to a running application that's > being swapped than for a file cache. > > Is there any way to set custom parameters on Solaris' file-caching > behavior to allow PostgreSQL to use more physical RAM? Your explanation doesn't sound quite correct. If postgresql malloc()'s some memory and uses it, the file cache will be reduced in size and the memory given to postgresql. But if postgresql doesn't ask for or use the memory, then solaris is going to use it for something else. There's nothing in Solaris that doesn't "allow" postgresql to use more RAM. -- Alan From pgsql-performance-owner@postgresql.org Wed Jan 19 16:40:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D977A3A420D for ; Wed, 19 Jan 2005 15:40: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 02963-02 for ; Wed, 19 Jan 2005 15:40:04 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 770AB3A433F for ; Wed, 19 Jan 2005 15:40:05 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id B708068015 for ; Wed, 19 Jan 2005 09:38:04 -0600 (CST) Message-ID: <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" Cc: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 09:40:12 -0600 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-Archive-Number: 200501/243 X-Sequence-Number: 9933 I may be asking the question the wrong way, but when I start up PostgreSQL swap is what gets used the most of. I've got 1282MB free RAM right now and and 515MB swap in use. Granted, swap file usage probably wouldn't be zero, but I would guess that it should be a lot lower so something must be keeping PostgreSQL from using the free RAM that my system is reporting. For example, one of my postgres processes is 201M in size but on 72M is resident in RAM. That extra 130M is available in RAM, according to top, but postgres isn't using it. Kevin ----- Original Message ----- From: "Alan Stange" To: "Kevin Schroeder" Cc: Sent: Wednesday, January 19, 2005 9:30 AM Subject: Re: [PERFORM] Swapping on Solaris > Kevin Schroeder wrote: > >> I suspect that the memory is being used to cache files as well since the >> email boxes are using unix mailboxes, for the time being. With people >> checking their email sometimes once per minute I can see why Solaris >> would want to cache those files. Perhaps my question would be more >> appropriate to a Solaris mailing list since what I really want to do is >> get Solaris to simply allow PostgreSQL to use more RAM and reduce the >> amount of RAM used for file caching. I would have thought that Solaris >> gives some deference to a running application that's being swapped than >> for a file cache. >> >> Is there any way to set custom parameters on Solaris' file-caching >> behavior to allow PostgreSQL to use more physical RAM? > > Your explanation doesn't sound quite correct. If postgresql malloc()'s > some memory and uses it, the file cache will be reduced in size and the > memory given to postgresql. But if postgresql doesn't ask for or use the > memory, then solaris is going to use it for something else. There's > nothing in Solaris that doesn't "allow" postgresql to use more RAM. > > -- Alan > > > From pgsql-performance-owner@postgresql.org Wed Jan 19 16:35:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6AA363A4323 for ; Wed, 19 Jan 2005 15:42: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 03238-03 for ; Wed, 19 Jan 2005 15:42:28 +0000 (GMT) Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id 53ECD3A4301 for ; Wed, 19 Jan 2005 15:42:30 +0000 (GMT) Received: from wren.rentec.com (wren.rentec.com [192.5.35.106]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j0JFgQEP027618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Jan 2005 10:42:28 -0500 (EST) X-Rentec: external Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by wren.rentec.com (8.13.1/8.12.1) with ESMTP id j0JFgQtx005944; Wed, 19 Jan 2005 10:42:26 -0500 (EST) Message-ID: <41EE7FE2.7030808@rentec.com> Date: Wed, 19 Jan 2005 10:42:26 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Schroeder Cc: pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> <011f01c4fe37$2ea10f20$0200a8c0@WORKSTATION> In-Reply-To: <011f01c4fe37$2ea10f20$0200a8c0@WORKSTATION> 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: 200501/242 X-Sequence-Number: 9932 Kevin Schroeder wrote: > I take that back. There actually is some paging going on. I ran sar > -g 5 10 and when a request was made (totally about 10 DB queries) my > pgout/s jumped to 5.8 and my ppgout/s jumped to 121.8. pgfree/s also > jumped to 121.80. I'm fairly sure that the pi and po numbers include file IO in Solaris, because of the unified VM and file systems. -- Alan From pgsql-performance-owner@postgresql.org Wed Jan 19 16:06:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0603A3A428D for ; Wed, 19 Jan 2005 15: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 04807-01 for ; Wed, 19 Jan 2005 15:52:43 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by svr1.postgresql.org (Postfix) with ESMTP id 8BB613A42F4 for ; Wed, 19 Jan 2005 15:52:40 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so8164wra for ; Wed, 19 Jan 2005 07:52:36 -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=G9RTFsCr1LKayMCklD9Hnn4HAKHkhQ8Pi3q9+p5iLW7iAdQi/5fSEq4GdXvgL+YPdqIo3WPNsph6d86kv/wuKPIG069QdOy5YFCg8sLH/olhueBGFm8igqXqY3lXpBiF71XJ6lRJxkvmGS1H6aFJiUW7Oapo00QfnsET1x6KARA= Received: by 10.54.50.15 with SMTP id x15mr87564wrx; Wed, 19 Jan 2005 07:52:35 -0800 (PST) Received: by 10.54.18.72 with HTTP; Wed, 19 Jan 2005 07:52:35 -0800 (PST) Message-ID: <33c6269f050119075217a42c42@mail.gmail.com> Date: Wed, 19 Jan 2005 10:52:35 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Benjamin Wragg Subject: Re: Disk configuration Cc: pgsql-performance@postgresql.org In-Reply-To: <20050118220344.83426C153@vscan02.westnet.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050118220344.83426C153@vscan02.westnet.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/241 X-Sequence-Number: 9931 The primary goal is to reduce the number of seeks a disk or array has to perform. Serial write throughput is much higher than random write throughput. If you are performing very high volume throughput on a server that is doing multiple things, then it maybe advisable to have one partition for OS, one for postgresql binaries, one for xlog and one for table data (or multiple if you are PG8.0). This is the ultimate configuration, but most people don't require this level of seperation. If you do need this level of seperation, also bare in mind that table data writes are more likely to be random writes so you want an array that can sustain a high levels of IO/sec, so RAID 10 with 6 or more drives is ideal. If you want fault tolerance, then RAID 1 for OS and postgresql binaries is a minimum, and I believe that xlog can also go on a RAID 1 unless you need more MB/sec. Ultimately you will need to benchmark any configuration you build in order to determine if it's successfull and meets your needs. This of course sucks, because you don't want to buy too much because it's a waste of $$s. What I can tell you is my own experience which is a database running with xlog, software and OS on a RAID 1, with Data partition running on 3 disk RAID 5 with a database of about 3 million rows total gets an insert speed of about 200 rows/sec on an average size table using a compaq proliant ML370 Dual Pentium 933 w/2G RAM. Most of the DB is in RAM, so read times are very good with most queries returning sub second. Hope this helps at least a little Alex Turner NetEconomist On Wed, 19 Jan 2005 09:03:44 +1100, Benjamin Wragg wrote: > > I just wanted to bounce off the list the best way to configure disks for a > postgresql server. My gut feeling is as follows: > > Keep the OS and postgresql install on seperate disks to the postgresql /data > directory? > Is a single hard disk drive acceptable for the OS and postgresql program, or > will this create a bottle neck? Would a multi disk array be more > appropriate? > > Cheers, > > Benjamin Wragg > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 > From pgsql-performance-owner@postgresql.org Wed Jan 19 15:55:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 87F663A4446 for ; Wed, 19 Jan 2005 15:55: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 05061-03 for ; Wed, 19 Jan 2005 15:54:53 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id BD47C3A43DC for ; Wed, 19 Jan 2005 15:53:51 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id 07D6468015 for ; Wed, 19 Jan 2005 09:51:51 -0600 (CST) Message-ID: <015e01c4fe3f$16ac4580$0200a8c0@WORKSTATION> From: "Kevin Schroeder" Cc: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> <011f01c4fe37$2ea10f20$0200a8c0@WORKSTATION> <41EE7FE2.7030808@rentec.com> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 09:53:58 -0600 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-Archive-Number: 200501/240 X-Sequence-Number: 9930 Maybe, I'm just seeing a problem where none exists. I ran sar -w 3 100 and I actually did not see any swap activity despite the fact that I've got 500+MB of swap file being used. Kevin ----- Original Message ----- From: "Alan Stange" To: "Kevin Schroeder" Cc: Sent: Wednesday, January 19, 2005 9:42 AM Subject: Re: [PERFORM] Swapping on Solaris > Kevin Schroeder wrote: > >> I take that back. There actually is some paging going on. I ran sar -g >> 5 10 and when a request was made (totally about 10 DB queries) my pgout/s >> jumped to 5.8 and my ppgout/s jumped to 121.8. pgfree/s also jumped to >> 121.80. > > I'm fairly sure that the pi and po numbers include file IO in Solaris, > because of the unified VM and file systems. > > -- Alan > > > From pgsql-performance-owner@postgresql.org Wed Jan 19 16:59:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38C543A4380 for ; Wed, 19 Jan 2005 16:56: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 14680-05 for ; Wed, 19 Jan 2005 16:56:43 +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 DDDC43A43C3 for ; Wed, 19 Jan 2005 16:56:37 +0000 (GMT) Received: (qmail 4115 invoked from network); 19 Jan 2005 16:12:42 -0000 Received: from dhcp-10-124-7-103.wal.lycos.com (HELO ?10.124.7.103?) (10.124.7.103) by dhcp-10-124-7-248.wal.lycos.com with SMTP; 19 Jan 2005 16:12:42 -0000 In-Reply-To: <41EE7FE2.7030808@rentec.com> References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> <011f01c4fe37$2ea10f20$0200a8c0@WORKSTATION> <41EE7FE2.7030808@rentec.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <53308814-6A3B-11D9-9D52-000D9366F0C4@torgo.978.org> Content-Transfer-Encoding: 7bit Cc: PostgreSQL Performance From: Jeff Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 11:58:21 -0500 To: Kevin Schroeder 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: 200501/244 X-Sequence-Number: 9934 On Jan 19, 2005, at 10:42 AM, Alan Stange wrote: > Kevin Schroeder wrote: > >> I take that back. There actually is some paging going on. I ran sar >> -g 5 10 and when a request was made (totally about 10 DB queries) my >> pgout/s jumped to 5.8 and my ppgout/s jumped to 121.8. pgfree/s also >> jumped to 121.80. > > I'm fairly sure that the pi and po numbers include file IO in Solaris, > because of the unified VM and file systems. Curiously, what are your shared_buffers and sort_mem set too? Perhaps they are too high? -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Wed Jan 19 17:37:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7A7C73A432F for ; Wed, 19 Jan 2005 17:04: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 16317-01 for ; Wed, 19 Jan 2005 17:04:29 +0000 (GMT) Received: from unicorn.rentec.com (unicorn.rentec.com [216.223.240.9]) by svr1.postgresql.org (Postfix) with ESMTP id D58F23A4368 for ; Wed, 19 Jan 2005 17:04:26 +0000 (GMT) Received: from ram.rentec.com (mailhost [192.5.35.66]) by unicorn.rentec.com (8.13.1/8.12.1) with ESMTP id j0JH4L6O000973 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Jan 2005 12:04:22 -0500 (EST) X-Rentec: external Received: from [172.26.132.145] (hoopoe.rentec.com [172.26.132.145]) by ram.rentec.com (8.13.1/8.12.1) with ESMTP id j0JH4LbF005471; Wed, 19 Jan 2005 12:04:21 -0500 (EST) Message-ID: <41EE9315.2010707@rentec.com> Date: Wed, 19 Jan 2005 12:04:21 -0500 From: Alan Stange Reply-To: stange@rentec.com Organization: Renaissance Technologies Corp. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Schroeder Cc: pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> In-Reply-To: <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> 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: 200501/246 X-Sequence-Number: 9936 Kevin Schroeder wrote: > I may be asking the question the wrong way, but when I start up > PostgreSQL swap is what gets used the most of. I've got 1282MB free > RAM right now and and 515MB swap in use. Granted, swap file usage > probably wouldn't be zero, but I would guess that it should be a lot > lower so something must be keeping PostgreSQL from using the free RAM > that my system is reporting. For example, one of my postgres > processes is 201M in size but on 72M is resident in RAM. That extra > 130M is available in RAM, according to top, but postgres isn't using it. The test you're doing doesn't measure what you think you're measuring. First, what else is running on the machine? Note that some shared memory allocations do reserve backing pages in swap, even though the pages aren't currently in use. Perhaps this is what you're measuring? "swap -s" has better numbers than top. You'd be better by trying a reboot then starting pgsql and seeing what memory is used. Just because you start a process and see the swap number increase doesn't mean that the new process is in swap. It means some anonymous pages had to be evicted to swap to make room for the new process or some pages had to be reserved in swap for future use. Typically a new process won't be paged out unless something else is causing enormous memory pressure... -- Alan From pgsql-performance-owner@postgresql.org Wed Jan 19 17:31:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30B9F3A41D6 for ; Wed, 19 Jan 2005 17:08: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 15792-08 for ; Wed, 19 Jan 2005 17:08:44 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 21B7E3A42CF for ; Wed, 19 Jan 2005 17:08:44 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id 5E6DD68015 for ; Wed, 19 Jan 2005 11:06:43 -0600 (CST) Message-ID: <019701c4fe49$8c72d4a0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" Cc: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> <41EE9315.2010707@rentec.com> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 11:08:51 -0600 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-Archive-Number: 200501/245 X-Sequence-Number: 9935 I think it's probably just reserving them. I can't think of anything else. Also, when I run swap activity with sar I don't see any activity, which also points to reserved swap space, not used swap space. swap -s reports total: 358336k bytes allocated + 181144k reserved = 539480k used, 2988840k available Kevin ----- Original Message ----- From: "Alan Stange" To: "Kevin Schroeder" Cc: Sent: Wednesday, January 19, 2005 11:04 AM Subject: Re: [PERFORM] Swapping on Solaris > Kevin Schroeder wrote: > >> I may be asking the question the wrong way, but when I start up >> PostgreSQL swap is what gets used the most of. I've got 1282MB free RAM >> right now and and 515MB swap in use. Granted, swap file usage probably >> wouldn't be zero, but I would guess that it should be a lot lower so >> something must be keeping PostgreSQL from using the free RAM that my >> system is reporting. For example, one of my postgres processes is 201M >> in size but on 72M is resident in RAM. That extra 130M is available in >> RAM, according to top, but postgres isn't using it. > > The test you're doing doesn't measure what you think you're measuring. > > First, what else is running on the machine? Note that some shared > memory allocations do reserve backing pages in swap, even though the pages > aren't currently in use. Perhaps this is what you're measuring? > "swap -s" has better numbers than top. > > You'd be better by trying a reboot then starting pgsql and seeing what > memory is used. > > Just because you start a process and see the swap number increase doesn't > mean that the new process is in swap. It means some anonymous pages had > to be evicted to swap to make room for the new process or some pages had > to be reserved in swap for future use. Typically a new process won't be > paged out unless something else is causing enormous memory pressure... > > -- Alan > > > From pgsql-performance-owner@postgresql.org Wed Jan 19 17:55:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B523C3A420D for ; Wed, 19 Jan 2005 17:35: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 20820-04 for ; Wed, 19 Jan 2005 17:35:09 +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 941F93A3D7D for ; Wed, 19 Jan 2005 17:35:08 +0000 (GMT) Received: (qmail 4602 invoked from network); 19 Jan 2005 16:51:15 -0000 Received: from dhcp-10-124-7-103.wal.lycos.com (HELO ?10.124.7.103?) (10.124.7.103) by dhcp-10-124-7-248.wal.lycos.com with SMTP; 19 Jan 2005 16:51:15 -0000 In-Reply-To: <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: From: Jeff Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 12:36:54 -0500 To: "Kevin Schroeder" 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: 200501/247 X-Sequence-Number: 9937 On Jan 19, 2005, at 10:40 AM, Kevin Schroeder wrote: > I may be asking the question the wrong way, but when I start up > PostgreSQL swap is what gets used the most of. I've got 1282MB free > RAM right now and and 515MB swap in use. Granted, swap file usage > probably wouldn't be zero, but I would guess that it should be a lot > lower so something must be keeping PostgreSQL from using the free RAM > that my system is reporting. For example, one of my postgres > processes is 201M in size but on 72M is resident in RAM. That extra > 130M is available in RAM, according to top, but postgres isn't using > it. Can you please give us your exact shared_buffer and sort_mem settings? This will help greatly. As a general thing, we say don't use more than 10k shared bufs unless you have done testing and enjoy a benefit. Managing all those buffers isn't free. I'm also not sure how Solaris reports shared memory usage for apps... a lot of that could be shared mem. Can you watch say, vmstat 1 for a minute or two while PG is running and see if you're actually swapping? -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Wed Jan 19 19:02:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A606D3A4430 for ; Wed, 19 Jan 2005 19:02: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 41176-04 for ; Wed, 19 Jan 2005 19:02:04 +0000 (GMT) Received: from bayswater1.ymogen.net (unknown [217.27.247.154]) by svr1.postgresql.org (Postfix) with ESMTP id AE1E93A4476 for ; Wed, 19 Jan 2005 19:01:51 +0000 (GMT) Received: from [82.68.132.234] (82-68-132-234.dsl.in-addr.zen.co.uk [82.68.132.234]) by bayswater1.ymogen.net (Postfix) with ESMTP id 95140B3217; Wed, 19 Jan 2005 19:01:48 +0000 (GMT) Message-ID: <41EEAE9C.7070806@ymogen.net> Date: Wed, 19 Jan 2005 19:01:48 +0000 From: Matt Clark User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Schroeder Cc: pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> <41EE9315.2010707@rentec.com> <019701c4fe49$8c72d4a0$0200a8c0@WORKSTATION> In-Reply-To: <019701c4fe49$8c72d4a0$0200a8c0@WORKSTATION> 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: 200501/248 X-Sequence-Number: 9938 This page may be of use: http://www.serverworldmagazine.com/monthly/2003/02/solaris.shtml From personal experience, for god's sake don't think Solaris' VM/swap implementation is easy - it's damn good, but it ain't easy! Matt Kevin Schroeder wrote: > I think it's probably just reserving them. I can't think of anything > else. Also, when I run swap activity with sar I don't see any > activity, which also points to reserved swap space, not used swap space. > > swap -s reports > > total: 358336k bytes allocated + 181144k reserved = 539480k used, > 2988840k available > > Kevin > > ----- Original Message ----- From: "Alan Stange" > To: "Kevin Schroeder" > Cc: > Sent: Wednesday, January 19, 2005 11:04 AM > Subject: Re: [PERFORM] Swapping on Solaris > > >> Kevin Schroeder wrote: >> >>> I may be asking the question the wrong way, but when I start up >>> PostgreSQL swap is what gets used the most of. I've got 1282MB free >>> RAM right now and and 515MB swap in use. Granted, swap file usage >>> probably wouldn't be zero, but I would guess that it should be a lot >>> lower so something must be keeping PostgreSQL from using the free >>> RAM that my system is reporting. For example, one of my postgres >>> processes is 201M in size but on 72M is resident in RAM. That extra >>> 130M is available in RAM, according to top, but postgres isn't using >>> it. >> >> >> The test you're doing doesn't measure what you think you're measuring. >> >> First, what else is running on the machine? Note that some shared >> memory allocations do reserve backing pages in swap, even though the >> pages aren't currently in use. Perhaps this is what you're >> measuring? "swap -s" has better numbers than top. >> >> You'd be better by trying a reboot then starting pgsql and seeing >> what memory is used. >> >> Just because you start a process and see the swap number increase >> doesn't mean that the new process is in swap. It means some >> anonymous pages had to be evicted to swap to make room for the new >> process or some pages had to be reserved in swap for future use. >> Typically a new process won't be paged out unless something else is >> causing enormous memory pressure... >> >> -- Alan >> >> >> > > > ---------------------------(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 Jan 19 19:48:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D69703A43EC for ; Wed, 19 Jan 2005 19: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 54268-01 for ; Wed, 19 Jan 2005 19:47:48 +0000 (GMT) Received: from mail.blogtap.com (66.241.8.26.maxuptime.com [66.241.8.26]) by svr1.postgresql.org (Postfix) with ESMTP id 603CE3A44D8 for ; Wed, 19 Jan 2005 19:46:43 +0000 (GMT) Received: from WORKSTATION (c-24-1-91-108.client.comcast.net [24.1.91.108]) by mail.blogtap.com (Postfix) with ESMTP id 5FBFE68015 for ; Wed, 19 Jan 2005 13:44:43 -0600 (CST) Message-ID: <022601c4fe5f$9f3f98f0$0200a8c0@WORKSTATION> From: "Kevin Schroeder" Cc: References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> <41EE9315.2010707@rentec.com> <019701c4fe49$8c72d4a0$0200a8c0@WORKSTATION> <41EEAE9C.7070806@ymogen.net> Subject: Re: Swapping on Solaris Date: Wed, 19 Jan 2005 13:46:51 -0600 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-Archive-Number: 200501/249 X-Sequence-Number: 9939 Well, easy it ain't and I believe it's good. One final question: When I run sar -w I get no swap activity, but the process switch column registers between 400 and 700 switches per second. Would that be in the normal range for a medium-use system? Thanks Kevin ----- Original Message ----- From: "Matt Clark" To: "Kevin Schroeder" Cc: Sent: Wednesday, January 19, 2005 1:01 PM Subject: Re: [PERFORM] Swapping on Solaris > This page may be of use: > > http://www.serverworldmagazine.com/monthly/2003/02/solaris.shtml > > From personal experience, for god's sake don't think Solaris' VM/swap > implementation is easy - it's damn good, but it ain't easy! > > Matt > > Kevin Schroeder wrote: > >> I think it's probably just reserving them. I can't think of anything >> else. Also, when I run swap activity with sar I don't see any activity, >> which also points to reserved swap space, not used swap space. >> >> swap -s reports >> >> total: 358336k bytes allocated + 181144k reserved = 539480k used, >> 2988840k available >> >> Kevin >> >> ----- Original Message ----- From: "Alan Stange" >> To: "Kevin Schroeder" >> Cc: >> Sent: Wednesday, January 19, 2005 11:04 AM >> Subject: Re: [PERFORM] Swapping on Solaris >> >> >>> Kevin Schroeder wrote: >>> >>>> I may be asking the question the wrong way, but when I start up >>>> PostgreSQL swap is what gets used the most of. I've got 1282MB free >>>> RAM right now and and 515MB swap in use. Granted, swap file usage >>>> probably wouldn't be zero, but I would guess that it should be a lot >>>> lower so something must be keeping PostgreSQL from using the free RAM >>>> that my system is reporting. For example, one of my postgres processes >>>> is 201M in size but on 72M is resident in RAM. That extra 130M is >>>> available in RAM, according to top, but postgres isn't using it. >>> >>> >>> The test you're doing doesn't measure what you think you're measuring. >>> >>> First, what else is running on the machine? Note that some shared >>> memory allocations do reserve backing pages in swap, even though the >>> pages aren't currently in use. Perhaps this is what you're measuring? >>> "swap -s" has better numbers than top. >>> >>> You'd be better by trying a reboot then starting pgsql and seeing what >>> memory is used. >>> >>> Just because you start a process and see the swap number increase >>> doesn't mean that the new process is in swap. It means some anonymous >>> pages had to be evicted to swap to make room for the new process or some >>> pages had to be reserved in swap for future use. Typically a new >>> process won't be paged out unless something else is causing enormous >>> memory pressure... >>> >>> -- Alan >>> >>> >>> >> >> >> ---------------------------(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 Jan 19 22:31:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 64C423A42C9 for ; Wed, 19 Jan 2005 22: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 78757-05 for ; Wed, 19 Jan 2005 22:31:21 +0000 (GMT) Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) by svr1.postgresql.org (Postfix) with ESMTP id EAED93A2B9F for ; Wed, 19 Jan 2005 22:31:19 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 5956C8EF95 for ; Thu, 20 Jan 2005 06:31:17 +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 27305-15 for ; Thu, 20 Jan 2005 06:31:17 +0800 (WST) Received: from mapping12 (dsl-202-173-155-79.vic.westnet.com.au [202.173.155.79]) by vscan01.westnet.com.au (Postfix) with ESMTP id DD37C8EF75 for ; Thu, 20 Jan 2005 06:31:16 +0800 (WST) From: "Benjamin Wragg" To: Subject: areca raid controller Date: Thu, 20 Jan 2005 09:31:16 +1100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0044_01C4FED2.CA9C88A0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Thread-Index: AcT+dpawdnAO8TgbRIGsm3Gr11fVoA== Message-Id: <20050119223116.DD37C8EF75@vscan01.westnet.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.274 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML X-Spam-Level: X-Archive-Number: 200501/250 X-Sequence-Number: 9940 This is a multi-part message in MIME format. ------=_NextPart_000_0044_01C4FED2.CA9C88A0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: 7bit Hi, Has anyone had any experiance with any of the Areca SATA RAID controllers? I was looking at a 3ware one but it won't fit in the 2U case we have so the sales guy recommended these. Cheers, Benjamin Wragg -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 ------=_NextPart_000_0044_01C4FED2.CA9C88A0 Content-Type: text/html; charset="windows-1250" Content-Transfer-Encoding: quoted-printable
Hi,
 
Has = anyone had any=20 experiance with any of the Areca SATA RAID controllers? I was looking at = a 3ware=20 one but it won't fit in the 2U case we have so the sales guy = recommended=20 these.
 
Cheers,
 
Benjamin=20 Wragg

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: = 17/01/2005

------=_NextPart_000_0044_01C4FED2.CA9C88A0-- From pgsql-performance-owner@postgresql.org Wed Jan 19 23:52:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F7793A44DA for ; Wed, 19 Jan 2005 23:52: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 86036-02 for ; Wed, 19 Jan 2005 23:52:20 +0000 (GMT) Received: from cmailg2.svr.pol.co.uk (cmailg2.svr.pol.co.uk [195.92.195.172]) by svr1.postgresql.org (Postfix) with ESMTP id 523123A4458 for ; Wed, 19 Jan 2005 23:52:19 +0000 (GMT) Received: from modem-3419.lion.dialup.pol.co.uk ([217.135.173.91] helo=192.168.0.102) by cmailg2.svr.pol.co.uk with esmtp (Exim 4.14) id 1CrPcW-0001kE-7N; Wed, 19 Jan 2005 23:52:16 +0000 Subject: Re: Swapping on Solaris From: Simon Riggs To: Kevin Schroeder Cc: pgsql-performance@postgresql.org In-Reply-To: <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <41EE65FC.2000909@rentec.com> <00d601c4fe33$89682eb0$0200a8c0@WORKSTATION> <41EE7D19.4060503@rentec.com> <014801c4fe3d$2a2478f0$0200a8c0@WORKSTATION> Content-Type: text/plain Organization: 2nd Quadrant Date: Wed, 19 Jan 2005 23:47:04 +0000 Message-Id: <1106178424.14384.373.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/251 X-Sequence-Number: 9941 On Wed, 2005-01-19 at 09:40 -0600, Kevin Schroeder wrote: > I may be asking the question the wrong way, but when I start up PostgreSQL > swap is what gets used the most of. I've got 1282MB free RAM right now and > and 515MB swap in use. Granted, swap file usage probably wouldn't be zero, > but I would guess that it should be a lot lower so something must be keeping > PostgreSQL from using the free RAM that my system is reporting. For > example, one of my postgres processes is 201M in size but on 72M is resident > in RAM. That extra 130M is available in RAM, according to top, but postgres > isn't using it. You probably need to look at the way Solaris memory allocation works. On Linux 2.6, my understanding is that if a process allocates memory, but doesn't actually use it, then the OS is smart enough to swap the overallocated portion out to swap. The effect of that is that the program stays happy because it has all the "memory" it thinks it needs, while the OS is happy because it conserves it valuable physical RAM for memory that is actually being used. If what I say is correct, you should actually observe very low swapping I/O rates on the system. Anyway, look at how the algorithms work if you are worried by what you see. But mostly, if the system is performing OK, then no need to worry - if your only measure of that is system performance data then you need to instrument your application better, so you can look at the data that really matters. -- Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Thu Jan 20 00:56:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8AB013A1A78 for ; Thu, 20 Jan 2005 00:55: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 91842-09 for ; Thu, 20 Jan 2005 00:55:39 +0000 (GMT) Received: from vscan01.westnet.com.au (vscan01.westnet.com.au [203.10.1.131]) by svr1.postgresql.org (Postfix) with ESMTP id 5CA953A45AC for ; Thu, 20 Jan 2005 00:55:40 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 5071D6E892; Thu, 20 Jan 2005 08:55:38 +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 01022-07; Thu, 20 Jan 2005 08:55:38 +0800 (WST) Received: from mapping12 (dsl-202-173-155-79.vic.westnet.com.au [202.173.155.79]) by vscan01.westnet.com.au (Postfix) with ESMTP id AE5D08EAB6; Thu, 20 Jan 2005 08:55:37 +0800 (WST) From: "Benjamin Wragg" To: Cc: Subject: Re: Disk configuration Date: Thu, 20 Jan 2005 11:55:37 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <33c6269f050119075217a42c42@mail.gmail.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Thread-Index: AcT+Q9tgLsneWlzDS1SdG1bkCM4mNwARqj8w Message-Id: <20050120005537.AE5D08EAB6@vscan01.westnet.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.123 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/252 X-Sequence-Number: 9942 Thanks. That sorts out all my questions regarding disk configuration. One more regarding RAID. Is RAID 1+0 and 0+1 essentially the same at a performance level? Thanks, Benjamin -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Alex Turner Sent: Thursday, 20 January 2005 2:53 AM To: Benjamin Wragg Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] Disk configuration The primary goal is to reduce the number of seeks a disk or array has to perform. Serial write throughput is much higher than random write throughput. If you are performing very high volume throughput on a server that is doing multiple things, then it maybe advisable to have one partition for OS, one for postgresql binaries, one for xlog and one for table data (or multiple if you are PG8.0). This is the ultimate configuration, but most people don't require this level of seperation. If you do need this level of seperation, also bare in mind that table data writes are more likely to be random writes so you want an array that can sustain a high levels of IO/sec, so RAID 10 with 6 or more drives is ideal. If you want fault tolerance, then RAID 1 for OS and postgresql binaries is a minimum, and I believe that xlog can also go on a RAID 1 unless you need more MB/sec. Ultimately you will need to benchmark any configuration you build in order to determine if it's successfull and meets your needs. This of course sucks, because you don't want to buy too much because it's a waste of $$s. What I can tell you is my own experience which is a database running with xlog, software and OS on a RAID 1, with Data partition running on 3 disk RAID 5 with a database of about 3 million rows total gets an insert speed of about 200 rows/sec on an average size table using a compaq proliant ML370 Dual Pentium 933 w/2G RAM. Most of the DB is in RAM, so read times are very good with most queries returning sub second. Hope this helps at least a little Alex Turner NetEconomist On Wed, 19 Jan 2005 09:03:44 +1100, Benjamin Wragg wrote: > > I just wanted to bounce off the list the best way to configure disks > for a postgresql server. My gut feeling is as follows: > > Keep the OS and postgresql install on seperate disks to the postgresql > /data directory? > Is a single hard disk drive acceptable for the OS and postgresql > program, or will this create a bottle neck? Would a multi disk array > be more appropriate? > > Cheers, > > Benjamin Wragg > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 > ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005 From pgsql-performance-owner@postgresql.org Thu Jan 20 01:36:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C67A93A451C for ; Thu, 20 Jan 2005 01:36: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 95908-05 for ; Thu, 20 Jan 2005 01:35:56 +0000 (GMT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id A632F3A456E for ; Thu, 20 Jan 2005 01:35:58 +0000 (GMT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 9482A3D37 for ; Wed, 19 Jan 2005 20:35:57 -0500 (EST) From: "Dan Langille" To: pgsql-performance@postgresql.org Date: Wed, 19 Jan 2005 20:37:59 -0500 MIME-Version: 1.0 Subject: index scan of whole table, can't see why Message-ID: <41EEC527.22215.A7AAF84@localhost> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body 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: 200501/253 X-Sequence-Number: 9943 Hi folks, Running on 7.4.2, recently vacuum analysed the three tables in question. The query plan in question changes dramatically when a WHERE clause changes from ports.broken to ports.deprecated. I don't see why. Well, I do see why: a sequential scan of a 130,000 rows. The query goes from 13ms to 1100ms because the of this. The full plans are at http://rafb.net/paste/results/v8ccvQ54.html I have tried some tuning by: set effective_cache_size to 4000, was 1000 set random_page_cost to 1, was 4 The resulting plan changes, but no speed improvment, are at http://rafb.net/paste/results/rV8khJ18.html Any suggestions please? -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/ From pgsql-performance-owner@postgresql.org Thu Jan 20 03:24:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE74B3A449A for ; Thu, 20 Jan 2005 03:24: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 06616-04 for ; Thu, 20 Jan 2005 03:23:53 +0000 (GMT) Received: from vscan02.westnet.com.au (vscan02.westnet.com.au [203.10.1.132]) by svr1.postgresql.org (Postfix) with ESMTP id ED7363A18CF for ; Thu, 20 Jan 2005 03:23:55 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by localhost (Postfix) with ESMTP id 42DCCCF06 for ; Thu, 20 Jan 2005 11:23:54 +0800 (WST) Received: from vscan02.westnet.com.au ([127.0.0.1]) by localhost (vscan02.westnet.com.au [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07932-03 for ; Thu, 20 Jan 2005 11:23:53 +0800 (WST) Received: from mapping12 (dsl-202-173-155-79.vic.westnet.com.au [202.173.155.79]) by vscan02.westnet.com.au (Postfix) with ESMTP id 673F9CCC8 for ; Thu, 20 Jan 2005 11:23:52 +0800 (WST) From: "Benjamin Wragg" To: Subject: Query performance and understanding explain analzye Date: Thu, 20 Jan 2005 14:23:51 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Thread-Index: AcT+n3Z8yaoWrPpAS62AkhLpQj8imQ== Message-Id: <20050120032352.673F9CCC8@vscan02.westnet.com.au> 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: 200501/254 X-Sequence-Number: 9944 Hi, I'm trying to tune a query that is taking to long to execute. I haven't done much sql tuning and have only had a little exposure to explain and explain analyze but from what I've read on the list and in books the following is generally true: Seq Scans are the almost always evil (except if a table has only a few values) Nested Joins are generally evil as every node below it is executed the number of times the "loops=" value says. Hash Joins are extremely quick. This is because when postgres uses Hash joins it creates a copy of the values of the table in memory and then Hashes (some type of memory join) to the other table. Is that correct? If so, I'm after some help on the following query which I feel is taking too long. At the outset I want to apologise for the length of this email, I just wanted to provide as much info as possible. I just can't seem to make sense of it and have been trying for days! SELECT abs(item.area-userpolygon.area) as area,item.title as item_title,item.id as item_id,item.collection_id as item_collection_id,item.type_id as item_type_id,item.scale as item_scale,publisher.publisher as publisher_publisher,publisher.description as publisher_description,language.language as language_language,language.description as language_description,language.code2 as language_code2,language.code3 as language_code3,collection.collection as collection_collection,collection.description as collection_description,item_base_type.type as item_type_combination_type,item_subtype.subtype as item_type_combination_subtype,item_format.format as item_type_combination_format,status.status as status_status,status.description as status_description,currency.code as currency_code,currency.description as currency_description,item.subtitle as item_subtitle,item.description as item_description,item.item_number as item_item_number,item.edition as item_edition,item.h_datum as item_h_datum,item.v_datum as item_v_datum,item.projection as item_projection,item.isbn as item_isbn,client_item_field.stock as client_item_field_stock,client_item_field.price as client_item_field_price,client_freight.freight as client_freight_freight,client_freight.description as client_freight_description FROM item INNER JOIN (client INNER JOIN client_item ON (client.id=client_item.client_id)) ON (client_item.item_id=item.id ) INNER JOIN publisher ON (item.publisher_id = publisher.id) INNER JOIN language ON (item.language_id = language.id) LEFT OUTER JOIN collection ON (item.collection_id = collection.id) INNER JOIN item_base_type ON (item.type_id = item_base_type.id) INNER JOIN item_subtype ON (item.subtype_id = item_subtype.id) INNER JOIN item_format ON (item.format_id = item_format.id) INNER JOIN status ON (item.status_id = status.id) INNER JOIN currency ON (item.publisher_currency_id = currency.id) LEFT OUTER JOIN client_item_field ON (client_item.client_id=client_item_field.client_id) AND (client_item.item_id=client_item_field.item_id) LEFT OUTER JOIN client_item_freight ON (client_item.client_id=client_item_freight.client_id) AND (client_item.item_id=client_item_freight.item_id) LEFT OUTER JOIN client_freight ON (client_freight.id=client_item_freight.client_freight_id), userpolygon WHERE item.the_geom && userpolygon.the_geom AND distance(item.the_geom, userpolygon.the_geom)=0 AND userpolygon.session_id='TestQuery' AND client.id=1 ORDER BY area asc When I explain analyze it I get: QUERY PLAN ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- ------------ Sort (cost=4793.89..4793.91 rows=7 width=622) (actual time=4066.52..4067.79 rows=4004 loops=1) Sort Key: abs((item.area - userpolygon.area)) -> Nested Loop (cost=533.45..4793.79 rows=7 width=622) (actual time=66.89..4054.01 rows=4004 loops=1) Join Filter: (("outer".the_geom && "inner".the_geom) AND (distance("outer".the_geom, "inner".the_geom) = 0::double precision)) -> Hash Join (cost=533.45..4548.30 rows=14028 width=582) (actual time=63.79..3826.16 rows=14028 loops=1) Hash Cond: ("outer".client_freight_id = "inner".id) -> Hash Join (cost=532.38..4437.64 rows=14028 width=540) (actual time=63.52..3413.48 rows=14028 loops=1) Hash Cond: ("outer".item_id = "inner".item_id) Join Filter: ("outer".client_id = "inner".client_id) -> Hash Join (cost=532.38..4367.49 rows=14028 width=528) (actual time=62.95..2993.37 rows=14028 loops=1) Hash Cond: ("outer".item_id = "inner".item_id) Join Filter: ("outer".client_id = "inner".client_id) -> Hash Join (cost=532.38..4297.33 rows=14028 width=508) (actual time=62.48..2576.46 rows=14028 loops=1) Hash Cond: ("outer".publisher_currency_id = "inner".id) -> Hash Join (cost=528.23..4047.69 rows=14028 width=476) (actual time=61.64..2189.57 rows=14028 loops=1) Hash Cond: ("outer".status_id = "inner".id) -> Hash Join (cost=527.17..3766.07 rows=14028 width=430) (actual time=61.30..1846.30 rows=14028 loops=1) Hash Cond: ("outer".format_id = "inner".id) -> Hash Join (cost=526.02..3519.43 rows=14028 width=417) (actual time=60.62..1537.19 rows=14028 loops=1) Hash Cond: ("outer".subtype_id = "inner".id) -> Hash Join (cost=524.67..3272.59 rows=14028 width=400) (actual time=60.09..1258.45 rows=14028 loops=1) Hash Cond: ("outer".type_id = "inner".id) -> Hash Join (cost=523.60..2990.96 rows=14028 width=388) (actual time=59.53..1009.52 rows=14028 loops=1) Hash Cond: ("outer".collection_id = "inner".id) -> Hash Join (cost=522.35..2709.15 rows=14028 width=329) (actual time=59.21..785.50 rows=14028 loops=1) Hash Cond: ("outer".language_id = "inner".id) -> Hash Join (cost=513.30..2419.54 rows=14028 width=269) (actual time=57.65..582.34 rows=14028 loops=1) Hash Cond: ("outer".publisher_id = "inner".id) -> Hash Join (cost=510.85..2171.60 rows=14028 width=220) (actual time=57.03..414.43 rows=14028 loops=1) Hash Cond: ("outer".id = "inner".item_id) -> Seq Scan on item (cost=0.00..924.28 rows=14028 width=208) (actual time=0.03..211.81 rows=14028 loops=1) -> Hash (cost=475.78..475.78 rows=14028 width=12) (actual time=56.47..56.47 rows=0 loops=1) -> Nested Loop (cost=0.00..475.78 rows=14028 width=12) (actual time=0.06..43.86 rows=14028 loops=1) -> Seq Scan on client (cost=0.00..1.05 rows=1 width=4) (actual time=0.01..0.03 rows=1 loops=1) Filter: (id = 1) -> Index Scan using client_item_client_id_idx on client_item (cost=0.00..299.38 rows=14028 width=8) (actual time=0.03..27.45 rows=14028 loops=1) Index Cond: ("outer".id = client_item.client_id) -> Hash (cost=2.21..2.21 rows=97 width=49) (actual time=0.33..0.33 rows=0 loops=1) -> Seq Scan on organisation (cost=0.00..2.21 rows=97 width=49) (actual time=0.02..0.22 rows=97 loops=1) Filter: (type_id = 1) -> Hash (cost=8.04..8.04 rows=404 width=60) (actual time=1.27..1.27 rows=0 loops=1) -> Seq Scan on "language" (cost=0.00..8.04 rows=404 width=60) (actual time=0.01..0.81 rows=404 loops=1) -> Hash (cost=1.20..1.20 rows=20 width=59) (actual time=0.06..0.06 rows=0 loops=1) -> Seq Scan on collection (cost=0.00..1.20 rows=20 width=59) (actual time=0.01..0.04 rows=20 loops=1) -> Hash (cost=1.05..1.05 rows=5 width=12) (actual time=0.02..0.02 rows=0 loops=1) -> Seq Scan on item_base_type (cost=0.00..1.05 rows=5 width=12) (actual time=0.01..0.02 rows=5 loops=1) -> Hash (cost=1.28..1.28 rows=28 width=17) (actual time=0.07..0.07 rows=0 loops=1) -> Seq Scan on item_subtype (cost=0.00..1.28 rows=28 width=17) (actual time=0.01..0.05 rows=28 loops=1) -> Hash (cost=1.12..1.12 rows=12 width=13) (actual time=0.05..0.05 rows=0 loops=1) -> Seq Scan on item_format (cost=0.00..1.12 rows=12 width=13) (actual time=0.01..0.03 rows=12 loops=1) -> Hash (cost=1.05..1.05 rows=5 width=46) (actual time=0.02..0.02 rows=0 loops=1) -> Seq Scan on status (cost=0.00..1.05 rows=5 width=46) (actual time=0.01..0.02 rows=5 loops=1) -> Hash (cost=3.72..3.72 rows=172 width=32) (actual time=0.45..0.45 rows=0 loops=1) -> Seq Scan on currency (cost=0.00..3.72 rows=172 width=32) (actual time=0.02..0.28 rows=172 loops=1) -> Hash (cost=0.00..0.00 rows=1 width=20) (actual time=0.01..0.01 rows=0 loops=1) -> Seq Scan on client_item_field (cost=0.00..0.00 rows=1 width=20) (actual time=0.00..0.00 rows=0 loops=1) -> Hash (cost=0.00..0.00 rows=1 width=12) (actual time=0.01..0.01 rows=0 loops=1) -> Seq Scan on client_item_freight (cost=0.00..0.00 rows=1 width=12) (actual time=0.00..0.00 rows=0 loops=1) -> Hash (cost=1.05..1.05 rows=5 width=42) (actual time=0.03..0.03 rows=0 loops=1) -> Seq Scan on client_freight (cost=0.00..1.05 rows=5 width=42) (actual time=0.01..0.02 rows=5 loops=1) -> Seq Scan on userpolygon (cost=0.00..0.00 rows=1 width=40) (actual time=0.01..0.01 rows=1 loops=14028) Filter: (session_id = 'TestQuery'::character varying) Total runtime: 4070.87 msec (63 rows) (if you have trouble reading it I can send it in a formatted txt file) So from my basic knowledge of explain analyze, am I correct is saying that postgres is deciding to attack the query in the following way: 1) All the small tables which I join to item should be loaded into a hashes. (e.g currency, status, collection, language, etc)? 2) The following indicates that the client table is joined to the client_item table and a hash is created in memory? -> Hash (cost=475.78..475.78 rows=14028 width=12) (actual time=56.47..56.47 rows=0 loops=1) -> Nested Loop (cost=0.00..475.78 rows=14028 width=12) (actual time=0.06..43.86 rows=14028 loops=1) -> Seq Scan on client (cost=0.00..1.05 rows=1 width=4) (actual time=0.01..0.03 rows=1 loops=1) Filter: (id = 1) -> Index Scan using client_item_client_id_idx on client_item (cost=0.00..299.38 rows=14028 width=8) (actual time=0.03..27.45 rows=14028 loops=1) Index Cond: ("outer".id = client_item.client_id) 3) All the records in the items table are selected with: -> Seq Scan on item (cost=0.00..924.28 rows=14028 width=208) (actual time=0.03..211.81 rows=14028 loops=1). This is ok as I am selecting everything from the item table. 4) Then the hash in step 2 is joined to the records from step 3: -> Hash Join (cost=510.85..2171.60 rows=14028 width=220) (actual time=57.03..414.43 rows=14028 loops=1) Hash Cond: ("outer".id = "inner".item_id) 5) All the hashes created in the first step are joined to the items returned in the second step (e.g currency, status, collection, language, etc)? 6) A nested loop runs at the end (actually a spatial operation for PostGIS) and a sort occurs. Am I correct??? If I am correct in the above execution path, doesn't this show that what is slowing down the query down is all the hash joins of the small tables??? I say this because at the start of step 4 the time taken so far is 57.03 milli secs and at the end of step 4 the time taken is 414.43 millisecs. So that part of the query took 414.43-57.03 but then just before step 6 at the last hash join the time taken is reported as: -> Hash Join (cost=533.45..4548.30 rows=14028 width=582) (actual time=63.79..3826.16 rows=14028 loops=1) So does this mean that at that point 3826.16 milli seconds had past and if we take 414.43 from 3826.16 it shows that all the hash joins took about 3.4 seconds to do? This doesn't seem right, as I thought that the hash joins were the quickest way to do a join? My final question is that on the last Nested loops, as well as on some of the hash joins I see "actual time" report as: -> Nested Loop (cost=533.45..4793.79 rows=7 width=622) (actual time=66.89..4054.01 rows=4004 loops=1) What does the first time, 66.89, represent? It can't be the time taken so far in the query because the node below it reports 3826.16 milli sec had passed. How do I interpret this? Thanks, Benjamin Wragg P.S I have indexes on all the primary and foreign keys and have vacuum analyzed -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005 From pgsql-performance-owner@postgresql.org Thu Jan 20 04:04:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30D243A461C for ; Thu, 20 Jan 2005 04:04: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 10723-01 for ; Thu, 20 Jan 2005 04:04:29 +0000 (GMT) Received: from planae.com.br (nat.planae.com.br [200.210.129.190]) by svr1.postgresql.org (Postfix) with SMTP id 2DDEB3A4603 for ; Thu, 20 Jan 2005 04:04:27 +0000 (GMT) Received: (qmail 43686 invoked by uid 1004); 20 Jan 2005 04:05:27 -0000 Received: from 127.0.0.1 by mercurio.planae.com.br (envelope-from , uid 0) with qmail-scanner-1.23 (clamdscan: 0.75. uvscan: v4.3.20/v4420. Clear:RC:1(127.0.0.1):. Processed in 0.703688 secs); 20 Jan 2005 04:05:27 -0000 Received: from localhost (HELO webmail.planae.com.br) (127.0.0.1) by localhost with SMTP; 20 Jan 2005 04:05:26 -0000 Received: from 10.20.2.231 (SquirrelMail authenticated user gfnobrega@planae.com.br); by webmail.planae.com.br with HTTP; Thu, 20 Jan 2005 02:05:26 -0200 (BRST) Message-ID: <1892.10.20.2.231.1106193926.squirrel@10.20.2.231> Date: Thu, 20 Jan 2005 02:05:26 -0200 (BRST) Subject: Tips and tunning for pgsql on HP-UX PA-RISC (RP3410) From: Gustavo Franklin =?iso-8859-1?Q?N=F3brega?= 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=iso-8859-1 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.008 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/255 X-Sequence-Number: 9945 Hi, Anyone have tips for performance of Postgresql, running on HP-UX 11.11, PA-RISC (HP RP3410)? What is better compiler (GCC or HP C/ANSI), flags of compilation, kernel and FS tunning? I have installed pgsql, and compiled with gcc -O2 -fexpensive-optimizations flags only. Another question: Postgres running well on HP-UX? What is the better: HP-UX or Linux on HP RP3410? Thanks! Gustavo Franklin N�brega Infraestrutura e Banco de Dados Planae Tecnologia da Informa��o (+55) 14 3224-3066 Ramal 209 www.planae.com.br From pgsql-performance-owner@postgresql.org Thu Jan 20 05:02:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36FE43A46B3 for ; Thu, 20 Jan 2005 05:00: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 17073-02 for ; Thu, 20 Jan 2005 05:00:44 +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 6D8843A45DB for ; Thu, 20 Jan 2005 05:00:42 +0000 (GMT) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id j0K50W508121; Wed, 19 Jan 2005 21:00:32 -0800 Date: Wed, 19 Jan 2005 21:00:32 -0800 From: andrew@pillette.com Message-Id: <200501200500.j0K50W508121@pillette.com> Subject: Re: index scan of whole table, can't see why To: "Dan Langille" Cc: pgsql-performance@postgresql.org X-Originating-IP: 64.172.56.204 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.189 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NO_REAL_NAME X-Spam-Level: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200501/256 X-Sequence-Number: 9946 This is a multi-part message in MIME format. --bound1106197232 Content-Type: text/plain Content-Transfer-Encoding: 7bit Let's see if I have been paying enough attention to the SQL gurus. The planner is making a different estimate of how many deprecated<>'' versus how many broken <> ''. I would try SET STATISTICS to a larger number on the ports table, and re-analyze. --bound1106197232-- From pgsql-performance-owner@postgresql.org Thu Jan 20 09:21:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 659C23A1D37 for ; Thu, 20 Jan 2005 09: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 59326-10 for ; Thu, 20 Jan 2005 09:21:13 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 719C73A40AB for ; Thu, 20 Jan 2005 09:21:13 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 4F821308EC; Thu, 20 Jan 2005 10:21:13 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: Tips and tunning for pgsql on HP-UX PA-RISC (RP3410) Date: Thu, 20 Jan 2005 01:21:09 -0800 Organization: Hub.Org Networking Services Lines: 36 Message-ID: References: <1892.10.20.2.231.1106193926.squirrel@10.20.2.231> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <1892.10.20.2.231.1106193926.squirrel@10.20.2.231> 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: 200501/257 X-Sequence-Number: 9947 Well you probably will need to run your own tests to get a conclusive answer. It should be that hard -- compile once with gcc, make a copy of the installed binaries to pgsql.gcc -- then repeat with the HP compiler. In general though, gcc works best under x86 computers. Comparisons of gcc on x86 versus Itanium versus PPC show binaries compiled for Itanium and PPC drastically underperform compared to gcc/x86. I suspect it's probably the same situation for HP-UX. Gustavo Franklin N�brega wrote: > Hi, > > Anyone have tips for performance of Postgresql, running on HP-UX 11.11, > PA-RISC (HP RP3410)? What is better compiler (GCC or HP C/ANSI), flags of > compilation, kernel and FS tunning? > > I have installed pgsql, and compiled with gcc -O2 > -fexpensive-optimizations flags only. > > Another question: Postgres running well on HP-UX? What is the better: > HP-UX or Linux on HP RP3410? > > Thanks! > > > Gustavo Franklin N�brega > Infraestrutura e Banco de Dados > Planae Tecnologia da Informa��o > (+55) 14 3224-3066 Ramal 209 > www.planae.com.br > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend > From pgsql-performance-owner@postgresql.org Thu Jan 20 09:23:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DB05A3A42AE for ; Thu, 20 Jan 2005 09:23: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 59672-05 for ; Thu, 20 Jan 2005 09:22:48 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id D227E3A3D7D for ; Thu, 20 Jan 2005 09:22:48 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Thu, 20 Jan 2005 09:22:44 Z Subject: Re: index scan of whole table, can't see why From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: andrew@pillette.com Cc: Dan Langille , pgsql-performance@postgresql.org In-Reply-To: <200501200500.j0K50W508121@pillette.com> References: <200501200500.j0K50W508121@pillette.com> Content-Type: text/plain Date: Thu, 20 Jan 2005 09:23:58 +0000 Message-Id: <1106213038.22416.10.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: 200501/258 X-Sequence-Number: 9948 On Wed, 2005-01-19 at 21:00 -0800, andrew@pillette.com wrote: > Let's see if I have been paying enough attention to the SQL gurus. > The planner is making a different estimate of how many deprecated<>'' versus how many broken <> ''. > I would try SET STATISTICS to a larger number on the ports table, and re-analyze. that should not help, as the estimate is accurate, according to the explain analyze. gnari From pgsql-performance-owner@postgresql.org Thu Jan 20 09:33:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA9993A4463 for ; Thu, 20 Jan 2005 09:33: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 61328-06 for ; Thu, 20 Jan 2005 09:33:14 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 14F003A444B for ; Thu, 20 Jan 2005 09:33:15 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Thu, 20 Jan 2005 09:33:15 Z Subject: Re: index scan of whole table, can't see why From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Dan Langille Cc: pgsql-performance@postgresql.org In-Reply-To: <41EEC527.22215.A7AAF84@localhost> References: <41EEC527.22215.A7AAF84@localhost> Content-Type: text/plain Date: Thu, 20 Jan 2005 09:34:29 +0000 Message-Id: <1106213669.22416.17.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: 200501/259 X-Sequence-Number: 9949 On Wed, 2005-01-19 at 20:37 -0500, Dan Langille wrote: > Hi folks, > > Running on 7.4.2, recently vacuum analysed the three tables in > question. > > The query plan in question changes dramatically when a WHERE clause > changes from ports.broken to ports.deprecated. I don't see why. > Well, I do see why: a sequential scan of a 130,000 rows. The query > goes from 13ms to 1100ms because the of this. The full plans are at > http://rafb.net/paste/results/v8ccvQ54.html > > I have tried some tuning by: > > set effective_cache_size to 4000, was 1000 > set random_page_cost to 1, was 4 > > The resulting plan changes, but no speed improvment, are at > http://rafb.net/paste/results/rV8khJ18.html > this just confirms that an indexscan is not always better than a tablescan. by setting random_page_cost to 1, you deceiving the planner into thinking that the indexscan is almost as effective as a tablescan. > Any suggestions please? did you try to increase sort_mem ? gnari From pgsql-performance-owner@postgresql.org Thu Jan 20 09:34:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B9E863A4477 for ; Thu, 20 Jan 2005 09:34: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 61656-04 for ; Thu, 20 Jan 2005 09:34:36 +0000 (GMT) Received: from zeus.linuxsystems.be (zeus.linuxsystems.be [213.193.231.130]) by svr1.postgresql.org (Postfix) with ESMTP id F34A43A4269 for ; Thu, 20 Jan 2005 09:34:36 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id 926C43B05B0 for ; Thu, 20 Jan 2005 10:34:35 +0100 (CET) Received: from zeus.linuxsystems.be ([127.0.0.1]) by localhost (zeus [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14584-07 for ; Thu, 20 Jan 2005 10:34:35 +0100 (CET) Received: from webmail.linuxsystems.be (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id 395743B07E3 for ; Thu, 20 Jan 2005 10:34:35 +0100 (CET) Received: from 193.190.212.113 (SquirrelMail authenticated user matt.ibridge.be); by webmail.linuxsystems.be with HTTP; Thu, 20 Jan 2005 10:34:35 +0100 (CET) Message-ID: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> Date: Thu, 20 Jan 2005 10:34:35 +0100 (CET) Subject: From: "Matt Casters" To: pgsql-performance@postgresql.org Reply-To: Matt.Casters@advalvas.be User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at linuxsystems.be X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.098 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, MISSING_SUBJECT X-Spam-Level: ** X-Archive-Number: 200501/260 X-Sequence-Number: 9950 Hi, I have the go ahead of a customer to do some testing on Postgresql in a couple of weeks as a replacement for Oracle. The reason for the test is that the number of users of the warehouse is going to increase and this will have a serious impact on licencing costs. (I bet that sounds familiar) We're running a medium sized data warehouse on a Solaris box (4CPU, 8Gb RAM) on Oracle. Basically we have 2 large fact tables to deal with: one going for 400M rows, the other will be hitting 1B rows soon. (around 250Gb of data) My questions to the list are: has this sort of thing been attempted before? If so, what where the performance results compared to Oracle? I've been reading up on partitioned tabes on pgsql, will the performance benefit will be comparable to Oracle partitioned tables? What are the gotchas? Should I be testing on 8 or the 7 version? While I didn't find any documents immediately, are there any fine manuals to read on data warehouse performance tuning on PostgreSQL? Thanks in advance for any help you may have, I'll do my best to keep pgsql-performance up to date on the results. Best regards, Matt ------ Matt Casters i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 From pgsql-performance-owner@postgresql.org Thu Jan 20 10:14:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C85A43A3F1D for ; Thu, 20 Jan 2005 10:14: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 68547-09 for ; Thu, 20 Jan 2005 10:14:41 +0000 (GMT) Received: from mailout10.sul.t-online.com (mailout10.sul.t-online.com [194.25.134.21]) by svr1.postgresql.org (Postfix) with ESMTP id D45593A444B for ; Thu, 20 Jan 2005 10:14:42 +0000 (GMT) Received: from fwd06.aul.t-online.de by mailout10.sul.t-online.com with smtp id 1CrZKq-0001Iu-03; Thu, 20 Jan 2005 11:14:40 +0100 Received: from jupiter.home.lan (ZY8QCyZGrexmqr3DrnVn8RIdrIaceHP-3eiq6zix1vKHr5jJgiRo8h@[217.86.71.171]) by fmrl06.sul.t-online.com with esmtp id 1CrZKg-0vCzr60; Thu, 20 Jan 2005 11:14:30 +0100 Received: from [192.168.20.1] (jupiter.home.lan [192.168.20.1]) by jupiter.home.lan (Postfix) with ESMTP id 38EC61A1F98 for ; Thu, 20 Jan 2005 11:14:29 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v619) Content-Transfer-Encoding: 7bit Message-Id: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net> Content-Type: text/plain; charset=US-ASCII; format=flowed To: pgsql-performance@postgresql.org From: Bernd Heller Subject: column without pg_stats entry?! Date: Thu, 20 Jan 2005 11:14:28 +0100 X-Mailer: Apple Mail (2.619) X-ID: ZY8QCyZGrexmqr3DrnVn8RIdrIaceHP-3eiq6zix1vKHr5jJgiRo8h@t-dialin.net X-TOI-MSGID: 84888618-89ec-442d-a461-10492af040ea X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/261 X-Sequence-Number: 9951 Hello everyone, I'm having a problem with some of my tables and I'm not sure if postgres' behaviour is maybe even a bug. I'm (still) using 8.0rc5 at present. I have a table that contains among other columns one of the sort: purge_date timestamp most records will have this field set to NULL, at present all of them really. the table has about 100k row right now. in regular intervals I'm doing some cleanup on this table using a query like: delete from mytable where purge_date is not null and purge_date < current_date And I have created these btree indexes: create index on mytable (purge_date); create index on mytable (purge_date) where purge_date is not null; my problem is that the planner always chooses a seq scan over an index scan. only when I set enable_seqscan to false does it use an index scan. The costs of both plans are extremely different, with the index scan being 5-10 times more expensive than the seq scan, which is obviously not true given that all rows have this column set to NULL. I wondered why the planner was making such bad assumptions about the number of rows to find and had a look at pg_stats. and there was the surprise: there is no entry in pg_stats for that column at all!! I can only suspect that this has to do with the column being all null. I tried to change a few records to a not-null value, but re-ANALYZE didn't catch them apparently. Is this desired behaviour for analyze? Can I change it somehow? If not, is there a better way to accomplish what I'm trying? I'm not to keen on disabling seqscan for that query explicitly. It's a simple enough query and the planner should be able to find the right plan without help - and I'm sure it would if it had stats about it. Any help appreciated. Bernd From pgsql-performance-owner@postgresql.org Thu Jan 20 11:13:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 81C483A4334; Thu, 20 Jan 2005 11:13: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 78962-07; Thu, 20 Jan 2005 11:13:38 +0000 (GMT) Received: from ar-sd.net (unknown [82.77.155.72]) by svr1.postgresql.org (Postfix) with ESMTP id DBA363A4263; Thu, 20 Jan 2005 11:13:38 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id C0C9E21308; Thu, 20 Jan 2005 13:09:09 +0200 (EET) Received: from ar-sd.net ([127.0.0.1]) by localhost (linz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03939-04; Thu, 20 Jan 2005 13:09:08 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id 2A205212F0; Thu, 20 Jan 2005 13:09:08 +0200 (EET) Message-ID: <019f01c4fee1$1b58d600$0b00a8c0@forge> From: "Andrei Bintintan" To: , Subject: OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 13:13:44 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_019A_01C4FEF1.DE1BBDF0" 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 ar-sd.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.06 tagged_above=0 required=5 tests=AWL, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/262 X-Sequence-Number: 9952 This is a multi-part message in MIME format. ------=_NextPart_000_019A_01C4FEF1.DE1BBDF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi to all,=20 I have the following 2 examples. Now, regarding on the offset if it is = small(10) or big(>50000) what is the impact on the performance of the = query?? I noticed that if I return more data's(columns) or if I make = more joins then the query runs even slower if the OFFSET is bigger. How = can I somehow improve the performance on this?=20 Best regards,=20 Andy. explain analyze SELECT o.id FROM report r=20 INNER JOIN orders o ON o.id=3Dr.id_order AND o.id_status=3D6 ORDER BY 1 LIMIT 10 OFFSET 10 Limit (cost=3D44.37..88.75 rows=3D10 width=3D4) (actual = time=3D0.160..0.275 rows=3D10 loops=3D1) -> Merge Join (cost=3D0.00..182150.17 rows=3D41049 width=3D4) = (actual time=3D0.041..0.260 rows=3D20 loops=3D1) Merge Cond: ("outer".id_order =3D "inner".id) -> Index Scan using report_id_order_idx on report r = (cost=3D0.00..157550.90 rows=3D42862 width=3D4) (actual = time=3D0.018..0.075 rows=3D20 loops=3D1) -> Index Scan using orders_pkey on orders o = (cost=3D0.00..24127.04 rows=3D42501 width=3D4) (actual = time=3D0.013..0.078 rows=3D20 loops=3D1) Filter: (id_status =3D 6) Total runtime: 0.373 ms explain analyze SELECT o.id FROM report r=20 INNER JOIN orders o ON o.id=3Dr.id_order AND o.id_status=3D6 ORDER BY 1 LIMIT 10 OFFSET 1000000 Limit (cost=3D31216.85..31216.85 rows=3D1 width=3D4) (actual = time=3D1168.152..1168.152 rows=3D0 loops=3D1) -> Sort (cost=3D31114.23..31216.85 rows=3D41049 width=3D4) (actual = time=3D1121.769..1152.246 rows=3D42693 loops=3D1) Sort Key: o.id -> Hash Join (cost=3D2329.99..27684.03 rows=3D41049 width=3D4) = (actual time=3D441.879..925.498 rows=3D42693 loops=3D1) Hash Cond: ("outer".id_order =3D "inner".id) -> Seq Scan on report r (cost=3D0.00..23860.62 = rows=3D42862 width=3D4) (actual time=3D38.634..366.035 rows=3D42864 = loops=3D1) -> Hash (cost=3D2077.74..2077.74 rows=3D42501 width=3D4) = (actual time=3D140.200..140.200 rows=3D0 loops=3D1) -> Seq Scan on orders o (cost=3D0.00..2077.74 = rows=3D42501 width=3D4) (actual time=3D0.059..96.890 rows=3D42693 = loops=3D1) Filter: (id_status =3D 6) Total runtime: 1170.586 ms ------=_NextPart_000_019A_01C4FEF1.DE1BBDF0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi to all,

I have the following 2 examples. = Now,=20 regarding on the offset if it is small(10) or big(>50000) what is the = impact=20 on the performance of the query?? I noticed that if I return more=20 data's(columns) or if I make more joins then the query runs = even=20 slower if the OFFSET is bigger. How can I somehow improve the = performance on=20 this?

Best regards,
Andy.

explain analyze
SELECT
=20 o.id
FROM=20 report r
INNER JOIN orders o ON=20 o.id=3Dr.id_order AND = o.id_status=3D6
ORDER BY 1 LIMIT 10 OFFSET 10

 
Limit  (cost=3D44.37..88.75 = rows=3D10 width=3D4)=20 (actual time=3D0.160..0.275 rows=3D10 loops=3D1)
  ->  = Merge=20 Join  (cost=3D0.00..182150.17 rows=3D41049 width=3D4) (actual = time=3D0.041..0.260=20 rows=3D20 loops=3D1)
        Merge = Cond:=20 ("outer".id_order =3D = "inner".id)
       =20 ->  Index Scan using report_id_order_idx on report r =20 (cost=3D0.00..157550.90 rows=3D42862 width=3D4) (actual = time=3D0.018..0.075 rows=3D20=20 loops=3D1)
        ->  = Index Scan=20 using orders_pkey on orders o  (cost=3D0.00..24127.04 rows=3D42501 = width=3D4)=20 (actual time=3D0.013..0.078 rows=3D20=20 loops=3D1)
          = ;   =20 Filter: (id_status =3D 6)
Total runtime: 0.373 ms

explain analyze
SELECT
=20 o.id
FROM=20 report r
INNER JOIN orders o ON=20 o.id=3Dr.id_order AND = o.id_status=3D6
ORDER BY 1 LIMIT 10 OFFSET 1000000

Limit  (cost=3D31216.85..31216.85 rows=3D1 width=3D4) = (actual=20 time=3D1168.152..1168.152 rows=3D0 loops=3D1)
  ->  = Sort =20 (cost=3D31114.23..31216.85 rows=3D41049 width=3D4) (actual = time=3D1121.769..1152.246=20 rows=3D42693 loops=3D1)
        = Sort Key:=20 o.id
        ->  Hash = Join =20 (cost=3D2329.99..27684.03 rows=3D41049 width=3D4) (actual = time=3D441.879..925.498=20 rows=3D42693=20 loops=3D1)
          = ;   =20 Hash Cond: ("outer".id_order =3D=20 "inner".id)
         &nbs= p;   =20 ->  Seq Scan on report r  (cost=3D0.00..23860.62 = rows=3D42862 width=3D4)=20 (actual time=3D38.634..366.035 rows=3D42864=20 loops=3D1)
          = ;   =20 ->  Hash  (cost=3D2077.74..2077.74 rows=3D42501 width=3D4) = (actual=20 time=3D140.200..140.200 rows=3D0=20 loops=3D1)
          = ;         =20 ->  Seq Scan on orders o  (cost=3D0.00..2077.74 = rows=3D42501 width=3D4)=20 (actual time=3D0.059..96.890 rows=3D42693=20 loops=3D1)
          = ;            =    =20 Filter: (id_status =3D 6)
Total runtime: 1170.586=20 ms
------=_NextPart_000_019A_01C4FEF1.DE1BBDF0-- From pgsql-performance-owner@postgresql.org Thu Jan 20 11:54:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 332B13A1D6B for ; Thu, 20 Jan 2005 11:54: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 84266-10 for ; Thu, 20 Jan 2005 11:54:17 +0000 (GMT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id CBA863A468E for ; Thu, 20 Jan 2005 11:54:18 +0000 (GMT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 42BA43D37; Thu, 20 Jan 2005 06:54:17 -0500 (EST) From: "Dan Langille" To: "=?ISO-8859-1?Q?Ragnar_Hafsta=F0?=" Date: Thu, 20 Jan 2005 06:56:20 -0500 MIME-Version: 1.0 Subject: Re: index scan of whole table, can't see why Cc: pgsql-performance@postgresql.org Message-ID: <41EF5614.28069.CB0CC42@localhost> In-reply-to: <1106213669.22416.17.camel@localhost.localdomain> References: <41EEC527.22215.A7AAF84@localhost> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: Quoted-printable Content-description: Mail message body 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: 200501/263 X-Sequence-Number: 9953 On 20 Jan 2005 at 9:34, Ragnar Hafsta=F0 wrote: > On Wed, 2005-01-19 at 20:37 -0500, Dan Langille wrote: > > Hi folks, > > > > Running on 7.4.2, recently vacuum analysed the three tables in > > question. > > > > The query plan in question changes dramatically when a WHERE clause > > changes from ports.broken to ports.deprecated. I don't see why. > > Well, I do see why: a sequential scan of a 130,000 rows. The query > > goes from 13ms to 1100ms because the of this. The full plans are at > > http://rafb.net/paste/results/v8ccvQ54.html > > > > I have tried some tuning by: > > > > set effective_cache_size to 4000, was 1000 > > set random_page_cost to 1, was 4 > > > > The resulting plan changes, but no speed improvment, are at > > http://rafb.net/paste/results/rV8khJ18.html > > > > this just confirms that an indexscan is not always better than a > tablescan. by setting random_page_cost to 1, you deceiving the > planner into thinking that the indexscan is almost as effective > as a tablescan. > > > Any suggestions please? > > did you try to increase sort_mem ? I tried sort_mem =3D 4096 and then 16384. This did not make a difference. See http://rafb.net/paste/results/AVDqEm55.html Thank you. -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/ From pgsql-performance-owner@postgresql.org Thu Jan 20 12:12:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0F80E3A1D6B; Thu, 20 Jan 2005 12: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 87143-03; Thu, 20 Jan 2005 12:12:31 +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 087E13A469E; Thu, 20 Jan 2005 12:12:23 +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 1Crb9l-000FvH-1X; Thu, 20 Jan 2005 12:11:26 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 9FF501593E; Thu, 20 Jan 2005 12:11:01 +0000 (GMT) Message-ID: <41EF9FD3.5020400@archonet.com> Date: Thu, 20 Jan 2005 12:10:59 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrei Bintintan Cc: pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> In-Reply-To: <019f01c4fee1$1b58d600$0b00a8c0@forge> 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.073 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/264 X-Sequence-Number: 9954 Andrei Bintintan wrote: > Hi to all, > > I have the following 2 examples. Now, regarding on the offset if it > is small(10) or big(>50000) what is the impact on the performance of > the query?? I noticed that if I return more data's(columns) or if I > make more joins then the query runs even slower if the OFFSET is > bigger. How can I somehow improve the performance on this? There's really only one way to do an offset of 1000 and that's to fetch 1000 rows and then some and discard the first 1000. If you're using this to provide "pages" of results, could you use a cursor? -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 20 13:20:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49E613A4774 for ; Thu, 20 Jan 2005 13: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 94352-05 for ; Thu, 20 Jan 2005 13:20:20 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id D99193A472A for ; Thu, 20 Jan 2005 13:20:21 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 08:20:21 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75C3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] OFFSET impact on Performance??? Thread-Index: AcT+4g7ofrisF7QSQDqvQMe8F9YvCQADoc2A From: "Merlin Moncure" To: "Andrei Bintintan" Cc: 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: 200501/265 X-Sequence-Number: 9955 Andrei: Hi to all,=20 I have the following 2 examples. Now, regarding on the offset if it is = small(10) or big(>50000) what is the impact on the performance of the = query?? I noticed that if I return more data's(columns) or=A0if I make = more joins=A0then the query runs even slower if the OFFSET is bigger. = How can I=20 somehow improve the performance on this?=20 Merlin: Offset is not suitable for traversal of large data sets. Better not use = it at all! There are many ways to deal with this problem, the two most direct being = the view approach and the cursor approach. cursor approach: declare report_order with hold cursor for select * from report r, order = o [...] Remember to close the cursor when you're done. Now fetch time is = proportional to the number of rows fetched, and should be very fast. = The major drawback to this approach is that cursors in postgres = (currently) are always insensitive, so that record changes after you = declare the cursor from other users are not visible to you. If this is = a big deal, try the view approach. view approach: create view report_order as select * from report r, order o [...] and this: prepare fetch_from_report_order(numeric, numeric, int4) as select * from report_order where order_id >=3D $1 and (order_id > $1 or report_id > $2) order by order_id, report_id limit $3; fetch next 1000 records from report_order: execute fetch_from_report_order(o, f, 1000); o and f being the last key = values you fetched (pass in zeroes to start it off). This is not quite as fast as the cursor approach (but it will be when we = get a proper row constructor, heh), but it more flexible in that it is = sensitive to changes from other users. This is more of a 'permanent' = binding whereas cursor is a binding around a particular task. Good luck! Merlin From pgsql-performance-owner@postgresql.org Thu Jan 20 13:45:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F3CAC3A47B7; Thu, 20 Jan 2005 13: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 96539-08; Thu, 20 Jan 2005 13:45:34 +0000 (GMT) Received: from ar-sd.net (unknown [82.77.155.72]) by svr1.postgresql.org (Postfix) with ESMTP id 06E373A4798; Thu, 20 Jan 2005 13:45:35 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id DE6B61E9B4; Thu, 20 Jan 2005 15:41:11 +0200 (EET) Received: from ar-sd.net ([127.0.0.1]) by localhost (linz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06198-05; Thu, 20 Jan 2005 15:41:11 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id AC88B1DDF2; Thu, 20 Jan 2005 15:41:10 +0200 (EET) Message-ID: <020d01c4fef6$595bb9d0$0b00a8c0@forge> From: "Andrei Bintintan" To: "Richard Huxton" Cc: , References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> Subject: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 15:45:47 +0200 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 ar-sd.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.022 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/266 X-Sequence-Number: 9956 > If you're using this to provide "pages" of results, could you use a > cursor? What do you mean by that? Cursor? Yes I'm using this to provide "pages", but If I jump to the last pages it goes very slow. Andy. ----- Original Message ----- From: "Richard Huxton" To: "Andrei Bintintan" Cc: ; Sent: Thursday, January 20, 2005 2:10 PM Subject: Re: [SQL] OFFSET impact on Performance??? > Andrei Bintintan wrote: >> Hi to all, >> >> I have the following 2 examples. Now, regarding on the offset if it >> is small(10) or big(>50000) what is the impact on the performance of >> the query?? I noticed that if I return more data's(columns) or if I >> make more joins then the query runs even slower if the OFFSET is >> bigger. How can I somehow improve the performance on this? > > There's really only one way to do an offset of 1000 and that's to fetch > 1000 rows and then some and discard the first 1000. > > If you're using this to provide "pages" of results, could you use a > cursor? > > -- > Richard Huxton > Archonet Ltd > From pgsql-performance-owner@postgresql.org Thu Jan 20 14:03:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1FB4F3A4269 for ; Thu, 20 Jan 2005 14:03: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 04069-06 for ; Thu, 20 Jan 2005 14:03:30 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id B77023A2B8D for ; Thu, 20 Jan 2005 14:03:32 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id A2857EC2AA for ; Thu, 20 Jan 2005 15:04:16 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 89FA2EC033 for ; Thu, 20 Jan 2005 15:04:16 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: pgsql-performance@postgresql.org Subject: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 15:03:31 +0100 User-Agent: KMail/1.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201503.31241.herve@elma.fr> 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: 200501/267 X-Sequence-Number: 9957 Dear community, My company, which I actually represent, is a fervent user of PostgreSQL. We used to make all our applications using PostgreSQL for more than 5 years. We usually do classical client/server applications under Linux, and Web interface (php, perl, C/C++). We used to manage also public web services with 10/15 millions records and up to 8 millions pages view by month. Now we are in front of a new need, but we do not find any good solution with PostgreSQL. We need to make a sort of directory of millions of data growing about 4/8 millions per month, and to be able to be used by many users from the web. In order to do this, our solution need to be able to run perfectly with many insert and many select access (done before each insert, and done by web site visitors). We will also need to make a search engine for the millions of data (140/150 millions records at the immediate beginning) ... No it's not google, but the kind of volume of data stored in the main table is similar. Then ... we have made some tests, with the actual servers we have here, like a Bi-Pro Xeon 2.8 Ghz, with 4 Gb of RAM and the result of the cumulative inserts, and select access is slowing down the service really quickly ... (Load average is going up to 10 really quickly on the database). We were at this moment thinking about a Cluster solution ... We saw on the Internet many solution talking about Cluster solution using MySQL ... but nothing about PostgreSQL ... the idea is to use several servers to make a sort of big virtual server using the disk space of each server as one, and having the ability to use the CPU and RAM of each servers in order to maintain good service performance ...one can imagin it is like a GFS but dedicated to postgreSQL... Is there any solution with PostgreSQL matching these needs ... ? Do we have to backport our development to MySQL for this kind of problem ? Is there any other solution than a Cluster for our problem ? Looking for your reply, Regards, -- Herv� From pgsql-performance-owner@postgresql.org Thu Jan 20 14:14:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EFC043A18CF for ; Thu, 20 Jan 2005 14:14: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 05339-09 for ; Thu, 20 Jan 2005 14:14:30 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id B85313A4779 for ; Thu, 20 Jan 2005 14:14:33 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 3283835A60; Thu, 20 Jan 2005 06:14:31 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 30F1735A5F; Thu, 20 Jan 2005 06:14:31 -0800 (PST) Date: Thu, 20 Jan 2005 06:14:31 -0800 (PST) From: Stephan Szabo To: Dan Langille Cc: pgsql-performance@postgresql.org Subject: Re: index scan of whole table, can't see why In-Reply-To: <41EEC527.22215.A7AAF84@localhost> Message-ID: <20050120061205.T35934@megazone.bigpanda.com> References: <41EEC527.22215.A7AAF84@localhost> 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.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/268 X-Sequence-Number: 9958 On Wed, 19 Jan 2005, Dan Langille wrote: > Hi folks, > > Running on 7.4.2, recently vacuum analysed the three tables in > question. > > The query plan in question changes dramatically when a WHERE clause > changes from ports.broken to ports.deprecated. I don't see why. > Well, I do see why: a sequential scan of a 130,000 rows. The query > goes from 13ms to 1100ms because the of this. The full plans are at > http://rafb.net/paste/results/v8ccvQ54.html > > I have tried some tuning by: > > set effective_cache_size to 4000, was 1000 > set random_page_cost to 1, was 4 > > The resulting plan changes, but no speed improvment, are at > http://rafb.net/paste/results/rV8khJ18.html > > Any suggestions please? As a question, what does it do if enable_hashjoin is false? I'm wondering if it'll pick a nested loop for that step for the element/ports join and what it estimates the cost to be. From pgsql-performance-owner@postgresql.org Thu Jan 20 14:23:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C4B953A18CF for ; Thu, 20 Jan 2005 14:23: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 06147-06 for ; Thu, 20 Jan 2005 14:23:00 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.203]) by svr1.postgresql.org (Postfix) with ESMTP id E029C3A4783 for ; Thu, 20 Jan 2005 14:23:02 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id b11so15882rne for ; Thu, 20 Jan 2005 06:23:03 -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=NmRteGupmrM2Y3JpMNIu/wK+IIYQdenDKihidho1P+joj/Cp7H6XHWZTW/0GanoHxAx1odL0TwP8VarZpm9EfYcSCVJ0tiWfmMRk/LCVeBLQBA9Ksd4NHAKeW2NEVBrfznl2EqNl/JnF3M+ZEDGX0ZcvGoTW3jH3TLAtYtK+NLI= Received: by 10.38.4.61 with SMTP id 61mr60323rnd; Thu, 20 Jan 2005 06:23:03 -0800 (PST) Received: by 10.38.149.21 with HTTP; Thu, 20 Jan 2005 06:23:03 -0800 (PST) Message-ID: <4b09a0c05012006236b40489d@mail.gmail.com> Date: Thu, 20 Jan 2005 15:23:03 +0100 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: =?ISO-8859-1?Q?Herv=E9_Piedvache?= Subject: Re: PostgreSQL clustering VS MySQL clustering Cc: pgsql-performance@postgresql.org In-Reply-To: <200501201503.31241.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable References: <200501201503.31241.herve@elma.fr> 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: 200501/269 X-Sequence-Number: 9959 On Thu, 20 Jan 2005 15:03:31 +0100, Herv=E9 Piedvache wrote= : > We were at this moment thinking about a Cluster solution ... We saw on th= e > Internet many solution talking about Cluster solution using MySQL ... but > nothing about PostgreSQL ... the idea is to use several servers to make a > sort of big virtual server using the disk space of each server as one, an= d > having the ability to use the CPU and RAM of each servers in order to > maintain good service performance ...one can imagin it is like a GFS but > dedicated to postgreSQL... >=20 forget mysql cluster for now. We have a small database which size is 500 Mb. It is not possible to load these base in a computer with 2 Mb of RAM and loading the base in RAM is required. So, we shrink the database and it is ok with 350 Mb to fit in the 2 Gb RAM. First tests of performance on a basic request: 500x slower, yes 500x. This issue is reported to mysql team but no answer (and correction) Actually, the solution is running with a replication database: 1 node for write request and all the other nodes for read requests and the load balancer is made with round robin solution. --=20 Jean-Max Reymond CKR Solutions Nice France http://www.ckr-solutions.com From pgsql-performance-owner@postgresql.org Thu Jan 20 14:25:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DEE6B3A47C5 for ; Thu, 20 Jan 2005 14:25: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 06278-10 for ; Thu, 20 Jan 2005 14:25:02 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 42E5A3A47C4 for ; Thu, 20 Jan 2005 14:25:03 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0KE4gtk011280; Thu, 20 Jan 2005 14:04:52 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Thu, 20 Jan 2005 14:24:05 +0000 Message-ID: <41EFBF05.6000509@familyhealth.com.au> Date: Thu, 20 Jan 2005 14:24:05 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> In-Reply-To: <200501201503.31241.herve@elma.fr> 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.24 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/270 X-Sequence-Number: 9960 > Is there any solution with PostgreSQL matching these needs ... ? You want: http://www.slony.info/ > Do we have to backport our development to MySQL for this kind of problem ? > Is there any other solution than a Cluster for our problem ? Well, Slony does replication which is basically what you want :) Only master->slave though, so you will need to have all inserts go via the master server, but selects can come off any server. Chris From pgsql-performance-owner@postgresql.org Thu Jan 20 14:26:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 290863A47B2 for ; Thu, 20 Jan 2005 14:26: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 06214-09 for ; Thu, 20 Jan 2005 14:25:48 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id 9E5843A47AF for ; Thu, 20 Jan 2005 14:25:50 +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 j0KEPlo1017721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 09:25:47 -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 j0KEQ5Vp010029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 09:26:05 -0500 Received: (from sfrost@localhost) by ns.snowman.net (8.13.1/8.13.1/Submit) id j0KEQ3p1010027; Thu, 20 Jan 2005 09:26:03 -0500 Date: Thu, 20 Jan 2005 09:26:03 -0500 From: Stephen Frost To: Matt Casters Cc: pgsql-performance@postgresql.org Subject: Re: Message-ID: <20050120142603.GM10437@ns.snowman.net> Mail-Followup-To: Matt Casters , pgsql-performance@postgresql.org References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LvBAm8/CQHvFF6wS" Content-Disposition: inline In-Reply-To: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> 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: 08:59:04 up 355 days, 8:54, 8 users, load average: 0.12, 0.18, 0.12 User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.018 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/271 X-Sequence-Number: 9961 --LvBAm8/CQHvFF6wS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Matt Casters (Matt.Casters@advalvas.be) wrote: > I have the go ahead of a customer to do some testing on Postgresql in a couple of weeks as a > replacement for Oracle. > The reason for the test is that the number of users of the warehouse is going to increase and this > will have a serious impact on licencing costs. (I bet that sounds familiar) Rather familiar, yes... :) > We're running a medium sized data warehouse on a Solaris box (4CPU, 8Gb RAM) on Oracle. > Basically we have 2 large fact tables to deal with: one going for 400M rows, the other will be > hitting 1B rows soon. > (around 250Gb of data) Quite a bit of data. There's one big thing to note here I think- Postgres will not take advantage of multiple CPUs for a given query, Oracle will. So, it depends on your workload as to how that may impact you. Situations where this will be unlikely to affect you: Your main bottle-neck is IO/disk and not CPU. You run multiple queries in parallel frequently. There are other processes on the system which chew up CPU time anyway. Situations where you're likely to be affected would be: You periodically run one big query. You run a set of queries in sequential order. > My questions to the list are: has this sort of thing been attempted before? If so, what where the > performance results compared to Oracle? I'm pretty sure it's been attempted before but unfortunately I don't have any numbers on it myself. My data sets aren't that large (couple million rows) but I've found PostgreSQL at least as fast as Oracle for what we do, and much easier to work with. > I've been reading up on partitioned tabes on pgsql, will the performance benefit will be > comparable to Oracle partitioned tables? In this case I would think so, except that PostgreSQL still won't use multiple CPUs for a given query, even against partitioned tables, aiui. > What are the gotchas? See above? :) Other issues are things having to do w/ your specific SQL- Oracle's old join syntax isn't supported by PostgreSQL (what is it, something like select x,y from a,b where x=%y; to do a right-join, iirc). > Should I be testing on 8 or the 7 version? Now that 8.0 is out I'd say probably test with that and just watch for 8.0.x releases before you go production, if you have time before you have to go into production with the new solution (sounds like you do- changing databases takes time anyway). > Thanks in advance for any help you may have, I'll do my best to keep pgsql-performance up to date > on the results. Hope that helps. Others on here will correct me if I misspoke. :) Stephen --LvBAm8/CQHvFF6wS 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) iD8DBQFB7796rzgMPqB3kigRAiECAKCXPFaCtJYBLFCan8Z5AgFY9WvEMgCfTarI F2uLv5LUn5WmW00BMaetYkc= =AHNC -----END PGP SIGNATURE----- --LvBAm8/CQHvFF6wS-- From pgsql-performance-owner@postgresql.org Thu Jan 20 14:30:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BCE853A470A for ; Thu, 20 Jan 2005 14:30: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 07047-06 for ; Thu, 20 Jan 2005 14:30:28 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id 115863A45B9 for ; Thu, 20 Jan 2005 14:30:30 +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 j0KEURIA017833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 09:30:27 -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 j0KEUjcK010235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 09:30:45 -0500 Received: (from sfrost@localhost) by ns.snowman.net (8.13.1/8.13.1/Submit) id j0KEUjnL010233; Thu, 20 Jan 2005 09:30:45 -0500 Date: Thu, 20 Jan 2005 09:30:45 -0500 From: Stephen Frost To: =?iso-8859-1?Q?Herv=E9?= Piedvache Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050120143045.GN10437@ns.snowman.net> Mail-Followup-To: =?iso-8859-1?Q?Herv=E9?= Piedvache , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8xrkxCw8NdvQ1PPj" Content-Disposition: inline In-Reply-To: <200501201503.31241.herve@elma.fr> 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: 09:27:53 up 355 days, 9:23, 8 users, load average: 0.18, 0.12, 0.09 User-Agent: Mutt/1.5.6+20040907i 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: 200501/272 X-Sequence-Number: 9962 --8xrkxCw8NdvQ1PPj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Herv? Piedvache (herve@elma.fr) wrote: > Is there any solution with PostgreSQL matching these needs ... ? You might look into pg_pool. Another possibility would be slony, though I'm not sure it's to the point you need it at yet, depends on if you can handle some delay before an insert makes it to the slave select systems. > Do we have to backport our development to MySQL for this kind of problem ? Well, hopefully not. :) > Is there any other solution than a Cluster for our problem ? Bigger server, more CPUs/disks in one box. Try to partition up your data some way such that it can be spread across multiple machines, then if you need to combine the data have it be replicated using slony to a big box that has a view which joins all the tables and do your big queries against that. Just some thoughts. Stephen --8xrkxCw8NdvQ1PPj 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) iD8DBQFB78CVrzgMPqB3kigRAtYCAJwI/YJlqadWGNSNJgdYLXQhoHwRJACfbEPm UEWaQ8XGRcGInTJxXiFvAEQ= =gNO+ -----END PGP SIGNATURE----- --8xrkxCw8NdvQ1PPj-- From pgsql-performance-owner@postgresql.org Thu Jan 20 14:36:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C01993A4529 for ; Thu, 20 Jan 2005 14:36: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 07540-04 for ; Thu, 20 Jan 2005 14:36:05 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 95E553A44BE for ; Thu, 20 Jan 2005 14:36:07 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 964ADEC206; Thu, 20 Jan 2005 15:36:53 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 7096FEC07F; Thu, 20 Jan 2005 15:36:53 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: Christopher Kings-Lynne Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 15:36:08 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> In-Reply-To: <41EFBF05.6000509@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201536.08656.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.29 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/273 X-Sequence-Number: 9963 Le Jeudi 20 Janvier 2005 15:24, Christopher Kings-Lynne a �crit : > > Is there any solution with PostgreSQL matching these needs ... ? > > You want: http://www.slony.info/ > > > Do we have to backport our development to MySQL for this kind of problem > > ? Is there any other solution than a Cluster for our problem ? > > Well, Slony does replication which is basically what you want :) > > Only master->slave though, so you will need to have all inserts go via > the master server, but selects can come off any server. Sorry but I don't agree with this ... Slony is a replication solution ... I don't need replication ... what will I do when my database will grow up to 50 Gb ... I'll need more than 50 Gb of RAM on each server ??? This solution is not very realistic for me ... I need a Cluster solution not a replication one or explain me in details how I will do for managing the scalabilty of my database ... regards, -- Herv� From pgsql-performance-owner@postgresql.org Thu Jan 20 14:39:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AED0C3A47F4 for ; Thu, 20 Jan 2005 14:39: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 08062-02 for ; Thu, 20 Jan 2005 14:39:19 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 2FF4F3A4799 for ; Thu, 20 Jan 2005 14:39:15 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0KEJB6f011513; Thu, 20 Jan 2005 14:19:11 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Thu, 20 Jan 2005 14:38:34 +0000 Message-ID: <41EFC26A.4070605@familyhealth.com.au> Date: Thu, 20 Jan 2005 14:38:34 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> In-Reply-To: <200501201536.08656.herve@elma.fr> 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.08 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/275 X-Sequence-Number: 9965 > Sorry but I don't agree with this ... Slony is a replication solution ... I > don't need replication ... what will I do when my database will grow up to 50 > Gb ... I'll need more than 50 Gb of RAM on each server ??? > This solution is not very realistic for me ... > > I need a Cluster solution not a replication one or explain me in details how I > will do for managing the scalabilty of my database ... Buy Oracle From pgsql-performance-owner@postgresql.org Thu Jan 20 14:40:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1E3F23A4741 for ; Thu, 20 Jan 2005 14:39: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 07372-10 for ; Thu, 20 Jan 2005 14:39:45 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 0EA2B3A480D for ; Thu, 20 Jan 2005 14:39:48 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id C98F1EC07F; Thu, 20 Jan 2005 15:40:34 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id A7154EC055; Thu, 20 Jan 2005 15:40:34 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: Stephen Frost Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 15:39:49 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <20050120143045.GN10437@ns.snowman.net> In-Reply-To: <20050120143045.GN10437@ns.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201539.49874.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.13 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/276 X-Sequence-Number: 9966 Le Jeudi 20 Janvier 2005 15:30, Stephen Frost a �crit : > * Herv? Piedvache (herve@elma.fr) wrote: > > Is there any solution with PostgreSQL matching these needs ... ? > > You might look into pg_pool. Another possibility would be slony, though > I'm not sure it's to the point you need it at yet, depends on if you can > handle some delay before an insert makes it to the slave select systems. I think not ... pgpool or slony are replication solutions ... but as I have said to Christopher Kings-Lynne how I'll manage the scalabilty of the database ? I'll need several servers able to load a database growing and growing to get good speed performance ... > > Do we have to backport our development to MySQL for this kind of problem > > ? > > Well, hopefully not. :) I hope so ;o) > > Is there any other solution than a Cluster for our problem ? > > Bigger server, more CPUs/disks in one box. Try to partition up your > data some way such that it can be spread across multiple machines, then > if you need to combine the data have it be replicated using slony to a > big box that has a view which joins all the tables and do your big > queries against that. But I'll arrive to limitation of a box size quickly I thing a 4 processors with 64 Gb of RAM ... and after ? regards, -- Herv� From pgsql-performance-owner@postgresql.org Thu Jan 20 14:38:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4FD973A45D8 for ; Thu, 20 Jan 2005 14:38: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 07697-04 for ; Thu, 20 Jan 2005 14:38:15 +0000 (GMT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id B8EE73A47A4 for ; Thu, 20 Jan 2005 14:38:18 +0000 (GMT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id F314A3D37; Thu, 20 Jan 2005 09:38:18 -0500 (EST) From: "Dan Langille" To: Stephan Szabo Date: Thu, 20 Jan 2005 09:40:21 -0500 MIME-Version: 1.0 Subject: Re: index scan of whole table, can't see why Cc: pgsql-performance@postgresql.org Message-ID: <41EF7C85.4180.D46F54D@localhost> In-reply-to: <20050120061205.T35934@megazone.bigpanda.com> References: <41EEC527.22215.A7AAF84@localhost> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body 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: 200501/274 X-Sequence-Number: 9964 On 20 Jan 2005 at 6:14, Stephan Szabo wrote: > On Wed, 19 Jan 2005, Dan Langille wrote: > > > Hi folks, > > > > Running on 7.4.2, recently vacuum analysed the three tables in > > question. > > > > The query plan in question changes dramatically when a WHERE clause > > changes from ports.broken to ports.deprecated. I don't see why. > > Well, I do see why: a sequential scan of a 130,000 rows. The query > > goes from 13ms to 1100ms because the of this. The full plans are at > > http://rafb.net/paste/results/v8ccvQ54.html > > > > I have tried some tuning by: > > > > set effective_cache_size to 4000, was 1000 > > set random_page_cost to 1, was 4 > > > > The resulting plan changes, but no speed improvment, are at > > http://rafb.net/paste/results/rV8khJ18.html > > > > Any suggestions please? > > As a question, what does it do if enable_hashjoin is false? I'm wondering > if it'll pick a nested loop for that step for the element/ports join and > what it estimates the cost to be. With enable_hashjoin = false, no speed improvement. Execution plan at http://rafb.net/paste/results/qtSFVM72.html thanks -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/ From pgsql-performance-owner@postgresql.org Thu Jan 20 14:42:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9DA783A47A4 for ; Thu, 20 Jan 2005 14:42: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 08173-05 for ; Thu, 20 Jan 2005 14:42:02 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id F41AC3A4741 for ; Thu, 20 Jan 2005 14:42:05 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 93D96EC206; Thu, 20 Jan 2005 15:42:51 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 70B6DEC14B; Thu, 20 Jan 2005 15:42:51 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: Christopher Kings-Lynne Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 15:42:06 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <41EFC26A.4070605@familyhealth.com.au> In-Reply-To: <41EFC26A.4070605@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201542.06645.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.119 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/277 X-Sequence-Number: 9967 Le Jeudi 20 Janvier 2005 15:38, Christopher Kings-Lynne a �crit : > > Sorry but I don't agree with this ... Slony is a replication solution ... > > I don't need replication ... what will I do when my database will grow up > > to 50 Gb ... I'll need more than 50 Gb of RAM on each server ??? > > This solution is not very realistic for me ... > > > > I need a Cluster solution not a replication one or explain me in details > > how I will do for managing the scalabilty of my database ... > > Buy Oracle I think this is not my solution ... sorry I'm talking about finding a PostgreSQL solution ... -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 14:44:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9284F3A4800 for ; Thu, 20 Jan 2005 14:44: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 08126-09 for ; Thu, 20 Jan 2005 14:44:09 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 9C1BE3A47B2 for ; Thu, 20 Jan 2005 14:44:12 +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 j0KEiBa8006530; Thu, 20 Jan 2005 06:44:11 -0800 Message-ID: <41EFC3C0.6080903@commandprompt.com> Date: Thu, 20 Jan 2005 06:44:16 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> In-Reply-To: <200501201503.31241.herve@elma.fr> Content-Type: multipart/mixed; boundary="------------040708050609000701040803" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.268 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/279 X-Sequence-Number: 9969 This is a multi-part message in MIME format. --------------040708050609000701040803 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Herv� Piedvache wrote: >Dear community, > >My company, which I actually represent, is a fervent user of PostgreSQL. >We used to make all our applications using PostgreSQL for more than 5 years. >We usually do classical client/server applications under Linux, and Web >interface (php, perl, C/C++). We used to manage also public web services with >10/15 millions records and up to 8 millions pages view by month. > > Depending on your needs either: Slony: www.slony.info or Replicator: www.commandprompt.com Will both do what you want. Replicator is easier to setup but Slony is free. Sincerely, Joshua D. Drake >Now we are in front of a new need, but we do not find any good solution with >PostgreSQL. >We need to make a sort of directory of millions of data growing about 4/8 >millions per month, and to be able to be used by many users from the web. In >order to do this, our solution need to be able to run perfectly with many >insert and many select access (done before each insert, and done by web site >visitors). We will also need to make a search engine for the millions of data >(140/150 millions records at the immediate beginning) ... No it's not google, >but the kind of volume of data stored in the main table is similar. > >Then ... we have made some tests, with the actual servers we have here, like a >Bi-Pro Xeon 2.8 Ghz, with 4 Gb of RAM and the result of the cumulative >inserts, and select access is slowing down the service really quickly ... >(Load average is going up to 10 really quickly on the database). > >We were at this moment thinking about a Cluster solution ... We saw on the >Internet many solution talking about Cluster solution using MySQL ... but >nothing about PostgreSQL ... the idea is to use several servers to make a >sort of big virtual server using the disk space of each server as one, and >having the ability to use the CPU and RAM of each servers in order to >maintain good service performance ...one can imagin it is like a GFS but >dedicated to postgreSQL... > >Is there any solution with PostgreSQL matching these needs ... ? >Do we have to backport our development to MySQL for this kind of problem ? >Is there any other solution than a Cluster for our problem ? > >Looking for your reply, > >Regards, > > -- 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 --------------040708050609000701040803 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 --------------040708050609000701040803-- From pgsql-performance-owner@postgresql.org Thu Jan 20 14:44:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 225BA3A47CA for ; Thu, 20 Jan 2005 14:44: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 08781-03 for ; Thu, 20 Jan 2005 14:43:57 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id DC7893A4741 for ; Thu, 20 Jan 2005 14:44:00 +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 j0KEhw4d018031 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 09:43:59 -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 j0KEiHpk011070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 09:44:17 -0500 Received: (from sfrost@localhost) by ns.snowman.net (8.13.1/8.13.1/Submit) id j0KEiGTf011068; Thu, 20 Jan 2005 09:44:16 -0500 Date: Thu, 20 Jan 2005 09:44:16 -0500 From: Stephen Frost To: =?iso-8859-1?Q?Herv=E9?= Piedvache Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050120144416.GO10437@ns.snowman.net> Mail-Followup-To: =?iso-8859-1?Q?Herv=E9?= Piedvache , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <20050120143045.GN10437@ns.snowman.net> <200501201539.49874.herve@elma.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="shuwmd2AqwYbirob" Content-Disposition: inline In-Reply-To: <200501201539.49874.herve@elma.fr> 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: 09:41:02 up 355 days, 9:36, 8 users, load average: 0.19, 0.69, 0.42 User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/278 X-Sequence-Number: 9968 --shuwmd2AqwYbirob Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Herv? Piedvache (herve@elma.fr) wrote: > Le Jeudi 20 Janvier 2005 15:30, Stephen Frost a =E9crit : > > * Herv? Piedvache (herve@elma.fr) wrote: > > > Is there any solution with PostgreSQL matching these needs ... ? > > > > You might look into pg_pool. Another possibility would be slony, though > > I'm not sure it's to the point you need it at yet, depends on if you can > > handle some delay before an insert makes it to the slave select systems. >=20 > I think not ... pgpool or slony are replication solutions ... but as I ha= ve=20 > said to Christopher Kings-Lynne how I'll manage the scalabilty of the=20 > database ? I'll need several servers able to load a database growing and= =20 > growing to get good speed performance ... They're both replication solutions, but they also help distribute the load. For example: pg_pool will distribute the select queries amoung the servers. They'll all get the inserts, so that hurts, but at least the select queries are distributed. slony is similar, but your application level does the load distribution of select statements instead of pg_pool. Your application needs to know to send insert statements to the 'main' server, and select from the others. > > > Is there any other solution than a Cluster for our problem ? > > > > Bigger server, more CPUs/disks in one box. Try to partition up your > > data some way such that it can be spread across multiple machines, then > > if you need to combine the data have it be replicated using slony to a > > big box that has a view which joins all the tables and do your big > > queries against that. >=20 > But I'll arrive to limitation of a box size quickly I thing a 4 processor= s=20 > with 64 Gb of RAM ... and after ? Go to non-x86 hardware after if you're going to continue to increase the size of the server. Personally I think your better bet might be to figure out a way to partition up your data (isn't that what google does anyway?). Stephen --shuwmd2AqwYbirob 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) iD8DBQFB78PArzgMPqB3kigRAoutAJ9a+B3BgJNh09kqkWfOELn+hnK2LgCfbu0P mJzxz3WHXJ3hvOlGbKXyJpA= =iUHg -----END PGP SIGNATURE----- --shuwmd2AqwYbirob-- From pgsql-performance-owner@postgresql.org Thu Jan 20 14:47:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66F4F3A478F for ; Thu, 20 Jan 2005 14:46: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 08776-06 for ; Thu, 20 Jan 2005 14:46:29 +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 3702C3A47D7 for ; Thu, 20 Jan 2005 14:46:20 +0000 (GMT) Received: (qmail 24193 invoked from network); 20 Jan 2005 14:02:40 -0000 Received: from dhcp-10-124-7-103.wal.lycos.com (HELO ?10.124.7.103?) (10.124.7.103) by dhcp-10-124-7-248.wal.lycos.com with SMTP; 20 Jan 2005 14:02:40 -0000 In-Reply-To: <200501201536.08656.herve@elma.fr> References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> Content-Transfer-Encoding: quoted-printable Cc: Christopher Kings-Lynne , pgsql-performance@postgresql.org From: Jeff Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 09:48:07 -0500 To: =?ISO-8859-1?Q?Herv=E9_Piedvache?= 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: 200501/280 X-Sequence-Number: 9970 On Jan 20, 2005, at 9:36 AM, Herv=E9 Piedvache wrote: > Sorry but I don't agree with this ... Slony is a replication solution=20= > ... I > don't need replication ... what will I do when my database will grow=20= > up to 50 > Gb ... I'll need more than 50 Gb of RAM on each server ??? Slony doesn't use much ram. The mysql clustering product, ndb I believe=20= it is called, requires all data fit in RAM. (At least, it used to). =20 What you'll need is disk space. As for a cluster I think you are thinking of multi-master replication. You should look into what others have said about trying to partiition=20 data among several boxes and then join the results together. Or you could fork over hundreds of thousands of dollars for Oracle's=20 RAC. -- Jeff Trout http://www.jefftrout.com/ http://www.stuarthamm.net/ From pgsql-performance-owner@postgresql.org Thu Jan 20 14:49:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A59E23A481C for ; Thu, 20 Jan 2005 14:49: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 09201-08 for ; Thu, 20 Jan 2005 14:49:49 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id D34573A47CA for ; Thu, 20 Jan 2005 14:49:52 +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 j0KEnpa8007617; Thu, 20 Jan 2005 06:49:51 -0800 Message-ID: <41EFC514.9090806@commandprompt.com> Date: Thu, 20 Jan 2005 06:49:56 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephen Frost Cc: =?ISO-8859-1?Q?Herv=E9_Piedvache?= , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <20050120143045.GN10437@ns.snowman.net> <200501201539.49874.herve@elma.fr> <20050120144416.GO10437@ns.snowman.net> In-Reply-To: <20050120144416.GO10437@ns.snowman.net> Content-Type: multipart/mixed; boundary="------------010609050609090701020801" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/281 X-Sequence-Number: 9971 This is a multi-part message in MIME format. --------------010609050609090701020801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Stephen Frost wrote: >* Herv? Piedvache (herve@elma.fr) wrote: > > >>Le Jeudi 20 Janvier 2005 15:30, Stephen Frost a �crit : >> >> >>>* Herv? Piedvache (herve@elma.fr) wrote: >>> >>> >>>>Is there any solution with PostgreSQL matching these needs ... ? >>>> >>>> >>>You might look into pg_pool. Another possibility would be slony, though >>>I'm not sure it's to the point you need it at yet, depends on if you can >>>handle some delay before an insert makes it to the slave select systems. >>> >>> >>I think not ... pgpool or slony are replication solutions ... but as I have >>said to Christopher Kings-Lynne how I'll manage the scalabilty of the >>database ? I'll need several servers able to load a database growing and >>growing to get good speed performance ... >> >> > >They're both replication solutions, but they also help distribute the >load. For example: > >pg_pool will distribute the select queries amoung the servers. They'll >all get the inserts, so that hurts, but at least the select queries are >distributed. > >slony is similar, but your application level does the load distribution >of select statements instead of pg_pool. Your application needs to know >to send insert statements to the 'main' server, and select from the >others. > > You can put pgpool in front of replicator or slony to get load balancing for reads. > > >>>>Is there any other solution than a Cluster for our problem ? >>>> >>>> >>>Bigger server, more CPUs/disks in one box. Try to partition up your >>>data some way such that it can be spread across multiple machines, then >>>if you need to combine the data have it be replicated using slony to a >>>big box that has a view which joins all the tables and do your big >>>queries against that. >>> >>> >>But I'll arrive to limitation of a box size quickly I thing a 4 processors >>with 64 Gb of RAM ... and after ? >> >> Opteron. > >Go to non-x86 hardware after if you're going to continue to increase the >size of the server. Personally I think your better bet might be to >figure out a way to partition up your data (isn't that what google >does anyway?). > > Stephen > > -- 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 --------------010609050609090701020801 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 --------------010609050609090701020801-- From pgsql-performance-owner@postgresql.org Thu Jan 20 14:52:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 96DFF3A4269 for ; Thu, 20 Jan 2005 14:52: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 09625-03 for ; Thu, 20 Jan 2005 14:52:00 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id E053F3A41E4 for ; Thu, 20 Jan 2005 14:52:02 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0KEVxej011739; Thu, 20 Jan 2005 14:31:59 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Thu, 20 Jan 2005 14:51:21 +0000 Message-ID: <41EFC569.6030800@familyhealth.com.au> Date: Thu, 20 Jan 2005 14:51:21 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <41EFC26A.4070605@familyhealth.com.au> <200501201542.06645.herve@elma.fr> In-Reply-To: <200501201542.06645.herve@elma.fr> 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.06 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/282 X-Sequence-Number: 9972 >>>Sorry but I don't agree with this ... Slony is a replication solution ... >>>I don't need replication ... what will I do when my database will grow up >>>to 50 Gb ... I'll need more than 50 Gb of RAM on each server ??? >>>This solution is not very realistic for me ... >>> >>>I need a Cluster solution not a replication one or explain me in details >>>how I will do for managing the scalabilty of my database ... >> >>Buy Oracle > > > I think this is not my solution ... sorry I'm talking about finding a > PostgreSQL solution ... My point being is that there is no free solution. There simply isn't. I don't know why you insist on keeping all your data in RAM, but the mysql cluster requires that ALL data MUST fit in RAM all the time. PostgreSQL has replication, but not partitioning (which is what you want). So, your only option is Oracle or another very expensive commercial database. Chris From pgsql-performance-owner@postgresql.org Thu Jan 20 14:54:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E02C33A4269 for ; Thu, 20 Jan 2005 14:54: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 10081-02 for ; Thu, 20 Jan 2005 14:54:19 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 4D1E43A47D6 for ; Thu, 20 Jan 2005 14:54:22 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 6CCAEEC2E4; Thu, 20 Jan 2005 15:55:08 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 40787EC2BF; Thu, 20 Jan 2005 15:55:08 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: Jeff Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 15:54:23 +0100 User-Agent: KMail/1.7.1 Cc: Christopher Kings-Lynne , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> In-Reply-To: <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201554.23462.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.098 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/283 X-Sequence-Number: 9973 Le Jeudi 20 Janvier 2005 15:48, Jeff a �crit : > On Jan 20, 2005, at 9:36 AM, Herv� Piedvache wrote: > > Sorry but I don't agree with this ... Slony is a replication solution > > ... I > > don't need replication ... what will I do when my database will grow > > up to 50 > > Gb ... I'll need more than 50 Gb of RAM on each server ??? > > Slony doesn't use much ram. The mysql clustering product, ndb I believe > it is called, requires all data fit in RAM. (At least, it used to). > What you'll need is disk space. Slony do not use RAM ... but PostgreSQL will need RAM for accessing a database of 50 Gb ... so having two servers with the same configuration replicated by slony do not slove the problem of the scalability of the database ... > As for a cluster I think you are thinking of multi-master replication. No I'm really thinking about a Cluster solution ... having several servers making one big virtual server to have several processors, and many RAM in many boxes ... > You should look into what others have said about trying to partiition > data among several boxes and then join the results together. ??? Who talk about this ? > Or you could fork over hundreds of thousands of dollars for Oracle's > RAC. No please do not talk about this again ... I'm looking about a PostgreSQL solution ... I know RAC ... and I'm not able to pay for a RAC certify hardware configuration plus a RAC Licence. Regards, -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 14:59:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0548A3A18CF for ; Thu, 20 Jan 2005 14:59: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 10713-01 for ; Thu, 20 Jan 2005 14:59:20 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id BF2CA3A4741 for ; Thu, 20 Jan 2005 14:59:23 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0KEdJIT011822; Thu, 20 Jan 2005 14:39:19 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Thu, 20 Jan 2005 14:58:42 +0000 Message-ID: <41EFC722.2050401@familyhealth.com.au> Date: Thu, 20 Jan 2005 14:58:42 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: Jeff , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> <200501201554.23462.herve@elma.fr> In-Reply-To: <200501201554.23462.herve@elma.fr> 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.048 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/284 X-Sequence-Number: 9974 >>Or you could fork over hundreds of thousands of dollars for Oracle's >>RAC. > > > No please do not talk about this again ... I'm looking about a PostgreSQL > solution ... I know RAC ... and I'm not able to pay for a RAC certify > hardware configuration plus a RAC Licence. There is absolutely zero PostgreSQL solution... You may have to split the data yourself onto two independent db servers and combine the results somehow in your application. Chris From pgsql-performance-owner@postgresql.org Thu Jan 20 15:00:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E95A3A4827 for ; Thu, 20 Jan 2005 15:00: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 10220-07 for ; Thu, 20 Jan 2005 15:00:43 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 94E783A4811 for ; Thu, 20 Jan 2005 15:00:46 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 7B6E3EC2EE; Thu, 20 Jan 2005 16:01:32 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 59E63EC2BF; Thu, 20 Jan 2005 16:01:32 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: "Joshua D. Drake" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:00:47 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> In-Reply-To: <41EFC3C0.6080903@commandprompt.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201600.47583.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.331 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/285 X-Sequence-Number: 9975 Joshua, Le Jeudi 20 Janvier 2005 15:44, Joshua D. Drake a �crit : > Herv� Piedvache wrote: > > > >My company, which I actually represent, is a fervent user of PostgreSQL. > >We used to make all our applications using PostgreSQL for more than 5 > > years. We usually do classical client/server applications under Linux, > > and Web interface (php, perl, C/C++). We used to manage also public web > > services with 10/15 millions records and up to 8 millions pages view by > > month. > > Depending on your needs either: > > Slony: www.slony.info > > or > > Replicator: www.commandprompt.com > > Will both do what you want. Replicator is easier to setup but > Slony is free. No ... as I have said ... how I'll manage a database getting a table of may be 250 000 000 records ? I'll need incredible servers ... to get quick access or index reading ... no ? So what we would like to get is a pool of small servers able to make one virtual server ... for that is called a Cluster ... no ? I know they are not using PostgreSQL ... but how a company like Google do to get an incredible database in size and so quick access ? regards, -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 15:02:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AB27C3A476F for ; Thu, 20 Jan 2005 15:02: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 10639-06 for ; Thu, 20 Jan 2005 15:02:35 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 10FA83A4529 for ; Thu, 20 Jan 2005 15:02:38 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 744D3EC2FC; Thu, 20 Jan 2005 16:03:24 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 55715EC2F7; Thu, 20 Jan 2005 16:03:24 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: Christopher Kings-Lynne Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:02:39 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> In-Reply-To: <41EFC569.6030800@familyhealth.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201602.39568.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.106 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/286 X-Sequence-Number: 9976 Le Jeudi 20 Janvier 2005 15:51, Christopher Kings-Lynne a �crit : > >>>Sorry but I don't agree with this ... Slony is a replication solution > >>> ... I don't need replication ... what will I do when my database will > >>> grow up to 50 Gb ... I'll need more than 50 Gb of RAM on each server > >>> ??? This solution is not very realistic for me ... > >>> > >>>I need a Cluster solution not a replication one or explain me in details > >>>how I will do for managing the scalabilty of my database ... > >> > >>Buy Oracle > > > > I think this is not my solution ... sorry I'm talking about finding a > > PostgreSQL solution ... > > My point being is that there is no free solution. There simply isn't. > I don't know why you insist on keeping all your data in RAM, but the > mysql cluster requires that ALL data MUST fit in RAM all the time. I don't insist about have data in RAM .... but when you use PostgreSQL with big database you know that for quick access just for reading the index file for example it's better to have many RAM as possible ... I just want to be able to get a quick access with a growing and growind database ... > PostgreSQL has replication, but not partitioning (which is what you want). :o( > So, your only option is Oracle or another very expensive commercial > database. That's not a good news ... -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 15:03:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C51F3A45AA for ; Thu, 20 Jan 2005 15: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 10672-08 for ; Thu, 20 Jan 2005 15:03:04 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 1135B3A41E4 for ; Thu, 20 Jan 2005 15:03:07 +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 j0KF2ua8009425; Thu, 20 Jan 2005 07:02:56 -0800 Message-ID: <41EFC825.50108@commandprompt.com> Date: Thu, 20 Jan 2005 07:03:01 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: Jeff , Christopher Kings-Lynne , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> <200501201554.23462.herve@elma.fr> In-Reply-To: <200501201554.23462.herve@elma.fr> Content-Type: multipart/mixed; boundary="------------010502080809010003020009" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/287 X-Sequence-Number: 9977 This is a multi-part message in MIME format. --------------010502080809010003020009 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > >No please do not talk about this again ... I'm looking about a PostgreSQL >solution ... I know RAC ... and I'm not able to pay for a RAC certify >hardware configuration plus a RAC Licence. > > What you want does not exist for PostgreSQL. You will either have to build it yourself or pay somebody to build it for you. Sincerely, Joshua D. Drake >Regards, > > -- 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 --------------010502080809010003020009 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 --------------010502080809010003020009-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:04:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92D713A4763 for ; Thu, 20 Jan 2005 15:04: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 10586-09 for ; Thu, 20 Jan 2005 15:04:12 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 87C723A456A for ; Thu, 20 Jan 2005 15:04:15 +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 j0KF4Da8009696; Thu, 20 Jan 2005 07:04:13 -0800 Message-ID: <41EFC873.1020708@commandprompt.com> Date: Thu, 20 Jan 2005 07:04:19 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> In-Reply-To: <200501201600.47583.herve@elma.fr> Content-Type: multipart/mixed; boundary="------------000206010106060001020400" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/288 X-Sequence-Number: 9978 This is a multi-part message in MIME format. --------------000206010106060001020400 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit >So what we would like to get is a pool of small servers able to make one >virtual server ... for that is called a Cluster ... no ? > >I know they are not using PostgreSQL ... but how a company like Google do to >get an incredible database in size and so quick access ? > > You could use dblink with multiple servers across data partitions within PostgreSQL but I don't know how fast that would be. J >regards, > > -- 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 --------------000206010106060001020400 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 --------------000206010106060001020400-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:05:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 428EB3A47C0 for ; Thu, 20 Jan 2005 15:05: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 11843-04 for ; Thu, 20 Jan 2005 15:05:28 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 602E03A47F8 for ; Thu, 20 Jan 2005 15:05:32 +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 j0KF5Ka8009945; Thu, 20 Jan 2005 07:05:20 -0800 Message-ID: <41EFC8B5.9040902@commandprompt.com> Date: Thu, 20 Jan 2005 07:05:25 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: =?ISO-8859-15?Q?Herv=E9_Piedvache?= , Jeff , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> <200501201554.23462.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> In-Reply-To: <41EFC722.2050401@familyhealth.com.au> Content-Type: multipart/mixed; boundary="------------030801040507090704090606" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/289 X-Sequence-Number: 9979 This is a multi-part message in MIME format. --------------030801040507090704090606 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Christopher Kings-Lynne wrote: >>> Or you could fork over hundreds of thousands of dollars for Oracle's >>> RAC. >> >> >> >> No please do not talk about this again ... I'm looking about a >> PostgreSQL solution ... I know RAC ... and I'm not able to pay for a >> RAC certify hardware configuration plus a RAC Licence. > > > There is absolutely zero PostgreSQL solution... I just replied the same thing but then I was thinking. Couldn't he use multiple databases over multiple servers with dblink? It is not exactly how I would want to do it, but it would provide what he needs I think??? Sincerely, Joshua D. Drake > > You may have to split the data yourself onto two independent db > servers and combine the results somehow in your application. > > Chris > > ---------------------------(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 --------------030801040507090704090606 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 --------------030801040507090704090606-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:07:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C491C3A18CF for ; Thu, 20 Jan 2005 15:07: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 10639-10 for ; Thu, 20 Jan 2005 15:07:19 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id DD0D53A44BE for ; Thu, 20 Jan 2005 15:07:22 +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 j0KF7Jjm018430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 10:07:20 -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 j0KF7cAt011980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 10:07:38 -0500 Received: (from sfrost@localhost) by ns.snowman.net (8.13.1/8.13.1/Submit) id j0KF7boD011978; Thu, 20 Jan 2005 10:07:37 -0500 Date: Thu, 20 Jan 2005 10:07:37 -0500 From: Stephen Frost To: =?iso-8859-1?Q?Herv=E9?= Piedvache Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050120150737.GP10437@ns.snowman.net> Mail-Followup-To: =?iso-8859-1?Q?Herv=E9?= Piedvache , "Joshua D. Drake" , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CkVcT5DPb0HurK+K" Content-Disposition: inline In-Reply-To: <200501201600.47583.herve@elma.fr> 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: 10:06:49 up 355 days, 10:02, 8 users, load average: 0.21, 0.21, 0.19 User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.016 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/290 X-Sequence-Number: 9980 --CkVcT5DPb0HurK+K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Herv? Piedvache (herve@elma.fr) wrote: > I know they are not using PostgreSQL ... but how a company like Google do= to=20 > get an incredible database in size and so quick access ? They segment their data across multiple machines and have an algorithm which tells the application layer which machine to contact for what data. Stephen --CkVcT5DPb0HurK+K 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) iD8DBQFB78k5rzgMPqB3kigRAqgCAJ94nkR30iQ2ZyqOcUkwLCXOnuIH8gCeOXfl znbL8QGVsfXj3DJ5kvEQ+eY= =Euv0 -----END PGP SIGNATURE----- --CkVcT5DPb0HurK+K-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:08:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 56D3E3A47CA for ; Thu, 20 Jan 2005 15:07: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 11883-07 for ; Thu, 20 Jan 2005 15:07:48 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 5EE053A4779 for ; Thu, 20 Jan 2005 15:07:51 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id A9CF7EC2FC; Thu, 20 Jan 2005 16:08:36 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 6FFBCEC2F7; Thu, 20 Jan 2005 16:08:36 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: "Joshua D. Drake" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:07:51 +0100 User-Agent: KMail/1.7.1 Cc: Christopher Kings-Lynne , Jeff , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> <41EFC8B5.9040902@commandprompt.com> In-Reply-To: <41EFC8B5.9040902@commandprompt.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201607.51659.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.11 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/291 X-Sequence-Number: 9981 Le Jeudi 20 Janvier 2005 16:05, Joshua D. Drake a �crit : > Christopher Kings-Lynne wrote: > >>> Or you could fork over hundreds of thousands of dollars for Oracle's > >>> RAC. > >> > >> No please do not talk about this again ... I'm looking about a > >> PostgreSQL solution ... I know RAC ... and I'm not able to pay for a > >> RAC certify hardware configuration plus a RAC Licence. > > > > There is absolutely zero PostgreSQL solution... > > I just replied the same thing but then I was thinking. Couldn't he use > multiple databases > over multiple servers with dblink? > > It is not exactly how I would want to do it, but it would provide what > he needs I think??? Yes seems to be the only solution ... but I'm a little disapointed about this ... could you explain me why there is not this kind of functionnality ... it seems to be a real need for big applications no ? Thanks all for your answers ... -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 15:09:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 35CB63A47F0 for ; Thu, 20 Jan 2005 15:09: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 11554-08 for ; Thu, 20 Jan 2005 15:08:43 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id 1E2883A4752 for ; Thu, 20 Jan 2005 15:08:46 +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 j0KF8Tnb018438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 10:08:29 -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 j0KF8lQ4012019 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 10:08:47 -0500 Received: (from sfrost@localhost) by ns.snowman.net (8.13.1/8.13.1/Submit) id j0KF8l3m012017; Thu, 20 Jan 2005 10:08:47 -0500 Date: Thu, 20 Jan 2005 10:08:47 -0500 From: Stephen Frost To: Christopher Kings-Lynne Cc: =?iso-8859-1?Q?Herv=E9?= Piedvache , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050120150847.GQ10437@ns.snowman.net> Mail-Followup-To: Christopher Kings-Lynne , =?iso-8859-1?Q?Herv=E9?= Piedvache , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <41EFC26A.4070605@familyhealth.com.au> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="F+K/njrK4+2xOJ0g" Content-Disposition: inline In-Reply-To: <41EFC569.6030800@familyhealth.com.au> 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: 10:07:53 up 355 days, 10:03, 8 users, load average: 0.28, 0.24, 0.19 User-Agent: Mutt/1.5.6+20040907i 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: 200501/292 X-Sequence-Number: 9982 --F+K/njrK4+2xOJ0g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Christopher Kings-Lynne (chriskl@familyhealth.com.au) wrote: > PostgreSQL has replication, but not partitioning (which is what you want). It doesn't have multi-server partitioning.. It's got partitioning within a single server (doesn't it? I thought it did, I know it was discussed w/ the guy from Cox Communications and I thought he was using it :). > So, your only option is Oracle or another very expensive commercial=20 > database. Or partition the data at the application layer. Stephen --F+K/njrK4+2xOJ0g 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) iD8DBQFB78l/rzgMPqB3kigRAkNkAJ0WDBq6zNz9CAl/2AemXBBskqsX1QCglHZ0 v8spVpSyyvXq0l5yV+noJ/0= =CA1o -----END PGP SIGNATURE----- --F+K/njrK4+2xOJ0g-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:12:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D2F53A47A3 for ; Thu, 20 Jan 2005 15:12: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 12527-08 for ; Thu, 20 Jan 2005 15:12:46 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 685803A4372 for ; Thu, 20 Jan 2005 15:12:49 +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 j0KFCba8011563; Thu, 20 Jan 2005 07:12:37 -0800 Message-ID: <41EFCA6A.1080802@commandprompt.com> Date: Thu, 20 Jan 2005 07:12:42 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: Christopher Kings-Lynne , Jeff , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> <41EFC8B5.9040902@commandprompt.com> <200501201607.51659.herve@elma.fr> In-Reply-To: <200501201607.51659.herve@elma.fr> Content-Type: multipart/mixed; boundary="------------020209050909030606010208" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/293 X-Sequence-Number: 9983 This is a multi-part message in MIME format. --------------020209050909030606010208 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit >> then I was thinking. Couldn't he use >>multiple databases >>over multiple servers with dblink? >> >>It is not exactly how I would want to do it, but it would provide what >>he needs I think??? >> >> > >Yes seems to be the only solution ... but I'm a little disapointed about >this ... could you explain me why there is not this kind of >functionnality ... it seems to be a real need for big applications no ? > > Because it is really, really hard to do correctly and hard equals expensive. Sincerely, Joshua D. Drake >Thanks all for your answers ... > > -- 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 --------------020209050909030606010208 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 --------------020209050909030606010208-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:14:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 82A583A47A3 for ; Thu, 20 Jan 2005 15:14: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 13120-04 for ; Thu, 20 Jan 2005 15:14:31 +0000 (GMT) Received: from noao.edu (dns.noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 5749B3A47FC for ; Thu, 20 Jan 2005 15:14:34 +0000 (GMT) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from [140.252.14.8] (HELO weaver.tuc.noao.edu) by noao.edu (CommuniGate Pro SMTP 4.2.8) with ESMTP-TLS id 16152929; Thu, 20 Jan 2005 08:14:33 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.8) with ESMTP id j0KFES32016514; Thu, 20 Jan 2005 08:14:28 -0700 Message-ID: <41EFCAD4.6040307@noao.edu> Date: Thu, 20 Jan 2005 08:14:28 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> In-Reply-To: <200501201600.47583.herve@elma.fr> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-noao.edu-MailScanner-Information: Please contact the ISP for more information X-noao.edu-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/294 X-Sequence-Number: 9984 Herv� Piedvache wrote: > > No ... as I have said ... how I'll manage a database getting a table of may be > 250 000 000 records ? I'll need incredible servers ... to get quick access or > index reading ... no ? > > So what we would like to get is a pool of small servers able to make one > virtual server ... for that is called a Cluster ... no ? > > I know they are not using PostgreSQL ... but how a company like Google do to > get an incredible database in size and so quick access ? Probably by carefully partitioning their data. I can't imagine anything being fast on a single table in 250,000,000 tuple range. Nor can I really imagine any database that efficiently splits a single table across multiple machines (or even inefficiently unless some internal partitioning is being done). So, you'll have to do some work at your end and not just hope that a "magic bullet" is available. Once you've got the data partitioned, the question becomes one of how to inhance performance/scalability. Have you considered RAIDb? -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Thu Jan 20 15:17:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7C3BA3A474B for ; Thu, 20 Jan 2005 15:17: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 12978-09 for ; Thu, 20 Jan 2005 15:17:16 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id C50F93A44BE for ; Thu, 20 Jan 2005 15:17:18 +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: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 10:16:21 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75C4@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL clustering VS MySQL clustering Thread-Index: AcT/APX/QxlheFvWRI6VOcT/1pkobwAAFoUg From: "Merlin Moncure" To: =?iso-8859-1?Q?Herv=E9_Piedvache?= Cc: 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: 200501/295 X-Sequence-Number: 9985 > No please do not talk about this again ... I'm looking about a = PostgreSQL > solution ... I know RAC ... and I'm not able to pay for a RAC certify > hardware configuration plus a RAC Licence. Are you totally certain you can't solve your problem with a single = server solution? How about: Price out a 4 way Opteron 4u rackmount server with 64 bit linux, stuffed = with hard drives (like 40) set up in a complex raid configuration = (multiple raid controllers) allowing you (with tablespaces) to divide up = your database. You can drop in dual core opterons at some later point for an easy = upgrade. Let's say this server costs 20k$...are you sure this will not = be enough to handle your load? Merlin From pgsql-performance-owner@postgresql.org Thu Jan 20 15:21:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 279F93A2B8D; Thu, 20 Jan 2005 15: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 13591-05; Thu, 20 Jan 2005 15:21:11 +0000 (GMT) Received: from anchor-post-36.mail.demon.net (anchor-post-36.mail.demon.net [194.217.242.86]) by svr1.postgresql.org (Postfix) with ESMTP id CD2443A18CF; Thu, 20 Jan 2005 15:21:10 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-36.mail.demon.net with esmtp (Exim 4.42) id 1Cre7N-0006wD-Kr; Thu, 20 Jan 2005 15:21:08 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id D902216BE3; Thu, 20 Jan 2005 15:20:53 +0000 (GMT) Message-ID: <41EFCC5B.5010302@archonet.com> Date: Thu, 20 Jan 2005 15:20:59 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrei Bintintan Cc: pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> In-Reply-To: <020d01c4fef6$595bb9d0$0b00a8c0@forge> 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.075 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/296 X-Sequence-Number: 9986 Andrei Bintintan wrote: >> If you're using this to provide "pages" of results, could you use a >> cursor? > > What do you mean by that? Cursor? > > Yes I'm using this to provide "pages", but If I jump to the last pages > it goes very slow. DECLARE mycursor CURSOR FOR SELECT * FROM ... FETCH FORWARD 10 IN mycursor; CLOSE mycursor; Repeated FETCHes would let you step through your results. That won't work if you have a web-app making repeated connections. If you've got a web-application then you'll probably want to insert the results into a cache table for later use. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 20 15:25:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 01CFD3A47B2 for ; Thu, 20 Jan 2005 15:23: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 14129-02 for ; Thu, 20 Jan 2005 15:23:13 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 693F43A2B8D for ; Thu, 20 Jan 2005 15:23:16 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id B39B3EC333; Thu, 20 Jan 2005 16:24:02 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 8C2BEEC2F7; Thu, 20 Jan 2005 16:24:02 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: Steve Wampler Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:23:17 +0100 User-Agent: KMail/1.7.1 Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201600.47583.herve@elma.fr> <41EFCAD4.6040307@noao.edu> In-Reply-To: <41EFCAD4.6040307@noao.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201623.17803.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.103 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/298 X-Sequence-Number: 9988 Le Jeudi 20 Janvier 2005 16:14, Steve Wampler a �crit : > Once you've got the data partitioned, the question becomes one of > how to inhance performance/scalability. Have you considered RAIDb? No but I'll seems to be very interesting ... close to the explanation of Joshua ... but automaticly done ... Thanks ! -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 15:22:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CFD663A45AA for ; Thu, 20 Jan 2005 15:22: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 13692-07 for ; Thu, 20 Jan 2005 15:22:09 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 1D2D63A47E8 for ; Thu, 20 Jan 2005 15:22:12 +0000 (GMT) Received: (qmail 26510 invoked from network); 20 Jan 2005 15:21:37 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 20 Jan 2005 15:21:37 -0000 Message-ID: <41EFCCF6.1060908@fastcrypt.com> Date: Thu, 20 Jan 2005 10:23:34 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> In-Reply-To: <200501201600.47583.herve@elma.fr> Content-Type: multipart/alternative; boundary="------------000002000804000801020902" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.307 tagged_above=0 required=5 tests=AWL, HTML_30_40, HTML_MESSAGE, HTML_TITLE_EMPTY, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/297 X-Sequence-Number: 9987 This is a multi-part message in MIME format. --------------000002000804000801020902 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Google uses something called the google filesystem, look it up in google. It is a distributed file system. Dave Herv� Piedvache wrote: >Joshua, > >Le Jeudi 20 Janvier 2005 15:44, Joshua D. Drake a �crit : > > >>Herv� Piedvache wrote: >> >> >>>My company, which I actually represent, is a fervent user of PostgreSQL. >>>We used to make all our applications using PostgreSQL for more than 5 >>>years. We usually do classical client/server applications under Linux, >>>and Web interface (php, perl, C/C++). We used to manage also public web >>>services with 10/15 millions records and up to 8 millions pages view by >>>month. >>> >>> >>Depending on your needs either: >> >>Slony: www.slony.info >> >>or >> >>Replicator: www.commandprompt.com >> >>Will both do what you want. Replicator is easier to setup but >>Slony is free. >> >> > >No ... as I have said ... how I'll manage a database getting a table of may be >250 000 000 records ? I'll need incredible servers ... to get quick access or >index reading ... no ? > >So what we would like to get is a pool of small servers able to make one >virtual server ... for that is called a Cluster ... no ? > >I know they are not using PostgreSQL ... but how a company like Google do to >get an incredible database in size and so quick access ? > >regards, > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 --------------000002000804000801020902 Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Google uses something called the google filesystem, look it up in google. It is a distributed file system.

Dave

Herv� Piedvache wrote:
Joshua,

Le Jeudi 20 Janvier 2005 15:44, Joshua D. Drake a �crit :
  
Herv� Piedvache wrote:
    
My company, which I actually represent, is a fervent user of PostgreSQL.
We used to make all our applications using PostgreSQL for more than 5
years. We usually do classical client/server applications under Linux,
and Web interface (php, perl, C/C++). We used to manage also public web
services with 10/15 millions records and up to 8 millions pages view by
month.
      
Depending on your needs either:

Slony: www.slony.info

or

Replicator: www.commandprompt.com

Will both do what you want. Replicator is easier to setup but
Slony is free.
    

No ... as I have said ... how I'll manage a database getting a table of may be 
250 000 000 records ? I'll need incredible servers ... to get quick access or 
index reading ... no ?

So what we would like to get is a pool of small servers able to make one 
virtual server ... for that is called a Cluster ... no ?

I know they are not using PostgreSQL ... but how a company like Google do to 
get an incredible database in size and so quick access ?

regards,
  

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
--------------000002000804000801020902-- From pgsql-performance-owner@postgresql.org Fri Jan 21 04:50:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 019193A47ED for ; Thu, 20 Jan 2005 15:20: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 13834-03 for ; Thu, 20 Jan 2005 15:20:37 +0000 (GMT) Received: from dino.di.lv (unknown [62.85.93.4]) by svr1.postgresql.org (Postfix) with ESMTP id 88AFB3A4823 for ; Thu, 20 Jan 2005 15:20:35 +0000 (GMT) Received: from edgars ([62.85.93.128]) by dino.di.lv (Lotus Domino Release 6.0.4) with SMTP id 2005012017244418-15486 ; Thu, 20 Jan 2005 17:24:44 +0200 Message-ID: <124701c4ff04$2b21bd40$805d553e@divi.lv> From: "Edgars Diebelis" To: "Christopher Kings-Lynne" Cc: References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> <200501201554.23462.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 17:24:37 +0200 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-MIMETrack: Itemize by SMTP Server on dino/Datorikas Instituts/LV(Release 6.0.4|June 01, 2004) at 2005.01.20 17:24:44, Serialize by Router on dino/Datorikas Instituts/LV(Release 6.0.4|June 01, 2004) at 2005.01.20 17:24:49, Serialize complete at 2005.01.20 17:24:49 Content-Transfer-Encoding: 8bit Content-Type: text/plain; format=flowed; charset="iso-8859-15"; reply-type=response 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: 200501/366 X-Sequence-Number: 10056 I have no experience with pgCluster, but I found: PGCluster is a multi-master and synchronous replication system that supports load balancing of PostgreSQL. http://www.software-facilities.com/databases-software/pgcluster.php May be some have some expierience with this tool? ----- Original Message ----- From: "Christopher Kings-Lynne" To: "Herv� Piedvache" Cc: "Jeff" ; Sent: Thursday, January 20, 2005 4:58 PM Subject: [spam] Re: [PERFORM] PostgreSQL clustering VS MySQL clustering >>>Or you could fork over hundreds of thousands of dollars for Oracle's >>>RAC. >> >> >> No please do not talk about this again ... I'm looking about a PostgreSQL >> solution ... I know RAC ... and I'm not able to pay for a RAC certify >> hardware configuration plus a RAC Licence. > > There is absolutely zero PostgreSQL solution... > > You may have to split the data yourself onto two independent db servers > and combine the results somehow in your application. > > Chris > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > From pgsql-performance-owner@postgresql.org Thu Jan 20 15:27:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7F1E03A47F4 for ; Thu, 20 Jan 2005 15:26: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 14278-08 for ; Thu, 20 Jan 2005 15:26:34 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id CAEDA3A47CA for ; Thu, 20 Jan 2005 15:26:37 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 989173596C; Thu, 20 Jan 2005 07:26:37 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 97022356BD; Thu, 20 Jan 2005 07:26:37 -0800 (PST) Date: Thu, 20 Jan 2005 07:26:37 -0800 (PST) From: Stephan Szabo To: Dan Langille Cc: pgsql-performance@postgresql.org Subject: Re: index scan of whole table, can't see why In-Reply-To: <41EF7C85.4180.D46F54D@localhost> Message-ID: <20050120072205.G38768@megazone.bigpanda.com> References: <41EEC527.22215.A7AAF84@localhost> <41EF7C85.4180.D46F54D@localhost> 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.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/299 X-Sequence-Number: 9989 On Thu, 20 Jan 2005, Dan Langille wrote: > On 20 Jan 2005 at 6:14, Stephan Szabo wrote: > > > On Wed, 19 Jan 2005, Dan Langille wrote: > > > > > Hi folks, > > > > > > Running on 7.4.2, recently vacuum analysed the three tables in > > > question. > > > > > > The query plan in question changes dramatically when a WHERE clause > > > changes from ports.broken to ports.deprecated. I don't see why. > > > Well, I do see why: a sequential scan of a 130,000 rows. The query > > > goes from 13ms to 1100ms because the of this. The full plans are at > > > http://rafb.net/paste/results/v8ccvQ54.html > > > > > > I have tried some tuning by: > > > > > > set effective_cache_size to 4000, was 1000 > > > set random_page_cost to 1, was 4 > > > > > > The resulting plan changes, but no speed improvment, are at > > > http://rafb.net/paste/results/rV8khJ18.html > > > > > > Any suggestions please? > > > > As a question, what does it do if enable_hashjoin is false? I'm wondering > > if it'll pick a nested loop for that step for the element/ports join and > > what it estimates the cost to be. > > With enable_hashjoin = false, no speed improvement. Execution plan > at http://rafb.net/paste/results/qtSFVM72.html Honestly I expected it to be slower (which it was), but I figured it's worth seeing what alternate plans it'll generate (specifically to see how it cost a nested loop on that join to compare to the fast plan). Unfortunately, it generated a merge join, so I think it might require both enable_hashjoin=false and enable_mergejoin=false to get it which is likely to be even slower in practice but still may be useful to see. From pgsql-performance-owner@postgresql.org Thu Jan 20 15:31:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 61EAC3A483D for ; Thu, 20 Jan 2005 15:31: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 15495-02 for ; Thu, 20 Jan 2005 15:31:04 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 4B8593A4802 for ; Thu, 20 Jan 2005 15:31:05 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id EBBC3EC229; Thu, 20 Jan 2005 16:31:51 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id CE079EC119; Thu, 20 Jan 2005 16:31:51 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: "Merlin Moncure" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:31:06 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A75C4@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75C4@Herge.rcsinc.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201631.07053.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.098 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/300 X-Sequence-Number: 9990 Le Jeudi 20 Janvier 2005 16:16, Merlin Moncure a �crit : > > No please do not talk about this again ... I'm looking about a PostgreSQL > > solution ... I know RAC ... and I'm not able to pay for a RAC certify > > hardware configuration plus a RAC Licence. > > Are you totally certain you can't solve your problem with a single server > solution? > > How about: > Price out a 4 way Opteron 4u rackmount server with 64 bit linux, stuffed > with hard drives (like 40) set up in a complex raid configuration (multiple > raid controllers) allowing you (with tablespaces) to divide up your > database. > > You can drop in dual core opterons at some later point for an easy upgrade. > Let's say this server costs 20k$...are you sure this will not be enough to > handle your load? I'm not as I said ibn my mail I want to do a Cluster of servers ... :o) -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 15:32:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E74CD3A4715 for ; Thu, 20 Jan 2005 15:32: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 15526-02 for ; Thu, 20 Jan 2005 15:32:23 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 9B2333A2B8D for ; Thu, 20 Jan 2005 15:32:27 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 1EAA8EC229; Thu, 20 Jan 2005 16:33:13 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id E74EAEC119; Thu, 20 Jan 2005 16:33:12 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: pg@fastcrypt.com Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:32:27 +0100 User-Agent: KMail/1.7.1 Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201600.47583.herve@elma.fr> <41EFCCF6.1060908@fastcrypt.com> In-Reply-To: <41EFCCF6.1060908@fastcrypt.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501201632.28236.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.096 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/301 X-Sequence-Number: 9991 Le Jeudi 20 Janvier 2005 16:23, Dave Cramer a �crit : > Google uses something called the google filesystem, look it up in > google. It is a distributed file system. Yes that's another point I'm working on ... make a cluster of server using GFS ... and making PostgreSQL running with it ... But I have not finished my test ... and may be people could have experience with this ... Regards, -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 15:34:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C18CE3A4805 for ; Thu, 20 Jan 2005 15:34: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 15733-05 for ; Thu, 20 Jan 2005 15:33:58 +0000 (GMT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id 13B243A47D4 for ; Thu, 20 Jan 2005 15:34:01 +0000 (GMT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 724D03D37; Thu, 20 Jan 2005 10:34:02 -0500 (EST) From: "Dan Langille" To: Stephan Szabo Date: Thu, 20 Jan 2005 10:36:04 -0500 MIME-Version: 1.0 Subject: Re: index scan of whole table, can't see why Cc: pgsql-performance@postgresql.org Message-ID: <41EF8994.24822.D79F9C9@localhost> In-reply-to: <20050120072205.G38768@megazone.bigpanda.com> References: <41EF7C85.4180.D46F54D@localhost> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body 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: 200501/302 X-Sequence-Number: 9992 On 20 Jan 2005 at 7:26, Stephan Szabo wrote: > On Thu, 20 Jan 2005, Dan Langille wrote: > > > On 20 Jan 2005 at 6:14, Stephan Szabo wrote: > > > > > On Wed, 19 Jan 2005, Dan Langille wrote: > > > > > > > Hi folks, > > > > > > > > Running on 7.4.2, recently vacuum analysed the three tables in > > > > question. > > > > > > > > The query plan in question changes dramatically when a WHERE clause > > > > changes from ports.broken to ports.deprecated. I don't see why. > > > > Well, I do see why: a sequential scan of a 130,000 rows. The query > > > > goes from 13ms to 1100ms because the of this. The full plans are at > > > > http://rafb.net/paste/results/v8ccvQ54.html > > > > > > > > I have tried some tuning by: > > > > > > > > set effective_cache_size to 4000, was 1000 > > > > set random_page_cost to 1, was 4 > > > > > > > > The resulting plan changes, but no speed improvment, are at > > > > http://rafb.net/paste/results/rV8khJ18.html > > > > > > > > Any suggestions please? > > > > > > As a question, what does it do if enable_hashjoin is false? I'm wondering > > > if it'll pick a nested loop for that step for the element/ports join and > > > what it estimates the cost to be. > > > > With enable_hashjoin = false, no speed improvement. Execution plan > > at http://rafb.net/paste/results/qtSFVM72.html > > Honestly I expected it to be slower (which it was), but I figured it's > worth seeing what alternate plans it'll generate (specifically to see how > it cost a nested loop on that join to compare to the fast plan). > Unfortunately, it generated a merge join, so I think it might require both > enable_hashjoin=false and enable_mergejoin=false to get it which is likely > to be even slower in practice but still may be useful to see. Setting both to false gives a dramatic performance boost. See http://rafb.net/paste/results/b70KAi42.html This gives suitable speed, but why does the plan vary so much with such a minor change in the WHERE clause? -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/ From pgsql-performance-owner@postgresql.org Thu Jan 20 15:40:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CAC663A451D for ; Thu, 20 Jan 2005 15: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 16756-06 for ; Thu, 20 Jan 2005 15:40:12 +0000 (GMT) Received: from noao.edu (email.noao.edu [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id A97503A18CF for ; Thu, 20 Jan 2005 15:40:15 +0000 (GMT) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from [140.252.14.8] (HELO weaver.tuc.noao.edu) by noao.edu (CommuniGate Pro SMTP 4.2.8) with ESMTP-TLS id 16153428; Thu, 20 Jan 2005 08:40:08 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.8) with ESMTP id j0KFe432017345; Thu, 20 Jan 2005 08:40:04 -0700 Message-ID: <41EFD0D4.8050604@noao.edu> Date: Thu, 20 Jan 2005 08:40:04 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: pg@fastcrypt.com, "Joshua D. Drake" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201600.47583.herve@elma.fr> <41EFCCF6.1060908@fastcrypt.com> <200501201632.28236.herve@elma.fr> In-Reply-To: <200501201632.28236.herve@elma.fr> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-noao.edu-MailScanner-Information: Please contact the ISP for more information X-noao.edu-MailScanner: Found to be clean 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: 200501/303 X-Sequence-Number: 9993 Herv� Piedvache wrote: > Le Jeudi 20 Janvier 2005 16:23, Dave Cramer a �crit : > >>Google uses something called the google filesystem, look it up in >>google. It is a distributed file system. > > > Yes that's another point I'm working on ... make a cluster of server using > GFS ... and making PostgreSQL running with it ... A few years ago I played around with GFS, but not for postgresql. I don't think it's going to help - logically there's no difference between putting PG on GFS and putting PG on NFS - in both cases the filesystem doesn't provide any support for distributing the task at hand - and a PG database server isn't written to be distributed across hosts regardless of the distribution of the data across filesystems. -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Thu Jan 20 15:59:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A4FF73A451D; Thu, 20 Jan 2005 15:59: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 19295-02; Thu, 20 Jan 2005 15:59:44 +0000 (GMT) Received: from dfw-gate1.raytheon.com (dfw-gate1.raytheon.com [199.46.199.230]) by svr1.postgresql.org (Postfix) with ESMTP id 988983A18CF; Thu, 20 Jan 2005 15:59:43 +0000 (GMT) Received: from ds02c01.directory.ray.com (ds02c01.directory.ray.com [147.25.138.115]) by dfw-gate1.raytheon.com (8.12.10/8.12.10) with ESMTP id j0KFjOTM016080; Thu, 20 Jan 2005 09:45:29 -0600 (CST) Received: from ds02c01 (localhost [127.0.0.1]) by ds02c01.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j0KFj9iC019982; Thu, 20 Jan 2005 15:45:10 GMT Received: from ds02c01.directory.ray.com with LMTP by ds02c01 (2.0.6/sieved-2-0-build-559); Thu, 20 Jan 2005 15:45:09 +0000 Received: from ds02t01.directory.ray.com (ds02t01.directory.ray.com [147.25.154.118]) by ds02c01.directory.ray.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j0KFho0A019370 sender Richard_D_Levine@raytheon.com; Thu, 20 Jan 2005 15:44:23 GMT Received: from notesserver5.ftw.us.ray.com (notesserver5.ftw.us.ray.com [151.168.145.35]) by ds02t01.directory.ray.com (8.12.10/8.12.10) with ESMTP id j0KFh0HJ004145; Thu, 20 Jan 2005 15:43:00 GMT Subject: Re: PostgreSQL clustering VS MySQL clustering To: Stephen Frost Cc: Christopher Kings-Lynne , =?ISO-8859-1?Q?Herv=E9_Piedvache?= , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001 Message-ID: From: Richard_D_Levine@raytheon.com Date: Thu, 20 Jan 2005 10:42:27 -0500 X-MIMETrack: Serialize by Router on NotesServer5/HDC(Release 6.5.2|June 01, 2004) at 01/20/2005 10:43:00 AM MIME-Version: 1.0 Content-type: multipart/mixed; Boundary="0__=8ABBE51CDFC59A338f9e8a93df938690918c8ABBE51CDFC59A33" Content-Disposition: inline X-SPAM: 0.00 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.184 tagged_above=0 required=5 tests=AWL, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200501/306 X-Sequence-Number: 9996 --0__=8ABBE51CDFC59A338f9e8a93df938690918c8ABBE51CDFC59A33 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: quoted-printable I think maybe a SAN in conjunction with tablespaces might be the answer= . Still need one honking server. Rick = = Stephen Frost = = To: Chri= stopher Kings-Lynne = Sent by: cc: Herv= =E9 Piedvache , pgsql-performance@postgresql.org = pgsql-performance-owner@pos Subject: Re: = [PERFORM] PostgreSQL clustering VS MySQL clustering = tgresql.org = = = = = = 01/20/2005 10:08 AM = = = = = = * Christopher Kings-Lynne (chriskl@familyhealth.com.au) wrote: > PostgreSQL has replication, but not partitioning (which is what you want). It doesn't have multi-server partitioning.. It's got partitioning within a single server (doesn't it? I thought it did, I know it was discussed w/ the guy from Cox Communications and I thought he was using= it :). > So, your only option is Oracle or another very expensive commercial > database. Or partition the data at the application layer. Stephen (See attached file: signature.asc) = --0__=8ABBE51CDFC59A338f9e8a93df938690918c8ABBE51CDFC59A33 Content-type: application/octet-stream; name="=?ISO-8859-1?Q?signature=2Easc?=" Content-Disposition: attachment; filename="=?ISO-8859-1?Q?signature=2Easc?=" Content-transfer-encoding: base64 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NClZlcnNpb246IEdudVBHIHYxLjIuNSAoR05V L0xpbnV4KQ0KDQppRDhEQlFGQjc4bC9yemdNUHFCM2tpZ1JBa05rQUowV0RCcTZ6Tno5Q0FsLzJB ZW1YQkJza3FzWDFRQ2dsSFowDQp2OHNwVnBTeXl2WHEwbDV5Vitub0ovMD0NCj1DQTFvDQotLS0t LUVORCBQR1AgU0lHTkFUVVJFLS0tLS0NCg== --0__=8ABBE51CDFC59A338f9e8a93df938690918c8ABBE51CDFC59A33-- From pgsql-performance-owner@postgresql.org Thu Jan 20 15:42:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7153F3A18CF for ; Thu, 20 Jan 2005 15:42: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 16807-07 for ; Thu, 20 Jan 2005 15:42:23 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 43C2C3A45AA for ; Thu, 20 Jan 2005 15:42:25 +0000 (GMT) Received: (qmail 29166 invoked from network); 20 Jan 2005 15:45:07 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 20 Jan 2005 15:45:07 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 27995-34 for ; Thu, 20 Jan 2005 22:45:05 +0700 (ICT) Received: (qmail 29158 invoked from network); 20 Jan 2005 15:45:05 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 20 Jan 2005 15:45:05 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Thu, 20 Jan 2005 22:45:05 +0700 Message-ID: <1106235905.41efd201295a5@webmail.moph.go.th> Date: Thu, 20 Jan 2005 22:45:05 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Subject: Which PARAMETER is most important for load query?? MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/304 X-Sequence-Number: 9994 I'm dealing with big database [3.8 Gb] and records of 3 millions . Some of the query seems to be slow eventhough just a few users in the night. I would like to know which parameter list below is most effective in rising the speed of these queries? Shmmax = 32384*8192 =265289728 Share buffer = 32384 sort_mem = 34025 <===== I guess increase this one is most effective but too high cause reading the swap , is that right? effective cache = 153204 My server has 4 Gb. ram and ~ 140 clients in rush hours. Amrit Thailand From pgsql-performance-owner@postgresql.org Thu Jan 20 15:58:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92FAC3A2B8D for ; Thu, 20 Jan 2005 15:58: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 18634-03 for ; Thu, 20 Jan 2005 15:58:28 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 780DD3A4790 for ; Thu, 20 Jan 2005 15:58:29 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0KFcKRI012781; Thu, 20 Jan 2005 15:38:20 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Thu, 20 Jan 2005 15:57:43 +0000 Message-ID: <41EFD4F7.1040900@familyhealth.com.au> Date: Thu, 20 Jan 2005 15:57:43 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Steve Wampler Cc: =?ISO-8859-15?Q?Herv=E9_Piedvache?= , "Joshua D. Drake" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> <41EFCAD4.6040307@noao.edu> In-Reply-To: <41EFCAD4.6040307@noao.edu> 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.04 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/305 X-Sequence-Number: 9995 > Probably by carefully partitioning their data. I can't imagine anything > being fast on a single table in 250,000,000 tuple range. Nor can I > really imagine any database that efficiently splits a single table > across multiple machines (or even inefficiently unless some internal > partitioning is being done). Ah, what about partial indexes - those might help. As a kind of 'semi-partition'. Chris From pgsql-performance-owner@postgresql.org Thu Jan 20 16:01:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 321DE3A455B for ; Thu, 20 Jan 2005 16:01: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 18694-08 for ; Thu, 20 Jan 2005 16:01:06 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 103543A4815 for ; Thu, 20 Jan 2005 16:01:04 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0KFerh9012825; Thu, 20 Jan 2005 15:40:54 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Thu, 20 Jan 2005 16:00:16 +0000 Message-ID: <41EFD590.3010001@familyhealth.com.au> Date: Thu, 20 Jan 2005 16:00:16 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: amrit@health2.moph.go.th Cc: PGsql-performance Subject: Re: Which PARAMETER is most important for load query?? References: <1106235905.41efd201295a5@webmail.moph.go.th> In-Reply-To: <1106235905.41efd201295a5@webmail.moph.go.th> Content-Type: text/plain; charset=TIS-620; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.034 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/307 X-Sequence-Number: 9997 amrit@health2.moph.go.th wrote: > I'm dealing with big database [3.8 Gb] and records of 3 millions . Some of the > query seems to be slow eventhough just a few users in the night. I would like > to know which parameter list below is most effective in rising the speed of > these queries? > > Shmmax = 32384*8192 =265289728 > Share buffer = 32384 That's the one you want to increase... > sort_mem = 34025 <===== I guess increase this one is most effective but too You should reduce this. This is memory PER SORT. You could have 10 sorts in one query and that query being run 10 times at once, using 100x that sort_mem in total - causing lots of swapping. So something like 8192 would probably be better, even lower at 4096 perhaps. > effective cache = 153204 That's probably about right. Chris From pgsql-performance-owner@postgresql.org Thu Jan 20 16:03:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6265B3A4839 for ; Thu, 20 Jan 2005 16:03: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 18752-07 for ; Thu, 20 Jan 2005 16:02:51 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id D3CEA3A4715 for ; Thu, 20 Jan 2005 16:02:49 +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 5A82176A3B; Thu, 20 Jan 2005 11:02:50 -0500 (EST) Subject: Re: PostgreSQL clustering VS MySQL clustering From: Rod Taylor To: =?ISO-8859-1?Q?Herv=E9?= Piedvache Cc: Christopher Kings-Lynne , Postgresql Performance In-Reply-To: <200501201536.08656.herve@elma.fr> References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> Content-Type: text/plain; charset=ISO-8859-1 Date: Thu, 20 Jan 2005 11:02:58 -0500 Message-Id: <1106236978.35299.496.camel@home> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 FreeBSD GNOME Team Port Content-Transfer-Encoding: 8bit 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: 200501/308 X-Sequence-Number: 9998 On Thu, 2005-01-20 at 15:36 +0100, Herv� Piedvache wrote: > Le Jeudi 20 Janvier 2005 15:24, Christopher Kings-Lynne a �crit : > > > Is there any solution with PostgreSQL matching these needs ... ? > > > > You want: http://www.slony.info/ > > > > > Do we have to backport our development to MySQL for this kind of problem > > > ? Is there any other solution than a Cluster for our problem ? > > > > Well, Slony does replication which is basically what you want :) > > > > Only master->slave though, so you will need to have all inserts go via > > the master server, but selects can come off any server. > > Sorry but I don't agree with this ... Slony is a replication solution ... I > don't need replication ... what will I do when my database will grow up to 50 > Gb ... I'll need more than 50 Gb of RAM on each server ??? > This solution is not very realistic for me ... Slony has some other issues with databases > 200GB in size as well (well, it hates long running transactions -- and pg_dump is a regular long running transaction) However, you don't need RAM one each server for this, you simply need enough disk space. Have a Master which takes writes, a "replicator" which you can consider to be a hot-backup of the master, have N slaves replicate off of the otherwise untouched "replicator" machine. For your next trick, have the application send read requests for Clients A-C to slave 1, D-F to slave 2, ... You need enough memory to hold the index sections for clients A-C on slave 1. The rest of the index can remain on disk. It's available should it be required (D-F box crashed, so your application is now feeding those read requests to the A-C machine)... Go to more slaves and smaller segments as you require. Use the absolute cheapest hardware you can find for the slaves that gives reasonable performance. They don't need to be reliable, so RAID 0 on IDE drives is perfectly acceptable. PostgreSQL can do the replication portion quite nicely. You need to implement the "cluster" part in the application side. -- From pgsql-performance-owner@postgresql.org Thu Jan 20 16:04:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A7E503A47FC for ; Thu, 20 Jan 2005 16: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 20402-01 for ; Thu, 20 Jan 2005 16:04:13 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 09E5C3A4823 for ; Thu, 20 Jan 2005 16:04:12 +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 j0KG3xa8020873; Thu, 20 Jan 2005 08:03:59 -0800 Message-ID: <41EFD674.2030600@commandprompt.com> Date: Thu, 20 Jan 2005 08:04:04 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: Steve Wampler , =?ISO-8859-15?Q?Herv=E9_Piedvach?= =?ISO-8859-15?Q?e?= , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> <41EFCAD4.6040307@noao.edu> <41EFD4F7.1040900@familyhealth.com.au> In-Reply-To: <41EFD4F7.1040900@familyhealth.com.au> Content-Type: multipart/mixed; boundary="------------090906040804070208060205" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/309 X-Sequence-Number: 9999 This is a multi-part message in MIME format. --------------090906040804070208060205 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Christopher Kings-Lynne wrote: >> Probably by carefully partitioning their data. I can't imagine anything >> being fast on a single table in 250,000,000 tuple range. Nor can I >> really imagine any database that efficiently splits a single table >> across multiple machines (or even inefficiently unless some internal >> partitioning is being done). > > > Ah, what about partial indexes - those might help. As a kind of > 'semi-partition'. He could also you schemas to partition out the information within the same database. J > > Chris -- 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 --------------090906040804070208060205 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 --------------090906040804070208060205-- From pgsql-performance-owner@postgresql.org Thu Jan 20 16:06:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 65F4F3A4817 for ; Thu, 20 Jan 2005 16:06: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 20380-03 for ; Thu, 20 Jan 2005 16:05:59 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205]) by svr1.postgresql.org (Postfix) with ESMTP id 9E3103A4811 for ; Thu, 20 Jan 2005 16:05:58 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 50so149875wri for ; Thu, 20 Jan 2005 08:05: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=BkbO1uW3BuMv9X73Z6FOd3CgC57NPUEpfVslsPs5GZD9RPvqJT5JXfUZcVXyR5SBu5cGwQdjI7A3DdG3BE9NKEwRfwPD3EgcUCgpD7i7iG/lL/5rBSLzPtTL3U6XoLuNQg8JhiAX8qKW9aBfQg/HFcEz1nirg2ECLOllBU63LBA= Received: by 10.54.30.15 with SMTP id d15mr135664wrd; Thu, 20 Jan 2005 08:05:57 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 20 Jan 2005 08:05:57 -0800 (PST) Message-ID: <33c6269f05012008054e094a4f@mail.gmail.com> Date: Thu, 20 Jan 2005 11:05:57 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Benjamin Wragg Subject: Re: Disk configuration Cc: pgsql-performance@postgresql.org In-Reply-To: <20050120005537.AE5D08EAB6@vscan01.westnet.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <33c6269f050119075217a42c42@mail.gmail.com> <20050120005537.AE5D08EAB6@vscan01.westnet.com.au> 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: 200501/310 X-Sequence-Number: 10000 I have never seen benchmarks for RAID 0+1. Very few people use it because it's not very fault tolerant, so I couldn't answer for sure. I would imagine that RAID 0+1 could acheive better read throughput because you could, in theory, read from each half of the mirror independantly. Write would be the same I would imagine because you still have to write all data to all drives. Thats my best guess. Alex Turner NetEconomist On Thu, 20 Jan 2005 11:55:37 +1100, Benjamin Wragg wrote: > > Thanks. That sorts out all my questions regarding disk configuration. One > more regarding RAID. Is RAID 1+0 and 0+1 essentially the same at a > performance level? > > Thanks, > > Benjamin > -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Alex Turner > Sent: Thursday, 20 January 2005 2:53 AM > To: Benjamin Wragg > Cc: pgsql-performance@postgresql.org > Subject: Re: [PERFORM] Disk configuration > > The primary goal is to reduce the number of seeks a disk or array has to > perform. Serial write throughput is much higher than random write > throughput. If you are performing very high volume throughput on a server > that is doing multiple things, then it maybe advisable to have one partition > for OS, one for postgresql binaries, one for xlog and one for table data (or > multiple if you are PG8.0). This is the ultimate configuration, but most > people don't require this level of seperation. If you do need this level of > seperation, also bare in mind that table data writes are more likely to be > random writes so you want an array that can sustain a high levels of IO/sec, > so RAID 10 with 6 or more drives is ideal. If you want fault tolerance, > then RAID 1 for OS and postgresql binaries is a minimum, and I believe that > xlog can also go on a RAID 1 unless you need more MB/sec. Ultimately you > will need to benchmark any configuration you build in order to determine if > it's successfull and meets your needs. This of course sucks, because you > don't want to buy too much because it's a waste of $$s. > > What I can tell you is my own experience which is a database running with > xlog, software and OS on a RAID 1, with Data partition running on > 3 disk RAID 5 with a database of about 3 million rows total gets an insert > speed of about 200 rows/sec on an average size table using a compaq proliant > ML370 Dual Pentium 933 w/2G RAM. Most of the DB is in RAM, so read times > are very good with most queries returning sub second. > > Hope this helps at least a little > > Alex Turner > NetEconomist > > On Wed, 19 Jan 2005 09:03:44 +1100, Benjamin Wragg > wrote: > > > > I just wanted to bounce off the list the best way to configure disks > > for a postgresql server. My gut feeling is as follows: > > > > Keep the OS and postgresql install on seperate disks to the postgresql > > /data directory? > > Is a single hard disk drive acceptable for the OS and postgresql > > program, or will this create a bottle neck? Would a multi disk array > > be more appropriate? > > > > Cheers, > > > > Benjamin Wragg > > > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Anti-Virus. > > Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005 > > From pgsql-performance-owner@postgresql.org Thu Jan 20 16:08:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 349C93A47B3 for ; Thu, 20 Jan 2005 16:07: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 20634-01 for ; Thu, 20 Jan 2005 16:07:31 +0000 (GMT) Received: from webmail.moph.go.th (health.moph.go.th [203.157.0.1]) by svr1.postgresql.org (Postfix) with SMTP id 267EE3A4715 for ; Thu, 20 Jan 2005 16:07:29 +0000 (GMT) Received: (qmail 798 invoked from network); 20 Jan 2005 16:10:11 -0000 Received: from unknown (HELO localhost) (127.0.0.1) by localhost with SMTP; 20 Jan 2005 16:10:11 -0000 Received: from webmail.moph.go.th ([127.0.0.1]) by localhost (webmail.moph.go.th [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 31084-62 for ; Thu, 20 Jan 2005 23:10:10 +0700 (ICT) Received: (qmail 773 invoked from network); 20 Jan 2005 16:10:06 -0000 Received: from unknown (HELO localhost) (203.157.0.1) by health.moph.go.th with SMTP; 20 Jan 2005 16:10:06 -0000 Received: from 203.157.100.42 ([203.157.100.42]) by webmail.moph.go.th (IMP) with HTTP for ; Thu, 20 Jan 2005 23:10:03 +0700 Message-ID: <1106237403.41efd7dbef1b3@webmail.moph.go.th> Date: Thu, 20 Jan 2005 23:10:03 +0700 From: amrit@health2.moph.go.th To: PGsql-performance Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> <41EFCCF6.1060908@fastcrypt.com> In-Reply-To: <41EFCCF6.1060908@fastcrypt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=TIS-620 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.3 X-Originating-IP: 203.157.100.42 X-Virus-Scanned: by amavisd-new at moph.go.th 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: 200501/311 X-Sequence-Number: 10001 What you want is some kind of huge pararell computing , isn't it? I have heard from many groups of Japanese Pgsql developer did it but they are talking in japanese website and of course in Japanese. I can name one of them " Asushi Mitani" and his website http://www.csra.co.jp/~mitani/jpug/pgcluster/en/index.html and you may directly contact him. Amrit Thailand From pgsql-performance-owner@postgresql.org Thu Jan 20 16:13:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B93723A47D7; Thu, 20 Jan 2005 16:13: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 21171-03; Thu, 20 Jan 2005 16:13:23 +0000 (GMT) Received: from relay.snowman.net (relay.snowman.net [66.92.160.56]) by svr1.postgresql.org (Postfix) with ESMTP id 893783A4804; Thu, 20 Jan 2005 16:13:21 +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 j0KGD7B4019709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 11:13:08 -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 j0KGDPEV015055 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 20 Jan 2005 11:13:26 -0500 Received: (from sfrost@localhost) by ns.snowman.net (8.13.1/8.13.1/Submit) id j0KGDPWT015053; Thu, 20 Jan 2005 11:13:25 -0500 Date: Thu, 20 Jan 2005 11:13:25 -0500 From: Stephen Frost To: Richard_D_Levine@raytheon.com Cc: Christopher Kings-Lynne , =?iso-8859-1?Q?Herv=E9?= Piedvache , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050120161325.GR10437@ns.snowman.net> Mail-Followup-To: Richard_D_Levine@raytheon.com, Christopher Kings-Lynne , =?iso-8859-1?Q?Herv=E9?= Piedvache , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aUZUxHew3C+tqlLv" Content-Disposition: inline In-Reply-To: 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: 11:13:03 up 355 days, 11:08, 8 users, load average: 0.10, 0.16, 0.17 User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/312 X-Sequence-Number: 10002 --aUZUxHew3C+tqlLv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Richard_D_Levine@raytheon.com (Richard_D_Levine@raytheon.com) wrote: > I think maybe a SAN in conjunction with tablespaces might be the answer. > Still need one honking server. That's interesting- can a PostgreSQL partition be acress multiple tablespaces? Stephen --aUZUxHew3C+tqlLv 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) iD8DBQFB79ilrzgMPqB3kigRAk1bAKCIA2wpbjLYTLy27jAv7rYI3RTyjwCdHn2s uqALSHXbE/WNAnQ1UzvawcM= =vfkW -----END PGP SIGNATURE----- --aUZUxHew3C+tqlLv-- From pgsql-performance-owner@postgresql.org Thu Jan 20 16:31:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 29FA83A1CF7 for ; Thu, 20 Jan 2005 16:31: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 23163-07 for ; Thu, 20 Jan 2005 16:31:30 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id B553C3A4804 for ; Thu, 20 Jan 2005 16:31:29 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 50so154047wri for ; Thu, 20 Jan 2005 08:31:29 -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=GosVeqmGWYoanRTfh4AsxCzG+a6vxASotYPFjvfEj0zcoc76+BMqr+Ikc0yrdHKwZCEdUR0AVkEcqcckK06AqHxfWHpeSAmBtIuivfEZPLq2HvCr+i77+0KKZlBOD4WPMvV0T+FBVhBr8YUkoehlfxyaUw3Nn3LPGJ8dtDtfmKo= Received: by 10.54.10.12 with SMTP id 12mr23386wrj; Thu, 20 Jan 2005 08:31:29 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 20 Jan 2005 08:31:29 -0800 (PST) Message-ID: <33c6269f050120083177fa0e83@mail.gmail.com> Date: Thu, 20 Jan 2005 11:31:29 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Matt Casters , pgsql-performance@postgresql.org Subject: Re: In-Reply-To: <20050120142603.GM10437@ns.snowman.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/313 X-Sequence-Number: 10003 I am curious - I wasn't aware that postgresql supported partitioned tables, Could someone point me to the docs on this. Thanks, Alex Turner NetEconomist On Thu, 20 Jan 2005 09:26:03 -0500, Stephen Frost wrote: > * Matt Casters (Matt.Casters@advalvas.be) wrote: > > I have the go ahead of a customer to do some testing on Postgresql in a couple of weeks as a > > replacement for Oracle. > > The reason for the test is that the number of users of the warehouse is going to increase and this > > will have a serious impact on licencing costs. (I bet that sounds familiar) > > Rather familiar, yes... :) > > > We're running a medium sized data warehouse on a Solaris box (4CPU, 8Gb RAM) on Oracle. > > Basically we have 2 large fact tables to deal with: one going for 400M rows, the other will be > > hitting 1B rows soon. > > (around 250Gb of data) > > Quite a bit of data. There's one big thing to note here I think- > Postgres will not take advantage of multiple CPUs for a given query, > Oracle will. So, it depends on your workload as to how that may impact > you. Situations where this will be unlikely to affect you: > > Your main bottle-neck is IO/disk and not CPU. > You run multiple queries in parallel frequently. > There are other processes on the system which chew up CPU time anyway. > > Situations where you're likely to be affected would be: > > You periodically run one big query. > You run a set of queries in sequential order. > > > My questions to the list are: has this sort of thing been attempted before? If so, what where the > > performance results compared to Oracle? > > I'm pretty sure it's been attempted before but unfortunately I don't > have any numbers on it myself. My data sets aren't that large (couple > million rows) but I've found PostgreSQL at least as fast as Oracle for > what we do, and much easier to work with. > > > I've been reading up on partitioned tabes on pgsql, will the performance benefit will be > > comparable to Oracle partitioned tables? > > In this case I would think so, except that PostgreSQL still won't use > multiple CPUs for a given query, even against partitioned tables, aiui. > > > What are the gotchas? > > See above? :) Other issues are things having to do w/ your specific > SQL- Oracle's old join syntax isn't supported by PostgreSQL (what is it, > something like select x,y from a,b where x=%y; to do a right-join, > iirc). > > > Should I be testing on 8 or the 7 version? > > Now that 8.0 is out I'd say probably test with that and just watch for > 8.0.x releases before you go production, if you have time before you > have to go into production with the new solution (sounds like you do- > changing databases takes time anyway). > > > Thanks in advance for any help you may have, I'll do my best to keep pgsql-performance up to date > > on the results. > > Hope that helps. Others on here will correct me if I misspoke. :) > > Stephen > > > From pgsql-performance-owner@postgresql.org Thu Jan 20 16:34:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 444233A2B8D for ; Thu, 20 Jan 2005 16:32: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 23071-10 for ; Thu, 20 Jan 2005 16:31:57 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 7CD633A4847 for ; Thu, 20 Jan 2005 16:31:56 +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 1CrfDs-0007NI-00; Thu, 20 Jan 2005 11:31:52 -0500 To: Matt.Casters@advalvas.be Cc: pgsql-performance@postgresql.org Subject: Re: References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> In-Reply-To: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 20 Jan 2005 11:31:52 -0500 Message-ID: <871xcgdptz.fsf@stark.xeocode.com> Lines: 24 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at 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: 200501/314 X-Sequence-Number: 10004 "Matt Casters" writes: > I've been reading up on partitioned tabes on pgsql, will the performance > benefit will be comparable to Oracle partitioned tables? Postgres doesn't have any built-in support for partitioned tables. You can do it the same way people did it on Oracle up until 8.0 which is by creating views of UNIONs or using inherited tables. The main advantage of partitioned tables is being able to load and drop data in large chunks instantaneously. This avoids having to perform large deletes and then having to vacuum huge tables to recover the space. However in Postgres you aren't going to get most of the performance advantage of partitions in your query plans. The Oracle planner can prune partitions it knows aren't relevant to the query to avoid having to search through them. This can let it get the speed of a full table scan without the disadvantage of having to read irrelevant tuples. Postgres is sometimes going to be forced to either do a much slower index scan or read tables that aren't relevant. -- greg From pgsql-performance-owner@postgresql.org Thu Jan 20 16:39:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3DACA3A48CD for ; Thu, 20 Jan 2005 16:39: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 39261-06 for ; Thu, 20 Jan 2005 16:39:20 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 7956D3A48A5 for ; Thu, 20 Jan 2005 16:39:19 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 50so155365wri for ; Thu, 20 Jan 2005 08:39: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Xi9uejKz0sNZ9WjTSq6LXPzIXl/KG+YIKJZZ2w9yUWESQasmSZJhnTh+kgu2FgymAnrVBxoqoYeQVEQd4viPW5vjKh5KBzayfqTIS5/Mhv0q7noqoNu2bErV0KnKhdZ+KNs/W82qq2A7k+Viw3Io+9/Qn+7nBQHr3lM8+33BHDc= Received: by 10.54.31.62 with SMTP id e62mr131667wre; Thu, 20 Jan 2005 08:39:16 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 20 Jan 2005 08:39:16 -0800 (PST) Message-ID: <33c6269f05012008391490448b@mail.gmail.com> Date: Thu, 20 Jan 2005 11:39:16 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Richard Huxton Subject: Re: [SQL] OFFSET impact on Performance??? Cc: Andrei Bintintan , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org In-Reply-To: <41EFCC5B.5010302@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/315 X-Sequence-Number: 10005 I am also very interesting in this very question.. Is there any way to declare a persistant cursor that remains open between pg sessions? This would be better than a temp table because you would not have to do the initial select and insert into a fresh table and incur those IO costs, which are often very heavy, and the reason why one would want to use a cursor. Alex Turner NetEconomist On Thu, 20 Jan 2005 15:20:59 +0000, Richard Huxton wrote: > Andrei Bintintan wrote: > >> If you're using this to provide "pages" of results, could you use a > >> cursor? > > > > What do you mean by that? Cursor? > > > > Yes I'm using this to provide "pages", but If I jump to the last pages > > it goes very slow. > > DECLARE mycursor CURSOR FOR SELECT * FROM ... > FETCH FORWARD 10 IN mycursor; > CLOSE mycursor; > > Repeated FETCHes would let you step through your results. That won't > work if you have a web-app making repeated connections. > > If you've got a web-application then you'll probably want to insert the > results into a cache table for later use. > > -- > Richard Huxton > Archonet Ltd > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > From pgsql-performance-owner@postgresql.org Thu Jan 20 16:44:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF71E3A4831 for ; Thu, 20 Jan 2005 16:44: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 44136-05 for ; Thu, 20 Jan 2005 16:44:32 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 99F9A3A4882 for ; Thu, 20 Jan 2005 16:44: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 1CrfPx-0007Oh-00; Thu, 20 Jan 2005 11:44:21 -0500 To: Steve Wampler Cc: =?iso-8859-1?q?Herv=E9_Piedvache?= , "Joshua D. Drake" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> <41EFCAD4.6040307@noao.edu> In-Reply-To: <41EFCAD4.6040307@noao.edu> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 20 Jan 2005 11:44:20 -0500 Message-ID: <87vf9scaor.fsf@stark.xeocode.com> Lines: 42 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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/316 X-Sequence-Number: 10006 Steve Wampler writes: > Herv� Piedvache wrote: > > > No ... as I have said ... how I'll manage a database getting a table of may > > be 250 000 000 records ? I'll need incredible servers ... to get quick access > > or index reading ... no ? > > Probably by carefully partitioning their data. I can't imagine anything > being fast on a single table in 250,000,000 tuple range. Why are you all so psyched out by the size of the table? That's what indexes are for. The size of the table really isn't relevant here. The important thing is the size of the working set. Ie, How many of those records are required to respond to queries. As long as you tune your application so every query can be satisfied by reading a (very) limited number of those records and have indexes to speed access to those records you can have quick response time even if you have terabytes of raw data. I would start by looking at the plans for the queries you're running and seeing if you have any queries that are reading more than hundred records or so. If so then you have to optimize them or rethink your application design. You might need to restructure your data so you don't have to scan too many records for any query. No clustering system is going to help you if your application requires reading through too much data. If every query is designed to not have to read more than a hundred or so records then there's no reason you can't have sub-100ms response time even if you had terabytes of raw data. If the problem is just that each individual query is fast but there's too many coming for a single server then something like slony is all you need. It'll spread the load over multiple machines. If you spread the load in an intelligent way you can even concentrate each server on certain subsets of the data. But that shouldn't even really be necessary, just a nice improvement. -- greg From pgsql-performance-owner@postgresql.org Thu Jan 20 16:48:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DE2963A488D for ; Thu, 20 Jan 2005 16:48: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 45016-02 for ; Thu, 20 Jan 2005 16:47:56 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A97EB3A1CF7 for ; Thu, 20 Jan 2005 16:47:55 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B74C8319C3; Thu, 20 Jan 2005 17:47:54 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 08:49:39 -0800 Organization: Hub.Org Networking Services Lines: 23 Message-ID: <41EFE123.9020209@cheapcomplexdevices.com> References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <41EFCC5B.5010302@archonet.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: 200501/317 X-Sequence-Number: 10007 Richard Huxton wrote: > > If you've got a web-application then you'll probably want to insert the > results into a cache table for later use. > If I have quite a bit of activity like this (people selecting 10000 out of a few million rows and paging through them in a web browser), would it be good to have a single table with a userid column shared by all users, or a separate table for each user that can be truncated/dropped? I started out with one table; but with people doing 10s of thousand of inserts and deletes per session, I had a pretty hard time figuring out a reasonable vacuum strategy. Eventually I started doing a whole bunch of create table tmp_XXXX tables where XXXX is a userid; and a script to drop these tables - but that's quite ugly in a different way. With 8.0 I guess I'll try the single table again - perhaps what I want may be to always have a I/O throttled vacuum running... hmm. Any suggestions? From pgsql-performance-owner@postgresql.org Fri Jan 21 04:53:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7FFEE3A48BC for ; Thu, 20 Jan 2005 16:50: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 44603-07 for ; Thu, 20 Jan 2005 16:49:57 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 47E9F3A484C for ; Thu, 20 Jan 2005 16:49:57 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9274E319C2; Thu, 20 Jan 2005 17:49:56 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Thu, 20 Jan 2005 16:49:55 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 55 Message-ID: References: <20050109180452.03723387.frank@wiles.org> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/367 X-Sequence-Number: 10057 "frank@wiles.org (Frank Wiles)" wrote in pgsql.performance: > On Thu, 6 Jan 2005 19:01:38 +0000 (UTC) > Randolf Richardson wrote: > >> I'm looking for recent performance statistics on PostgreSQL vs. >> Oracle >> vs. Microsoft SQL Server. Recently someone has been trying to >> convince my client to switch from SyBASE to Microsoft SQL Server (they >> originally wanted to go with Oracle but have since fallen in love with >> Microsoft). All this time I've been recommending PostgreSQL for cost >> and stability (my own testing has shown it to be better at handling >> abnormal shutdowns and using fewer system resources) in addition to >> true cross-platform compatibility. >> >> If I can show my client some statistics that PostgreSQL >> outperforms >> these (I'm more concerned about it beating Oracle because I know that >> Microsoft's stuff is always slower, but I need the information anyway >> to protect my client from falling victim to a 'sales job'), then >> PostgreSQL will be the solution of choice as the client has always >> believed that they need a high-performance solution. >> >> I've already convinced them on the usual price, cross-platform >> compatibility, open source, long history, etc. points, and I've been >> assured that if the performance is the same or better than Oracle's >> and Microsoft's solutions that PostgreSQL is what they'll choose. > > While this doesn't exactly answer your question, I use this little > tidbit of information when "selling" people on PostgreSQL. PostgreSQL > was chosen over Oracle as the database to handle all of the .org TLDs > information. While I don't believe the company that won was chosen > solely because they used PostgreSQL vs Oracle ( vs anything else ), > it does go to show that PostgreSQL can be used in a large scale > environment. Do you have a link for that information? I've told a few people about this and one PostgreSQL advocate (thanks to me -- they were going to be a Microsoft shop before that) is asking. > Another tidbit you can use in this particular case: I was involved > in moving www.ljworld.com, www.lawrence.com, and www.kusports.com from > a Sybase backend to a PostgreSQL backend back in 2000-2001. We got > roughly a 200% speed improvement at that time and PostgreSQL has only > improved since then. I would be more than happy to elaborate on this > migration off list if you would like. kusports.com gets a TON of > hits especially during "March Madness" and PostgreSQL has never been > an issue in the performance of the site. SyBase is better suited to the small projects in my opinion. I have a number of customers in the legal industry who have to use it because the products they use have a proprietary requirement for it. Fortunately it's quite stable, and uses very little in the way of system resources, but there is a license fee -- I'm not complaining at all, it has always been working well for my clients. From pgsql-performance-owner@postgresql.org Thu Jan 20 16:53:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B5C8F3A4815; Thu, 20 Jan 2005 16:53: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 45535-02; Thu, 20 Jan 2005 16:53:33 +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 B5BF03A4838; Thu, 20 Jan 2005 16:53:32 +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 1CrfXm-000GKm-3T; Thu, 20 Jan 2005 16:52:28 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id ACCA1171FA; Thu, 20 Jan 2005 16:53:11 +0000 (GMT) Message-ID: <41EFE1FA.60004@archonet.com> Date: Thu, 20 Jan 2005 16:53:14 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: alex@neteconomist.com Cc: Andrei Bintintan , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> <33c6269f05012008391490448b@mail.gmail.com> In-Reply-To: <33c6269f05012008391490448b@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.075 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/318 X-Sequence-Number: 10008 Alex Turner wrote: > I am also very interesting in this very question.. Is there any way > to declare a persistant cursor that remains open between pg sessions? Not sure how this would work. What do you do with multiple connections? Only one can access the cursor, so which should it be? > This would be better than a temp table because you would not have to > do the initial select and insert into a fresh table and incur those > IO costs, which are often very heavy, and the reason why one would > want to use a cursor. I'm pretty sure two things mean there's less difference than you might expect: 1. Temp tables don't fsync 2. A cursor will spill to disk beyond a certain size -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 20 17:24:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1F0053A4894 for ; Thu, 20 Jan 2005 17:24: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 48896-06 for ; Thu, 20 Jan 2005 17:24:22 +0000 (GMT) Received: from main.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id C1BBC3A4885 for ; Thu, 20 Jan 2005 17:24:21 +0000 (GMT) Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Crg2d-0005AV-00 for ; Thu, 20 Jan 2005 18:24:19 +0100 Received: from port-212-202-6-48.dynamic.qsc.de ([212.202.6.48]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Jan 2005 18:24:19 +0100 Received: from holger by port-212-202-6-48.dynamic.qsc.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Jan 2005 18:24:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: "Holger Hoffstaette" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 17:55:56 +0100 Organization: The Tyler Durden Rehab Clinic Lines: 18 Message-ID: References: <200501201503.31241.herve@elma.fr> <200501201600.47583.herve@elma.fr> <41EFCCF6.1060908@fastcrypt.com> <200501201632.28236.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: port-212-202-6-48.dynamic.qsc.de User-Agent: Pan/0.13.91 (Before we let euphoria convince us we are free) 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: 200501/324 X-Sequence-Number: 10014 On Thu, 20 Jan 2005 16:32:27 +0100, Herv� Piedvache wrote: > Le Jeudi 20 Janvier 2005 16:23, Dave Cramer a �crit : >> Google uses something called the google filesystem, look it up in >> google. It is a distributed file system. > > Yes that's another point I'm working on ... make a cluster of server using > GFS ... and making PostgreSQL running with it ... Did you read the GFS whitepaper? It really works differently from other filesystems with regard to latency and consistency. You'll probably have better success with Lustre (http://www.clusterfs.com/) or RedHat's Global File System (http://www.redhat.com/software/rha/gfs/). If you're looking for a 'cheap, free and easy' solution you can just as well stop right now. :-) -h From pgsql-performance-owner@postgresql.org Thu Jan 20 16:59:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E5DE73A4802; Thu, 20 Jan 2005 16:59: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 46135-03; Thu, 20 Jan 2005 16:59:52 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 84E333A4888; Thu, 20 Jan 2005 16:59:49 +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 1Crfeh-0007Pk-00; Thu, 20 Jan 2005 11:59:35 -0500 To: "Andrei Bintintan" Cc: "Richard Huxton" , , Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> In-Reply-To: <020d01c4fef6$595bb9d0$0b00a8c0@forge> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 20 Jan 2005 11:59:34 -0500 Message-ID: <87pt00c9zd.fsf@stark.xeocode.com> Lines: 44 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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/319 X-Sequence-Number: 10009 "Andrei Bintintan" writes: > > If you're using this to provide "pages" of results, could you use a cursor? > What do you mean by that? Cursor? > > Yes I'm using this to provide "pages", but If I jump to the last pages it goes > very slow. The best way to do pages for is not to use offset or cursors but to use an index. This only works if you can enumerate all the sort orders the application might be using and can have an index on each of them. To do this the query would look something like: SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 Then you take note of the last value used on a given page and if the user selects "next" you pass that as the starting point for the next page. This query takes the same amount of time no matter how many records are in the table and no matter what page of the result set the user is on. It should actually be instantaneous even if the user is on the hundredth page of millions of records because it uses an index both for the finding the right point to start and for the ordering. It also has the advantage that it works even if the list of items changes as the user navigates. If you use OFFSET and someone inserts a record in the table then the "next" page will overlap the current page. Worse, if someone deletes a record then "next" will skip a record. The disadvantages of this are a) it's hard (but not impossible) to go backwards. And b) it's impossible to give the user a list of pages and let them skip around willy nilly. (If this is for a web page then specifically don't recommend cursors. It will mean you'll have to have some complex session management system that guarantees the user will always come to the same postgres session and has some garbage collection if the user disappears. And it means the URL is only good for a limited amount of time. If they bookmark it it'll break if they come back the next day.) -- greg From pgsql-performance-owner@postgresql.org Thu Jan 20 17:00:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3E7EF3A48A5 for ; Thu, 20 Jan 2005 17:00: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 46239-06 for ; Thu, 20 Jan 2005 17:00:18 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 71BF83A4885 for ; Thu, 20 Jan 2005 17:00:07 +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: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 12:00:06 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75C6@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcT/D9EooLT+WKauSDyUGLrV8ripAQAAJ0cA From: "Merlin Moncure" To: Cc: , "Richard Huxton" 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: 200501/320 X-Sequence-Number: 10010 > I am also very interesting in this very question.. Is there any way to > declare a persistant cursor that remains open between pg sessions? > This would be better than a temp table because you would not have to > do the initial select and insert into a fresh table and incur those IO > costs, which are often very heavy, and the reason why one would want > to use a cursor. Yes, it's called a 'view' :-) Everything you can do with cursors you can do with a view, including selecting records in blocks in a reasonably efficient way. As long as your # records fetched is not real small (> 10) and your query is not super complex, you can slide your view just like a cursor with zero real impact on performance. If the query in question does not scale in time complexity with the amount of data returned (there is a fix processing step which can't be avoided), then it's materialized view time, such that they can be done in PostgreSQL. Now, cursors can be passed around in pl/pgsql functions which makes them very useful in that context. However, for normal data processing via queries, they have some limitations that makes them hard to use in a general sense. Merlin From pgsql-performance-owner@postgresql.org Fri Jan 21 04:53:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F17E73A484E for ; Thu, 20 Jan 2005 17:01: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 46717-03 for ; Thu, 20 Jan 2005 17:00:56 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id E31963A45AA for ; Thu, 20 Jan 2005 17:00:55 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id CAB19319C2; Thu, 20 Jan 2005 18:00:52 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Thu, 20 Jan 2005 17:00:51 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 107 Message-ID: References: <1105333466.41e20cda39716@webmail.rawbw.com> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/368 X-Sequence-Number: 10058 "mudfoot@rawbw.com" wrote in pgsql.performance: > Quoting Randolf Richardson : > >> I'm looking for recent performance statistics on PostgreSQL >> vs. Oracle >> >> vs. Microsoft SQL Server. Recently someone has been trying to convince >> my > > I don't know anything about your customer's requirements other than that > they have a DB currently and somebody(ies) is(are) trying to get them to > switch to another. > > I don't think you'll find meaningful numbers unless you do your own > benchmarks. > > DB performance is very largely determined by how the application > functions, > hardware, OS and the DBA's familiarity with the platform. I would > suspect that for any given workload on relatively similar hardware that > just about any of the DB's you mention would perform similarly if tuned > appropriately. > >> client to switch from SyBASE to Microsoft SQL Server (they originally >> wanted >> >> to go with Oracle but have since fallen in love with Microsoft). All >> this time I've been recommending PostgreSQL for cost and stability (my >> own testing >> >> has shown it to be better at handling abnormal shutdowns and using >> fewer system resources) in addition to true cross-platform >> compatibility. > > Right for the customer? How about "Don't fix it if it ain't broke"? > Replacing a DB backend isn't always trivial (understatement). I suppose > if their application is very simple and uses few if any proprietary > features of Sybase then changing the DB would be simple. That depends > heavily on the application. In general, though, you probably shouldn't > rip and replace DB platforms unless there's a very good strategic > reason. > > I don't know about MSSQL, but I know that, if managed properly, Sybase > and Oracle can be pretty rock-solid and high performing. If *you* have > found FooDB to be the most stable and highest performing, then that > probably means that FooDB is the one you're most familiar with rather > than FooDB being the best in all circumstances. PostgreSQL is great. I > love it. In the right hands and under the right circumstances, it is > the best DB. So is Sybase. And Oracle. And MSSQL. That's an objective answer. Unfortunately the issue I'm stuck with is a Microsoft-crazy sales droid who's arguing that "MS-SQL is so easy to manage, like all Microsoft products, that a novice can make it outperform other high-end systems like Oracle even when tuned by an expert." This crap makes me want to throw up, but in order to keep the client I'm doing my best to hold it down (I bet many of you are shaking your heads). The client is leaning away from the sales droid, however, and this is partly due to the help I've recieved here in these newsgroups -- thanks everyone. >> If I can show my client some statistics that PostgreSQL >> outperforms >> these (I'm more concerned about it beating Oracle because I know that >> Microsoft's stuff is always slower, but I need the information anyway >> to protect my client from falling victim to a 'sales job'), then >> PostgreSQL will >> >> be the solution of choice as the client has always believed that they >> need a >> >> high-performance solution. > > Unless there's a really compelling reason to switch, optimizing what > they already have is probably the best thing for them. They've already > paid for it. > They've already written their own application and have some familiarity > with > managing the DB. According to Sybase, Sybase is the fastest thing > going. :-) Which is probably pretty close to the truth if the > application and DB are tuned appropriately. I agree with you completely. However, the client's looking at getting the application completely re-programmed. The current developer didn't plan it properly, and has been slapping code together as if it's a bowl of spaghetti. In short, there are many problems with the existing system, and I'm talking about proper testing procedures that begin even at the design stage (before any coding begins). >> I've already convinced them on the usual price, cross-platform >> compatibility, open source, long history, etc. points, and I've been >> assured that if the performance is the same or better than Oracle's and >> Microsoft's solutions that PostgreSQL is what they'll choose. > > Are you telling me that they're willing to pay $40K per CPU for Oracle > if it performs 1% better than PostgreSQL, which is $0? Not to mention > throw away Sybase, which is a highly scalable platform in and of itself. > > The best DB platform is what they currently have, regardless of what > they have, unless there is a very compelling reason to switch. [sNip] Have you heard the saying "Nobody ever got fired for picking IBM?" It is one of those situations where if they don't spend the money in their budget, then they lose it the next time around (no suggestions are needed on this issue, but thanks anyway). From pgsql-performance-owner@postgresql.org Thu Jan 20 17:04:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DC4283A4888 for ; Thu, 20 Jan 2005 17:04: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 47740-01 for ; Thu, 20 Jan 2005 17:04:38 +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 01C853A484F for ; Thu, 20 Jan 2005 17:04:37 +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 1CrfiU-000Jfd-3Q; Thu, 20 Jan 2005 17:03:33 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id C75FB170C3; Thu, 20 Jan 2005 17:04:20 +0000 (GMT) Message-ID: <41EFE497.2070607@archonet.com> Date: Thu, 20 Jan 2005 17:04:23 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ron Mayer Cc: 'Postgresql Performance' Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> <41EFE123.9020209@cheapcomplexdevices.com> In-Reply-To: <41EFE123.9020209@cheapcomplexdevices.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.074 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/321 X-Sequence-Number: 10011 Ron Mayer wrote: > Richard Huxton wrote: > >> >> If you've got a web-application then you'll probably want to insert >> the results into a cache table for later use. >> > > If I have quite a bit of activity like this (people selecting 10000 out > of a few million rows and paging through them in a web browser), would > it be good to have a single table with a userid column shared by all > users, or a separate table for each user that can be truncated/dropped? > > I started out with one table; but with people doing 10s of thousand > of inserts and deletes per session, I had a pretty hard time figuring > out a reasonable vacuum strategy. As often as you can, and make sure your config allocates enough free-space-map for them. Unless, of course, you end up I/O saturated. > Eventually I started doing a whole bunch of create table tmp_XXXX > tables where XXXX is a userid; and a script to drop these tables - but > that's quite ugly in a different way. > > With 8.0 I guess I'll try the single table again - perhaps what I > want may be to always have a I/O throttled vacuum running... hmm. Well, there have been some tweaks, but I don't know if they'll help in this case. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 20 17:17:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7C51B3A484E for ; Thu, 20 Jan 2005 17:17: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 47830-09 for ; Thu, 20 Jan 2005 17:16:58 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 18EEF3A4805 for ; Thu, 20 Jan 2005 17:16:57 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 04ABE319C2; Thu, 20 Jan 2005 18:16:56 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 09:12:01 -0800 Organization: Hub.Org Networking Services Lines: 10 Message-ID: References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <200501201536.08656.herve@elma.fr> 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: 200501/322 X-Sequence-Number: 10012 Herv� Piedvache wrote: > Sorry but I don't agree with this ... Slony is a replication solution ... I > don't need replication ... what will I do when my database will grow up to 50 > Gb ... I'll need more than 50 Gb of RAM on each server ??? > This solution is not very realistic for me ... Have you confirmed you need a 1:1 RAM:data ratio? Of course more memory gets more speed but often at a diminishing rate of return. Unless every record of your 50GB is used in every query, only the most commonly used elements of your DB needs to be in RAM. This is the very idea of caching. From pgsql-performance-owner@postgresql.org Thu Jan 20 17:23:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A49E3A488E for ; Thu, 20 Jan 2005 17:23: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 48489-07 for ; Thu, 20 Jan 2005 17:23:14 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id B10F83A4881 for ; Thu, 20 Jan 2005 17:23:13 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 68so1561wri for ; Thu, 20 Jan 2005 09:23:12 -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=pR2ddWnaoNrEdzYAIVbDjN+axziA0QcsrkPmCZPoI/3B3bqqwVY279IqvjcbvwssXe1vAal+p8sb6lXM4PFgceGo/2roNu5UhNPEfIlQZ13ufXNlExUXaYLNJWFEpUNUErPzCH2P0UX+DaJs41Wyup9Fmdxr3h0jeliQKr+WQgo= Received: by 10.54.10.12 with SMTP id 12mr55464wrj; Thu, 20 Jan 2005 09:23:12 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 20 Jan 2005 09:23:12 -0800 (PST) Message-ID: <33c6269f05012009236f451499@mail.gmail.com> Date: Thu, 20 Jan 2005 12:23:12 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Richard_D_Levine@raytheon.com, Christopher Kings-Lynne , =?ISO-8859-1?Q?Herv=E9_Piedvache?= , pgsql-performance@postgresql.org, pgsql-performance-owner@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-Reply-To: <20050120161325.GR10437@ns.snowman.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20050120161325.GR10437@ns.snowman.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/323 X-Sequence-Number: 10013 The problem is very large ammounts of data that needs to be both read and updated. If you replicate a system, you will need to intelligently route the reads to the server that has the data in RAM or you will always be hitting DIsk which is slow. This kind of routing AFAIK is not possible with current database technology, and you are still stuck for writes. Writes are always going to be the bane of any cluster. Clustering can give better parallel read performance i.e. large no. of clients accessing data simultaneously, but your write performance is always going to be bound by the underlying disk infrastructure, not even Oracle RAC can get around this (It uses multiple read nodes accessing the same set of database files underneath) Google solved the problem by building this intelligence into the middle tier, and using a distributed file system. Java Entity Beans are supposed to solve this problem somewhat by distributing the data across multiple servers in a cluster and allowing you to defer write syncing, but it really doesn't work all that well. The only way I know to solve this at the RDBMS layer is to configure a very powerfull disk layer, which is basicaly going to a SAN mesh with multiple cards on a single system with multiple IO boards, or an OS that clusters at the base level, thinking HP Superdome or z900. Even Opteron w/PCI-X cards has a limit of about 400MB/sec throughput on a single IO channel, and there are only two independent channels on any boards I know about. The other solution is to do what google did. Implement your own middle tier that knows how to route queries to the appropriate place. Each node can then have it's own independant database with it's own independant disk subsystem, and your throughput is only limited by your network interconnects, and your internet pipe. This kind of middle tier is really not that hard to if your data can easily be segmented. Each node runs it's own query sort and filter independantly, and supplies the result to the central data broker, which then collates the results and supplies them back to the user. Updated work in a similar fasion. The update comes into the central broker that decides which nodes it will affect, and then issues updates to those nodes. I've built this kind of architecture, if you want to do it, don't use Java unless you want to pay top dollar for your programmers, because it's hard to make it work well in Java (most JMS implementations suck, look at MQueue or a custom queue impl, forget XML it's too slow to serialize and deserialize requests). Alex Turner NetEconomist On Thu, 20 Jan 2005 11:13:25 -0500, Stephen Frost wrote: > * Richard_D_Levine@raytheon.com (Richard_D_Levine@raytheon.com) wrote: > > I think maybe a SAN in conjunction with tablespaces might be the answer. > > Still need one honking server. > > That's interesting- can a PostgreSQL partition be acress multiple > tablespaces? > > Stephen > > > From pgsql-performance-owner@postgresql.org Thu Jan 20 17:24:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E4F7A3A4894; Thu, 20 Jan 2005 17:24: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 48559-08; Thu, 20 Jan 2005 17:24:38 +0000 (GMT) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id C76D13A1CF7; Thu, 20 Jan 2005 17:24:38 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 4.42) id 1Crg2u-000I3o-Fh; Thu, 20 Jan 2005 17:24:37 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id BEAE617089; Thu, 20 Jan 2005 17:24:35 +0000 (GMT) Message-ID: <41EFE954.7080205@archonet.com> Date: Thu, 20 Jan 2005 17:24:36 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Greg Stark Cc: Andrei Bintintan , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <87pt00c9zd.fsf@stark.xeocode.com> In-Reply-To: <87pt00c9zd.fsf@stark.xeocode.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.074 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/325 X-Sequence-Number: 10015 Greg Stark wrote: > "Andrei Bintintan" writes: > > >>>If you're using this to provide "pages" of results, could you use a cursor? >> >>What do you mean by that? Cursor? >> >>Yes I'm using this to provide "pages", but If I jump to the last pages it goes >>very slow. > > > The best way to do pages for is not to use offset or cursors but to use an > index. This only works if you can enumerate all the sort orders the > application might be using and can have an index on each of them. > > To do this the query would look something like: > > SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 > > Then you take note of the last value used on a given page and if the user > selects "next" you pass that as the starting point for the next page. Greg's is the most efficient, but you need to make sure you have a suitable key available in the output of your select. Also, since you are repeating the query you could get different results as people insert/delete rows. This might or might not be what you want. A similar solution is to partition by date/alphabet or similar, then page those results. That can reduce your resultset to a manageable size. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 20 17:31:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C9D223A48DA for ; Thu, 20 Jan 2005 17:31: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 49665-03 for ; Thu, 20 Jan 2005 17:30:54 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 915B63A4729 for ; Thu, 20 Jan 2005 17:30:54 +0000 (GMT) Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) by www.postgresql.com (Postfix) with SMTP id E172D739219 for ; Thu, 20 Jan 2005 17:30:52 +0000 (GMT) Received: (qmail 14884 invoked from network); 20 Jan 2005 18:46:37 -0000 Received: from dbitech.wavefire.com (HELO ?64.141.15.253?) (darcy@64.141.15.253) by radius.wavefire.com with SMTP; 20 Jan 2005 18:46:37 -0000 From: Darcy Buskermolen Organization: Wavefire Technologies Corp. To: "Joshua D. Drake" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 09:29:37 -0800 User-Agent: KMail/1.6.2 Cc: Stephen Frost , =?iso-8859-1?q?Herv=E9_Piedvache?= , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <20050120144416.GO10437@ns.snowman.net> <41EFC514.9090806@commandprompt.com> In-Reply-To: <41EFC514.9090806@commandprompt.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200501200929.37228.darcy@wavefire.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/326 X-Sequence-Number: 10016 On January 20, 2005 06:49 am, Joshua D. Drake wrote: > Stephen Frost wrote: > >* Herv? Piedvache (herve@elma.fr) wrote: > >>Le Jeudi 20 Janvier 2005 15:30, Stephen Frost a =E9crit : > >>>* Herv? Piedvache (herve@elma.fr) wrote: > >>>>Is there any solution with PostgreSQL matching these needs ... ? > >>> > >>>You might look into pg_pool. Another possibility would be slony, thou= gh > >>>I'm not sure it's to the point you need it at yet, depends on if you c= an > >>>handle some delay before an insert makes it to the slave select system= s. > >> > >>I think not ... pgpool or slony are replication solutions ... but as I > >> have said to Christopher Kings-Lynne how I'll manage the scalabilty of > >> the database ? I'll need several servers able to load a database growi= ng > >> and growing to get good speed performance ... > > > >They're both replication solutions, but they also help distribute the > >load. For example: > > > >pg_pool will distribute the select queries amoung the servers. They'll > >all get the inserts, so that hurts, but at least the select queries are > >distributed. > > > >slony is similar, but your application level does the load distribution > >of select statements instead of pg_pool. Your application needs to know > >to send insert statements to the 'main' server, and select from the > >others. > > You can put pgpool in front of replicator or slony to get load > balancing for reads. Last time I checked load ballanced reads was only available in pgpool if yo= u=20 were using pgpools's internal replication. Has something changed recently? > > >>>>Is there any other solution than a Cluster for our problem ? > >>> > >>>Bigger server, more CPUs/disks in one box. Try to partition up your > >>>data some way such that it can be spread across multiple machines, then > >>>if you need to combine the data have it be replicated using slony to a > >>>big box that has a view which joins all the tables and do your big > >>>queries against that. > >> > >>But I'll arrive to limitation of a box size quickly I thing a 4 > >> processors with 64 Gb of RAM ... and after ? > > Opteron. IBM Z-series, or other big iron. > > >Go to non-x86 hardware after if you're going to continue to increase the > >size of the server. Personally I think your better bet might be to > >figure out a way to partition up your data (isn't that what google > >does anyway?). > > > > Stephen =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 Jan 20 17:33:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F16B3A4860 for ; Thu, 20 Jan 2005 17: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 49638-06 for ; Thu, 20 Jan 2005 17:33:45 +0000 (GMT) Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) by svr1.postgresql.org (Postfix) with SMTP id C40F33A47BD for ; Thu, 20 Jan 2005 17:33:44 +0000 (GMT) Received: (qmail 15267 invoked from network); 20 Jan 2005 18:50:42 -0000 Received: from dbitech.wavefire.com (HELO ?64.141.15.253?) (darcy@64.141.15.253) by radius.wavefire.com with SMTP; 20 Jan 2005 18:50:42 -0000 From: Darcy Buskermolen Organization: Wavefire Technologies Corp. To: Christopher Kings-Lynne Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 09:33:42 -0800 User-Agent: KMail/1.6.2 Cc: =?iso-8859-15?q?Herv=E9_Piedvache?= , pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> In-Reply-To: <41EFC569.6030800@familyhealth.com.au> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <200501200933.42951.darcy@wavefire.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/327 X-Sequence-Number: 10017 On January 20, 2005 06:51 am, Christopher Kings-Lynne wrote: > >>>Sorry but I don't agree with this ... Slony is a replication solution > >>> ... I don't need replication ... what will I do when my database will > >>> grow up to 50 Gb ... I'll need more than 50 Gb of RAM on each server > >>> ??? This solution is not very realistic for me ... > >>> > >>>I need a Cluster solution not a replication one or explain me in details > >>>how I will do for managing the scalabilty of my database ... > >> > >>Buy Oracle > > > > I think this is not my solution ... sorry I'm talking about finding a > > PostgreSQL solution ... > > My point being is that there is no free solution. There simply isn't. > I don't know why you insist on keeping all your data in RAM, but the > mysql cluster requires that ALL data MUST fit in RAM all the time. > > PostgreSQL has replication, but not partitioning (which is what you want). > > So, your only option is Oracle or another very expensive commercial > database. Another Option to consider would be pgmemcache. that way you just build the farm out of lots of large memory, diskless boxes for keeping the whole database in memory in the whole cluster. More information on it can be found at: http://people.freebsd.org/~seanc/pgmemcache/ > > Chris > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend -- Darcy Buskermolen Wavefire Technologies Corp. ph: 250.717.0200 fx: 250.763.1759 http://www.wavefire.com From pgsql-performance-owner@postgresql.org Thu Jan 20 18:01:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 690623A4838 for ; Thu, 20 Jan 2005 18: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 53039-01 for ; Thu, 20 Jan 2005 18:01:35 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id D3EA93A444B for ; Thu, 20 Jan 2005 18:01:33 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 0090F319C2; Thu, 20 Jan 2005 19:01:32 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Thu, 20 Jan 2005 10:03:17 -0800 Organization: Hub.Org Networking Services Lines: 18 Message-ID: <41EFF265.40902@cheapcomplexdevices.com> References: <20050109180452.03723387.frank@wiles.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Randolf Richardson User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: 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: 200501/328 X-Sequence-Number: 10018 Randolf Richardson wrote: >> While this doesn't exactly answer your question, I use this little >> tidbit of information when "selling" people on PostgreSQL. PostgreSQL >> was chosen over Oracle as the database to handle all of the .org TLDs >> information. ... > > Do you have a link for that information? I've told a few people about > this and one PostgreSQL advocate (thanks to me -- they were going to be a > Microsoft shop before that) is asking. Of course you could read their application when they were competing with a bunch of other companies using databases from different vendors. I believe this is the link to their response to the database questions... http://www.icann.org/tlds/org/questions-to-applicants-13.htm#Response13TheInternetSocietyISOC From pgsql-performance-owner@postgresql.org Thu Jan 20 18:05:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 833AE3A48A3; Thu, 20 Jan 2005 18:05: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 53267-05; Thu, 20 Jan 2005 18:04:51 +0000 (GMT) Received: from COLSWEEPER.cranel.com (newmail.cranel.com [66.192.200.227]) by svr1.postgresql.org (Postfix) with ESMTP id E430E3A4807; Thu, 20 Jan 2005 18:04:51 +0000 (GMT) Received: from colmail01.cranel.local (colmail01.cranel.local) by COLSWEEPER.cranel.com (Content Technologies SMTPRS 4.3.14) with ESMTP id ; Thu, 20 Jan 2005 13:02:44 -0500 Received: by colmail01.cranel.local with Internet Mail Service (5.5.2657.72) id ; Thu, 20 Jan 2005 13:04:03 -0500 Message-ID: <387C22290D3FD71195D300508BF7DB5238B017@colmail01.cranel.local> From: "Spiegelberg, Greg" To: 'Richard Huxton' , Andrei Bintintan Cc: pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 13:04:02 -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: 200501/329 X-Sequence-Number: 10019 Isn't this a prime example of when to use a servlet or something similar in function? It will create the cursor, maintain it, and fetch against it for a particular page. Greg -----Original Message----- From: Richard Huxton [mailto:dev@archonet.com] Sent: Thursday, January 20, 2005 10:21 AM To: Andrei Bintintan Cc: pgsql-sql@postgresql.org; pgsql-performance@postgresql.org Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? Andrei Bintintan wrote: >> If you're using this to provide "pages" of results, could you use a >> cursor? > > What do you mean by that? Cursor? > > Yes I'm using this to provide "pages", but If I jump to the last pages > it goes very slow. DECLARE mycursor CURSOR FOR SELECT * FROM ... FETCH FORWARD 10 IN mycursor; CLOSE mycursor; Repeated FETCHes would let you step through your results. That won't work if you have a web-app making repeated connections. If you've got a web-application then you'll probably want to insert the results into a cache table for later use. -- Richard Huxton Archonet Ltd ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Thu Jan 20 18:09:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CBC763A48AD for ; Thu, 20 Jan 2005 18:09: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 53330-06 for ; Thu, 20 Jan 2005 18:08:56 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 7F31B3A47E8 for ; Thu, 20 Jan 2005 18:08:55 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so23217wri for ; Thu, 20 Jan 2005 10:08:55 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:cc:subject:date:organization:message-id:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:in-reply-to:x-mimeole:importance; b=T+kVoUW1xa06OWcJVHY9NBOYKV851kxbHmlD9CSZF1y/y2Ndk9xUv9QMtxPJAj6sdfCJPPeyItdfCLnvbYSl27drtq+aquHFX9QNb+ygPe0t03HzsfgO4HjAia9MpQSHIX6yo0MnqsqzlqmCpJbEwFeFe2tLQViEO1ssqIUHm9o= Received: by 10.54.14.79 with SMTP id 79mr142235wrn; Thu, 20 Jan 2005 10:08:55 -0800 (PST) Received: from sbew318anc22 ([200.184.93.96]) by smtp.gmail.com with ESMTP id 33sm3968wra.2005.01.20.10.08.53; Thu, 20 Jan 2005 10:08:55 -0800 (PST) From: "Bruno Almeida do Lago" To: =?iso-8859-1?Q?'Herv=E9_Piedvache'?= Cc: Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 16:09:57 -0200 Organization: G&P Message-ID: <005701c4ff1b$42c0ada0$e883f40a@br.gedasgrp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: <200501201631.07053.herve@elma.fr> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/330 X-Sequence-Number: 10020 Could you explain us what do you have in mind for that solution? I mean, forget the PostgreSQL (or any other database) restrictions and explain = us how this hardware would be. Where the data would be stored? I've something in mind for you, but first I need to understand your = needs! C ya. Bruno Almeida do Lago =20 -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Herv=E9 = Piedvache Sent: Thursday, January 20, 2005 1:31 PM To: Merlin Moncure Cc: pgsql-performance@postgresql.org Subject: Re: [PERFORM] PostgreSQL clustering VS MySQL clustering Le Jeudi 20 Janvier 2005 16:16, Merlin Moncure a =E9crit : > > No please do not talk about this again ... I'm looking about a PostgreSQL > > solution ... I know RAC ... and I'm not able to pay for a RAC = certify > > hardware configuration plus a RAC Licence. > > Are you totally certain you can't solve your problem with a single = server > solution? > > How about: > Price out a 4 way Opteron 4u rackmount server with 64 bit linux, = stuffed > with hard drives (like 40) set up in a complex raid configuration (multiple > raid controllers) allowing you (with tablespaces) to divide up your > database. > > You can drop in dual core opterons at some later point for an easy upgrade. > Let's say this server costs 20k$...are you sure this will not be = enough to > handle your load? I'm not as I said ibn my mail I want to do a Cluster of servers ... :o) --=20 Herv=E9 Piedvache Elma Ing=E9nierie Informatique 6 rue du Faubourg Saint-Honor=E9 F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Thu Jan 20 18:42:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7E6783A47B7 for ; Thu, 20 Jan 2005 18:42: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 56150-01 for ; Thu, 20 Jan 2005 18:42:26 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id EEF063A18CF for ; Thu, 20 Jan 2005 18:42:26 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 63so106250wri for ; Thu, 20 Jan 2005 10:42:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Zedz3jgl/uU+lMsq746kNimo+zmPA4nutk5OYFTns4Fjd3rIBMeb5+DcleTgPpc6buBImlWIEMhBCOg7eeCQC2R8JbvhrfxvUzyCJolGKqAwWVIxUBhiWjU2EF3lb4jzTlmEygFP4HkvpZNiCEE8zI277tlz9rMtOHW35SWMAQY= Received: by 10.54.17.37 with SMTP id 37mr172075wrq; Thu, 20 Jan 2005 10:42:25 -0800 (PST) Received: by 10.54.59.22 with HTTP; Thu, 20 Jan 2005 10:42:25 -0800 (PST) Message-ID: <330532b6050120104246597d2a@mail.gmail.com> Date: Thu, 20 Jan 2005 13:42:25 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-Reply-To: <200501200933.42951.darcy@wavefire.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501200933.42951.darcy@wavefire.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.046 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/331 X-Sequence-Number: 10021 On Thu, 20 Jan 2005 09:33:42 -0800, Darcy Buskermolen wrote: > > Another Option to consider would be pgmemcache. that way you just build the > farm out of lots of large memory, diskless boxes for keeping the whole > database in memory in the whole cluster. More information on it can be found > at: http://people.freebsd.org/~seanc/pgmemcache/ Which brings up another question: why not just cluster at the hardware layer? Get an external fiberchannel array, and cluster a bunch of dual Opterons, all sharing that storage. In that sense you would be getting one big PostgreSQL 'image' running across all of the servers. Or is that idea too 90's? ;-) -- Mitch From pgsql-performance-owner@postgresql.org Fri Jan 21 04:55:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6E7203A4A45 for ; Thu, 20 Jan 2005 18:51: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 57302-07 for ; Thu, 20 Jan 2005 18:51:38 +0000 (GMT) Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net [199.185.220.220]) by svr1.postgresql.org (Postfix) with ESMTP id 34F143A4954 for ; Thu, 20 Jan 2005 18:50:56 +0000 (GMT) Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050120185055.TJAT16962.priv-edtnes56.telusplanet.net@localhost>; Thu, 20 Jan 2005 11:50:55 -0700 Received: from 209.17.183.249 ( [209.17.183.249]) as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; Thu, 20 Jan 2005 10:50:55 -0800 Message-ID: <1106247055.41effd8f837c4@webmail.telus.net> Date: Thu, 20 Jan 2005 10:50:55 -0800 From: Mischa To: Greg Stark Cc: pgsql-performance@postgresql.org Subject: Re: References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <871xcgdptz.fsf@stark.xeocode.com> In-Reply-To: <871xcgdptz.fsf@stark.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1-cvs X-Originating-IP: 209.17.183.249 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.426 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, FORGED_RCVD_HELO X-Spam-Level: * X-Archive-Number: 200501/369 X-Sequence-Number: 10059 No support for partitioned tables? Perhaps in name ... but I use a time-based "partition" tables that inherit from a base table; new partitions are "placed" (moved) round-robin on a set of drives. Somewhat manual, but if you really need a solution now, it works. Quoting Greg Stark : > > "Matt Casters" writes: > > > I've been reading up on partitioned tabes on pgsql, will the performance > > benefit will be comparable to Oracle partitioned tables? > > Postgres doesn't have any built-in support for partitioned tables. You can > do > it the same way people did it on Oracle up until 8.0 which is by creating > views of UNIONs or using inherited tables. > > The main advantage of partitioned tables is being able to load and drop data > in large chunks instantaneously. This avoids having to perform large deletes > and then having to vacuum huge tables to recover the space. > > However in Postgres you aren't going to get most of the performance > advantage > of partitions in your query plans. The Oracle planner can prune partitions > it > knows aren't relevant to the query to avoid having to search through them. > > This can let it get the speed of a full table scan without the disadvantage > of > having to read irrelevant tuples. Postgres is sometimes going to be forced > to > either do a much slower index scan or read tables that aren't relevant. > > -- > greg > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- "Dreams come true, not free." From pgsql-performance-owner@postgresql.org Thu Jan 20 19:33:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8A16E3A48B8 for ; Thu, 20 Jan 2005 19:01: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 60679-03 for ; Thu, 20 Jan 2005 19:01:12 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 8F7143A4922 for ; Thu, 20 Jan 2005 19:00:05 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 45B6FEC30C; Thu, 20 Jan 2005 20:00:48 +0100 (CET) Received: from herve.elma.fr (herve.elma.fr [10.0.1.2]) by mailer.elma.loc (Postfix) with ESMTP id 24C90EC302; Thu, 20 Jan 2005 20:00:48 +0100 (CET) From: =?iso-8859-15?q?Herv=E9_Piedvache?= Organization: Elma =?iso-8859-15?q?Ing=E9nierie?= Informatique To: "Bruno Almeida do Lago" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 20:00:03 +0100 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org References: <005701c4ff1b$42c0ada0$e883f40a@br.gedasgrp> In-Reply-To: <005701c4ff1b$42c0ada0$e883f40a@br.gedasgrp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200501202000.03853.herve@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.09 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/337 X-Sequence-Number: 10027 Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a �crit : > Could you explain us what do you have in mind for that solution? I mean, > forget the PostgreSQL (or any other database) restrictions and explain us > how this hardware would be. Where the data would be stored? > > I've something in mind for you, but first I need to understand your needs! I just want to make a big database as explained in my first mail ... At the beginning we will have aprox. 150 000 000 records ... each month we will add about 4/8 millions new rows in constant flow during the day ... and in same time web users will access to the database in order to read those data. Stored data are quite close to data stored by google ... (we are not making a google clone ... just a lot of data many small values and some big ones ... that's why I'm comparing with google for data storage). Then we will have a search engine searching into those data ... Dealing about the hardware, for the moment we have only a bi-pentium Xeon 2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results ... so we are thinking about a new solution with maybe several servers (server design may vary from one to other) ... to get a kind of cluster to get better performance ... Am I clear ? Regards, -- Herv� Piedvache Elma Ing�nierie Informatique 6 rue du Faubourg Saint-Honor� F-75008 - Paris - France Pho. 33-144949901 Fax. 33-144949902 From pgsql-performance-owner@postgresql.org Thu Jan 20 19:29:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8CA083A4790 for ; Thu, 20 Jan 2005 19:07: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 61572-01 for ; Thu, 20 Jan 2005 19:07:27 +0000 (GMT) Received: from mail2.dbitech.ca (radius.wavefire.com [64.141.13.252]) by svr1.postgresql.org (Postfix) with SMTP id C251C3A480D for ; Thu, 20 Jan 2005 19:07:26 +0000 (GMT) Received: (qmail 28309 invoked from network); 20 Jan 2005 20:24:25 -0000 Received: from dbitech.wavefire.com (HELO ?64.141.15.253?) (darcy@64.141.15.253) by radius.wavefire.com with SMTP; 20 Jan 2005 20:24:25 -0000 From: Darcy Buskermolen Organization: Wavefire Technologies Corp. To: Mitch Pirtle Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 11:07:23 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501200933.42951.darcy@wavefire.com> <330532b6050120104246597d2a@mail.gmail.com> In-Reply-To: <330532b6050120104246597d2a@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501201107.23964.darcy@wavefire.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/334 X-Sequence-Number: 10024 On January 20, 2005 10:42 am, Mitch Pirtle wrote: > On Thu, 20 Jan 2005 09:33:42 -0800, Darcy Buskermolen > > wrote: > > Another Option to consider would be pgmemcache. that way you just build > > the farm out of lots of large memory, diskless boxes for keeping the > > whole database in memory in the whole cluster. More information on it > > can be found at: http://people.freebsd.org/~seanc/pgmemcache/ > > Which brings up another question: why not just cluster at the hardware > layer? Get an external fiberchannel array, and cluster a bunch of dual > Opterons, all sharing that storage. In that sense you would be getting > one big PostgreSQL 'image' running across all of the servers. It dosn't quite work that way, thanks to shared memory, and kernel disk cache. (among other things) > > Or is that idea too 90's? ;-) > > -- Mitch > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org -- Darcy Buskermolen Wavefire Technologies Corp. ph: 250.717.0200 fx: 250.763.1759 http://www.wavefire.com From pgsql-performance-owner@postgresql.org Thu Jan 20 19:11:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 19FFD3A48DB; Thu, 20 Jan 2005 19:11: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 61464-08; Thu, 20 Jan 2005 19:10:52 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 99DC03A484F; Thu, 20 Jan 2005 19:10:50 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Thu, 20 Jan 2005 19:10:49 Z Subject: Re: [SQL] OFFSET impact on Performance??? From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: pgsql-performance@postgresql.org Cc: Andrei Bintintan , pgsql-sql@postgresql.org In-Reply-To: <87pt00c9zd.fsf@stark.xeocode.com> References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <87pt00c9zd.fsf@stark.xeocode.com> Content-Type: text/plain Date: Thu, 20 Jan 2005 19:12:06 +0000 Message-Id: <1106248326.22416.22.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: 200501/332 X-Sequence-Number: 10022 On Thu, 2005-01-20 at 11:59 -0500, Greg Stark wrote: > The best way to do pages for is not to use offset or cursors but to use an > index. This only works if you can enumerate all the sort orders the > application might be using and can have an index on each of them. > > To do this the query would look something like: > > SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 > > Then you take note of the last value used on a given page and if the user > selects "next" you pass that as the starting point for the next page. this will only work unchanged if the index is unique. imagine , for example if you have more than 50 rows with the same value of col. one way to fix this is to use ORDER BY col,oid gnari From pgsql-performance-owner@postgresql.org Thu Jan 20 19:30:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 231553A48E6 for ; Thu, 20 Jan 2005 19:13: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 62393-03 for ; Thu, 20 Jan 2005 19:13:22 +0000 (GMT) Received: from noao.edu (astronomyinspanish.org [140.252.1.54]) by svr1.postgresql.org (Postfix) with ESMTP id 23E073A48F6 for ; Thu, 20 Jan 2005 19:13:22 +0000 (GMT) X-TFF-CGPSA-Version: 1.4f1 X-TFF-CGPSA-Filter: Scanned Received: from [140.252.14.8] (HELO weaver.tuc.noao.edu) by noao.edu (CommuniGate Pro SMTP 4.2.8) with ESMTP-TLS id 16158049; Thu, 20 Jan 2005 12:13:20 -0700 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by weaver.tuc.noao.edu (8.12.8/8.12.8) with ESMTP id j0KJDH32023133; Thu, 20 Jan 2005 12:13:18 -0700 Message-ID: <41F002CD.3040900@noao.edu> Date: Thu, 20 Jan 2005 12:13:17 -0700 From: Steve Wampler User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mitch Pirtle Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501200933.42951.darcy@wavefire.com> <330532b6050120104246597d2a@mail.gmail.com> In-Reply-To: <330532b6050120104246597d2a@mail.gmail.com> X-Enigmail-Version: 0.90.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-noao.edu-MailScanner-Information: Please contact the ISP for more information X-noao.edu-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.033 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/336 X-Sequence-Number: 10026 Mitch Pirtle wrote: > Which brings up another question: why not just cluster at the hardware > layer? Get an external fiberchannel array, and cluster a bunch of dual > Opterons, all sharing that storage. In that sense you would be getting > one big PostgreSQL 'image' running across all of the servers. This isn't as easy as it sounds. Simply sharing the array among hosts with a 'standard' file system won't work because of cache inconsistencies. So, you need to put a shareable filesystem (such as GFS or Lustre) on it. But that's not enough, because you're going to be running separate postgresql backends on the different hosts, and there are definitely consistency issues with trying to do that. So far as I know (right, experts?) postgresql isn't designed with providing distributed consistency in mind (isn't shared memory used for consistency, which restricts all the backends to a single host?). -- Steve Wampler -- swampler@noao.edu The gods that smiled on your birth are now laughing out loud. From pgsql-performance-owner@postgresql.org Thu Jan 20 19:23:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5D68A3A4894; Thu, 20 Jan 2005 19:22: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 63381-08; Thu, 20 Jan 2005 19:22:07 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 4E0153A491C; Thu, 20 Jan 2005 19:21:55 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Thu, 20 Jan 2005 19:21:55 Z Subject: Re: [SQL] OFFSET impact on Performance??? From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: pgsql-performance@postgresql.org Cc: Andrei Bintintan , pgsql-sql@postgresql.org In-Reply-To: <1106248326.22416.22.camel@localhost.localdomain> References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <87pt00c9zd.fsf@stark.xeocode.com> <1106248326.22416.22.camel@localhost.localdomain> Content-Type: text/plain; charset=iso-8859-1 Date: Thu, 20 Jan 2005 19:23:12 +0000 Message-Id: <1106248992.22416.25.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 8bit 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: 200501/333 X-Sequence-Number: 10023 On Thu, 2005-01-20 at 19:12 +0000, Ragnar Hafsta� wrote: > On Thu, 2005-01-20 at 11:59 -0500, Greg Stark wrote: > > > The best way to do pages for is not to use offset or cursors but to use an > > index. This only works if you can enumerate all the sort orders the > > application might be using and can have an index on each of them. > > > > To do this the query would look something like: > > > > SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 > > > > Then you take note of the last value used on a given page and if the user > > selects "next" you pass that as the starting point for the next page. > > this will only work unchanged if the index is unique. imagine , for > example if you have more than 50 rows with the same value of col. > > one way to fix this is to use ORDER BY col,oid and a slightly more complex WHERE clause as well, of course gnari From pgsql-performance-owner@postgresql.org Thu Jan 20 19:30:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 56BA33A491A for ; Thu, 20 Jan 2005 19:29: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 65125-04 for ; Thu, 20 Jan 2005 19:29:34 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id D89A73A48DF for ; Thu, 20 Jan 2005 19:29:34 +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: [SQL] OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 14:29:34 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75C8@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcT/JK8jY+KkcHiORoCteeDcCrEHCgAAPULg 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.051 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/335 X-Sequence-Number: 10025 > this will only work unchanged if the index is unique. imagine , for > example if you have more than 50 rows with the same value of col. >=20 > one way to fix this is to use ORDER BY col,oid nope! oid is 1. deprecated 2. not guaranteed to be unique even inside a (large) table. Use a sequence instead. =20 create view a_b as select nextval('some_sequnce')::k, a.*, b.* from a, b [...] =09 select * from a_b where k > k1 order by k limit 1000 *or* execute fetch_a_b(k1, 1000) <-- pass limit into prepared statement for = extra flexibility. From pgsql-performance-owner@postgresql.org Thu Jan 20 19:36:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BE1323A48DC for ; Thu, 20 Jan 2005 19:36: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 65650-09 for ; Thu, 20 Jan 2005 19:35:51 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by svr1.postgresql.org (Postfix) with ESMTP id D5F613A4905 for ; Thu, 20 Jan 2005 19:35:45 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id f1so21677rne for ; Thu, 20 Jan 2005 11:35:44 -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=fKJoCV/SZAAQIo/k7GnKvHaXM0K5s6gnj/Q39xejjAYDgerm8f73RleIEEGH5uPZES/G09n7HKPsgQNhtTWUHY3+QLVHq+GLATXUfH72u04UMnC6A1kS5nW3pg3iOhJZ2loVZQ7pwWAoRuj3Jh1w48ftUf2Edn67xNyaH+0cJtA= Received: by 10.38.157.1 with SMTP id f1mr123382rne; Thu, 20 Jan 2005 11:35:44 -0800 (PST) Received: by 10.38.149.21 with HTTP; Thu, 20 Jan 2005 11:35:44 -0800 (PST) Message-ID: <4b09a0c05012011355033781b@mail.gmail.com> Date: Thu, 20 Jan 2005 20:35:44 +0100 From: Jean-Max Reymond Reply-To: Jean-Max Reymond To: Steve Wampler Subject: Re: PostgreSQL clustering VS MySQL clustering Cc: Mitch Pirtle , pgsql-performance@postgresql.org In-Reply-To: <41F002CD.3040900@noao.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501200933.42951.darcy@wavefire.com> <330532b6050120104246597d2a@mail.gmail.com> <41F002CD.3040900@noao.edu> 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: 200501/338 X-Sequence-Number: 10028 On Thu, 20 Jan 2005 12:13:17 -0700, Steve Wampler wrote: > Mitch Pirtle wrote: > But that's not enough, because you're going to be running separate > postgresql backends on the different hosts, and there are > definitely consistency issues with trying to do that. So far as > I know (right, experts?) postgresql isn't designed with providing > distributed consistency in mind (isn't shared memory used for > consistency, which restricts all the backends to a single host?). yes, you're right: you'll need a Distributed Lock Manager and an application to manage it , Postgres ? From pgsql-performance-owner@postgresql.org Thu Jan 20 20:00:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F1733A490F for ; Thu, 20 Jan 2005 20:00: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 68579-04 for ; Thu, 20 Jan 2005 20:00:22 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 300383A48DF for ; Thu, 20 Jan 2005 20:00:22 +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 1CriTZ-0008EL-00; Thu, 20 Jan 2005 15:00:17 -0500 To: =?iso-8859-1?q?Herv=E9_Piedvache?= Cc: "Bruno Almeida do Lago" , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <005701c4ff1b$42c0ada0$e883f40a@br.gedasgrp> <200501202000.03853.herve@elma.fr> In-Reply-To: <200501202000.03853.herve@elma.fr> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 20 Jan 2005 15:00:17 -0500 Message-ID: <87651rdg6m.fsf@stark.xeocode.com> Lines: 30 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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/339 X-Sequence-Number: 10029 Herv� Piedvache writes: > Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a �crit : > > Could you explain us what do you have in mind for that solution? I mean, > > forget the PostgreSQL (or any other database) restrictions and explain us > > how this hardware would be. Where the data would be stored? > > > > I've something in mind for you, but first I need to understand your needs! > > I just want to make a big database as explained in my first mail ... At the > beginning we will have aprox. 150 000 000 records ... each month we will add > about 4/8 millions new rows in constant flow during the day ... and in same > time web users will access to the database in order to read those data. > Stored data are quite close to data stored by google ... (we are not making a > google clone ... just a lot of data many small values and some big ones ... > that's why I'm comparing with google for data storage). > Then we will have a search engine searching into those data ... You're concentrating on the data within the database. That's only half the picture. What are you going to *do* with the data in the database? You need to analyze what "we will have a search engine searching into those data" means in more detail. Postgres is more than capable of storing 150Gb of data. There are people with terabyte databases on this list. You need to define what types of queries you need to perform, how many data they need to manipulate, and what your performance requirements are for those queries. -- greg From pgsql-performance-owner@postgresql.org Thu Jan 20 20:02:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 55EB53A48DD for ; Thu, 20 Jan 2005 20: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 69817-05 for ; Thu, 20 Jan 2005 20:02:17 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id C2BA83A4918 for ; Thu, 20 Jan 2005 20:02:17 +0000 (GMT) Received: (qmail 28125 invoked from network); 20 Jan 2005 20:01:41 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 20 Jan 2005 20:01:41 -0000 Message-ID: <41F00E9D.9040309@fastcrypt.com> Date: Thu, 20 Jan 2005 15:03:41 -0500 From: Dave Cramer Reply-To: pg@fastcrypt.com Organization: Postgres International User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-15?Q?Herv=E9_Piedvache?= Cc: Bruno Almeida do Lago , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <005701c4ff1b$42c0ada0$e883f40a@br.gedasgrp> <200501202000.03853.herve@elma.fr> In-Reply-To: <200501202000.03853.herve@elma.fr> Content-Type: multipart/alternative; boundary="------------020303070708040809020305" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.297 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/340 X-Sequence-Number: 10030 This is a multi-part message in MIME format. --------------020303070708040809020305 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit Two way xeon's are as fast as a single opteron, 150M rows isn't a big deal. Clustering isn't really the solution, I fail to see how clustering actually helps since it has to slow down file access. Dave Herv� Piedvache wrote: >Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a �crit : > > >>Could you explain us what do you have in mind for that solution? I mean, >>forget the PostgreSQL (or any other database) restrictions and explain us >>how this hardware would be. Where the data would be stored? >> >>I've something in mind for you, but first I need to understand your needs! >> >> > >I just want to make a big database as explained in my first mail ... At the >beginning we will have aprox. 150 000 000 records ... each month we will add >about 4/8 millions new rows in constant flow during the day ... and in same >time web users will access to the database in order to read those data. >Stored data are quite close to data stored by google ... (we are not making a >google clone ... just a lot of data many small values and some big ones ... >that's why I'm comparing with google for data storage). >Then we will have a search engine searching into those data ... > >Dealing about the hardware, for the moment we have only a bi-pentium Xeon >2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results ... so >we are thinking about a new solution with maybe several servers (server >design may vary from one to other) ... to get a kind of cluster to get better >performance ... > >Am I clear ? > >Regards, > > -- Dave Cramer http://www.postgresintl.com 519 939 0336 ICQ#14675561 --------------020303070708040809020305 Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Two way xeon's are as fast as a single opteron, 150M rows isn't a big deal.
Clustering isn't really the solution, I fail to see how clustering actually helps since it has to slow down file access.

Dave

Herv� Piedvache wrote:
Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a �crit :
  
Could you explain us what do you have in mind for that solution? I mean,
forget the PostgreSQL (or any other database) restrictions and explain us
how this hardware would be. Where the data would be stored?

I've something in mind for you, but first I need to understand your needs!
    

I just want to make a big database as explained in my first mail ... At the 
beginning we will have aprox. 150 000 000 records ... each month we will add 
about 4/8 millions new rows in constant flow during the day ... and in same 
time web users will access to the database in order to read those data.
Stored data are quite close to data stored by google ... (we are not making a 
google clone ... just a lot of data many small values and some big ones ... 
that's why I'm comparing with google for data storage).
Then we will have a search engine searching into those data ...

Dealing about the hardware, for the moment we have only a bi-pentium Xeon 
2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results ... so 
we are thinking about a new solution with maybe several servers (server 
design may vary from one to other) ... to get a kind of cluster to get better 
performance ...

Am I clear ?

Regards,
  

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561
--------------020303070708040809020305-- From pgsql-performance-owner@postgresql.org Thu Jan 20 20:06:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9138C3A48C2 for ; Thu, 20 Jan 2005 20:06: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 70359-01 for ; Thu, 20 Jan 2005 20:06:14 +0000 (GMT) Received: from poros.telenet-ops.be (poros.telenet-ops.be [195.130.132.44]) by svr1.postgresql.org (Postfix) with ESMTP id E7C183A4932 for ; Thu, 20 Jan 2005 20:06:13 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by poros.telenet-ops.be (Postfix) with SMTP id 6AA363BC377 for ; Thu, 20 Jan 2005 21:06:10 +0100 (MET) Received: from Bolletje (d54C2921B.access.telenet.be [84.194.146.27]) by poros.telenet-ops.be (Postfix) with ESMTP id 3A75C3BC02A for ; Thu, 20 Jan 2005 21:06:10 +0100 (MET) Reply-To: From: "Matt Casters" To: Subject: Re: Date: Thu, 20 Jan 2005 21:06:07 +0100 Organization: i-Bridge bvba MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 In-Reply-To: <20050120142603.GM10437@ns.snowman.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcT++/Ji+2OJprnKQHipEyz46zl2PwALl9KQ Message-Id: <20050120200610.3A75C3BC02A@poros.telenet-ops.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.204 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, SUBJ_ALL_CAPS X-Spam-Level: ** X-Archive-Number: 200501/341 X-Sequence-Number: 10031 Thanks Stephen, My main concern is to get as much read performance on the disks as possible on this given system. CPU is rarely a problem on a typical data warehouse system, this one's not any different. We basically have 2 RAID5 disk sets (300Gb) and 150Gb) with a third one coming along.(around 350Gb) I was kind of hoping that the new PGSQL tablespaces would allow me to create a storage container spanning multiple file-systems, but unfortunately, that seems to be not the case. Is this correct? That tells me that I probably need to do a full reconfiguration of the disks on the Solaris level to get maximum performance out of the system. Mmmm. This is going to be a though one to crack. Perhaps it will be possible to get some extra juice out of placing the indexes on the smaller disks (150G) and the data on the bigger ones? Thanks! Matt -----Oorspronkelijk bericht----- Van: Stephen Frost [mailto:sfrost@snowman.net] Verzonden: donderdag 20 januari 2005 15:26 Aan: Matt Casters CC: pgsql-performance@postgresql.org Onderwerp: Re: [PERFORM] * Matt Casters (Matt.Casters@advalvas.be) wrote: > I have the go ahead of a customer to do some testing on Postgresql in > a couple of weeks as a replacement for Oracle. > The reason for the test is that the number of users of the warehouse > is going to increase and this will have a serious impact on licencing > costs. (I bet that sounds familiar) Rather familiar, yes... :) > We're running a medium sized data warehouse on a Solaris box (4CPU, 8Gb RAM) on Oracle. > Basically we have 2 large fact tables to deal with: one going for 400M > rows, the other will be hitting 1B rows soon. > (around 250Gb of data) Quite a bit of data. There's one big thing to note here I think- Postgres will not take advantage of multiple CPUs for a given query, Oracle will. So, it depends on your workload as to how that may impact you. Situations where this will be unlikely to affect you: Your main bottle-neck is IO/disk and not CPU. You run multiple queries in parallel frequently. There are other processes on the system which chew up CPU time anyway. Situations where you're likely to be affected would be: You periodically run one big query. You run a set of queries in sequential order. > My questions to the list are: has this sort of thing been attempted > before? If so, what where the performance results compared to Oracle? I'm pretty sure it's been attempted before but unfortunately I don't have any numbers on it myself. My data sets aren't that large (couple million rows) but I've found PostgreSQL at least as fast as Oracle for what we do, and much easier to work with. > I've been reading up on partitioned tabes on pgsql, will the > performance benefit will be comparable to Oracle partitioned tables? In this case I would think so, except that PostgreSQL still won't use multiple CPUs for a given query, even against partitioned tables, aiui. > What are the gotchas? See above? :) Other issues are things having to do w/ your specific SQL- Oracle's old join syntax isn't supported by PostgreSQL (what is it, something like select x,y from a,b where x=%y; to do a right-join, iirc). > Should I be testing on 8 or the 7 version? Now that 8.0 is out I'd say probably test with that and just watch for 8.0.x releases before you go production, if you have time before you have to go into production with the new solution (sounds like you do- changing databases takes time anyway). > Thanks in advance for any help you may have, I'll do my best to keep > pgsql-performance up to date on the results. Hope that helps. Others on here will correct me if I misspoke. :) Stephen From pgsql-performance-owner@postgresql.org Thu Jan 20 20:22:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 293223A484E for ; Thu, 20 Jan 2005 20:22: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 71076-05 for ; Thu, 20 Jan 2005 20:22:19 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 6DE513A483D for ; Thu, 20 Jan 2005 20:22:19 +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: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 15:21:18 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75C9@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL clustering VS MySQL clustering Thread-Index: AcT/J6Y/RS/b2xgSSPy0tmqaI7ljKgAA0uaA From: "Merlin Moncure" To: =?iso-8859-1?Q?Herv=E9_Piedvache?= Cc: 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: 200501/342 X-Sequence-Number: 10032 > Dealing about the hardware, for the moment we have only a bi-pentium = Xeon > 2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results = ... > so > we are thinking about a new solution with maybe several servers = (server > design may vary from one to other) ... to get a kind of cluster to get > better > performance ... >=20 > Am I clear ? yes. Clustering is not the answer to your problem. You need to build a = bigger, faster box with lots of storage. Clustering is=20 A: a headache B: will cost you more, not less C: not designed for what you are trying to do. Going the x86 route, for about 20k$ you can get quad Opteron with 1-2 = terabytes of storage (SATA), depending on how you configure your raid. = This is the best bang for the buck you are going to get, period. = Replicate for redundancy, not performance. If you are doing fair amount of writes, you will not be able to make a = faster system than this for similar amount of cash. You can drop the = price a bit by pushing optional upgrades out to the future... If this is not good enough for you, it's time to start thinking about a = mid range server. Merlin From pgsql-performance-owner@postgresql.org Thu Jan 20 20:26:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A63E63A489C for ; Thu, 20 Jan 2005 20:26: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 71540-04 for ; Thu, 20 Jan 2005 20:26:31 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 9EC9B3A4859 for ; Thu, 20 Jan 2005 20:26:32 +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 j0KKQTa8005678; Thu, 20 Jan 2005 12:26:29 -0800 Message-ID: <41F013EB.9060105@commandprompt.com> Date: Thu, 20 Jan 2005 12:26:19 -0800 From: "Joshua D. Drake" Organization: Command Prompt, Inc. User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: matt.casters@advalvas.be Cc: pgsql-performance@postgresql.org Subject: Re: References: <20050120200610.3A75C3BC02A@poros.telenet-ops.be> In-Reply-To: <20050120200610.3A75C3BC02A@poros.telenet-ops.be> Content-Type: multipart/mixed; boundary="------------060709070705030405010507" 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: 200501/343 X-Sequence-Number: 10033 This is a multi-part message in MIME format. --------------060709070705030405010507 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Matt Casters wrote: > > Thanks Stephen, > > My main concern is to get as much read performance on the disks as possible > on this given system. CPU is rarely a problem on a typical data warehouse > system, this one's not any different. > > We basically have 2 RAID5 disk sets (300Gb) and 150Gb) with a third one > coming along.(around 350Gb) Why not run two raid systems. A RAID 1 for your OS and a RAID 10 for your database? Push all of your extra drives into the RAID 10. Sincerely, Joshua D. Drake > I was kind of hoping that the new PGSQL tablespaces would allow me to create > a storage container spanning multiple file-systems, but unfortunately, that > seems to be not the case. Is this correct? > > That tells me that I probably need to do a full reconfiguration of the disks > on the Solaris level to get maximum performance out of the system. > Mmmm. This is going to be a though one to crack. Perhaps it will be > possible to get some extra juice out of placing the indexes on the smaller > disks (150G) and the data on the bigger ones? > > Thanks! > > Matt > > -----Oorspronkelijk bericht----- > Van: Stephen Frost [mailto:sfrost@snowman.net] > Verzonden: donderdag 20 januari 2005 15:26 > Aan: Matt Casters > CC: pgsql-performance@postgresql.org > Onderwerp: Re: [PERFORM] > > * Matt Casters (Matt.Casters@advalvas.be) wrote: > >>I have the go ahead of a customer to do some testing on Postgresql in >>a couple of weeks as a replacement for Oracle. >>The reason for the test is that the number of users of the warehouse >>is going to increase and this will have a serious impact on licencing >>costs. (I bet that sounds familiar) > > > Rather familiar, yes... :) > > >>We're running a medium sized data warehouse on a Solaris box (4CPU, 8Gb > > RAM) on Oracle. > >>Basically we have 2 large fact tables to deal with: one going for 400M >>rows, the other will be hitting 1B rows soon. >>(around 250Gb of data) > > > Quite a bit of data. There's one big thing to note here I think- Postgres > will not take advantage of multiple CPUs for a given query, Oracle will. > So, it depends on your workload as to how that may impact you. Situations > where this will be unlikely to affect you: > > Your main bottle-neck is IO/disk and not CPU. > You run multiple queries in parallel frequently. > There are other processes on the system which chew up CPU time anyway. > > Situations where you're likely to be affected would be: > > You periodically run one big query. > You run a set of queries in sequential order. > > >>My questions to the list are: has this sort of thing been attempted >>before? If so, what where the performance results compared to Oracle? > > > I'm pretty sure it's been attempted before but unfortunately I don't have > any numbers on it myself. My data sets aren't that large (couple million > rows) but I've found PostgreSQL at least as fast as Oracle for what we do, > and much easier to work with. > > >>I've been reading up on partitioned tabes on pgsql, will the >>performance benefit will be comparable to Oracle partitioned tables? > > > In this case I would think so, except that PostgreSQL still won't use > multiple CPUs for a given query, even against partitioned tables, aiui. > > >>What are the gotchas? > > > See above? :) Other issues are things having to do w/ your specific > SQL- Oracle's old join syntax isn't supported by PostgreSQL (what is it, > something like select x,y from a,b where x=%y; to do a right-join, iirc). > > >>Should I be testing on 8 or the 7 version? > > > Now that 8.0 is out I'd say probably test with that and just watch for 8.0.x > releases before you go production, if you have time before you have to go > into production with the new solution (sounds like you do- changing > databases takes time anyway). > > >>Thanks in advance for any help you may have, I'll do my best to keep >>pgsql-performance up to date on the results. > > > Hope that helps. Others on here will correct me if I misspoke. :) > > Stephen > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Command Prompt, Inc., your source for PostgreSQL replication, professional support, programming, managed services, shared and dedicated hosting. Home of the Open Source Projects plPHP, plPerlNG, pgManage, and pgPHPtoolkit. Contact us now at: +1-503-667-4564 - http://www.commandprompt.com --------------060709070705030405010507 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 --------------060709070705030405010507-- From pgsql-performance-owner@postgresql.org Thu Jan 20 21:02:10 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6C2F63A4269 for ; Thu, 20 Jan 2005 21:02: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 75911-01 for ; Thu, 20 Jan 2005 21:01:56 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 31F833A1CF7 for ; Thu, 20 Jan 2005 21:01:56 +0000 (GMT) Received: (qmail 24772 invoked from network); 20 Jan 2005 21:01:53 -0000 Received: from 218-101-14-86.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.86) by 0 with SMTP; 20 Jan 2005 21:01:53 -0000 Message-ID: <41F01D2B.9030902@coretech.co.nz> Date: Fri, 21 Jan 2005 10:05:47 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Herv=E9_Piedvache?= Cc: Bruno Almeida do Lago , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <005701c4ff1b$42c0ada0$e883f40a@br.gedasgrp> <200501202000.03853.herve@elma.fr> In-Reply-To: <200501202000.03853.herve@elma.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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: 200501/344 X-Sequence-Number: 10034 Herv� Piedvache wrote: > > > Dealing about the hardware, for the moment we have only a bi-pentium Xeon > 2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results ... so > we are thinking about a new solution with maybe several servers (server > design may vary from one to other) ... to get a kind of cluster to get better > performance ... > The poor performance may not necessarily be: i) attributable to the hardware or, ii) solved by clustering. I would recommend determining *why* you got the slowdown. A few possible reasons are: i) not vacuuming often enough, freespacemap settings too small. ii) postgresql.conf setting very non optimal. iii) index and/or data design not optimal for PG. My suspicions would start at iii). Other posters have pointed out that 250000000 records in itself is not necessarily a problem, so this sort of data size is manageable. regards Mark From pgsql-performance-owner@postgresql.org Thu Jan 20 21:35:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 931213A1CF7 for ; Thu, 20 Jan 2005 21:35: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 82945-03 for ; Thu, 20 Jan 2005 21:35:12 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.206]) by svr1.postgresql.org (Postfix) with ESMTP id EC3283A4811 for ; Thu, 20 Jan 2005 21:35:12 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 70so19307wra for ; Thu, 20 Jan 2005 13:35:12 -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=qabnD1A9RiESpOTyYHcfYsTCZCHz/EKBEJ1kp4BVuKnl5v9b3QY4AKxJrf+S11rKpojcmsAsQLoK9BNK9sqa0rSuZ9a8g4k1lTLp8D5Rpou8nmmpcubuWxjCqZkSnTPnIqTJAPoGZQIUsfPf4PFrp6RYonPEXLt0d1MHDQXRj7I= Received: by 10.54.30.58 with SMTP id d58mr273131wrd; Thu, 20 Jan 2005 13:35:12 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 20 Jan 2005 13:35:12 -0800 (PST) Message-ID: <33c6269f05012013354ebf8bd8@mail.gmail.com> Date: Thu, 20 Jan 2005 16:35:12 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Merlin Moncure Subject: Re: [SQL] OFFSET impact on Performance??? Cc: pgsql-performance@postgresql.org, Richard Huxton In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75C6@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75C6@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.042 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/345 X-Sequence-Number: 10035 How do you create a temporary view that has only a small subset of the data from the DB init? (Links to docs are fine - I can read ;). My query isn't all that complex, and my number of records might be from 10 to 2k depending on how I implement it. Alex Turner NetEconomist On Thu, 20 Jan 2005 12:00:06 -0500, Merlin Moncure wrote: > > I am also very interesting in this very question.. Is there any way to > > declare a persistant cursor that remains open between pg sessions? > > This would be better than a temp table because you would not have to > > do the initial select and insert into a fresh table and incur those IO > > costs, which are often very heavy, and the reason why one would want > > to use a cursor. > > Yes, it's called a 'view' :-) > > Everything you can do with cursors you can do with a view, including > selecting records in blocks in a reasonably efficient way. As long as > your # records fetched is not real small (> 10) and your query is not > super complex, you can slide your view just like a cursor with zero real > impact on performance. > > If the query in question does not scale in time complexity with the > amount of data returned (there is a fix processing step which can't be > avoided), then it's materialized view time, such that they can be done > in PostgreSQL. > > Now, cursors can be passed around in pl/pgsql functions which makes them > very useful in that context. However, for normal data processing via > queries, they have some limitations that makes them hard to use in a > general sense. > > Merlin > > From pgsql-performance-owner@postgresql.org Thu Jan 20 21:38:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 816BF3A492D for ; Thu, 20 Jan 2005 21:38: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 83296-02 for ; Thu, 20 Jan 2005 21:38:25 +0000 (GMT) Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) by svr1.postgresql.org (Postfix) with SMTP id CB8123A484C for ; Thu, 20 Jan 2005 21:38:25 +0000 (GMT) Received: (qmail 28920 invoked from network); 20 Jan 2005 21:38:21 -0000 Received: from unknown (HELO wizzard.pws.com.au) (russell@pws.com.au@138.217.55.142) by mail.pws.com.au with SMTP; 20 Jan 2005 21:38:21 -0000 From: Russell Smith To: "Dan Langille" Subject: Re: index scan of whole table, can't see why Date: Fri, 21 Jan 2005 08:38:19 +1100 User-Agent: KMail/1.7 Cc: Stephan Szabo , pgsql-performance@postgresql.org References: <41EF7C85.4180.D46F54D@localhost> <41EF8994.24822.D79F9C9@localhost> In-Reply-To: <41EF8994.24822.D79F9C9@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501210838.19638.mr-russ@pws.com.au> 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: 200501/346 X-Sequence-Number: 10036 On Fri, 21 Jan 2005 02:36 am, Dan Langille wrote: > On 20 Jan 2005 at 7:26, Stephan Szabo wrote: [snip] > > Honestly I expected it to be slower (which it was), but I figured it's > > worth seeing what alternate plans it'll generate (specifically to see how > > it cost a nested loop on that join to compare to the fast plan). > > Unfortunately, it generated a merge join, so I think it might require both > > enable_hashjoin=false and enable_mergejoin=false to get it which is likely > > to be even slower in practice but still may be useful to see. > > Setting both to false gives a dramatic performance boost. See > http://rafb.net/paste/results/b70KAi42.html > -> Materialize (cost=15288.70..15316.36 rows=2766 width=35) (actual time=0.004..0.596 rows=135 loops=92) -> Nested Loop (cost=0.00..15288.70 rows=2766 width=35) (actual time=0.060..9.130 rows=135 loops=1) The Planner here has a quite inaccurate guess at the number of rows that will match in the join. An alternative to turning off join types is to up the statistics on the Element columns because that's where the join is happening. Hopefully the planner will get a better idea. However it may not be able too. 2766 rows vs 135 is quite likely to choose different plans. As you can see you have had to turn off two join types to give something you wanted/expected. > This gives suitable speed, but why does the plan vary so much with > such a minor change in the WHERE clause? Plan 1 - broken -> Nested Loop (cost=0.00..3825.30 rows=495 width=35) (actual time=0.056..16.161 rows=218 loops=1) Plan 2 - deprecated -> Hash Join (cost=3676.78..10144.06 rows=2767 width=35) (actual time=7.638..1158.128 rows=135 loops=1) The performance difference is when the where is changed, you have a totally different set of selection options. The Plan 1 and Plan 2 shown from your paste earlier, report that you are out by a factor of 2 for plan 1. But for plan 2 its a factor of 20. The planner is likely to make the wrong choice when the stats are out by that factor. Beware what is a small "typing" change does not mean they queries are anything alight. Regards Russell Smith. From pgsql-performance-owner@postgresql.org Thu Jan 20 21:39:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6AE3B3A492D for ; Thu, 20 Jan 2005 21:39: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 83236-03 for ; Thu, 20 Jan 2005 21:39:07 +0000 (GMT) Received: from asia.telenet-ops.be (asia.telenet-ops.be [195.130.132.59]) by svr1.postgresql.org (Postfix) with ESMTP id 553EF3A4885 for ; Thu, 20 Jan 2005 21:39:06 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by asia.telenet-ops.be (Postfix) with SMTP id 80E0022432C for ; Thu, 20 Jan 2005 22:39:05 +0100 (MET) Received: from Bolletje (d54C2921B.access.telenet.be [84.194.146.27]) by asia.telenet-ops.be (Postfix) with ESMTP id 59ACC2240CC for ; Thu, 20 Jan 2005 22:39:05 +0100 (MET) Reply-To: From: "Matt Casters" To: Subject: Re: Date: Thu, 20 Jan 2005 22:39:02 +0100 Organization: i-Bridge bvba MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcT/LlVsdYAmWf/tRI+w2yMjbHk5aQACbhzQ In-Reply-To: <41F013EB.9060105@commandprompt.com> Message-Id: <20050120213905.59ACC2240CC@asia.telenet-ops.be> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.957 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, SUBJ_ALL_CAPS X-Spam-Level: * X-Archive-Number: 200501/347 X-Sequence-Number: 10037 Joshua, Actually that's a great idea! I'll have to check if Solaris wants to play ball though. We'll have to see as we don't have the new disks yet, ETA is next week. Cheers, Matt -----Oorspronkelijk bericht----- Van: Joshua D. Drake [mailto:jd@commandprompt.com] Verzonden: donderdag 20 januari 2005 21:26 Aan: matt.casters@advalvas.be CC: pgsql-performance@postgresql.org Onderwerp: Re: [PERFORM] Matt Casters wrote: > > Thanks Stephen, > > My main concern is to get as much read performance on the disks as > possible on this given system. CPU is rarely a problem on a typical > data warehouse system, this one's not any different. > > We basically have 2 RAID5 disk sets (300Gb) and 150Gb) with a third > one coming along.(around 350Gb) Why not run two raid systems. A RAID 1 for your OS and a RAID 10 for your database? Push all of your extra drives into the RAID 10. Sincerely, Joshua D. Drake > I was kind of hoping that the new PGSQL tablespaces would allow me to > create a storage container spanning multiple file-systems, but > unfortunately, that seems to be not the case. Is this correct? > > That tells me that I probably need to do a full reconfiguration of the > disks on the Solaris level to get maximum performance out of the system. > Mmmm. This is going to be a though one to crack. Perhaps it will be > possible to get some extra juice out of placing the indexes on the > smaller disks (150G) and the data on the bigger ones? > > Thanks! > > Matt > > -----Oorspronkelijk bericht----- > Van: Stephen Frost [mailto:sfrost@snowman.net] > Verzonden: donderdag 20 januari 2005 15:26 > Aan: Matt Casters > CC: pgsql-performance@postgresql.org > Onderwerp: Re: [PERFORM] > > * Matt Casters (Matt.Casters@advalvas.be) wrote: > >>I have the go ahead of a customer to do some testing on Postgresql in >>a couple of weeks as a replacement for Oracle. >>The reason for the test is that the number of users of the warehouse >>is going to increase and this will have a serious impact on licencing >>costs. (I bet that sounds familiar) > > > Rather familiar, yes... :) > > >>We're running a medium sized data warehouse on a Solaris box (4CPU, >>8Gb > > RAM) on Oracle. > >>Basically we have 2 large fact tables to deal with: one going for 400M >>rows, the other will be hitting 1B rows soon. >>(around 250Gb of data) > > > Quite a bit of data. There's one big thing to note here I think- > Postgres will not take advantage of multiple CPUs for a given query, Oracle will. > So, it depends on your workload as to how that may impact you. > Situations where this will be unlikely to affect you: > > Your main bottle-neck is IO/disk and not CPU. > You run multiple queries in parallel frequently. > There are other processes on the system which chew up CPU time anyway. > > Situations where you're likely to be affected would be: > > You periodically run one big query. > You run a set of queries in sequential order. > > >>My questions to the list are: has this sort of thing been attempted >>before? If so, what where the performance results compared to Oracle? > > > I'm pretty sure it's been attempted before but unfortunately I don't > have any numbers on it myself. My data sets aren't that large (couple > million > rows) but I've found PostgreSQL at least as fast as Oracle for what we > do, and much easier to work with. > > >>I've been reading up on partitioned tabes on pgsql, will the >>performance benefit will be comparable to Oracle partitioned tables? > > > In this case I would think so, except that PostgreSQL still won't use > multiple CPUs for a given query, even against partitioned tables, aiui. > > >>What are the gotchas? > > > See above? :) Other issues are things having to do w/ your specific > SQL- Oracle's old join syntax isn't supported by PostgreSQL (what is > it, something like select x,y from a,b where x=%y; to do a right-join, iirc). > > >>Should I be testing on 8 or the 7 version? > > > Now that 8.0 is out I'd say probably test with that and just watch for > 8.0.x releases before you go production, if you have time before you > have to go into production with the new solution (sounds like you do- > changing databases takes time anyway). > > >>Thanks in advance for any help you may have, I'll do my best to keep >>pgsql-performance up to date on the results. > > > Hope that helps. Others on here will correct me if I misspoke. :) > > Stephen > > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Command Prompt, Inc., your source for PostgreSQL replication, professional support, programming, managed services, shared and dedicated hosting. Home of the Open Source Projects plPHP, plPerlNG, pgManage, and pgPHPtoolkit. Contact us now at: +1-503-667-4564 - http://www.commandprompt.com From pgsql-performance-owner@postgresql.org Thu Jan 20 21:40:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2843F3A2D3A for ; Thu, 20 Jan 2005 21: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 83236-04 for ; Thu, 20 Jan 2005 21:40:16 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 51DCE3A4945 for ; Thu, 20 Jan 2005 21:40:16 +0000 (GMT) Received: (qmail 26858 invoked from network); 20 Jan 2005 21:40:15 -0000 Received: from 218-101-14-86.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.86) by 0 with SMTP; 20 Jan 2005 21:40:15 -0000 Message-ID: <41F02629.3040305@coretech.co.nz> Date: Fri, 21 Jan 2005 10:44:09 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matt.Casters@advalvas.be Cc: pgsql-performance@postgresql.org Subject: Re: References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> In-Reply-To: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> 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: 200501/348 X-Sequence-Number: 10038 Matt Casters wrote: > Hi, > > My questions to the list are: has this sort of thing been attempted before? If so, what where the > performance results compared to Oracle? > I've been reading up on partitioned tabes on pgsql, will the performance benefit will be > comparable to Oracle partitioned tables? > What are the gotchas? > Should I be testing on 8 or the 7 version? > While I didn't find any documents immediately, are there any fine manuals to read on data > warehouse performance tuning on PostgreSQL? > Some of the previous postings on this list discuss various methods for doing partitioning (UNION and INHERIT), as well as the use of partial indexes - see the thread titled : 'Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables'. Unfortunately none of these work well for a standard 'star' because : i) all conditions are on the dimension tables, and ii) the optimizer can eliminate 'partition' tables only on the basis of *constant* conditions, and the resulting implied restrictions caused by the join to the dimension table(s) are not usable for this. So I think to get it to work well some violence to your 'star' may be required (e.g. adding constant columns to 'fact' tables to aid the optimizer, plus rewriting queries to include conditions on the added columns). One other gotcha is that Pg cannot do index only access, which can hurt. However it may be possibly to get good performance using CLUSTER on the fact tables (or just loading them in a desirable order) plus using partial indexes. regards Mark From pgsql-performance-owner@postgresql.org Fri Jan 21 04:57:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 24B143A1CF7 for ; Thu, 20 Jan 2005 21:45: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 83735-05 for ; Thu, 20 Jan 2005 21:45:43 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id AF53C3A41A6 for ; Thu, 20 Jan 2005 21:45:44 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 94275319C2; Thu, 20 Jan 2005 22:45:44 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Thu, 20 Jan 2005 21:45:39 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 23 Message-ID: References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/371 X-Sequence-Number: 10061 "Ron Mayer " wrote in pgsql.performance: > Randolf Richardson wrote: > >>> While this doesn't exactly answer your question, I use this little >>> tidbit of information when "selling" people on PostgreSQL. >>> PostgreSQL was chosen over Oracle as the database to handle all of >>> the .org TLDs information. ... >> >> Do you have a link for that information? I've told a few >> people about >> this and one PostgreSQL advocate (thanks to me -- they were going to be >> a Microsoft shop before that) is asking. > > Of course you could read their application when they were competing > with a bunch of other companies using databases from different vendors. > > I believe this is the link to their response to the database > questions... > > http://www.icann.org/tlds/org/questions-to-applicants-13.htm#Response13Th > eInternetSocietyISOC That's perfect. Thanks! From pgsql-performance-owner@postgresql.org Thu Jan 20 21:44:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1B6E03A484C for ; Thu, 20 Jan 2005 21:44: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 83324-08 for ; Thu, 20 Jan 2005 21:44:20 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2F1D43A4269 for ; Thu, 20 Jan 2005 21:44:21 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id D835A319C2; Thu, 20 Jan 2005 22:44:21 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 13:46:06 -0800 Organization: Hub.Org Networking Services Lines: 30 Message-ID: <41F0269E.3040406@cheapcomplexdevices.com> References: <6EE64EF3AB31D5448D0007DD34EEB3412A75C9@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Merlin Moncure User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75C9@Herge.rcsinc.local> 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: 200501/349 X-Sequence-Number: 10039 Merlin Moncure wrote: > ...You need to build a bigger, faster box with lots of storage... > Clustering ... > B: will cost you more, not less Is this still true when you get to 5-way or 17-way systems? My (somewhat outdated) impression is that up to about 4-way systems they're price competitive; but beyond that, I thought multiple cheap servers scales much more afordably than large servers. Certainly at the point of a 129-CPU system I bet you're better off with a network of cheap servers. > A: a headache Agreed if you mean clustering as-in making it look like one single database to the end user. However in my experience a few years ago, if you can partition the data in a way managed by the application, it'll not only be less of a headache, but probably provide a more flexable solution. Currently I'm working on a pretty big GIS database, that we're looking to partition our data in a manner similar to the microsoft whitepaper on scaling terraserver that can be found here: http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2002-53 I think this paper is a very nice analysis of many aspects of larger-server&SAN vs. application-partitioned-clusters, including looking at cost, reliability, managability, etc. After reading that paper, we started very seriously looking into application-level partitioning. From pgsql-performance-owner@postgresql.org Thu Jan 20 21:48:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AFC1E3A4269 for ; Thu, 20 Jan 2005 21:48: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 83735-06 for ; Thu, 20 Jan 2005 21:48:06 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4382F3A2D3A for ; Thu, 20 Jan 2005 21:48:08 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 253A8319C2; Thu, 20 Jan 2005 22:48:08 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 13:49:53 -0800 Organization: Hub.Org Networking Services Lines: 16 Message-ID: <41F02781.4080309@cheapcomplexdevices.com> References: <6EE64EF3AB31D5448D0007DD34EEB3412A75C9@Herge.rcsinc.local> <41F0269E.3040406@cheapcomplexdevices.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org Cc: Merlin Moncure To: Ron Mayer User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <41F0269E.3040406@cheapcomplexdevices.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: 200501/350 X-Sequence-Number: 10040 Ron Mayer wrote: > http://research.microsoft.com/research/pubs/view.aspx?msr_tr_id=MSR-TR-2002-53 Wrong link... http://research.microsoft.com/research/pubs/view.aspx?type=Technical%20Report&id=812 This is the one that discusses scalability, price, performance, failover, power consumption, hardware components, etc. Bottom line was that the large server with SAN had $1877K hardware costs while the application-partitioned cluster had $110K hardware costs -- but it's apples-to-oranges since they were deployed in different years. Still a big advantage for the small systems. From pgsql-performance-owner@postgresql.org Thu Jan 20 23:38:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7ED673A492D for ; Thu, 20 Jan 2005 23:38: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 93494-01 for ; Thu, 20 Jan 2005 23:37:59 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id F19D83A4811 for ; Thu, 20 Jan 2005 23:38:01 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 7B87C319C2; Fri, 21 Jan 2005 00:38:01 +0100 (MET) From: Ron Mayer X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Thu, 20 Jan 2005 15:39:46 -0800 Organization: Hub.Org Networking Services Lines: 9 Message-ID: <41F04142.7080705@cheapcomplexdevices.com> References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Randolf Richardson User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: 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: 200501/351 X-Sequence-Number: 10041 I sometimes also think it's fun to point out that Postgresql bigger companies supporting it's software - like this one: http://www.fastware.com.au/docs/FujitsuSupportedPostgreSQLWhitePaper.pdf with $43 billion revenue -- instead of those little companies like Mysql AB or Oracle. :) From pgsql-performance-owner@postgresql.org Fri Jan 21 00:00:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F410C3A4811 for ; Fri, 21 Jan 2005 00:00: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 13232-04 for ; Fri, 21 Jan 2005 00:00:20 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 150253A1CF7 for ; Fri, 21 Jan 2005 00:00:21 +0000 (GMT) Received: (qmail 15553 invoked by uid 500); 21 Jan 2005 00:14:27 -0000 Date: Thu, 20 Jan 2005 18:14:27 -0600 From: Bruno Wolff III To: alex@neteconomist.com Cc: Matt Casters , pgsql-performance@postgresql.org Subject: Re: Message-ID: <20050121001427.GA10806@wolff.to> Mail-Followup-To: alex@neteconomist.com, Matt Casters , pgsql-performance@postgresql.org References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> <33c6269f050120083177fa0e83@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33c6269f050120083177fa0e83@mail.gmail.com> 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: 200501/352 X-Sequence-Number: 10042 On Thu, Jan 20, 2005 at 11:31:29 -0500, Alex Turner wrote: > I am curious - I wasn't aware that postgresql supported partitioned tables, > Could someone point me to the docs on this. Some people have been doing it using a union view. There isn't actually a partition feature. From pgsql-performance-owner@postgresql.org Fri Jan 21 00:12:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 363993A49AA for ; Fri, 21 Jan 2005 00:12: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 14417-07 for ; Fri, 21 Jan 2005 00:12:11 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 949E23A499F for ; Fri, 21 Jan 2005 00:12:13 +0000 (GMT) Received: (qmail 16620 invoked by uid 500); 21 Jan 2005 00:26:20 -0000 Date: Thu, 20 Jan 2005 18:26:20 -0600 From: Bruno Wolff III To: Bernd Heller Cc: pgsql-performance@postgresql.org Subject: Re: column without pg_stats entry?! Message-ID: <20050121002620.GB16417@wolff.to> Mail-Followup-To: Bernd Heller , pgsql-performance@postgresql.org References: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.433 tagged_above=0 required=5 tests=AWL, PLING_QUERY X-Spam-Level: X-Archive-Number: 200501/353 X-Sequence-Number: 10043 On Thu, Jan 20, 2005 at 11:14:28 +0100, Bernd Heller wrote: > > I wondered why the planner was making such bad assumptions about the > number of rows to find and had a look at pg_stats. and there was the > surprise: > there is no entry in pg_stats for that column at all!! I can only > suspect that this has to do with the column being all null. I tried to > change a few records to a not-null value, but re-ANALYZE didn't catch > them apparently. Someone else reported this recently and I think it is going to be fixed. > Is this desired behaviour for analyze? Can I change it somehow? If not, > is there a better way to accomplish what I'm trying? I'm not to keen on > disabling seqscan for that query explicitly. It's a simple enough query > and the planner should be able to find the right plan without help - > and I'm sure it would if it had stats about it. In the short run you could add an IS NOT NULL clause to your query. The optimizer doesn't know that < being TRUE implies IS NOT NULL and so the partial index won't be used unless you add that clause explicitly. From pgsql-performance-owner@postgresql.org Fri Jan 21 00:42:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5A6333A49CA for ; Fri, 21 Jan 2005 00:39: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 44891-07 for ; Fri, 21 Jan 2005 00:39:17 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.202]) by svr1.postgresql.org (Postfix) with ESMTP id 8B3A03A4A04 for ; Fri, 21 Jan 2005 00:38:59 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id i8so26242rne for ; Thu, 20 Jan 2005 16:38:59 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:cc:subject:date:organization:message-id:mime-version:content-type:content-transfer-encoding:x-priority:x-msmail-priority:x-mailer:importance:in-reply-to:x-mimeole; b=sqBKXXaRNes7qMLx8RNAGNEqiWQYi7HymGkA9ZJbl7uleoVW/pGwkqTqaLqfTnwdpnRcO0F593gMa9jvzDqWZh81zp0YRMVzp9JFGI17fGjS9OcURmEoz/pG2JGoJJEGsWjimx3eGPkco3azrLjv/4A+WYqFLb8OZmX6HEXgO5Q= Received: by 10.38.15.14 with SMTP id 14mr88410rno; Thu, 20 Jan 2005 16:38:59 -0800 (PST) Received: from sbew318anc22 ([200.184.93.96]) by smtp.gmail.com with ESMTP id 71sm3699rnb.2005.01.20.16.38.58; Thu, 20 Jan 2005 16:38:59 -0800 (PST) From: "Bruno Almeida do Lago" To: "'Mitch Pirtle'" Cc: Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 22:40:02 -0200 Organization: G&P Message-ID: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> 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 Importance: Normal In-Reply-To: <330532b6050120104246597d2a@mail.gmail.com> 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.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/354 X-Sequence-Number: 10044 =20 I was thinking the same! I'd like to know how other databases such as = Oracle do it. -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Mitch = Pirtle Sent: Thursday, January 20, 2005 4:42 PM To: pgsql-performance@postgresql.org Subject: Re: [PERFORM] PostgreSQL clustering VS MySQL clustering On Thu, 20 Jan 2005 09:33:42 -0800, Darcy Buskermolen wrote: >=20 > Another Option to consider would be pgmemcache. that way you just = build the > farm out of lots of large memory, diskless boxes for keeping the whole > database in memory in the whole cluster. More information on it can = be found > at: http://people.freebsd.org/~seanc/pgmemcache/ Which brings up another question: why not just cluster at the hardware layer? Get an external fiberchannel array, and cluster a bunch of dual Opterons, all sharing that storage. In that sense you would be getting one big PostgreSQL 'image' running across all of the servers. Or is that idea too 90's? ;-) -- Mitch ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org From pgsql-performance-owner@postgresql.org Fri Jan 21 00:53:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF3653A49AA for ; Fri, 21 Jan 2005 00:53: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 45076-09 for ; Fri, 21 Jan 2005 00:53:17 +0000 (GMT) Received: from bast.unixathome.org (bast.unixathome.org [66.11.174.150]) by svr1.postgresql.org (Postfix) with ESMTP id 38FC23A498B for ; Fri, 21 Jan 2005 00:53:19 +0000 (GMT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 64E253D37; Thu, 20 Jan 2005 19:53:18 -0500 (EST) From: "Dan Langille" To: Russell Smith Date: Thu, 20 Jan 2005 19:55:20 -0500 MIME-Version: 1.0 Subject: Re: index scan of whole table, can't see why Cc: Stephan Szabo , pgsql-performance@postgresql.org Message-ID: <41F00CA8.8976.F79FE91@localhost> In-reply-to: <200501210838.19638.mr-russ@pws.com.au> References: <41EF8994.24822.D79F9C9@localhost> X-mailer: Pegasus Mail for Windows (4.21c) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body 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: 200501/355 X-Sequence-Number: 10045 On 21 Jan 2005 at 8:38, Russell Smith wrote: > On Fri, 21 Jan 2005 02:36 am, Dan Langille wrote: > > On 20 Jan 2005 at 7:26, Stephan Szabo wrote: > > [snip] > > > Honestly I expected it to be slower (which it was), but I figured > > > it's worth seeing what alternate plans it'll generate > > > (specifically to see how it cost a nested loop on that join to > > > compare to the fast plan). Unfortunately, it generated a merge > > > join, so I think it might require both enable_hashjoin=false and > > > enable_mergejoin=false to get it which is likely to be even slower > > > in practice but still may be useful to see. > > > > Setting both to false gives a dramatic performance boost. See > > http://rafb.net/paste/results/b70KAi42.html > > > -> Materialize (cost=15288.70..15316.36 rows=2766 width=35) > (actual time=0.004..0.596 rows=135 loops=92) > -> Nested Loop (cost=0.00..15288.70 rows=2766 > width=35) (actual time=0.060..9.130 rows=135 loops=1) > > The Planner here has a quite inaccurate guess at the number of rows > that will match in the join. An alternative to turning off join types > is to up the statistics on the Element columns because that's where > the join is happening. Hopefully the planner will get a better idea. > However it may not be able too. 2766 rows vs 135 is quite likely to > choose different plans. As you can see you have had to turn off two > join types to give something you wanted/expected. Fair comment. However, the statistics on ports.element_id, ports.deprecated, ports.broken, and element.id are both set to 1000. > > This gives suitable speed, but why does the plan vary so much with > > such a minor change in the WHERE clause? > Plan 1 - broken > -> Nested Loop (cost=0.00..3825.30 rows=495 width=35) (actual > time=0.056..16.161 rows=218 loops=1) > > Plan 2 - deprecated > -> Hash Join (cost=3676.78..10144.06 rows=2767 width=35) > (actual time=7.638..1158.128 rows=135 loops=1) > > The performance difference is when the where is changed, you have a > totally different set of selection options. The Plan 1 and Plan 2 > shown from your paste earlier, report that you are out by a factor of > 2 for plan 1. But for plan 2 its a factor of 20. The planner is > likely to make the wrong choice when the stats are out by that factor. > > Beware what is a small "typing" change does not mean they queries are > anything alight. Agreed. I just did not expect such a dramatic change which a result set that is similar. Actually, they aren't that similar at all. Thank you. -- Dan Langille : http://www.langille.org/ BSDCan - The Technical BSD Conference - http://www.bsdcan.org/ From pgsql-performance-owner@postgresql.org Fri Jan 21 04:56:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A4C93A49AF for ; Fri, 21 Jan 2005 01:03: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 39847-07 for ; Fri, 21 Jan 2005 01:02:50 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 65A323A487F for ; Fri, 21 Jan 2005 01:02:52 +0000 (GMT) Received: (qmail 30713 invoked from network); 21 Jan 2005 01:02:16 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.36?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 21 Jan 2005 01:02:16 -0000 Message-ID: <41F05513.6040808@fastcrypt.com> Date: Thu, 20 Jan 2005 20:04:19 -0500 From: Dave Cramer User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruno Almeida do Lago Cc: 'Mitch Pirtle' , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> In-Reply-To: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> Content-Type: multipart/alternative; boundary="------------010200020507040709090003" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.066 tagged_above=0 required=5 tests=AWL, HTML_40_50, HTML_MESSAGE, HTML_TITLE_EMPTY X-Spam-Level: X-Archive-Number: 200501/370 X-Sequence-Number: 10060 This is a multi-part message in MIME format. --------------010200020507040709090003 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit This idea won't work with postgresql only one instance can operate on a datastore at a time. Dave Bruno Almeida do Lago wrote: > >I was thinking the same! I'd like to know how other databases such as Oracle >do it. > >-----Original Message----- >From: pgsql-performance-owner@postgresql.org >[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Mitch Pirtle >Sent: Thursday, January 20, 2005 4:42 PM >To: pgsql-performance@postgresql.org >Subject: Re: [PERFORM] PostgreSQL clustering VS MySQL clustering > >On Thu, 20 Jan 2005 09:33:42 -0800, Darcy Buskermolen > wrote: > > >>Another Option to consider would be pgmemcache. that way you just build >> >> >the > > >>farm out of lots of large memory, diskless boxes for keeping the whole >>database in memory in the whole cluster. More information on it can be >> >> >found > > >>at: http://people.freebsd.org/~seanc/pgmemcache/ >> >> > >Which brings up another question: why not just cluster at the hardware >layer? Get an external fiberchannel array, and cluster a bunch of dual >Opterons, all sharing that storage. In that sense you would be getting >one big PostgreSQL 'image' running across all of the servers. > >Or is that idea too 90's? ;-) > >-- Mitch > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > >---------------------------(end of broadcast)--------------------------- >TIP 7: don't forget to increase your free space map settings > > > > --------------010200020507040709090003 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit This idea won't work with postgresql only one instance can operate on a datastore at a time.

Dave

Bruno Almeida do Lago wrote:
 
I was thinking the same! I'd like to know how other databases such as Oracle
do it.

-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Mitch Pirtle
Sent: Thursday, January 20, 2005 4:42 PM
To: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] PostgreSQL clustering VS MySQL clustering

On Thu, 20 Jan 2005 09:33:42 -0800, Darcy Buskermolen
<darcy@wavefire.com> wrote:
  
Another Option to consider would be pgmemcache.  that way you just build
    
the
  
farm out of lots of large memory, diskless boxes for keeping the whole
database in memory in the whole cluster.  More information on it can be
    
found
  
at: http://people.freebsd.org/~seanc/pgmemcache/
    

Which brings up another question: why not just cluster at the hardware
layer? Get an external fiberchannel array, and cluster a bunch of dual
Opterons, all sharing that storage. In that sense you would be getting
one big PostgreSQL 'image' running across all of the servers.

Or is that idea too 90's?  ;-)

-- Mitch

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


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


  
--------------010200020507040709090003-- From pgsql-performance-owner@postgresql.org Fri Jan 21 01:22:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5B4E93A3D24 for ; Fri, 21 Jan 2005 01:21: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 59625-07 for ; Fri, 21 Jan 2005 01:21:45 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 76C333A49FB for ; Fri, 21 Jan 2005 01:21:47 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6931990; Thu, 20 Jan 2005 17:23:29 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Bruno Almeida do Lago" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 17:25:41 -0800 User-Agent: KMail/1.7.1 Cc: "'Mitch Pirtle'" , pgsql-performance@postgresql.org References: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> In-Reply-To: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501201725.41528.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/356 X-Sequence-Number: 10046 Bruno, > Which brings up another question: why not just cluster at the hardware > layer? Get an external fiberchannel array, and cluster a bunch of dual > Opterons, all sharing that storage. In that sense you would be getting > one big PostgreSQL 'image' running across all of the servers. > > Or is that idea too 90's? ;-) No, it just doesn't work. Multiple postmasters can't share one database. LinuxLabs (as I've gathered) tried to go one better by using a tool that allows shared memory to bridge multple networked servers -- in other words, one postmaster controlling 4 or 5 servers. The problem is that IPC via this method is about 1,000 times slower than IPC on a single machine, wiping out all of the scalability gains from having the cluster in the first place. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 21 01:33:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0514C3A49F2 for ; Fri, 21 Jan 2005 01:30: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 61062-03 for ; Fri, 21 Jan 2005 01:30:39 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 02E613A49A6 for ; Fri, 21 Jan 2005 01:30:41 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 079151C8F3; Thu, 20 Jan 2005 19:30:40 -0600 (CST) Date: Thu, 20 Jan 2005 19:30:40 -0600 From: "Jim C. Nasby" To: Bruno Almeida do Lago Cc: 'Mitch Pirtle' , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050121013040.GK67721@decibel.org> References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> 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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/358 X-Sequence-Number: 10048 On Thu, Jan 20, 2005 at 10:40:02PM -0200, Bruno Almeida do Lago wrote: > > I was thinking the same! I'd like to know how other databases such as Oracle > do it. > In a nutshell, in a clustered environment (which iirc in oracle means shared disks), they use a set of files for locking and consistency across machines. So you better have fast access to the drive array, and the array better have caching of some kind. -- 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 Jan 21 01:32:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49D783A4A0F for ; Fri, 21 Jan 2005 01:32: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 60843-06 for ; Fri, 21 Jan 2005 01:32:02 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 263363A4A07 for ; Fri, 21 Jan 2005 01:32:04 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id C400F1C8F3; Thu, 20 Jan 2005 19:32:04 -0600 (CST) Date: Thu, 20 Jan 2005 19:32:04 -0600 From: "Jim C. Nasby" To: Christopher Kings-Lynne , Herv? Piedvache , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050121013204.GL67721@decibel.org> References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <41EFC26A.4070605@familyhealth.com.au> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <20050120150847.GQ10437@ns.snowman.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050120150847.GQ10437@ns.snowman.net> 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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/357 X-Sequence-Number: 10047 On Thu, Jan 20, 2005 at 10:08:47AM -0500, Stephen Frost wrote: > * Christopher Kings-Lynne (chriskl@familyhealth.com.au) wrote: > > PostgreSQL has replication, but not partitioning (which is what you want). > > It doesn't have multi-server partitioning.. It's got partitioning > within a single server (doesn't it? I thought it did, I know it was > discussed w/ the guy from Cox Communications and I thought he was using > it :). No, PostgreSQL doesn't support any kind of partitioning, unless you write it yourself. I think there's some work being done in this area, though. -- 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 Jan 21 01:40:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 41AFB3A49C8 for ; Fri, 21 Jan 2005 01:39: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 79073-01 for ; Fri, 21 Jan 2005 01:39:19 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 8C7BB3A4944 for ; Fri, 21 Jan 2005 01:39:22 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 4D7891C8F3; Thu, 20 Jan 2005 19:39:22 -0600 (CST) Date: Thu, 20 Jan 2005 19:39:22 -0600 From: "Jim C. Nasby" To: "Joshua D. Drake" Cc: Herv? Piedvache , Christopher Kings-Lynne , Jeff , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050121013922.GM67721@decibel.org> References: <200501201503.31241.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> <41EFC8B5.9040902@commandprompt.com> <200501201607.51659.herve@elma.fr> <41EFCA6A.1080802@commandprompt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41EFCA6A.1080802@commandprompt.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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/360 X-Sequence-Number: 10050 On Thu, Jan 20, 2005 at 07:12:42AM -0800, Joshua D. Drake wrote: > > >>then I was thinking. Couldn't he use > >>multiple databases > >>over multiple servers with dblink? > >> > >>It is not exactly how I would want to do it, but it would provide what > >>he needs I think??? > >> > >> > > > >Yes seems to be the only solution ... but I'm a little disapointed about > >this ... could you explain me why there is not this kind of > >functionnality ... it seems to be a real need for big applications no ? > > > > > Because it is really, really hard to do correctly and hard > equals expensive. To expand on what Josh said, the expense in this case is development resources. If you look on the developer site you'll see a huge TODO list and a relatively small list of PostgreSQL developers. To develop a cluster solution similar to RAC would probably take the efforts of the entire development team for a year or more, during which time very little else would be done. I'm glad to see your persistance in wanting to use PostgreSQL, and there might be some kind of limited clustering scheme that could be implemented without a great amount of effort by the core developers. In that case I think there's a good chance you could find people willing to work on it. -- 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 Jan 21 01:39:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8FF2D3A49AC for ; Fri, 21 Jan 2005 01:39: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 65267-05 for ; Fri, 21 Jan 2005 01:39:16 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5F55C3A494E for ; Fri, 21 Jan 2005 01:39:16 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id 20CA4629CD; Fri, 21 Jan 2005 10:38:57 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id EAA9410CD06; Fri, 21 Jan 2005 10:38:56 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id CAE4110CD04; Fri, 21 Jan 2005 10:38:56 +0900 (JST) Received: from localhost (IDENT:t-ishii@portsv2-100.sra.co.jp [133.137.8.100]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id KAA21508; Fri, 21 Jan 2005 10:38:52 +0900 Date: Fri, 21 Jan 2005 10:40:07 +0900 (JST) Message-Id: <20050121.104007.74755729.t-ishii@sra.co.jp> To: darcy@wavefire.com Cc: jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <200501200929.37228.darcy@wavefire.com> References: <20050120144416.GO10437@ns.snowman.net> <41EFC514.9090806@commandprompt.com> <200501200929.37228.darcy@wavefire.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/359 X-Sequence-Number: 10049 > On January 20, 2005 06:49 am, Joshua D. Drake wrote: > > Stephen Frost wrote: > > >* Herv? Piedvache (herve@elma.fr) wrote: > > >>Le Jeudi 20 Janvier 2005 15:30, Stephen Frost a =E9crit : > > >>>* Herv? Piedvache (herve@elma.fr) wrote: > > >>>>Is there any solution with PostgreSQL matching these needs ... = ? > > >>> > > >>>You might look into pg_pool. Another possibility would be slony= , though > > >>>I'm not sure it's to the point you need it at yet, depends on if= you can > > >>>handle some delay before an insert makes it to the slave select = systems. > > >> > > >>I think not ... pgpool or slony are replication solutions ... but= as I > > >> have said to Christopher Kings-Lynne how I'll manage the scalabi= lty of > > >> the database ? I'll need several servers able to load a database= growing > > >> and growing to get good speed performance ... > > > > > >They're both replication solutions, but they also help distribute = the > > >load. For example: > > > > > >pg_pool will distribute the select queries amoung the servers. Th= ey'll > > >all get the inserts, so that hurts, but at least the select querie= s are > > >distributed. > > > > > >slony is similar, but your application level does the load distrib= ution > > >of select statements instead of pg_pool. Your application needs t= o know > > >to send insert statements to the 'main' server, and select from th= e > > >others. > > > > You can put pgpool in front of replicator or slony to get load > > balancing for reads. > = > Last time I checked load ballanced reads was only available in pgpool= if you = > were using pgpools's internal replication. Has something changed rec= ently? Yes. However it would be pretty easy to modify pgpool so that it could cope with Slony-I. I.e. 1) pgpool does the load balance and sends query to Slony-I's slave and master if the query is SELECT. 2) pgpool sends query only to the master if the query is other than SELECT. Remaining problem is that Slony-I is not a sync replication solution. Thus you need to prepare that the load balanced query results might differ among servers. If there's enough demand, I would do such that enhancements to pgpool. -- Tatsuo Ishii > > >>>>Is there any other solution than a Cluster for our problem ? > > >>> > > >>>Bigger server, more CPUs/disks in one box. Try to partition up = your > > >>>data some way such that it can be spread across multiple machine= s, then > > >>>if you need to combine the data have it be replicated using slon= y to a > > >>>big box that has a view which joins all the tables and do your b= ig > > >>>queries against that. > > >> > > >>But I'll arrive to limitation of a box size quickly I thing a 4 > > >> processors with 64 Gb of RAM ... and after ? > > > > Opteron. > = > IBM Z-series, or other big iron. > = > > > > >Go to non-x86 hardware after if you're going to continue to increa= se the > > >size of the server. Personally I think your better bet might be t= o > > >figure out a way to partition up your data (isn't that what google= > > >does anyway?). > > > > > > Stephen > = > -- = > Darcy Buskermolen > Wavefire Technologies Corp. > ph: 250.717.0200 > fx: 250.763.1759 > http://www.wavefire.com > = > ---------------------------(end of broadcast)------------------------= --- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.= org > = From pgsql-performance-owner@postgresql.org Fri Jan 21 02:13:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2B9B43A4A23 for ; Fri, 21 Jan 2005 02:13: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 29135-07 for ; Fri, 21 Jan 2005 02:12:45 +0000 (GMT) Received: from millenium.mst.co.jp (millenium.mst.co.jp [210.251.240.193]) by svr1.postgresql.org (Postfix) with ESMTP id D57DF3A4A29 for ; Fri, 21 Jan 2005 02:12:42 +0000 (GMT) Received: from mst1x5r347kymb (lc12114 [192.168.1.114]) by millenium.mst.co.jp (8.11.6p2/3.7W) with SMTP id j0L2C2Q03804; Fri, 21 Jan 2005 11:12:02 +0900 Message-ID: <01a001c4ff5f$05688b50$7201a8c0@mst1x5r347kymb> From: "Iain" To: "Jim C. Nasby" , "Bruno Almeida do Lago" Cc: "'Mitch Pirtle'" , References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> <20050121013040.GK67721@decibel.org> Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 21 Jan 2005 11:14:59 +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: 200501/361 X-Sequence-Number: 10051 Oracle's RAC is good, but I think it's best to view it as a step in the high availability direction rather than a performance enhancer. While it can help your application scale up, that depends on the usage pattern. Also it's not 100% transparent to the application for example you can't depend on a sequence numbers being allocated uniquely as there can be delays propagating them to all nodes. So in clusters where insert rates are high this means you should explicitly check for unique key violations and try again. Dealing with propagation delays comes with the clustering technology I guess. Nonetheless, I would love to see this kind of functionality in postgres. Regards Iain ----- Original Message ----- From: "Jim C. Nasby" To: "Bruno Almeida do Lago" Cc: "'Mitch Pirtle'" ; Sent: Friday, January 21, 2005 10:30 AM Subject: Re: [PERFORM] PostgreSQL clustering VS MySQL clustering > On Thu, Jan 20, 2005 at 10:40:02PM -0200, Bruno Almeida do Lago wrote: >> >> I was thinking the same! I'd like to know how other databases such as >> Oracle >> do it. >> > In a nutshell, in a clustered environment (which iirc in oracle means > shared disks), they use a set of files for locking and consistency > across machines. So you better have fast access to the drive array, and > the array better have caching of some kind. > -- > 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?" > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly From pgsql-performance-owner@postgresql.org Fri Jan 21 03:16:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 88F0C3A427A for ; Fri, 21 Jan 2005 03:16: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 34487-09 for ; Fri, 21 Jan 2005 03:16:18 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 55D843A4A4B for ; Fri, 21 Jan 2005 03:16:22 +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 j0L3GAa8014244; Thu, 20 Jan 2005 19:16:10 -0800 Message-ID: <41F073FF.1080606@commandprompt.com> Date: Thu, 20 Jan 2005 19:16:15 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tatsuo Ishii Cc: darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <20050120144416.GO10437@ns.snowman.net> <41EFC514.9090806@commandprompt.com> <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> In-Reply-To: <20050121.104007.74755729.t-ishii@sra.co.jp> Content-Type: multipart/mixed; boundary="------------040406070509050303040404" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/362 X-Sequence-Number: 10052 This is a multi-part message in MIME format. --------------040406070509050303040404 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit >1) pgpool does the load balance and sends query to Slony-I's slave and > master if the query is SELECT. > >2) pgpool sends query only to the master if the query is other than > SELECT. > >Remaining problem is that Slony-I is not a sync replication >solution. Thus you need to prepare that the load balanced query >results might differ among servers. > >If there's enough demand, I would do such that enhancements to pgpool. > > Well I know that Replicator could also use this functionality. Sincerely, Joshua D. Drake >-- >Tatsuo Ishii > > > >>>>>>>Is there any other solution than a Cluster for our problem ? >>>>>>> >>>>>>> >>>>>>Bigger server, more CPUs/disks in one box. Try to partition up your >>>>>>data some way such that it can be spread across multiple machines, then >>>>>>if you need to combine the data have it be replicated using slony to a >>>>>>big box that has a view which joins all the tables and do your big >>>>>>queries against that. >>>>>> >>>>>> >>>>>But I'll arrive to limitation of a box size quickly I thing a 4 >>>>>processors with 64 Gb of RAM ... and after ? >>>>> >>>>> >>>Opteron. >>> >>> >>IBM Z-series, or other big iron. >> >> >> >>>>Go to non-x86 hardware after if you're going to continue to increase the >>>>size of the server. Personally I think your better bet might be to >>>>figure out a way to partition up your data (isn't that what google >>>>does anyway?). >>>> >>>> Stephen >>>> >>>> >>-- >>Darcy Buskermolen >>Wavefire Technologies Corp. >>ph: 250.717.0200 >>fx: 250.763.1759 >>http://www.wavefire.com >> >>---------------------------(end of broadcast)--------------------------- >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >> >> >> > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > -- 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 --------------040406070509050303040404 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 --------------040406070509050303040404-- From pgsql-performance-owner@postgresql.org Fri Jan 21 03:49:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2504F3A49E3 for ; Fri, 21 Jan 2005 03:49: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 38045-04 for ; Fri, 21 Jan 2005 03:49:37 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 282FB3A496B for ; Fri, 21 Jan 2005 03:49:38 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6932417; Thu, 20 Jan 2005 19:51:20 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Thu, 20 Jan 2005 19:49:24 -0800 User-Agent: KMail/1.6.2 Cc: Tatsuo Ishii , darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr References: <20050120144416.GO10437@ns.snowman.net> <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> In-Reply-To: <20050121.104007.74755729.t-ishii@sra.co.jp> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501201949.24292.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/363 X-Sequence-Number: 10053 Tatsuo, > Yes. However it would be pretty easy to modify pgpool so that it could > cope with Slony-I. I.e. > > 1) pgpool does the load balance and sends query to Slony-I's slave and > master if the query is SELECT. > > 2) pgpool sends query only to the master if the query is other than > SELECT. > > Remaining problem is that Slony-I is not a sync replication > solution. Thus you need to prepare that the load balanced query > results might differ among servers. Yes, please, some of us are already doing the above ad-hoc. The simple workaround to replication lag is to calculate the longest likely lag (<3 seconds if Slony is tuned right) and have the dispatcher (pgpool) send all requests from that connection to the master for that period. Then it switches back to "pool" mode where the slaves may be used. Of course, all of the above is only useful if you're doing a web app where 96% of query activity is selects. For additional scalability, put all of your session maintenance in memcached, so that you're not doing database writes every time a page loads. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 21 06:03:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9A5603A3B0E for ; Fri, 21 Jan 2005 06:03: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 55971-03 for ; Fri, 21 Jan 2005 06:03: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 22D7A3A4AC0 for ; Fri, 21 Jan 2005 06:03:00 +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 j0L62xUo012412; Fri, 21 Jan 2005 01:02:59 -0500 (EST) To: Bruno Wolff III Cc: Bernd Heller , pgsql-performance@postgresql.org Subject: Re: column without pg_stats entry?! In-reply-to: <20050121002620.GB16417@wolff.to> References: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net> <20050121002620.GB16417@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Thu, 20 Jan 2005 18:26:20 -0600" Date: Fri, 21 Jan 2005 01:02:59 -0500 Message-ID: <12411.1106287379@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.432 tagged_above=0 required=5 tests=AWL, PLING_QUERY X-Spam-Level: X-Archive-Number: 200501/372 X-Sequence-Number: 10062 Bruno Wolff III writes: > Bernd Heller wrote: >> there is no entry in pg_stats for that column at all!! I can only >> suspect that this has to do with the column being all null. > Someone else reported this recently and I think it is going to be fixed. Yeah, this was griped of a little bit ago, but I felt it was too close to 8.0 release to risk fooling with for this cycle. > In the short run you could add an IS NOT NULL clause to your query. > The optimizer doesn't know that < being TRUE implies IS NOT NULL and > so the partial index won't be used unless you add that clause explicitly. Actually, as of 8.0 the optimizer *does* know that. I'm a bit surprised that it didn't pick the partial index, since even without any analyze stats, the small physical size of the partial index should have clued it that there weren't many such tuples. Could we see EXPLAIN output for both cases (both settings of enable_seqscan)? regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 21 07:00:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 09C9C3A4B30 for ; Fri, 21 Jan 2005 07:00: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 60619-10 for ; Fri, 21 Jan 2005 07:00:19 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 015C33A4B17 for ; Fri, 21 Jan 2005 07:00: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 j0L703qZ012827; Fri, 21 Jan 2005 02:00:03 -0500 (EST) To: Randolf Richardson Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft In-reply-to: References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> Comments: In-reply-to Randolf Richardson message dated "Thu, 20 Jan 2005 21:45:39 +0000" Date: Fri, 21 Jan 2005 02:00:03 -0500 Message-ID: <12826.1106290803@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: 200501/373 X-Sequence-Number: 10063 Randolf Richardson writes: > "Ron Mayer " wrote in pgsql.performance: >> Randolf Richardson wrote: >>> While this doesn't exactly answer your question, I use this little >>> tidbit of information when "selling" people on PostgreSQL. >>> PostgreSQL was chosen over Oracle as the database to handle all of >>> the .org TLDs information. ... > > Do you have a link for that information? >> >> http://www.icann.org/tlds/org/questions-to-applicants-13.htm#Response13TheInternetSocietyISOC > That's perfect. Thanks! This is rather old news, actually, as Afilias (the outfit actually running the registry for ISOC) has been running the .info TLD on Postgres since 2001. They have the contract for the new .mobi TLD. And they are currently one of not many bidders to take over the .net registry when Verisign's contract expires this June. Now *that* will be a hard TLD to ignore ;-) I am actually sitting in a Toronto hotel room right now because I'm attending a meeting sponsored by Afilias for the purpose of initial design of the Slony-II replication system for Postgres (see Slony-I). According to the Afilias guys I've been having dinners with, they got absolutely zero flak about their use of Postgres in connection with the .mobi bid, after having endured very substantial bombardment (cf above link) --- and a concerted disinformation campaign by Oracle --- in connection with the .org and .info bids. As far as the ICANN community is concerned, this is established technology. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 21 08:06:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8DDDA3A2BB7 for ; Fri, 21 Jan 2005 08:06: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 71669-01 for ; Fri, 21 Jan 2005 08:06:24 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id BC8A83A18CF for ; Fri, 21 Jan 2005 08:06:23 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id 515C962D9A; Fri, 21 Jan 2005 17:06:14 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id 15DAE10CD06; Fri, 21 Jan 2005 17:06:14 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 96DE010CD04; Fri, 21 Jan 2005 17:06:13 +0900 (JST) Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id RAA18045; Fri, 21 Jan 2005 17:06:13 +0900 Date: Fri, 21 Jan 2005 17:07:31 +0900 (JST) Message-Id: <20050121.170731.08315885.t-ishii@sra.co.jp> To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org, darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <200501201949.24292.josh@agliodbs.com> References: <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> <200501201949.24292.josh@agliodbs.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/374 X-Sequence-Number: 10064 > Tatsuo, > > > Yes. However it would be pretty easy to modify pgpool so that it could > > cope with Slony-I. I.e. > > > > 1) pgpool does the load balance and sends query to Slony-I's slave and > > master if the query is SELECT. > > > > 2) pgpool sends query only to the master if the query is other than > > SELECT. > > > > Remaining problem is that Slony-I is not a sync replication > > solution. Thus you need to prepare that the load balanced query > > results might differ among servers. > > Yes, please, some of us are already doing the above ad-hoc. > > The simple workaround to replication lag is to calculate the longest likely > lag (<3 seconds if Slony is tuned right) and have the dispatcher (pgpool) > send all requests from that connection to the master for that period. Then > it switches back to "pool" mode where the slaves may be used. Can I ask a question? Suppose table A gets updated on the master at time 00:00. Until 00:03 pgpool needs to send all queries regarding A to the master only. My question is, how can pgpool know a query is related to A? -- Tatsuo Ishii > Of course, all of the above is only useful if you're doing a web app where 96% > of query activity is selects. For additional scalability, put all of your > session maintenance in memcached, so that you're not doing database writes > every time a page loads. > > -- > Josh Berkus > Aglio Database Solutions > San Francisco > From pgsql-performance-owner@postgresql.org Fri Jan 21 08:23:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D5173A44FF for ; Fri, 21 Jan 2005 08:23: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 74069-05 for ; Fri, 21 Jan 2005 08:23:42 +0000 (GMT) Received: from server272.com (server272.com [64.14.68.49]) by svr1.postgresql.org (Postfix) with SMTP id 330BA3A434A for ; Fri, 21 Jan 2005 08:23:42 +0000 (GMT) Received: (qmail 30622 invoked from network); 21 Jan 2005 08:23:40 -0000 Received: from unknown (HELO ?192.168.1.10?) (216.190.89.53) by server272.com with SMTP; 21 Jan 2005 08:23:40 -0000 Subject: inheritance performance From: ken To: pgsql-performance@postgresql.org Content-Type: text/plain Message-Id: <1106295545.6622.266.camel@pesky.s6portland> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 21 Jan 2005 00:19:05 -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: 200501/375 X-Sequence-Number: 10065 Wondering ... >From a performance standpoint, is it a bad idea to use inheritance simply as a tool for easy database building. That is for creating tables that share the same columns but otherwise are unrelated. For example, let's say I have the following set of columns that are common to many of my tables. objectid int, createdby varchar(32), createddate timestamp ... and let's say I create a table with these columns just so that I can then create other tables that inherit this table so that I have these columns in it without having to respecify them over and over again separately for each table that contains them. >From my understanding, all the data for these columns in all the child tables will be stored in this one parent table and that, furthermore, there is a "hidden" column in the parent table called tableoid that allows postgres to determine which row is stored in which child table. Given that, is there a performance hit for queries on the child tables because postgres has to effectively put a condition on every query based on the tableoid of the given child table? In other words, if say child table A has 10 million rows in it and child B has 2 rows in it. Will a query on child table B be slowed down by the fact that it inherits from the same table as A. I'm sure the answer is absolutely yes, and so I guess I'm just looking for corroboration. Maybe I'll be surprised! Thanks a bunch, Ken From pgsql-performance-owner@postgresql.org Fri Jan 21 08:51:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 15F0B3A4766 for ; Fri, 21 Jan 2005 08:51: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 77133-07 for ; Fri, 21 Jan 2005 08:50:54 +0000 (GMT) Received: from zeus.linuxsystems.be (zeus.linuxsystems.be [213.193.231.130]) by svr1.postgresql.org (Postfix) with ESMTP id 511873A467E for ; Fri, 21 Jan 2005 08:50:51 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id 1A0D03B037A for ; Fri, 21 Jan 2005 09:50:47 +0100 (CET) Received: from zeus.linuxsystems.be ([127.0.0.1]) by localhost (zeus [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21557-05 for ; Fri, 21 Jan 2005 09:50:46 +0100 (CET) Received: from webmail.linuxsystems.be (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id C7B873B036B for ; Fri, 21 Jan 2005 09:50:46 +0100 (CET) Received: from 193.190.212.113 (SquirrelMail authenticated user matt.ibridge.be); by webmail.linuxsystems.be with HTTP; Fri, 21 Jan 2005 09:50:46 +0100 (CET) Message-ID: <12670.193.190.212.113.1106297446.squirrel@193.190.212.113> In-Reply-To: <20050121001427.GA10806@wolff.to> References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> <33c6269f050120083177fa0e83@mail.gmail.com> <20050121001427.GA10806@wolff.to> Date: Fri, 21 Jan 2005 09:50:46 +0100 (CET) Subject: Re: From: "Matt Casters" To: pgsql-performance@postgresql.org Reply-To: Matt.Casters@advalvas.be User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at linuxsystems.be X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.509 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200501/376 X-Sequence-Number: 10066 > On Thu, Jan 20, 2005 at 11:31:29 -0500, > Alex Turner wrote: >> I am curious - I wasn't aware that postgresql supported partitioned tables, >> Could someone point me to the docs on this. > > Some people have been doing it using a union view. There isn't actually > a partition feature. > > Actually, there is. If found this example on pgsql-performance: >> 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 ; >> I think that in certain cases this system even beats Oracle as it stores less information in the table partitions. (and in doing so is causing less disk IO) BTW, internally, Oracle sees partitions as tables too. Even the "Union all" system that MS SQL Server uses works fine as long as the optimiser supports it to prune correctly. Cheers, Matt ------ Matt Casters i-Bridge bvba, http://www.kettle.be Fonteinstraat 70, 9400 Okegem, Belgium Phone +32 (0) 486/97.29.37 From pgsql-performance-owner@postgresql.org Fri Jan 21 09:16:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4202F3A43EC for ; Fri, 21 Jan 2005 09:16: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 80658-08 for ; Fri, 21 Jan 2005 09:16:09 +0000 (GMT) Received: from bayswater1.ymogen.net (unknown [217.27.247.154]) by svr1.postgresql.org (Postfix) with ESMTP id 7A63C3A427A for ; Fri, 21 Jan 2005 09:16:09 +0000 (GMT) Received: from [82.68.132.234] (82-68-132-234.dsl.in-addr.zen.co.uk [82.68.132.234]) by bayswater1.ymogen.net (Postfix) with ESMTP id 707BCA693B; Fri, 21 Jan 2005 09:16:08 +0000 (GMT) Message-ID: <41F0C858.7070508@ymogen.net> Date: Fri, 21 Jan 2005 09:16:08 +0000 From: Matt Clark User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tatsuo Ishii Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> In-Reply-To: <20050121.170731.08315885.t-ishii@sra.co.jp> 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: 200501/377 X-Sequence-Number: 10067 Presumably it can't _ever_ know without being explicitly told, because even for a plain SELECT there might be triggers involved that update tables, or it might be a select of a stored proc, etc. So in the general case, you can't assume that a select doesn't cause an update, and you can't be sure that the table list in an update is a complete list of the tables that might be updated. Tatsuo Ishii wrote: >Can I ask a question? > >Suppose table A gets updated on the master at time 00:00. Until 00:03 >pgpool needs to send all queries regarding A to the master only. My >question is, how can pgpool know a query is related to A? >-- >Tatsuo Ishii > > > From pgsql-performance-owner@postgresql.org Fri Jan 21 09:21:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B7163A47A5; Fri, 21 Jan 2005 09:21: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 81936-01; Fri, 21 Jan 2005 09:21:10 +0000 (GMT) Received: from ar-sd.net (unknown [82.77.155.72]) by svr1.postgresql.org (Postfix) with ESMTP id 27C023A4788; Fri, 21 Jan 2005 09:21:11 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id 15FF32126D; Fri, 21 Jan 2005 11:16:44 +0200 (EET) Received: from ar-sd.net ([127.0.0.1]) by localhost (linz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20649-06; Fri, 21 Jan 2005 11:16:42 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id 58C6F1E9D4; Fri, 21 Jan 2005 11:16:07 +0200 (EET) Message-ID: <00c001c4ff9a$809918e0$0b00a8c0@forge> From: "Andrei Bintintan" To: =?iso-8859-1?Q?Ragnar_Hafsta=F0?= , Cc: References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <87pt00c9zd.fsf@stark.xeocode.com> <1106248326.22416.22.camel@localhost.localdomain> <1106248992.22416.25.camel@localhost.localdomain> Subject: Re: [SQL] OFFSET impact on Performance??? Date: Fri, 21 Jan 2005 11:20:48 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 8bit 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 ar-sd.net 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: 200501/378 X-Sequence-Number: 10068 Now I read all the posts and I have some answers. Yes, I have a web aplication. I HAVE to know exactly how many pages I have and I have to allow the user to jump to a specific page(this is where I used limit and offset). We have this feature and I cannot take it out. >> > SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 Now this solution looks very fast, but I cannot implement it, because I cannot jump from page 1 to page xxxx only to page 2. Because I know with this type where did the page 1 ended. And we have some really complicated where's and about 10 tables are involved in the sql query. About the CURSOR I have to read more about them because this is my first time when I hear about. I don't know if temporary tables are a solution, really I don't think so, there are a lot of users that are working in the same time at the same page. So... still DIGGING for solutions. Andy. ----- Original Message ----- From: "Ragnar Hafsta�" To: Cc: "Andrei Bintintan" ; Sent: Thursday, January 20, 2005 9:23 PM Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? > On Thu, 2005-01-20 at 19:12 +0000, Ragnar Hafsta� wrote: >> On Thu, 2005-01-20 at 11:59 -0500, Greg Stark wrote: >> >> > The best way to do pages for is not to use offset or cursors but to use >> > an >> > index. This only works if you can enumerate all the sort orders the >> > application might be using and can have an index on each of them. >> > >> > To do this the query would look something like: >> > >> > SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 >> > >> > Then you take note of the last value used on a given page and if the >> > user >> > selects "next" you pass that as the starting point for the next page. >> >> this will only work unchanged if the index is unique. imagine , for >> example if you have more than 50 rows with the same value of col. >> >> one way to fix this is to use ORDER BY col,oid > > and a slightly more complex WHERE clause as well, of course > > gnari > > > From pgsql-performance-owner@postgresql.org Fri Jan 21 09:55:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4FBE53A4835 for ; Fri, 21 Jan 2005 09:55: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 86557-05 for ; Fri, 21 Jan 2005 09:55:21 +0000 (GMT) Received: from mailout10.sul.t-online.com (mailout10.sul.t-online.com [194.25.134.21]) by svr1.postgresql.org (Postfix) with ESMTP id 3EFFE3A476F for ; Fri, 21 Jan 2005 09:55:22 +0000 (GMT) Received: from fwd04.aul.t-online.de by mailout10.sul.t-online.com with smtp id 1CrvVe-00025f-02; Fri, 21 Jan 2005 10:55:18 +0100 Received: from jupiter.home.lan (Vmq41+ZDYeR793p0iLFemowK5wa0ligRX6OGubUmlSQkjc9y7mtzcJ@[80.132.127.63]) by fmrl04.sul.t-online.com with esmtp id 1CrvVR-256Se00; Fri, 21 Jan 2005 10:55:05 +0100 Received: from [192.168.20.1] (jupiter.home.lan [192.168.20.1]) by jupiter.home.lan (Postfix) with ESMTP id 6F34C1A299F; Fri, 21 Jan 2005 10:55:00 +0100 (CET) In-Reply-To: <12411.1106287379@sss.pgh.pa.us> References: <11D72EC4-6ACC-11D9-A12E-000A957B8C6E@users.sourceforge.net> <20050121002620.GB16417@wolff.to> <12411.1106287379@sss.pgh.pa.us> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <83971C76-6B92-11D9-A12E-000A957B8C6E@users.sourceforge.net> Content-Transfer-Encoding: 7bit Cc: pgsql-performance@postgresql.org, Bruno Wolff III From: Bernd Heller Subject: Re: column without pg_stats entry?! Date: Fri, 21 Jan 2005 10:55:00 +0100 To: Tom Lane X-Mailer: Apple Mail (2.619) X-ID: Vmq41+ZDYeR793p0iLFemowK5wa0ligRX6OGubUmlSQkjc9y7mtzcJ@t-dialin.net X-TOI-MSGID: be23ed26-8591-44c4-a705-4860d87f2909 X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/379 X-Sequence-Number: 10069 Ah no, I think both of you have mistaken me. The problem here is not about partial indexes (not really anyway). I do have a partial index with "WHERE purge_date IS NOT NULL", and my query does contain "WHERE purge_date IS NOT NULL" as well. The problem here is, that all rows (or almost all) have the column purge_date set to NULL. The planner expected the query to return 33% of all rows in the table. So it made the seq scan MUCH cheaper, which was right in the planner's way of thinking because it didn't know anything about the column from pg_stats. I had a look at the source code of the analyze command meanwhile: the compute_*_stats functions don't return valid statistics if they can't find any non-null values, and as a result no statistics tuple for that column is created in pg_stats. I think this is wrong. Not finding any non-null values IS a very useful information, it means a null-fraction of 100%. I have patched my postgres to return valid statistics even in that case (patch below). The difference now is that the planner doesn't assume anymore it would get about 33% of rows back, instead it knows that the null-fraction of that column is approximately 1.0 and it chooses the index scan because that is now the by far cheapest plan. --- analyze.c Thu Jan 20 11:37:58 2005 +++ analyze.c.orig Sun Nov 14 03:04:13 2004 @@ -1704,9 +1704,6 @@ stats->stavalues[0] = mcv_values; stats->numvalues[0] = num_mcv; } - } else { - stats->stats_valid = true; - stats->stanullfrac = 1.0; } /* We don't need to bother cleaning up any of our temporary palloc's */ @@ -2164,9 +2161,6 @@ stats->numnumbers[slot_idx] = 1; slot_idx++; } - } else { - stats->stats_valid = true; - stats->stanullfrac = 1.0; } /* We don't need to bother cleaning up any of our temporary palloc's */ On 21.01.2005, at 7:02 Uhr, Tom Lane wrote: > Bruno Wolff III writes: >> Bernd Heller wrote: >>> there is no entry in pg_stats for that column at all!! I can only >>> suspect that this has to do with the column being all null. > >> Someone else reported this recently and I think it is going to be >> fixed. > > Yeah, this was griped of a little bit ago, but I felt it was too close > to 8.0 release to risk fooling with for this cycle. > >> In the short run you could add an IS NOT NULL clause to your query. >> The optimizer doesn't know that < being TRUE implies IS NOT NULL and >> so the partial index won't be used unless you add that clause >> explicitly. > > Actually, as of 8.0 the optimizer *does* know that. I'm a bit > surprised > that it didn't pick the partial index, since even without any analyze > stats, the small physical size of the partial index should have clued > it > that there weren't many such tuples. Could we see EXPLAIN output for > both cases (both settings of enable_seqscan)? > > regards, tom lane > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster From pgsql-performance-owner@postgresql.org Fri Jan 21 12:30:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 629433A47C4 for ; Fri, 21 Jan 2005 12:30: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 02349-02 for ; Fri, 21 Jan 2005 12:30:13 +0000 (GMT) Received: from zoom.spline.inf.fu-berlin.de (zoom.spline.inf.fu-berlin.de [160.45.117.148]) by svr1.postgresql.org (Postfix) with ESMTP id A365A3A4923 for ; Fri, 21 Jan 2005 12:30:14 +0000 (GMT) Received: by zoom.spline.inf.fu-berlin.de (Postfix, from userid 2091) id 811E68D616; Fri, 21 Jan 2005 13:30:09 +0100 (CET) Date: Fri, 21 Jan 2005 13:30:08 +0100 From: Yann Michel To: Matt Casters Cc: pgsql-performance@postgresql.org Subject: Re: Message-ID: <20050121123008.GA13904@zoom.spline.inf.fu-berlin.de> References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> <33c6269f050120083177fa0e83@mail.gmail.com> <20050121001427.GA10806@wolff.to> <12670.193.190.212.113.1106297446.squirrel@193.190.212.113> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12670.193.190.212.113.1106297446.squirrel@193.190.212.113> 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: 200501/380 X-Sequence-Number: 10070 Hi, On Fri, Jan 21, 2005 at 09:50:46AM +0100, Matt Casters wrote: > > > Some people have been doing it using a union view. There isn't actually > > a partition feature. > > Actually, there is. If found this example on pgsql-performance: > > >> CREATE TABLE super_foo ( partition NUMERIC, bar NUMERIC ); > >> ANALYZE super_foo ; > >> > >> CREATE TABLE sub_foo1 () INHERITS ( super_foo ); [...] > >> > >> CREATE TABLE sub_foo2 () INHERITS ( super_foo ); [...] > >> Yes, this could be used instead of a view. But there is one thing missing. You can't just insert into super_foo and aquire the "correct partition". You will still have to insert into the correct underlying table. "Real" partitioning will take care of correct partition selection. Regards, Yann From pgsql-performance-owner@postgresql.org Fri Jan 21 12:51:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF14B3A48D6 for ; Fri, 21 Jan 2005 12:51: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 04595-03 for ; Fri, 21 Jan 2005 12:51:05 +0000 (GMT) Received: from zeus.linuxsystems.be (zeus.linuxsystems.be [213.193.231.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0DFBB3A48AB for ; Fri, 21 Jan 2005 12:51:04 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id C03F63B085A; Fri, 21 Jan 2005 13:51:02 +0100 (CET) Received: from zeus.linuxsystems.be ([127.0.0.1]) by localhost (zeus [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04001-01; Fri, 21 Jan 2005 13:51:02 +0100 (CET) Received: from webmail.linuxsystems.be (localhost.localdomain [127.0.0.1]) by zeus.linuxsystems.be (Postfix) with ESMTP id 226253B0075; Fri, 21 Jan 2005 13:51:02 +0100 (CET) Received: from 212-100-172-237.adsl.easynet.be ([212.100.172.237]) (SquirrelMail authenticated user matt.ibridge.be); by webmail.linuxsystems.be with HTTP; Fri, 21 Jan 2005 13:51:02 +0100 (CET) Message-ID: <36073.212.100.172.237.1106311862.squirrel@212.100.172.237> In-Reply-To: <20050121123008.GA13904@zoom.spline.inf.fu-berlin.de> References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> <33c6269f050120083177fa0e83@mail.gmail.com> <20050121001427.GA10806@wolff.to> <12670.193.190.212.113.1106297446.squirrel@193.190.212.113> <20050121123008.GA13904@zoom.spline.inf.fu-berlin.de> Date: Fri, 21 Jan 2005 13:51:02 +0100 (CET) Subject: Re: From: "Matt Casters" To: "Yann Michel" Cc: "Matt Casters" , pgsql-performance@postgresql.org Reply-To: Matt.Casters@advalvas.be User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: by amavisd-new at linuxsystems.be X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.443 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200501/381 X-Sequence-Number: 10071 >> > Some people have been doing it using a union view. There isn't actually >> > a partition feature. >> >> Actually, there is. If found this example on pgsql-performance: >> >> >> CREATE TABLE super_foo ( partition NUMERIC, bar NUMERIC ); >> >> ANALYZE super_foo ; >> >> >> >> CREATE TABLE sub_foo1 () INHERITS ( super_foo ); > [...] >> >> >> >> CREATE TABLE sub_foo2 () INHERITS ( super_foo ); > [...] >> >> > > Yes, this could be used instead of a view. But there is one thing > missing. You can't just insert into super_foo and aquire the "correct > partition". You will still have to insert into the correct underlying > table. "Real" partitioning will take care of correct partition > selection. This IS bad news. It would mean a serious change in the ETL. I think I can solve the other problems, but I don't know about this one... Regards, Matt From pgsql-performance-owner@postgresql.org Fri Jan 21 13:33:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 360DE3A4A76 for ; Fri, 21 Jan 2005 13:33: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 09318-08 for ; Fri, 21 Jan 2005 13:33:28 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 54BBF3A4983 for ; Fri, 21 Jan 2005 13:33:27 +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: Re: [SQL] OFFSET impact on Performance??? Date: Fri, 21 Jan 2005 08:33:24 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcT/mspO6xlKKzePTTKZexy59alJyAAISrdg From: "Merlin Moncure" To: "Andrei Bintintan" Cc: 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: 200501/382 X-Sequence-Number: 10072 > Now I read all the posts and I have some answers. >=20 > Yes, I have a web aplication. > I HAVE to know exactly how many pages I have and I have to allow the user > to > jump to a specific page(this is where I used limit and offset). We have > this > feature and I cannot take it out. If your working set is small, say a couple hundred records at the most (web form or such), limit/offset may be ok. However you are already paying double because you are extracting the # of records matching your where clause, yes? Also, this # can change while the user is browsing, heh. IOW, your application code is writing expensive checks that the database has to cash. > >> > SELECT * FROM tab WHERE col > ? ORDER BY col LIMIT 50 > Now this solution looks very fast, but I cannot implement it, because I > cannot jump from page 1 to page xxxx only to page 2. Because I know with > this type where did the page 1 ended. And we have some really complicated > where's and about 10 tables are involved in the sql query. > About the CURSOR I have to read more about them because this is my first > time when I hear about. > I don't know if temporary tables are a solution, really I don't think so, > there are a lot of users that are working in the same time at the same > page. Cursors held by a connection. If your web app keeps persistent connection, you can use them. In this case, pass the where clause to a plpgsql function which returns a composite object containing a refcursor object and the number of rows (read the docs!). If/When pg gets shared cursors, this may be the way to go...but in this case you may have to worry about closing them. Without a connection, you need some type of persistence on the database. This is complex but it can be done...but it will not be faster than limit offset for browsing relatively small sets. Merlin From pgsql-performance-owner@postgresql.org Fri Jan 21 14:37:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 82CD43A483E for ; Fri, 21 Jan 2005 14: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 18712-05 for ; Fri, 21 Jan 2005 14:37:07 +0000 (GMT) Received: from mail.fluidhosting.com (mail1.fluidhosting.com [66.150.201.101]) by svr1.postgresql.org (Postfix) with SMTP id 168283A4AB3 for ; Fri, 21 Jan 2005 14:37:10 +0000 (GMT) Received: (qmail 58183 invoked by uid 399); 21 Jan 2005 14:37:09 -0000 Received: from unknown (HELO ?127.0.0.1?) (194.185.112.82) by mail1.fluidhosting.com with SMTP; 21 Jan 2005 14:37:09 -0000 Message-ID: <41F113A0.1020908@beccati.com> Date: Fri, 21 Jan 2005 15:37:20 +0100 From: Matteo Beccati User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it-IT; rv:1.8a6) Gecko/20050111 X-Accept-Language: it, en-us, en MIME-Version: 1.0 To: Yann Michel Cc: Matt Casters , pgsql-performance@postgresql.org Subject: Re: References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> <33c6269f050120083177fa0e83@mail.gmail.com> <20050121001427.GA10806@wolff.to> <12670.193.190.212.113.1106297446.squirrel@193.190.212.113> <20050121123008.GA13904@zoom.spline.inf.fu-berlin.de> In-Reply-To: <20050121123008.GA13904@zoom.spline.inf.fu-berlin.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/383 X-Sequence-Number: 10073 Hi, >>>> CREATE TABLE super_foo ( partition NUMERIC, bar NUMERIC ); >>>> ANALYZE super_foo ; >>>> >>>> CREATE TABLE sub_foo1 () INHERITS ( super_foo ); >>>> CREATE TABLE sub_foo2 () INHERITS ( super_foo ); > > Yes, this could be used instead of a view. But there is one thing > missing. You can't just insert into super_foo and aquire the "correct > partition". You will still have to insert into the correct underlying > table. "Real" partitioning will take care of correct partition > selection. I've recently used this method for partitioning data. In my setup inserts are done inside a pl/pgsql function called at regular intervals, so this isn't a problem for me. I didn't test it, but I think some rules (or a trigger) could do the trick. Best regards -- Matteo Beccati http://phpadsnew.com http://phppgads.com From pgsql-performance-owner@postgresql.org Fri Jan 21 15:41:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CEFA43A4B7F for ; Fri, 21 Jan 2005 15:41: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 31643-05 for ; Fri, 21 Jan 2005 15:40:47 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id 6E2AF3A4AC4 for ; Fri, 21 Jan 2005 15:40:51 +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 j0LFepa8021883; Fri, 21 Jan 2005 07:40:51 -0800 Message-ID: <41F12289.1070104@commandprompt.com> Date: Fri, 21 Jan 2005 07:40:57 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matt Clark Cc: Tatsuo Ishii , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> <41F0C858.7070508@ymogen.net> In-Reply-To: <41F0C858.7070508@ymogen.net> Content-Type: multipart/mixed; boundary="------------040302060603050206030805" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/384 X-Sequence-Number: 10074 This is a multi-part message in MIME format. --------------040302060603050206030805 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Matt Clark wrote: > Presumably it can't _ever_ know without being explicitly told, because > even for a plain SELECT there might be triggers involved that update > tables, or it might be a select of a stored proc, etc. So in the > general case, you can't assume that a select doesn't cause an update, > and you can't be sure that the table list in an update is a complete > list of the tables that might be updated. Uhmmm no :) There is no such thing as a select trigger. The closest you would get is a function that is called via select which could be detected by making sure you are prepending with a BEGIN or START Transaction. Thus yes pgPool can be made to do this. Sincerely, Joshua D. Drake > > > > Tatsuo Ishii wrote: > >> Can I ask a question? >> >> Suppose table A gets updated on the master at time 00:00. Until 00:03 >> pgpool needs to send all queries regarding A to the master only. My >> question is, how can pgpool know a query is related to A? >> -- >> Tatsuo Ishii >> >> >> > > ---------------------------(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 --------------040302060603050206030805 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 --------------040302060603050206030805-- From pgsql-performance-owner@postgresql.org Fri Jan 21 16:05:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBBDE3A4BD0 for ; Fri, 21 Jan 2005 16:05: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 39262-06 for ; Fri, 21 Jan 2005 16:05:18 +0000 (GMT) Received: from ns1.turtle-entertainment.de (ns1.turtle-entertainment.de [193.41.200.20]) by svr1.postgresql.org (Postfix) with ESMTP id A8FC73A4BAC for ; Fri, 21 Jan 2005 16:05:15 +0000 (GMT) Received: from ip96.85.1311c-cud12k-02.ish.de ([62.143.85.96] helo=mail.office.turtle-entertainment.de) by ns1.turtle-entertainment.de with asmtp (Exim 3.22 #3 (Debian)) id 1Cs1HL-0003PL-00; Fri, 21 Jan 2005 17:04:55 +0100 Received: from [212.6.194.211] (helo=[212.6.194.211]) by mail.office.turtle-entertainment.de with asmtp (Exim 3.22 #7 (Debian)) id 1Cs1HK-000205-00; Fri, 21 Jan 2005 17:04:54 +0100 Message-ID: <41F12828.3090309@turtle-entertainment.de> Date: Fri, 21 Jan 2005 17:04:56 +0100 From: Bjoern Metzdorf User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Joshua D. Drake" Cc: Matt Clark , Tatsuo Ishii , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> <41F0C858.7070508@ymogen.net> <41F12289.1070104@commandprompt.com> In-Reply-To: <41F12289.1070104@commandprompt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.842 tagged_above=0 required=5 tests=FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200501/385 X-Sequence-Number: 10075 Joshua D. Drake wrote: > Matt Clark wrote: > >> Presumably it can't _ever_ know without being explicitly told, because >> even for a plain SELECT there might be triggers involved that update >> tables, or it might be a select of a stored proc, etc. So in the >> general case, you can't assume that a select doesn't cause an update, >> and you can't be sure that the table list in an update is a complete >> list of the tables that might be updated. > > > Uhmmm no :) There is no such thing as a select trigger. The closest you > would get > is a function that is called via select which could be detected by > making sure > you are prepending with a BEGIN or START Transaction. Thus yes pgPool > can be made > to do this. SELECT SETVAL() is another case. I'd really love to see pgpool do this. I am also curious about Slony-II development, Tom mentioned a first meeting about it :) Regards, Bjoern From pgsql-performance-owner@postgresql.org Fri Jan 21 16:06:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39ECD3A4B79 for ; Fri, 21 Jan 2005 16:06: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 39030-09 for ; Fri, 21 Jan 2005 16:05:42 +0000 (GMT) Received: from zoom.spline.inf.fu-berlin.de (zoom.spline.inf.fu-berlin.de [160.45.117.148]) by svr1.postgresql.org (Postfix) with ESMTP id 81C2D3A4B6D for ; Fri, 21 Jan 2005 16:05:41 +0000 (GMT) Received: by zoom.spline.inf.fu-berlin.de (Postfix, from userid 2091) id 7744F8D60A; Fri, 21 Jan 2005 17:05:39 +0100 (CET) Date: Fri, 21 Jan 2005 17:05:39 +0100 From: Yann Michel To: Matteo Beccati Cc: Matt Casters , pgsql-performance@postgresql.org Subject: Re: Message-ID: <20050121160539.GA15734@zoom.spline.inf.fu-berlin.de> References: <16153.193.190.212.113.1106213675.squirrel@193.190.212.113> <20050120142603.GM10437@ns.snowman.net> <33c6269f050120083177fa0e83@mail.gmail.com> <20050121001427.GA10806@wolff.to> <12670.193.190.212.113.1106297446.squirrel@193.190.212.113> <20050121123008.GA13904@zoom.spline.inf.fu-berlin.de> <41F113A0.1020908@beccati.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41F113A0.1020908@beccati.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: 200501/386 X-Sequence-Number: 10076 Hi, On Fri, Jan 21, 2005 at 03:37:20PM +0100, Matteo Beccati wrote: > > >>>> CREATE TABLE super_foo ( partition NUMERIC, bar NUMERIC ); > >>>> ANALYZE super_foo ; > >>>> > >>>> CREATE TABLE sub_foo1 () INHERITS ( super_foo ); > >>>> CREATE TABLE sub_foo2 () INHERITS ( super_foo ); > > > >Yes, this could be used instead of a view. But there is one thing > >missing. You can't just insert into super_foo and aquire the "correct > >partition". You will still have to insert into the correct underlying > >table. "Real" partitioning will take care of correct partition > >selection. > > I've recently used this method for partitioning data. In my setup > inserts are done inside a pl/pgsql function called at regular intervals, > so this isn't a problem for me. I didn't test it, but I think some rules > (or a trigger) could do the trick. Yes, a pl/pgsql function or any software solution can solve this problem, but what you normally expect from a partitioning support is that you don't have to care about where to put your data due to the db will take care for that. Of cause a trigger could do this as well, but don't forget, that a trigger in dwh environments, where you process thousands of row at once during data loading, is very expensive and therefore no solution for production use. Regards, Yann From pgsql-performance-owner@postgresql.org Fri Jan 21 16:09:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E06963A4BB9 for ; Fri, 21 Jan 2005 16:09: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 41463-03 for ; Fri, 21 Jan 2005 16:09:51 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 6C25E3A4BC7 for ; Fri, 21 Jan 2005 16:09:49 +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: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 21 Jan 2005 11:08:41 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75CD@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL clustering VS MySQL clustering Thread-Index: AcT/0NOkE5zIMj+ZTyiwoS8q25ekTQAAiDIA From: "Merlin Moncure" To: "Joshua D. Drake" Cc: 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: 200501/387 X-Sequence-Number: 10077 > Uhmmm no :) There is no such thing as a select trigger. The closest you > would get > is a function that is called via select which could be detected by > making sure > you are prepending with a BEGIN or START Transaction. Thus yes pgPool > can be made > to do this. Technically, you can also set up a rule to do things on a select with DO ALSO. However putting update statements in there would be considered (at least by me) very bad form. Note that this is not a trigger because it does not operate at the row level [I know you knew that already :-)]. Merlin From pgsql-performance-owner@postgresql.org Fri Jan 21 16:15:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 848EF3A4BD0 for ; Fri, 21 Jan 2005 16:15: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 42639-04 for ; Fri, 21 Jan 2005 16:14:46 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 5D9503A4B79 for ; Fri, 21 Jan 2005 16:14:21 +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 1Cs1QK-0003fH-00; Fri, 21 Jan 2005 11:14:12 -0500 To: ken Cc: pgsql-performance@postgresql.org Subject: Re: inheritance performance References: <1106295545.6622.266.camel@pesky.s6portland> In-Reply-To: <1106295545.6622.266.camel@pesky.s6portland> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 21 Jan 2005 11:14:12 -0500 Message-ID: <87hdlaahez.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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/388 X-Sequence-Number: 10078 ken writes: > >From my understanding, all the data for these columns in all the child > tables will be stored in this one parent table No, all the data is stored in the child table. > and that, furthermore, there is a "hidden" column in the parent table called > tableoid that allows postgres to determine which row is stored in which > child table. That's true. > Given that, is there a performance hit for queries on the child tables > because postgres has to effectively put a condition on every query based on > the tableoid of the given child table? There's a performance hit for the extra space required to store the tableoid. This means slightly fewer records will fit on a page and i/o requirements will be slightly higher. This will probably only be noticeable on narrow tables, and even then probably only on large sequential scans. There's also a slight performance hit because there's an optimization that the planner does normally for simple queries that isn't currently done for either UNION ALL or inherited tables. I think it's planned to fix that soon. > In other words, if say child table A has 10 million rows in it and child > B has 2 rows in it. Will a query on child table B be slowed down by the > fact that it inherits from the same table as A. I'm sure the answer is > absolutely yes, and so I guess I'm just looking for corroboration. No, it isn't slowed down by the records in A. It's slightly slower because it is an inherited table, but that impact is the same regardless of what other tables inherit from the same parent and how many records are in them. -- greg From pgsql-performance-owner@postgresql.org Fri Jan 21 16:26:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2ED3A3A4B03 for ; Fri, 21 Jan 2005 16:26: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 45378-04 for ; Fri, 21 Jan 2005 16:26:41 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id D5C5C3A4BA2 for ; Fri, 21 Jan 2005 16:22: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 1Cs1Ym-0003h0-00; Fri, 21 Jan 2005 11:22:56 -0500 To: "Merlin Moncure" Cc: "Andrei Bintintan" , Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 21 Jan 2005 11:22:56 -0500 Message-ID: <87brbiah0f.fsf@stark.xeocode.com> Lines: 29 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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/389 X-Sequence-Number: 10079 > > Now I read all the posts and I have some answers. > > > > Yes, I have a web aplication. I HAVE to know exactly how many pages I have > > and I have to allow the user to jump to a specific page(this is where I > > used limit and offset). We have this feature and I cannot take it out. I'm afraid you have a problem then. The only way postgres can know exactly how many pages and allow users to jump to a specific point for an arbitrary query is by doing what OFFSET and LIMIT does. There are ways to optimize this but they'll be lots of work. And they'll only amount to moving around when the work is done. The work of gathering all the records from the query will still have to be done sometime. If the queries are relatively static you could preprocess the data so you have all the results in a table with a sequential id. Then you can get the maximum and jump around in the table using an index all you want. Otherwise you could consider performing the queries on demand and storing them in a temporary table. Then fetch the actual records for the page from the temporary table again using an index on a sequential id to jump around. This might make the actual performing of the initial query much slower though since you have to wait for the entire query to be performed and the records stored. You'll also have to deal with vacuuming this table aggressively. -- greg From pgsql-performance-owner@postgresql.org Tue Jan 25 17:44:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E5D303A4BC0 for ; Fri, 21 Jan 2005 16:32: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 46210-06 for ; Fri, 21 Jan 2005 16:31:52 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id B85433A4B8E for ; Fri, 21 Jan 2005 16:30:58 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6C0FE31988; Fri, 21 Jan 2005 17:30:57 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Fri, 21 Jan 2005 16:30:56 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 15 Message-ID: References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> <41F04142.7080705@cheapcomplexdevices.com> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/469 X-Sequence-Number: 10159 "Ron Mayer " wrote in pgsql.performance: > I sometimes also think it's fun to point out that Postgresql > bigger companies supporting it's software - like this one: > > http://www.fastware.com.au/docs/FujitsuSupportedPostgreSQLWhitePaper.pdf > > with $43 billion revenue -- instead of those little companies > like Mysql AB or Oracle. > > :) Heheh. That is a good point indeed. When the illogical "everyone else is doing it" argument comes along (as typically does whenever someone is pushing for a Microsoft solution), then this will be very helpful. From pgsql-performance-owner@postgresql.org Tue Jan 25 17:45:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91B8C3A4B17 for ; Fri, 21 Jan 2005 16:35: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 47051-09 for ; Fri, 21 Jan 2005 16:35:51 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id C08FC3A4B90 for ; Fri, 21 Jan 2005 16:35:41 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 1DB3F31988; Fri, 21 Jan 2005 17:35:40 +0100 (MET) From: Randolf Richardson X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Fri, 21 Jan 2005 16:35:38 +0000 (UTC) Organization: Inter-Corporate Computer & Network Services, Inc. Lines: 53 Message-ID: References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> <12826.1106290803@sss.pgh.pa.us> X-Complaints-To: usenet@news.hub.org User-Agent: Xnews/06.08.25 X-Face: +kXh]8'{:R`HzXla-aT~$s8a+C)k/B%RBr$_3sP`[kA}cl7#mD^9Z:oM`HpoC_kUEH['RZ*Ob%pz\ww^q&x)~zc`.xd]VQ4WN/3t2nS-BvI%LF\B4:\9$EI:/|<)`?8I_; xzG@SOYFir/gk_eB4"Rl43-h%)8O0sR$b&Mp3XHR(0j= X-Face-Author: Randolf Richardson (composed with Adobe Photoshop) 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: 200501/470 X-Sequence-Number: 10160 "tgl@sss.pgh.pa.us (Tom Lane)" wrote in pgsql.performance: > Randolf Richardson writes: >> "Ron Mayer " wrote in pgsql.performance: >>> Randolf Richardson wrote: >>> >>>> While this doesn't exactly answer your question, I use this little >>>> tidbit of information when "selling" people on PostgreSQL. >>>> PostgreSQL was chosen over Oracle as the database to handle all of >>>> the .org TLDs information. ... >> >> Do you have a link for that information? >> >>> http://www.icann.org/tlds/org/questions-to-applicants-13.htm#Response13 >>> TheInternetSocietyISOC >> >> That's perfect. Thanks! > > This is rather old news, actually, as Afilias (the outfit actually > running the registry for ISOC) has been running the .info TLD on > Postgres since 2001. They have the contract for the new .mobi TLD. Perhaps it's old, but it's new to me because I don't follow that area of the internet very closely. > And they are currently one of not many bidders to take over the .net > registry when Verisign's contract expires this June. Now *that* will > be a hard TLD to ignore ;-) Yes, indeed, that will be. My feeling is that Network Solutions actually manages the .NET and .COM registries far better than anyone else does, and when .ORG was switched away I didn't like the lack of flexibility that I have always enjoyed with .NET and .COM -- the problem is that I have to create a separate account and password for each .ORG internet domain name now and can't just use one master account and password for all of them, and if the same folks are going to be running .NET then I'm going to wind up having more management to do for that one as well (and I'm not talking about just a mere handlful of internet domain names either). > I am actually sitting in a Toronto hotel room right now because I'm > attending a meeting sponsored by Afilias for the purpose of initial > design of the Slony-II replication system for Postgres (see Slony-I). > According to the Afilias guys I've been having dinners with, they > got absolutely zero flak about their use of Postgres in connection > with the .mobi bid, after having endured very substantial bombardment > (cf above link) --- and a concerted disinformation campaign by Oracle > --- in connection with the .org and .info bids. As far as the ICANN > community is concerned, this is established technology. Perhaps you could mention this problem I've noticed to them if you happen to be talking with them. It's obviously not a difficult problem to solve when it comes to good database management and would really make life a lot easier for those of us who are responsible for large numbers of internet domain names. From pgsql-performance-owner@postgresql.org Fri Jan 21 16:45:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D8BF3A4BDB for ; Fri, 21 Jan 2005 16:45: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 49767-04 for ; Fri, 21 Jan 2005 16:45:14 +0000 (GMT) Received: from orrtax_exchg3.orrtax.com (unknown [12.39.189.66]) by svr1.postgresql.org (Postfix) with ESMTP id 534383A4B70 for ; Fri, 21 Jan 2005 16:45:10 +0000 (GMT) Received: by orrtax_exchg3.nls.nlsholdings.com with Internet Mail Service (5.5.2653.19) id ; Fri, 21 Jan 2005 10:57:20 -0600 Message-ID: <8343824939973D4FAC4AD93C1CF35944013A4147@orrtax_exchg3.nls.nlsholdings.com> From: Robert Sanford To: pgsql-performance@postgresql.org Subject: Profiling a function... Date: Fri, 21 Jan 2005 10:57:19 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain 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: 200501/390 X-Sequence-Number: 10080 How do I profile a user-defined function so that I know which parts of the function are the ones that are taking the biggest chunk of time? When I run EXPLAIN on the queries within the function none of them show up as onerous burdens to the performance. But when they are all operating together within the function and within the functional logic they become really expensive. Obviously I've made a mistake somewhere but it isn't obvious (otherwise it would be fixed already) and I'd prefer having a profile report telling me what is taking so long rather than guessing and possibly making things worse. So is there any way to get a line-by-line timing profile of a user-defined function? Thanks! rjsjr From pgsql-performance-owner@postgresql.org Fri Jan 21 17:27:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D2C13A4BC2 for ; Fri, 21 Jan 2005 17: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 59868-05 for ; Fri, 21 Jan 2005 17:26:47 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 24F4D3A4C07 for ; Fri, 21 Jan 2005 17:26:01 +0000 (GMT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by www.postgresql.com (Postfix) with ESMTP id ADB507388F1 for ; Fri, 21 Jan 2005 17:25:59 +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 1Cs2Rc-000Fe7-I6; Fri, 21 Jan 2005 17:19:36 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 97C3A168F7; Fri, 21 Jan 2005 17:20:55 +0000 (GMT) Message-ID: <41F139F7.6060904@archonet.com> Date: Fri, 21 Jan 2005 17:20:55 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Robert Sanford Cc: pgsql-performance@postgresql.org Subject: Re: Profiling a function... References: <8343824939973D4FAC4AD93C1CF35944013A4147@orrtax_exchg3.nls.nlsholdings.com> In-Reply-To: <8343824939973D4FAC4AD93C1CF35944013A4147@orrtax_exchg3.nls.nlsholdings.com> 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.073 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/391 X-Sequence-Number: 10081 Robert Sanford wrote: > How do I profile a user-defined function so that I know which parts of the > function are the ones that are taking the biggest chunk of time? > > When I run EXPLAIN on the queries within the function none of them show up > as onerous burdens to the performance. But when they are all operating > together within the function and within the functional logic they become > really expensive. Obviously I've made a mistake somewhere but it isn't > obvious (otherwise it would be fixed already) and I'd prefer having a > profile report telling me what is taking so long rather than guessing and > possibly making things worse. > > So is there any way to get a line-by-line timing profile of a user-defined > function? Not really. What you can do is simulate the queries in functions by using PREPARE. You're probably seeing a difference because when PG plans the queries for functions/prepared queries it doesn't know the actual values. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Fri Jan 21 17:35:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B26D23A4C10 for ; Fri, 21 Jan 2005 17:35: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 62041-03 for ; Fri, 21 Jan 2005 17:35:24 +0000 (GMT) Received: from bayswater1.ymogen.net (unknown [217.27.247.154]) by svr1.postgresql.org (Postfix) with ESMTP id 51F1B3A4BEC for ; Fri, 21 Jan 2005 17:35:15 +0000 (GMT) Received: from [82.68.132.234] (82-68-132-234.dsl.in-addr.zen.co.uk [82.68.132.234]) by bayswater1.ymogen.net (Postfix) with ESMTP id A2260A6640; Fri, 21 Jan 2005 17:35:13 +0000 (GMT) Message-ID: <41F13D51.9070608@ymogen.net> Date: Fri, 21 Jan 2005 17:35:13 +0000 From: Matt Clark User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Joshua D. Drake" Cc: Tatsuo Ishii , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501200929.37228.darcy@wavefire.com> <20050121.104007.74755729.t-ishii@sra.co.jp> <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> <41F0C858.7070508@ymogen.net> <41F12289.1070104@commandprompt.com> In-Reply-To: <41F12289.1070104@commandprompt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/392 X-Sequence-Number: 10082 Yes, I wasn't really choosing my examples particularly carefully, but I think the conclusion stands: pgpool (or anyone/thing except for the server) cannot in general tell from the SQL it is handed by the client whether an update will occur, nor which tables might be affected. That's not to say that pgpool couldn't make a good guess in the majority of cases! M Joshua D. Drake wrote: > Matt Clark wrote: > >> Presumably it can't _ever_ know without being explicitly told, >> because even for a plain SELECT there might be triggers involved that >> update tables, or it might be a select of a stored proc, etc. So in >> the general case, you can't assume that a select doesn't cause an >> update, and you can't be sure that the table list in an update is a >> complete list of the tables that might be updated. > > > Uhmmm no :) There is no such thing as a select trigger. The closest > you would get > is a function that is called via select which could be detected by > making sure > you are prepending with a BEGIN or START Transaction. Thus yes pgPool > can be made > to do this. > > Sincerely, > > Joshua D. Drake > > > From pgsql-performance-owner@postgresql.org Fri Jan 21 17:48:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C9B503A4B9A for ; Fri, 21 Jan 2005 17:48: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 65061-04 for ; Fri, 21 Jan 2005 17:48:13 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id DFA073A4A87 for ; Fri, 21 Jan 2005 17:48:13 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6934745; Fri, 21 Jan 2005 09:49:53 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 21 Jan 2005 09:47:53 -0800 User-Agent: KMail/1.6.2 Cc: Tatsuo Ishii , darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr References: <200501200929.37228.darcy@wavefire.com> <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> In-Reply-To: <20050121.170731.08315885.t-ishii@sra.co.jp> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501210947.53938.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/393 X-Sequence-Number: 10083 Tatsuo, > Suppose table A gets updated on the master at time 00:00. Until 00:03 > pgpool needs to send all queries regarding A to the master only. My > question is, how can pgpool know a query is related to A? Well, I'm a little late to head off tangental discussion about this, but .... The systems where I've implemented something similar are for web applications. In the case of the web app, you don't care if a most users see data which is 2 seconds out of date; with caching and whatnot, it's often much more than that! The one case where it's not permissable for a user to see "old" data is the case where the user is updating the data. Namely: (1) 00:00 User A updates "My Profile" (2) 00:01 "My Profile" UPDATE finishes executing. (3) 00:02 User A sees "My Profile" re-displayed (6) 00:04 "My Profile":UserA cascades to the last Slave server So in an application like the above, it would be a real problem if User A were to get switched over to a slave server immediately after the update; she would see the old data, assume that her update was not saved, and update again. Or send angry e-mails to webmaster@. However, it makes no difference what User B sees: (1) 00:00 User A updates "My Profile"v1 Master (2) 00:01 "My Profile" UPDATE finishes executing. Master (3) 00:02 User A sees "My Profile"v2 displayed Master (4) 00:02 User B requests "MyProfile":UserA Slave2 (5) 00:03 User B sees "My Profile"v1 Slave2 (6) 00:04 "My Profile"v2 cascades to the last Slave server Slave2 If the web application is structured properly, the fact that UserB is seeing UserA's information which is 2 seconds old is not a problem (though it might be for web auctions, where it could result in race conditions. Consider memcached as a helper). This means that pgPool only needs to monitor "update switching" by *connection* not by *table*. Make sense? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 21 18:05:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BA7233A4AF1 for ; Fri, 21 Jan 2005 18:05: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 69297-07 for ; Fri, 21 Jan 2005 18:05:00 +0000 (GMT) Received: from server272.com (server272.com [64.14.68.49]) by svr1.postgresql.org (Postfix) with SMTP id 02F9A3A4BFC for ; Fri, 21 Jan 2005 18:04:27 +0000 (GMT) Received: (qmail 16253 invoked from network); 21 Jan 2005 18:04:22 -0000 Received: from unknown (HELO ?192.168.1.10?) (216.190.89.53) by server272.com with SMTP; 21 Jan 2005 18:04:22 -0000 Subject: Re: inheritance performance From: ken To: Greg Stark Cc: pgsql-performance@postgresql.org In-Reply-To: <87hdlaahez.fsf@stark.xeocode.com> References: <1106295545.6622.266.camel@pesky.s6portland> <87hdlaahez.fsf@stark.xeocode.com> Content-Type: text/plain Message-Id: <1106330319.6622.276.camel@pesky.s6portland> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 21 Jan 2005 09:58:39 -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: 200501/394 X-Sequence-Number: 10084 On Fri, 2005-01-21 at 08:14, Greg Stark wrote: > ken writes: > > > >From my understanding, all the data for these columns in all the child > > tables will be stored in this one parent table > > No, all the data is stored in the child table. So if you perform a "select * from parent" then does postgres internally create a union between all the child tables and return you the results of that? ken From pgsql-performance-owner@postgresql.org Fri Jan 21 18:17:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7DD493A19F6 for ; Fri, 21 Jan 2005 18:16: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 72009-04 for ; Fri, 21 Jan 2005 18:16:32 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id AEA1F3A4BC2 for ; Fri, 21 Jan 2005 18:16:06 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0LHtkv3034928; Fri, 21 Jan 2005 17:55:47 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.1]); Fri, 21 Jan 2005 18:15:16 +0000 Message-ID: <41F146B4.8010900@familyhealth.com.au> Date: Fri, 21 Jan 2005 18:15:16 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ken Cc: Greg Stark , pgsql-performance@postgresql.org Subject: Re: inheritance performance References: <1106295545.6622.266.camel@pesky.s6portland> <87hdlaahez.fsf@stark.xeocode.com> <1106330319.6622.276.camel@pesky.s6portland> In-Reply-To: <1106330319.6622.276.camel@pesky.s6portland> 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.027 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/396 X-Sequence-Number: 10086 > So if you perform a "select * from parent" then does postgres internally > create a union between all the child tables and return you the results > of that? Basically, yes. Kind of. Chris From pgsql-performance-owner@postgresql.org Fri Jan 21 18:16:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CB5F93A4BD4 for ; Fri, 21 Jan 2005 18:16: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 71913-05 for ; Fri, 21 Jan 2005 18:16:32 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 965343A4C59 for ; Fri, 21 Jan 2005 18:16:14 +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 1Cs3KM-00049T-00; Fri, 21 Jan 2005 13:16:10 -0500 To: ken Cc: Greg Stark , pgsql-performance@postgresql.org Subject: Re: inheritance performance References: <1106295545.6622.266.camel@pesky.s6portland> <87hdlaahez.fsf@stark.xeocode.com> <1106330319.6622.276.camel@pesky.s6portland> In-Reply-To: <1106330319.6622.276.camel@pesky.s6portland> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 21 Jan 2005 13:16:09 -0500 Message-ID: <87oefi8x7a.fsf@stark.xeocode.com> Lines: 18 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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/395 X-Sequence-Number: 10085 ken writes: > On Fri, 2005-01-21 at 08:14, Greg Stark wrote: > > ken writes: > > > > > >From my understanding, all the data for these columns in all the child > > > tables will be stored in this one parent table > > > > No, all the data is stored in the child table. > > So if you perform a "select * from parent" then does postgres internally > create a union between all the child tables and return you the results > of that? Essentially, yes. -- greg From pgsql-performance-owner@postgresql.org Fri Jan 21 18:19:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B87063A4B8E for ; Fri, 21 Jan 2005 18:18: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 72159-06 for ; Fri, 21 Jan 2005 18:18:05 +0000 (GMT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5EA2F3A4B17 for ; Fri, 21 Jan 2005 18:18:04 +0000 (GMT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.10.2+Sun/8.11.3) with ESMTP id j0LII0J01596; Fri, 21 Jan 2005 11:18:00 -0700 (MST) Message-ID: <41F14758.4030602@outputservices.com> Date: Fri, 21 Jan 2005 11:18:00 -0700 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: herve@elma.fr, pgsql-performance@postgresql.org Cc: Marty Scholes Subject: Re: PostgreSQL clustering VS MySQL clustering References: <41F144FE.30902@outputservices.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable 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: 200501/397 X-Sequence-Number: 10087 This is probably a lot easier than you would think. You say that your=20 DB will have lots of data, lots of updates and lots of reads. Very likely the disk bottleneck is mostly index reads and writes, with=20 some critical WAL fsync() calls. In the grand scheme of things, the=20 actual data is likely not accessed very often. The indexes can be put on a RAM disk tablespace and that's the end of=20 index problems -- just make sure you have enough memory available. Also = make sure that the machine can restart correctly after a crash: the=20 tablespace is dropped and recreated, along with the indexes. This will=20 cause a machine restart to take some time. After that, if the WAL fsync() calls are becoming a problem, put the WAL = files on a fast RAID array, etiher a card or external enclosure, that=20 has a good amount of battery-backed write cache. This way, the WAL=20 fsync() calls will flush quickly to the RAM and Pg can move on while the = RAID controller worries about putting the data to disk. With WAL, low=20 access time is usually more important than total throughput. The truth is that you could have this running for not much money. Good Luck, Marty > Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a =E9crit : > > Could you explain us what do you have in mind for that solution? I m= ean, > > forget the PostgreSQL (or any other database) restrictions and=20 > explain us > > how this hardware would be. Where the data would be stored? > > > > I've something in mind for you, but first I need to understand your = > needs! >=20 > I just want to make a big database as explained in my first mail ... At= the > beginning we will have aprox. 150 000 000 records ... each month we wil= l=20 > add > about 4/8 millions new rows in constant flow during the day ... and in = same > time web users will access to the database in order to read those data.= > Stored data are quite close to data stored by google ... (we are not=20 > making a > google clone ... just a lot of data many small values and some big ones= ... > that's why I'm comparing with google for data storage). > Then we will have a search engine searching into those data ... >=20 > Dealing about the hardware, for the moment we have only a bi-pentium Xe= on > 2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results=20 > ... so > we are thinking about a new solution with maybe several servers (server= > design may vary from one to other) ... to get a kind of cluster to get = > better > performance ... >=20 > Am I clear ? >=20 > Regards, From pgsql-performance-owner@postgresql.org Fri Jan 21 19:25:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 23B623A4C23 for ; Fri, 21 Jan 2005 19:24: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 87004-09 for ; Fri, 21 Jan 2005 19:24:36 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 4E0CC3A4C3C for ; Fri, 21 Jan 2005 19:24:19 +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: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 21 Jan 2005 14:23:24 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75CF@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL clustering VS MySQL clustering Thread-Index: AcT/7gBElSk5kmiUS4uBqgI3XC3USgAADexA From: "Merlin Moncure" To: "Chris Travers" Cc: 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: 200501/398 X-Sequence-Number: 10088 > >Technically, you can also set up a rule to do things on a select with DO > >ALSO. However putting update statements in there would be considered (at > >least by me) very bad form. Note that this is not a trigger because it > >does not operate at the row level [I know you knew that already :-)]. > > > > > > > Unfortunately, you can't. Select operations only allow a single rule, > and it must be a DO INSTEAD rule, unless this has changed in 8.0 and I > missed it in the docs. However, you can do this in a view by calling a > function either in the row definition or in the where clause. You're right...forgot about that. Heh, the do instead rule could be a set returning function which could (besides returning the set) do almost anything! So in theory it makes no difference...diclaimer: never tried doing this! Merlin From pgsql-performance-owner@postgresql.org Fri Jan 21 19:33:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D5CE03A4BD0 for ; Fri, 21 Jan 2005 19:32: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 89102-05 for ; Fri, 21 Jan 2005 19:32:36 +0000 (GMT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 515363A4C18 for ; Fri, 21 Jan 2005 19:32:14 +0000 (GMT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.10.2+Sun/8.11.3) with ESMTP id j0LJWCJ29489; Fri, 21 Jan 2005 12:32:13 -0700 (MST) Message-ID: <41F158BC.8070505@outputservices.com> Date: Fri, 21 Jan 2005 12:32:12 -0700 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance , rr@8x.ca Cc: Marty Scholes Subject: Re: PostgreSQL vs. Oracle vs. Microsoft References: <41F15407.5030207@outputservices.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: 200501/399 X-Sequence-Number: 10089 Randolf, You probably won't want to hear this, but this decision likely has nothing to do with brands, models, performance or applications. You are up against a pro salesman who is likely very good at what he does. Instead spewing all sorts of "facts" and statistics to your client, the salesman is probably trying to figure out what is driving your client. Do you know what is driving your client? Why does he want to switch? Why now? Why not next quarter? Why not last quarter? Why does he want to do the application at all? Forget the expected answers, e.g., "We need this application to enhance our competitiveness in the marketplace and increase the blah blah blah." Why does YOUR CLIENT actually care about any of this? Is he trying to impress his boss? Build his career? Demonstrate that he can manage a significant project? Is he trying to get rid of old code from an ex-coworker that he hated? Is it spite? Pride? Is he angling for a bigger budget next year? Is there someone who will be assigned to this project that your client wants to lord over? The list goes on and on, and there is no way that your client is going to admit the truth and say something like, "The real reason I want to do this right now is that my childhood rival at XYZ corp just did a project like this. I need to boost my ego, so I *MUST* do a bigger project, right now." You gotta read between the lines. How important is this and why? How urgent and why? Who all is behind this project? What are each individual's personal motivations? Does anyone resent a leader on the team and secretly wish for this project to fail? Once you know what is actually going on in people's heads, you can begin to build rapport and influence them. You can establish your own credibility and safety with your solution, while planting seeds of doubt about another solution. At its core, this decision is (very likely) not at all about RDBMS performance or anything else related to computing. Have you asked yourself why you care about one solution over another? What's driving you to push Pg over MS? Why? You might want to start answering those questions before you even talk to your client. Good Luck, Marty Randolf Richardson wrote: > I'm looking for recent performance statistics on PostgreSQL vs. Oracle > vs. Microsoft SQL Server. Recently someone has been trying to convince my > client to switch from SyBASE to Microsoft SQL Server (they originally > wanted > to go with Oracle but have since fallen in love with Microsoft). All this > time I've been recommending PostgreSQL for cost and stability (my own > testing > has shown it to be better at handling abnormal shutdowns and using fewer > system resources) in addition to true cross-platform compatibility. > > If I can show my client some statistics that PostgreSQL outperforms > these (I'm more concerned about it beating Oracle because I know that > Microsoft's stuff is always slower, but I need the information anyway to > protect my client from falling victim to a 'sales job'), then PostgreSQL > will > be the solution of choice as the client has always believed that they > need a > high-performance solution. > > I've already convinced them on the usual price, cross-platform > compatibility, open source, long history, etc. points, and I've been > assured > that if the performance is the same or better than Oracle's and Microsoft's > solutions that PostgreSQL is what they'll choose. > > Thanks in advance. > > From pgsql-performance-owner@postgresql.org Fri Jan 21 20:40:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 584713A4CBE for ; Fri, 21 Jan 2005 20:39: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 05067-04 for ; Fri, 21 Jan 2005 20:39:36 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id E084E3A4CC6 for ; Fri, 21 Jan 2005 20:38:28 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 27A811C8B3; Fri, 21 Jan 2005 14:38:27 -0600 (CST) Date: Fri, 21 Jan 2005 14:38:27 -0600 From: "Jim C. Nasby" To: pgsql-performance@postgresql.org Subject: Odd number of rows expected Message-ID: <20050121203827.GW67721@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/400 X-Sequence-Number: 10090 I have a query that thinks it's going to generate a huge number of rows, when in fact it won't: INSERT INTO page_log.rrs ( bucket_id, page_id,project_id,other, hits,min_hits,max_hits,total_duration,min_duration,max_duration ) SELECT a.rrs_bucket_id, page_id,project_id,other , count(*),count(*),count(*),sum(duration),min(duration),max(duration) FROM (SELECT b.bucket_id AS rrs_bucket_id, s.* FROM rrs.bucket b JOIN page_log.log s ON ( b.prev_end_time < log_time AND b.end_time >= log_time ) WHERE b.rrs_id = '1' AND b.end_time <= '2005-01-21 20:23:00+00' AND b.end_time > '1970-01-01 00:00:00+00' ) a GROUP BY rrs_bucket_id, page_id,project_id,other; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Subquery Scan "*SELECT*" (cost=170461360504.98..183419912556.69 rows=91175544 width=77) -> GroupAggregate (cost=170461360504.98..183418316984.67 rows=91175544 width=29) -> Sort (cost=170461360504.98..171639141309.21 rows=471112321692 width=29) Sort Key: b.bucket_id, s.page_id, s.project_id, s.other -> Nested Loop (cost=0.00..17287707964.10 rows=471112321692 width=29) -> Seq Scan on bucket b (cost=0.00..9275.84 rows=281406 width=20) Filter: ((rrs_id = 1) AND (end_time <= '2005-01-21 20:23:00+00'::timestamp with time zone) AND (end_time > '1970-01-01 00:00:00+00'::timestamp with time zone)) -> Index Scan using log__log_time on log s (cost=0.00..36321.24 rows=1674137 width=33) Index Cond: (("outer".prev_end_time < s.log_time) AND ("outer".end_time >= s.log_time)) The final rowcount after the aggregate will actually be about 1.9M rows: QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Subquery Scan "*SELECT*" (cost=170461360504.98..183419912556.69 rows=91175544 width=77) (actual time=156777.374..234613.843 rows=1945123 loops=1) -> GroupAggregate (cost=170461360504.98..183418316984.67 rows=91175544 width=29) (actual time=156777.345..214246.751 rows=1945123 loops=1) -> Sort (cost=170461360504.98..171639141309.21 rows=471112321692 width=29) (actual time=156777.296..177517.663 rows=4915567 loops=1) Sort Key: b.bucket_id, s.page_id, s.project_id, s.other -> Nested Loop (cost=0.00..17287707964.10 rows=471112321692 width=29) (actual time=0.662..90702.755 rows=4915567 loops=1) -> Seq Scan on bucket b (cost=0.00..9275.84 rows=281406 width=20) (actual time=0.063..1591.591 rows=265122 loops=1) Filter: ((rrs_id = 1) AND (end_time <= '2005-01-21 20:23:00+00'::timestamp with time zone) AND (end_time > '1970-01-01 00:00:00+00'::timestamp with time zone)) -> Index Scan using log__log_time on log s (cost=0.00..36321.24 rows=1674137 width=33) (actual time=0.014..0.174 rows=19 loops=265122) Index Cond: (("outer".prev_end_time < s.log_time) AND ("outer".end_time >= s.log_time)) Total runtime: 299623.954 ms Everything is analyzed, and the statistics target is set to 1000. Basically, it seems that it doesn't understand that each row in log will match up with at most one row in bucket. There is a unique index on bucket(rrs_id, end_time), so it should be able to tell this. -- 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 Sat Jan 22 00:20:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 105973A4D13 for ; Sat, 22 Jan 2005 00:19: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 36986-03 for ; Sat, 22 Jan 2005 00:19:37 +0000 (GMT) Received: from mail14.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by svr1.postgresql.org (Postfix) with ESMTP id A77F83A5113 for ; Fri, 21 Jan 2005 22:34:42 +0000 (GMT) Received: (qmail 30336 invoked from network); 21 Jan 2005 22:34:42 -0000 Received: from mail.kinesis-cem.com (HELO pdarley) ([64.81.9.230]) (envelope-sender ) by mail14.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 21 Jan 2005 22:34:41 -0000 From: "Peter Darley" To: "Tatsuo Ishii" , Cc: , , , Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 21 Jan 2005 14:34:40 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <20050121.104007.74755729.t-ishii@sra.co.jp> 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: 200501/402 X-Sequence-Number: 10092 Tatsuo, What would happen with SELECT queries that, through a function or some other mechanism, updates data in the database? Would those need to be passed to pgpool in some special way? Thanks, Peter Darley -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Tatsuo Ishii Sent: Thursday, January 20, 2005 5:40 PM To: darcy@wavefire.com Cc: jd@www.commandprompt.com; sfrost@snowman.net; herve@elma.fr; pgsql-performance@postgresql.org Subject: Re: [PERFORM] PostgreSQL clustering VS MySQL clustering > On January 20, 2005 06:49 am, Joshua D. Drake wrote: > > Stephen Frost wrote: > > >* Herv? Piedvache (herve@elma.fr) wrote: > > >>Le Jeudi 20 Janvier 2005 15:30, Stephen Frost a �crit : > > >>>* Herv? Piedvache (herve@elma.fr) wrote: > > >>>>Is there any solution with PostgreSQL matching these needs ... ? > > >>> > > >>>You might look into pg_pool. Another possibility would be slony, though > > >>>I'm not sure it's to the point you need it at yet, depends on if you can > > >>>handle some delay before an insert makes it to the slave select systems. > > >> > > >>I think not ... pgpool or slony are replication solutions ... but as I > > >> have said to Christopher Kings-Lynne how I'll manage the scalabilty of > > >> the database ? I'll need several servers able to load a database growing > > >> and growing to get good speed performance ... > > > > > >They're both replication solutions, but they also help distribute the > > >load. For example: > > > > > >pg_pool will distribute the select queries amoung the servers. They'll > > >all get the inserts, so that hurts, but at least the select queries are > > >distributed. > > > > > >slony is similar, but your application level does the load distribution > > >of select statements instead of pg_pool. Your application needs to know > > >to send insert statements to the 'main' server, and select from the > > >others. > > > > You can put pgpool in front of replicator or slony to get load > > balancing for reads. > > Last time I checked load ballanced reads was only available in pgpool if you > were using pgpools's internal replication. Has something changed recently? Yes. However it would be pretty easy to modify pgpool so that it could cope with Slony-I. I.e. 1) pgpool does the load balance and sends query to Slony-I's slave and master if the query is SELECT. 2) pgpool sends query only to the master if the query is other than SELECT. Remaining problem is that Slony-I is not a sync replication solution. Thus you need to prepare that the load balanced query results might differ among servers. If there's enough demand, I would do such that enhancements to pgpool. -- Tatsuo Ishii > > >>>>Is there any other solution than a Cluster for our problem ? > > >>> > > >>>Bigger server, more CPUs/disks in one box. Try to partition up your > > >>>data some way such that it can be spread across multiple machines, then > > >>>if you need to combine the data have it be replicated using slony to a > > >>>big box that has a view which joins all the tables and do your big > > >>>queries against that. > > >> > > >>But I'll arrive to limitation of a box size quickly I thing a 4 > > >> processors with 64 Gb of RAM ... and after ? > > > > Opteron. > > IBM Z-series, or other big iron. > > > > > >Go to non-x86 hardware after if you're going to continue to increase the > > >size of the server. Personally I think your better bet might be to > > >figure out a way to partition up your data (isn't that what google > > >does anyway?). > > > > > > Stephen > > -- > Darcy Buskermolen > Wavefire Technologies Corp. > ph: 250.717.0200 > fx: 250.763.1759 > http://www.wavefire.com > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) From pgsql-performance-owner@postgresql.org Fri Jan 21 23:26:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 641343A4C58 for ; Fri, 21 Jan 2005 23: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 25140-06 for ; Fri, 21 Jan 2005 23:23:32 +0000 (GMT) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by svr1.postgresql.org (Postfix) with ESMTP id 3D8B93A4CFE for ; Fri, 21 Jan 2005 23:23:31 +0000 (GMT) Received: from sysexperts.com (c-24-6-183-218.client.comcast.net[24.6.183.218]) by comcast.net (rwcrmhc12) with ESMTP id <2005012123233101400hm7c1e>; Fri, 21 Jan 2005 23:23:31 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Fri, 21 Jan 2005 15:23:30 -0800 id 00045215.41F18EF2.00003C1A Date: Fri, 21 Jan 2005 15:23:30 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-ID: <20050121232329.GA7164@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <1105333466.41e20cda39716@webmail.rawbw.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: Organization: Frobozzco International User-Agent: Mutt/1.5.6+20040907i 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: 200501/401 X-Sequence-Number: 10091 Randolf Richardson wrote: > > The best DB platform is what they currently have, regardless of what > > they have, unless there is a very compelling reason to switch. > [sNip] > > Have you heard the saying "Nobody ever got fired for picking IBM?" It > is one of those situations where if they don't spend the money in their > budget, then they lose it the next time around (no suggestions are needed > on this issue, but thanks anyway). If that's their situation, then they're almost certainly better off throwing the additional money at beefier hardware than at a more expensive database engine, because the amount of incremental performance they'll get is almost certainly going to be greater with better hardware than with a different database engine. In particular, they're probably best off throwing the money at the highest performance disk subsystem they can afford. But that, like anything else, depends on what they're going to be doing. If it's likely to be a small database with lots of processor-intensive analysis, then a beefier CPU setup would be in order. But in my (limited) experience, the disk subsystem is likely to be a bottleneck long before the CPU is in the general case, especially these days as disk subsystems haven't improved in performance nearly as quickly as CPUs have. -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Sat Jan 22 00:31:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9C40C3A4CC4 for ; Sat, 22 Jan 2005 00:30: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 38146-09 for ; Sat, 22 Jan 2005 00:30:43 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 4F3613A4D36 for ; Sat, 22 Jan 2005 00:30:45 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6936046; Fri, 21 Jan 2005 16:32:25 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: "Peter Darley" Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 21 Jan 2005 16:34:39 -0800 User-Agent: KMail/1.7.1 Cc: "Tatsuo Ishii" , darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr, pgsql-performance@postgresql.org References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501211634.39560.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/403 X-Sequence-Number: 10093 Peter, Tatsuo: would happen with SELECT queries that, through a function or some > other mechanism, updates data in the database? Would those need to be > passed to pgpool in some special way? Oh, yes, that reminds me. It would be helpful if pgPool accepted a control string ... perhaps one in a SQL comment ... which indicated that the statement to follow was, despite appearances, an update. For example: --STATEMENT_IS_UPDATE\n The alternative is, of course, that pgPool direct all explicit transactions to the master ... which is a good idea anyway. So you could do: BEGIN; SELECT some_update_function(); COMMIT; -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sat Jan 22 01:12:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F2DAF3A4D34 for ; Sat, 22 Jan 2005 01:09: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 44485-01 for ; Sat, 22 Jan 2005 01:09:33 +0000 (GMT) Received: from mailhost.ics.forth.gr (mailhost.ics.forth.gr [139.91.157.50]) by svr1.postgresql.org (Postfix) with ESMTP id BB4873A4B17 for ; Sat, 22 Jan 2005 01:09:34 +0000 (GMT) Received: from mailhost.ics.forth.gr (nemesis.ics.forth.gr [139.91.157.50]) by mailhost.ics.forth.gr (8.12.10/ICS-FORTH/V10-Server-1.0) with SMTP id j0M19PAT014828; Sat, 22 Jan 2005 03:09:30 +0200 (EET) Received: (from ASSP-nospam [127.0.0.1]) by mailhost.ics.forth.gr (SAVSMTP 3.1.0.29) with SMTP id M2005012203092901517 ; Sat, 22 Jan 2005 03:09:29 +0200 Received: from 139.91.82.28 ([139.91.82.28] helo=ourania.ics.forth.gr) by ASSP-nospam ; 22 Jan 05 01:09:29 -0000 Received: from ourania.ics.forth.gr (localhost [127.0.0.1]) by ourania.ics.forth.gr (8.12.10+Sun/8.12.2) with ESMTP id j0M19TXD006111; Sat, 22 Jan 2005 03:09:29 +0200 (EET) Received: from localhost (theohari@localhost) by ourania.ics.forth.gr (8.12.10+Sun/8.12.2/Submit) with ESMTP id j0M19SO4006108; Sat, 22 Jan 2005 03:09:29 +0200 (EET) Date: Sat, 22 Jan 2005 03:09:28 +0200 (EET) From: Ioannis Theoharis To: Greg Stark Cc: ken , pgsql-performance@postgresql.org Subject: Re: inheritance performance In-Reply-To: <87hdlaahez.fsf@stark.xeocode.com> Message-ID: References: <1106295545.6622.266.camel@pesky.s6portland> <87hdlaahez.fsf@stark.xeocode.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: 200501/404 X-Sequence-Number: 10094 On Fri, 21 Jan 2005, Greg Stark wrote: > There's also a slight performance hit because there's an optimization that the > planner does normally for simple queries that isn't currently done for either > UNION ALL or inherited tables. I think it's planned to fix that soon. Can you explain me in more details what kind of optimization is missing in that case? From pgsql-performance-owner@postgresql.org Sat Jan 22 03:04:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C2D993A4C21 for ; Sat, 22 Jan 2005 03:00: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 59218-10 for ; Sat, 22 Jan 2005 03:00:10 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id 424383A4AC0 for ; Sat, 22 Jan 2005 03:00:12 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id CBDF463296; Sat, 22 Jan 2005 12:00:11 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id B075F10CD06; Sat, 22 Jan 2005 12:00:11 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 86D9E10CD04; Sat, 22 Jan 2005 12:00:11 +0900 (JST) Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id MAA22591; Sat, 22 Jan 2005 12:00:11 +0900 Date: Sat, 22 Jan 2005 12:01:28 +0900 (JST) Message-Id: <20050122.120128.74753619.t-ishii@sra.co.jp> To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org, darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <200501210947.53938.josh@agliodbs.com> References: <200501201949.24292.josh@agliodbs.com> <20050121.170731.08315885.t-ishii@sra.co.jp> <200501210947.53938.josh@agliodbs.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/405 X-Sequence-Number: 10095 > Tatsuo, > > > Suppose table A gets updated on the master at time 00:00. Until 00:03 > > pgpool needs to send all queries regarding A to the master only. My > > question is, how can pgpool know a query is related to A? > > Well, I'm a little late to head off tangental discussion about this, but .... > > The systems where I've implemented something similar are for web applications. > In the case of the web app, you don't care if a most users see data which is > 2 seconds out of date; with caching and whatnot, it's often much more than > that! > > The one case where it's not permissable for a user to see "old" data is the > case where the user is updating the data. Namely: > > (1) 00:00 User A updates "My Profile" > (2) 00:01 "My Profile" UPDATE finishes executing. > (3) 00:02 User A sees "My Profile" re-displayed > (6) 00:04 "My Profile":UserA cascades to the last Slave server > > So in an application like the above, it would be a real problem if User A were > to get switched over to a slave server immediately after the update; she > would see the old data, assume that her update was not saved, and update > again. Or send angry e-mails to webmaster@. > > However, it makes no difference what User B sees: > > (1) 00:00 User A updates "My Profile"v1 Master > (2) 00:01 "My Profile" UPDATE finishes executing. Master > (3) 00:02 User A sees "My Profile"v2 displayed Master > (4) 00:02 User B requests "MyProfile":UserA Slave2 > (5) 00:03 User B sees "My Profile"v1 Slave2 > (6) 00:04 "My Profile"v2 cascades to the last Slave server Slave2 > > If the web application is structured properly, the fact that UserB is seeing > UserA's information which is 2 seconds old is not a problem (though it might > be for web auctions, where it could result in race conditions. Consider > memcached as a helper). This means that pgPool only needs to monitor > "update switching" by *connection* not by *table*. > > Make sense? I'm not clear what "pgPool only needs to monitor "update switching" by *connection* not by *table*" means. In your example: > (1) 00:00 User A updates "My Profile" > (2) 00:01 "My Profile" UPDATE finishes executing. > (3) 00:02 User A sees "My Profile" re-displayed > (6) 00:04 "My Profile":UserA cascades to the last Slave server I think (2) and (3) are on different connections, thus pgpool cannot judge if SELECT in (3) should go only to the master or not. To solve the problem you need to make pgpool understand "web sessions" not "database connections" and it seems impossible for pgpool to understand "sessions". -- Tatsuo Ishii From pgsql-performance-owner@postgresql.org Sat Jan 22 03:12:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D57D63A4D92 for ; Sat, 22 Jan 2005 03:12: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 63340-04 for ; Sat, 22 Jan 2005 03:11:44 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6495C3A4D90 for ; Sat, 22 Jan 2005 03:11:42 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id 275C5633F2; Sat, 22 Jan 2005 12:11:43 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id D2EC510CD06; Sat, 22 Jan 2005 12:11:42 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id BA6B410CD04; Sat, 22 Jan 2005 12:11:42 +0900 (JST) Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id MAA22956; Sat, 22 Jan 2005 12:11:42 +0900 Date: Sat, 22 Jan 2005 12:13:00 +0900 (JST) Message-Id: <20050122.121300.41631131.t-ishii@sra.co.jp> To: marty@outputservices.com Cc: herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <41F14758.4030602@outputservices.com> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/406 X-Sequence-Number: 10096 IMO the bottle neck is not WAL but table/index bloat. Lots of updates on large tables will produce lots of dead tuples. Problem is, There' is no effective way to reuse these dead tuples since VACUUM on huge tables takes longer time. 8.0 adds new vacuum delay paramters. Unfortunately this does not help. It just make the execution time of VACUUM longer, that means more and more dead tuples are being made while updating. Probably VACUUM works well for small to medium size tables, but not for huge ones. I'm considering about to implement "on the spot salvaging dead tuples". -- Tatsuo Ishii > This is probably a lot easier than you would think. You say that you= r = > DB will have lots of data, lots of updates and lots of reads. > = > Very likely the disk bottleneck is mostly index reads and writes, wit= h = > some critical WAL fsync() calls. In the grand scheme of things, the = > actual data is likely not accessed very often. > = > The indexes can be put on a RAM disk tablespace and that's the end of= = > index problems -- just make sure you have enough memory available. A= lso = > make sure that the machine can restart correctly after a crash: the = > tablespace is dropped and recreated, along with the indexes. This wi= ll = > cause a machine restart to take some time. > = > After that, if the WAL fsync() calls are becoming a problem, put the = WAL = > files on a fast RAID array, etiher a card or external enclosure, that= = > has a good amount of battery-backed write cache. This way, the WAL = > fsync() calls will flush quickly to the RAM and Pg can move on while = the = > RAID controller worries about putting the data to disk. With WAL, lo= w = > access time is usually more important than total throughput. > = > The truth is that you could have this running for not much money. > = > Good Luck, > Marty > = > > Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a =E9crit : > > > Could you explain us what do you have in mind for that solution?= I mean, > > > forget the PostgreSQL (or any other database) restrictions and = > > explain us > > > how this hardware would be. Where the data would be stored? > > > > > > I've something in mind for you, but first I need to understand y= our = > > needs! > > = > > I just want to make a big database as explained in my first mail ..= . At the > > beginning we will have aprox. 150 000 000 records ... each month we= will = > > add > > about 4/8 millions new rows in constant flow during the day ... and= in same > > time web users will access to the database in order to read those d= ata. > > Stored data are quite close to data stored by google ... (we are no= t = > > making a > > google clone ... just a lot of data many small values and some big = ones ... > > that's why I'm comparing with google for data storage). > > Then we will have a search engine searching into those data ... > > = > > Dealing about the hardware, for the moment we have only a bi-pentiu= m Xeon > > 2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance resul= ts = > > ... so > > we are thinking about a new solution with maybe several servers (se= rver > > design may vary from one to other) ... to get a kind of cluster to = get = > > better > > performance ... > > = > > Am I clear ? > > = > > Regards, > = > = > = > = > ---------------------------(end of broadcast)------------------------= --- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.o= rg) > = From pgsql-performance-owner@postgresql.org Sat Jan 22 03:49:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2B2E53A4D93 for ; Sat, 22 Jan 2005 03:38: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 66578-07 for ; Sat, 22 Jan 2005 03:38:08 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id 430143A4C86 for ; Sat, 22 Jan 2005 03:38:11 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id CE73363418; Sat, 22 Jan 2005 12:38:11 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id AA18E10CD06; Sat, 22 Jan 2005 12:38:11 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 873D310CD04; Sat, 22 Jan 2005 12:38:11 +0900 (JST) Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id MAA24029; Sat, 22 Jan 2005 12:38:11 +0900 Date: Sat, 22 Jan 2005 12:39:28 +0900 (JST) Message-Id: <20050122.123928.71087515.t-ishii@sra.co.jp> To: josh@agliodbs.com Cc: pdarley@kinesis-cem.com, darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <200501211634.39560.josh@agliodbs.com> References: <200501211634.39560.josh@agliodbs.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.012 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/407 X-Sequence-Number: 10097 > Peter, Tatsuo: > > would happen with SELECT queries that, through a function or some > > other mechanism, updates data in the database? Would those need to be > > passed to pgpool in some special way? > > Oh, yes, that reminds me. It would be helpful if pgPool accepted a control > string ... perhaps one in a SQL comment ... which indicated that the > statement to follow was, despite appearances, an update. For example: > --STATEMENT_IS_UPDATE\n Actually the way judging if it's a "pure" SELECT or not in pgpool is very simple. pgpool just checkes if the SQL statement exactly begins with "SELECT" (case insensitive, of course). So, for example, you could insert an SQL comment something like "/*this SELECT has side effect*/ at the beginning of line to indicate that pgpool should not send this query to the slave. > The alternative is, of course, that pgPool direct all explicit transactions to > the master ... which is a good idea anyway. So you could do: > > BEGIN; > SELECT some_update_function(); > COMMIT; Yes. pgpool has already done this in load balancing. Expanding this for Slony-I is pretty easy. -- Tatsuo Ishii From pgsql-performance-owner@postgresql.org Sat Jan 22 04:25:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 07EB03A4D34 for ; Sat, 22 Jan 2005 04:22: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 74787-03 for ; Sat, 22 Jan 2005 04:22:17 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id F3DE83A4C18 for ; Sat, 22 Jan 2005 04:22:16 +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 1CsCmr-0003jj-00; Fri, 21 Jan 2005 23:22:13 -0500 To: Ioannis Theoharis Cc: Greg Stark , ken , pgsql-performance@postgresql.org Subject: Re: inheritance performance References: <1106295545.6622.266.camel@pesky.s6portland> <87hdlaahez.fsf@stark.xeocode.com> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 21 Jan 2005 23:22:13 -0500 Message-ID: <87pszy6qkq.fsf@stark.xeocode.com> Lines: 17 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.056 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/408 X-Sequence-Number: 10098 Ioannis Theoharis writes: > Can you explain me in more details what kind of optimization is missing in > that case? Uh, no I can't really. It was mentioned on the mailing list with regards to UNION ALL specifically. I think it applied to inherited tables as well but I wouldn't know for sure. You could search the mailing list archives for recent discussions of partitioned tables. In any acse it was a purely technical detail. Some step in the processing of the data that could be skipped if there weren't any actual changes to the data being done or something like that. It made a small but noticeable difference in the runtime but nothing that made the technique infeasible. -- greg From pgsql-performance-owner@postgresql.org Sat Jan 22 13:18:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8BAFF3A427E for ; Sat, 22 Jan 2005 13:18: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 35786-03 for ; Sat, 22 Jan 2005 13:18:25 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.204]) by svr1.postgresql.org (Postfix) with ESMTP id 4961D3A4EA0 for ; Sat, 22 Jan 2005 13:18:27 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id z35so233577rne for ; Sat, 22 Jan 2005 05:18:27 -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=L8N6FC3YmBOUeXMjDeJq9wyzVmDxLyiKOdvBqigoYtBez314unuNq96KH6+vyPNFzS/K/cOEVsLiutWhMoVar0HoyHd8pgTF+K6/NRMnqbZ/Z2mNwFQjJuFIUSM4Z5ok9TGhGOEmar/9KXFbbB+9ihb+A7mcVu/ll1WmVj9T6FI= Received: by 10.38.104.5 with SMTP id b5mr41805rnc; Sat, 22 Jan 2005 05:18:27 -0800 (PST) Received: by 10.38.163.47 with HTTP; Sat, 22 Jan 2005 05:18:27 -0800 (PST) Message-ID: <758d5e7f0501220518477cedfa@mail.gmail.com> Date: Sat, 22 Jan 2005 14:18:27 +0100 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: pgsql-performance@postgresql.org Subject: PostgreSQL clustering VS MySQL clustering In-Reply-To: <758d5e7f050122011713f9e27f@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <758d5e7f050122011713f9e27f@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.556 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/409 X-Sequence-Number: 10099 On Sat, 22 Jan 2005 12:13:00 +0900 (JST), Tatsuo Ishii wrote: > IMO the bottle neck is not WAL but table/index bloat. Lots of updates > on large tables will produce lots of dead tuples. Problem is, There' > is no effective way to reuse these dead tuples since VACUUM on huge > tables takes longer time. 8.0 adds new vacuum delay > paramters. Unfortunately this does not help. It just make the > execution time of VACUUM longer, that means more and more dead tuples > are being made while updating. > > Probably VACUUM works well for small to medium size tables, but not > for huge ones. I'm considering about to implement "on the spot > salvaging dead tuples". Quick thought -- would it be to possible to implement a 'partial VACUUM' per analogiam to partial indexes? It would be then posiible to do: VACUUM footable WHERE footime < current_date - 60; after a statement to DELETE all/some rows older than 60 days. The VACUUM would check visibility of columns which are mentioned in an index (in this case: footable_footime_index ;)). Of course it is not a great solution, but could be great for doing housecleaning after large update/delete in a known range. ...and should be relatively simple to implement, I guess (maybe without 'ANALYZE' part). Regards, Dawid From pgsql-performance-owner@postgresql.org Sat Jan 22 17:21:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7CF733A4F4D for ; Sat, 22 Jan 2005 17:21: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 68530-07 for ; Sat, 22 Jan 2005 17:21:00 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 475D03A4F3F for ; Sat, 22 Jan 2005 17:20: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 1CsOwQ-0005Pl-00; Sat, 22 Jan 2005 12:20:54 -0500 To: Dawid Kuroczko Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <758d5e7f050122011713f9e27f@mail.gmail.com> <758d5e7f0501220518477cedfa@mail.gmail.com> In-Reply-To: <758d5e7f0501220518477cedfa@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 22 Jan 2005 12:20:53 -0500 Message-ID: <87brbh753e.fsf@stark.xeocode.com> Lines: 19 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.055 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/410 X-Sequence-Number: 10100 Dawid Kuroczko writes: > Quick thought -- would it be to possible to implement a 'partial VACUUM' > per analogiam to partial indexes? No. But it gave me another idea. Perhaps equally infeasible, but I don't see why. What if there were a map of modified pages. So every time any tuple was marked deleted it could be marked in the map as modified. VACUUM would only have to look at these pages. And if it could mark as free every tuple that was marked as deleted then it could unmark the page. The only downside I see is that this could be a source of contention on multi-processor machines running lots of concurrent update/deletes. -- greg From pgsql-performance-owner@postgresql.org Sat Jan 22 18:27:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4F31B3A4F24 for ; Sat, 22 Jan 2005 18:27: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 78548-03 for ; Sat, 22 Jan 2005 18:27:14 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id AE4333A4F58 for ; Sat, 22 Jan 2005 18:27:13 +0000 (GMT) Received: (qmail 22076 invoked by uid 500); 22 Jan 2005 18:41:24 -0000 Date: Sat, 22 Jan 2005 12:41:24 -0600 From: Bruno Wolff III To: Tatsuo Ishii Cc: marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050122184124.GA21889@wolff.to> Mail-Followup-To: Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050122.121300.41631131.t-ishii@sra.co.jp> 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: 200501/411 X-Sequence-Number: 10101 On Sat, Jan 22, 2005 at 12:13:00 +0900, Tatsuo Ishii wrote: > > Probably VACUUM works well for small to medium size tables, but not > for huge ones. I'm considering about to implement "on the spot > salvaging dead tuples". You are probably vacuuming too often. You want to wait until a significant fraction of a large table is dead tuples before doing a vacuum. If you are scanning a large table and only marking a few tuples as deleted, you aren't getting much bang for your buck. From pgsql-general-owner@postgresql.org Tue Jan 25 15:43:10 2005 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 C0FB53A4F37 for ; Sat, 22 Jan 2005 18:42: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 79934-05 for ; Sat, 22 Jan 2005 18:41:54 +0000 (GMT) Received: from mail.travelamericas.com (unknown [206.130.134.147]) by svr1.postgresql.org (Postfix) with SMTP id 0BCD83A4F05 for ; Sat, 22 Jan 2005 18:41:54 +0000 (GMT) Received: (qmail 9298 invoked from network); 22 Jan 2005 18:41:52 -0000 Received: from unknown (HELO ?10.0.0.253?) (10.0.0.253) by verkiel.travelamericas.com with SMTP; 22 Jan 2005 18:41:52 -0000 Message-ID: <41F29E70.40808@metatrontech.com> Date: Sat, 22 Jan 2005 10:41:52 -0800 From: Chris Travers User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matt.Casters@advalvas.be, pgsql-general , pgsql-general Subject: Re: [PERFORM] DWH on Postgresql References: <20050118213218.3F1CE22401E@asia.telenet-ops.be> In-Reply-To: <20050118213218.3F1CE22401E@asia.telenet-ops.be> Content-Type: multipart/mixed; boundary="------------020307010206040904070903" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/1379 X-Sequence-Number: 72328 This is a multi-part message in MIME format. --------------020307010206040904070903 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cross-posting to GENERAL for additional comment. Matt Casters wrote: > Hi, > > I have the go ahead of a customer to do some testing on Postgresql in > a couple of weeks as a replacement for Oracle. > The reason for the test is that the number of users of the warehouse > is going to increase and this will have a serious impact on licencing > costs. (I bet that sounds familiar) > > We're running a medium sized data warehouse on a Solaris box (4CPU, > 8Gb RAM) on Oracle. > Basically we have 2 large fact tables to deal with: one going for 400M > rows, the other will be hitting 1B rows soon. > (around 250Gb of data) I have heard of databases larger than 1TB on PostgreSQL. Don't have much experience with them. but here are thoughts that come to mind. > > My questions to the list are: has this sort of thing been attempted > before? If so, what where the results? If you search the archives (of the General list, I think) and you will be able to find people talking about databases much larger than this. More "look what PostgreSQL can do" rather than "I need help." > I've been reading up on partitioned tabes on pgsql, will the > performance benefit will be comparable to Oracle partitioned tables? I am not aware of any data to base such a comparison on. > What are the gotchas? A few I can think of: Cross-table indexes don't really work for constraing purposes, so you need to assume that only one table will be actively getting inserts/updates. Secondly, you will probably need to consider the level of transparency you need. If you need more transparency, you can do it with views, rules, etc. (or simply having on insert rules on your base table and inheriting new tables from it regularly). Also, I have seen posts in the past regarding performance issues specific to Solaris. You may want to research this too. > Should I be testing on 8 or the 7 version? > 8. Has better cache management, meaning will likely perform better. Hope this helps. It is not a typical question on the list, but if you start running into issues, this is a good list to ask question on :-) Best Wishes, Chris Travers Metatron Technology Consulting --------------020307010206040904070903 Content-Type: text/x-vcard; charset=utf-8; name="chris.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="chris.vcf" begin:vcard fn:Chris Travers n:Travers;Chris email;internet:chris@metatrontech.com x-mozilla-html:FALSE version:2.1 end:vcard --------------020307010206040904070903-- From pgsql-performance-owner@postgresql.org Sat Jan 22 19:00:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C96BC3A4F60 for ; Sat, 22 Jan 2005 19:00: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 81673-09 for ; Sat, 22 Jan 2005 19:00:27 +0000 (GMT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id B72443A4DE2 for ; Sat, 22 Jan 2005 19:00:27 +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 BA6D376A28; Sat, 22 Jan 2005 14:00:28 -0500 (EST) Subject: Re: PostgreSQL clustering VS MySQL clustering From: Rod Taylor To: Bruno Wolff III Cc: Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, Postgresql Performance In-Reply-To: <20050122184124.GA21889@wolff.to> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <20050122184124.GA21889@wolff.to> Content-Type: text/plain Date: Sat, 22 Jan 2005 14:00:40 -0500 Message-Id: <1106420440.35299.763.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.021 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/412 X-Sequence-Number: 10102 On Sat, 2005-01-22 at 12:41 -0600, Bruno Wolff III wrote: > On Sat, Jan 22, 2005 at 12:13:00 +0900, > Tatsuo Ishii wrote: > > > > Probably VACUUM works well for small to medium size tables, but not > > for huge ones. I'm considering about to implement "on the spot > > salvaging dead tuples". > > You are probably vacuuming too often. You want to wait until a significant > fraction of a large table is dead tuples before doing a vacuum. If you are > scanning a large table and only marking a few tuples as deleted, you aren't > getting much bang for your buck. The big problem occurs when you have a small set of hot tuples within a large table. In the time it takes to vacuum a table with 200M tuples one can update a small subset of that table many many times. Some special purpose vacuum which can target hot spots would be great, but I've always assumed this would come in the form of table partitioning and the ability to vacuum different partitions independently of each-other. -- From pgsql-performance-owner@postgresql.org Sat Jan 22 20:11:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 40C5C3A4FA3 for ; Sat, 22 Jan 2005 20:11: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 93047-02 for ; Sat, 22 Jan 2005 20:10:49 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id B21443A4FCC for ; Sat, 22 Jan 2005 20:10:50 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id B97E31C8FD; Sat, 22 Jan 2005 14:10:49 -0600 (CST) Date: Sat, 22 Jan 2005 14:10:49 -0600 From: "Jim C. Nasby" To: Greg Stark Cc: Dawid Kuroczko , pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050122201049.GR67721@decibel.org> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <758d5e7f050122011713f9e27f@mail.gmail.com> <758d5e7f0501220518477cedfa@mail.gmail.com> <87brbh753e.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87brbh753e.fsf@stark.xeocode.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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/413 X-Sequence-Number: 10103 >From http://developer.postgresql.org/todo.php: Maintain a map of recently-expired rows This allows vacuum to reclaim free space without requiring a sequential scan On Sat, Jan 22, 2005 at 12:20:53PM -0500, Greg Stark wrote: > Dawid Kuroczko writes: > > > Quick thought -- would it be to possible to implement a 'partial VACUUM' > > per analogiam to partial indexes? > > No. > > But it gave me another idea. Perhaps equally infeasible, but I don't see why. > > What if there were a map of modified pages. So every time any tuple was marked > deleted it could be marked in the map as modified. VACUUM would only have to > look at these pages. And if it could mark as free every tuple that was marked > as deleted then it could unmark the page. > > The only downside I see is that this could be a source of contention on > multi-processor machines running lots of concurrent update/deletes. > > -- > greg > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- 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 Sat Jan 22 20:22:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 44FB93A4DE2 for ; Sat, 22 Jan 2005 20:22: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 94816-04 for ; Sat, 22 Jan 2005 20:22: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 5696A3A4FBB for ; Sat, 22 Jan 2005 20:22:24 +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 j0MKMMVH024997; Sat, 22 Jan 2005 15:22:22 -0500 (EST) To: Greg Stark Cc: ken , pgsql-performance@postgresql.org Subject: Re: inheritance performance In-reply-to: <87hdlaahez.fsf@stark.xeocode.com> References: <1106295545.6622.266.camel@pesky.s6portland> <87hdlaahez.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "21 Jan 2005 11:14:12 -0500" Date: Sat, 22 Jan 2005 15:22:22 -0500 Message-ID: <24996.1106425342@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: 200501/414 X-Sequence-Number: 10104 Greg Stark writes: > ken writes: >> From my understanding, all the data for these columns in all the child >> tables will be stored in this one parent table > No, all the data is stored in the child table. Correct ... >> and that, furthermore, there is a "hidden" column in the parent table called >> tableoid that allows postgres to determine which row is stored in which >> child table. > That's true. > There's a performance hit for the extra space required to store the tableoid. Bzzzt ... tableoid isn't actually stored anywhere on disk. It's a pseudo-column that is generated during row fetch. (It works for all tables, not only inheritance children.) >> Given that, is there a performance hit for queries on the child tables >> because postgres has to effectively put a condition on every query based on >> the tableoid of the given child table? AFAIR, a query directed specifically to a child table is *completely* unaware of the fact that that table is a child. Only queries directed to a parent table, which have to implicitly UNION in the children, pay any price for inheritance. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jan 22 21:10:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B0EC23A4F58 for ; Sat, 22 Jan 2005 21:10: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 02020-03 for ; Sat, 22 Jan 2005 21:10: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 669923A4ED0 for ; Sat, 22 Jan 2005 21:10: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 j0MLANjY025336; Sat, 22 Jan 2005 16:10:23 -0500 (EST) To: Tatsuo Ishii Cc: marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-reply-to: <20050122.121300.41631131.t-ishii@sra.co.jp> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> Comments: In-reply-to Tatsuo Ishii message dated "Sat, 22 Jan 2005 12:13:00 +0900" Date: Sat, 22 Jan 2005 16:10:23 -0500 Message-ID: <25335.1106428223@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: 200501/415 X-Sequence-Number: 10105 Tatsuo Ishii writes: > Probably VACUUM works well for small to medium size tables, but not > for huge ones. I'm considering about to implement "on the spot > salvaging dead tuples". That's impossible on its face, except for the special case where the same transaction inserts and deletes a tuple. In all other cases, the transaction deleting a tuple cannot know whether it will commit. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 23 03:18:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8A5533A4FC4 for ; Sun, 23 Jan 2005 03:18: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 46111-06 for ; Sun, 23 Jan 2005 03:17: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 C455E3A3F0C for ; Sun, 23 Jan 2005 03:18: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 j0N3I0co026466; Sat, 22 Jan 2005 22:18:00 -0500 (EST) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: Odd number of rows expected In-reply-to: <20050121203827.GW67721@decibel.org> References: <20050121203827.GW67721@decibel.org> Comments: In-reply-to "Jim C. Nasby" message dated "Fri, 21 Jan 2005 14:38:27 -0600" Date: Sat, 22 Jan 2005 22:18:00 -0500 Message-ID: <26465.1106450280@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: 200501/416 X-Sequence-Number: 10106 "Jim C. Nasby" writes: > (SELECT b.bucket_id AS rrs_bucket_id, s.* > FROM rrs.bucket b > JOIN page_log.log s > ON ( > b.prev_end_time < log_time > AND b.end_time >= log_time ) > WHERE b.rrs_id = '1' > AND b.end_time <= '2005-01-21 20:23:00+00' > AND b.end_time > '1970-01-01 00:00:00+00' > ) a > Basically, it seems that it doesn't understand that each row in log will > match up with at most one row in bucket. There is a unique index on > bucket(rrs_id, end_time), so it should be able to tell this. Why should it be able to tell that? regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 23 05:50:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2528A3A5119 for ; Sun, 23 Jan 2005 05:50: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 68932-08 for ; Sun, 23 Jan 2005 05:50:27 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 954603A5102 for ; Sun, 23 Jan 2005 05:50:10 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6359D31D90; Sun, 23 Jan 2005 06:50:10 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sun, 23 Jan 2005 00:41:22 -0500 Organization: cbbrowne Computing Inc Lines: 55 Message-ID: References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 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.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:asj5OVGpOnscwiyaKoM4yzOcZ2g= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.333 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/417 X-Sequence-Number: 10107 In an attempt to throw the authorities off his trail, herve@elma.fr (Herv� Piedvache) transmitted: > Le Jeudi 20 Janvier 2005 15:24, Christopher Kings-Lynne a �crit : >> > Is there any solution with PostgreSQL matching these needs ... ? >> >> You want: http://www.slony.info/ >> >> > Do we have to backport our development to MySQL for this kind of problem >> > ? Is there any other solution than a Cluster for our problem ? >> >> Well, Slony does replication which is basically what you want :) >> >> Only master->slave though, so you will need to have all inserts go via >> the master server, but selects can come off any server. > > Sorry but I don't agree with this ... Slony is a replication > solution ... I don't need replication ... what will I do when my > database will grow up to 50 Gb ... I'll need more than 50 Gb of RAM > on each server ??? This solution is not very realistic for me ... Huh? Why on earth do you imagine that Slony-I requires a lot of memory? It doesn't. A fairly _large_ Slony-I process is about 10MB. There will be some demand for memory on the DB servers, but you don't need an enormous quantity of extra memory to run it. There is a MySQL "replicating/clustering" system that uses an in-memory database which means that if your DB is 50GB in size, you need something like 200GB of RAM. If you're thinking of that, that's not relevant to PostgreSQL or Slony-I... > I need a Cluster solution not a replication one or explain me in > details how I will do for managing the scalabilty of my database ... I'm not sure you understand clustering if you imagine it doesn't involve replication. There are numerous models for clustering, much as there are numerous RAID models. But the only sorts of clustering cases where you get to NOT do replication are the cases where all you're looking for from clustering is improved speed, and you're willing for any breakage on any host to potentially destroy your cluster. Perhaps you need to describe what you _think_ you mean by a "cluster solution." It may be that it'll take further thought to determine what you actually need... -- output = ("cbbrowne" "@" "gmail.com") http://www3.sympatico.ca/cbbrowne/postgresql.html "Not me, guy. I read the Bash man page each day like a Jehovah's Witness reads the Bible. No wait, the Bash man page IS the bible. Excuse me..." (More on confusing aliases, taken from comp.os.linux.misc) From pgsql-performance-owner@postgresql.org Sun Jan 23 05:50:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D9A963A515F for ; Sun, 23 Jan 2005 05:50: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 68977-06 for ; Sun, 23 Jan 2005 05:50:27 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 545BE3A513E for ; Sun, 23 Jan 2005 05:50:12 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B7B7831D91; Sun, 23 Jan 2005 06:50:11 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sun, 23 Jan 2005 00:46:51 -0500 Organization: cbbrowne Computing Inc Lines: 48 Message-ID: References: <200501201503.31241.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> <41EFC8B5.9040902@commandprompt.com> <200501201607.51659.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 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.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:nPrh5dxS28UBTsssVecm6VvF/a8= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.094 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/418 X-Sequence-Number: 10108 In the last exciting episode, herve@elma.fr (Herv� Piedvache) wrote: > Le Jeudi 20 Janvier 2005 16:05, Joshua D. Drake a �crit : >> Christopher Kings-Lynne wrote: >> >>> Or you could fork over hundreds of thousands of dollars for Oracle's >> >>> RAC. >> >> >> >> No please do not talk about this again ... I'm looking about a >> >> PostgreSQL solution ... I know RAC ... and I'm not able to pay for a >> >> RAC certify hardware configuration plus a RAC Licence. >> > >> > There is absolutely zero PostgreSQL solution... >> >> I just replied the same thing but then I was thinking. Couldn't he use >> multiple databases >> over multiple servers with dblink? >> >> It is not exactly how I would want to do it, but it would provide what >> he needs I think??? > > Yes seems to be the only solution ... but I'm a little disapointed about > this ... could you explain me why there is not this kind of > functionnality ... it seems to be a real need for big applications no ? If this is what you actually need, well, it's something that lots of people would sort of like to have, but it's really DIFFICULT to implement it. Partitioning data onto different servers appears like it ought to be a good idea. Unfortunately, getting _exactly_ the right semantics is hard. If the data is all truly independent, then it's no big deal; just have one server for one set of data, and another for the other. But reality normally is that if you _think_ you need a cluster, that's because some of the data needs to be _shared_, which means you need to either: a) Have queries that run across two databases, or b) Replicate the shared data between the systems. We're likely back to the need for replication. -- If this was helpful, rate me http://www3.sympatico.ca/cbbrowne/rdbms.html "It is the user who should parameterize procedures, not their creators." -- Alan Perlis From pgsql-performance-owner@postgresql.org Sun Jan 23 06:51:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 092A73A5119 for ; Sun, 23 Jan 2005 06:51: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 84681-06 for ; Sun, 23 Jan 2005 06:51:22 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 757ED3A3FF1 for ; Sun, 23 Jan 2005 06:50:16 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 318D031D90; Sun, 23 Jan 2005 07:50:16 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sun, 23 Jan 2005 00:58:28 -0500 Organization: cbbrowne Computing Inc Lines: 66 Message-ID: References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 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.1007 (Gnus v5.10.7) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:RDZjV2SyaPeIrrp3vwTeHhyuAXY= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.333 tagged_above=0 required=5 tests=AWL, INFO_TLD X-Spam-Level: X-Archive-Number: 200501/421 X-Sequence-Number: 10111 After a long battle with technology, herve@elma.fr (Herv� Piedvache), an earthling, wrote: > Joshua, > > Le Jeudi 20 Janvier 2005 15:44, Joshua D. Drake a �crit : >> Herv� Piedvache wrote: >> > >> >My company, which I actually represent, is a fervent user of PostgreSQL. >> >We used to make all our applications using PostgreSQL for more than 5 >> > years. We usually do classical client/server applications under Linux, >> > and Web interface (php, perl, C/C++). We used to manage also public web >> > services with 10/15 millions records and up to 8 millions pages view by >> > month. >> >> Depending on your needs either: >> >> Slony: www.slony.info >> >> or >> >> Replicator: www.commandprompt.com >> >> Will both do what you want. Replicator is easier to setup but >> Slony is free. > > No ... as I have said ... how I'll manage a database getting a table > of may be 250 000 000 records ? I'll need incredible servers ... to > get quick access or index reading ... no ? > > So what we would like to get is a pool of small servers able to make > one virtual server ... for that is called a Cluster ... no ? The term "cluster" simply indicates the use of multiple servers. There are numerous _DIFFERENT_ forms of "clusters," so that for someone to say "I want a cluster" commonly implies that since they didn't realize the need to specify things further, they really don't know what they want in a usefully identifiable way. > I know they are not using PostgreSQL ... but how a company like > Google do to get an incredible database in size and so quick access > ? Google has built a specialized application that evidently falls into the category known as "embarrassingly parallel." There are classes of applications that are amenable to parallelization. Those tend to be applications completely different from those implemented atop transactional data stores like PostgreSQL. If your problem is "embarrassingly parallel," then I'd bet lunch that PostgreSQL (and all other SQL databases) are exactly the _wrong_ tool for implementing its data store. If your problem is _not_ "embarrassingly parallel," then you'll almost certainly discover that the cheapest way to make it fast involves fitting all the data onto _one_ computer so that you do not have to pay the costs of transmitting data over slow inter-computer communications links. -- let name="cbbrowne" and tld="gmail.com" in String.concat "@" [name;tld];; http://www.ntlug.org/~cbbrowne/ It isn't that physicists enjoy physics more than they enjoy sex, its that they enjoy sex more when they are thinking of physics. From pgsql-performance-owner@postgresql.org Sun Jan 23 06:51:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4725A3A516D for ; Sun, 23 Jan 2005 06:51: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 84692-04 for ; Sun, 23 Jan 2005 06:51:22 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id DB83B3A5168 for ; Sun, 23 Jan 2005 06:50:17 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 39BD631D91; Sun, 23 Jan 2005 07:50:17 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sun, 23 Jan 2005 01:08:26 -0500 Organization: cbbrowne Computing Inc Lines: 38 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A75C9@Herge.rcsinc.local> <41F0269E.3040406@cheapcomplexdevices.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 (Corporate Culture, linux) Cancel-Lock: sha1:m+z/FHm5tkovS6n72GOUOH/Wrl4= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.094 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/419 X-Sequence-Number: 10109 Quoth Ron Mayer : > Merlin Moncure wrote: >> ...You need to build a bigger, faster box with lots of storage... >> Clustering ... B: will cost you more, not less > > > Is this still true when you get to 5-way or 17-way systems? > > My (somewhat outdated) impression is that up to about 4-way systems > they're price competitive; but beyond that, I thought multiple cheap > servers scales much more afordably than large servers. Certainly > at the point of a 129-CPU system I bet you're better off with a > network of cheap servers. Not necessarily. If you have 129 boxes that you're trying to keep synced, it is likely that the cost of syncing them will be greater than the other write load. If the problem being addressed is that a 4-way box won't handle the transaction load, it is unlikely that building a cluster of _smaller_ machines will help terribly much. The reason to "cluster" in the context of a transactional system is that you need improved _reliability_. Since communications between servers is _thousands_ of times slower than communicating with local memory, you have to be willing to live with an ENORMOUS degradation of performance when hosts are synchronized. And if "real estate" has a cost, where you have to pay for rack space, having _fewer_ machines is preferable to having more. -- output = ("cbbrowne" "@" "gmail.com") http://www.ntlug.org/~cbbrowne/postgresql.html If con is the opposite of pro, is Congress the opposite of progress? From pgsql-performance-owner@postgresql.org Sun Jan 23 06:51:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F3DFA3A5154 for ; Sun, 23 Jan 2005 06:51: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 84781-04 for ; Sun, 23 Jan 2005 06:51:22 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 347883A50AC for ; Sun, 23 Jan 2005 06:50:18 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 91C9E31D92; Sun, 23 Jan 2005 07:50:17 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Cheaper VACUUMing Date: Sun, 23 Jan 2005 01:16:20 -0500 Organization: cbbrowne Computing Inc Lines: 33 Message-ID: References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <758d5e7f050122011713f9e27f@mail.gmail.com> <758d5e7f0501220518477cedfa@mail.gmail.com> <87brbh753e.fsf@stark.xeocode.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 (Corporate Culture, linux) Cancel-Lock: sha1:GqW+uK6OKCOcjKFLQnETvgLdwqM= 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: 200501/420 X-Sequence-Number: 10110 A long time ago, in a galaxy far, far away, gsstark@mit.edu (Greg Stark) wrote: > Dawid Kuroczko writes: > >> Quick thought -- would it be to possible to implement a 'partial VACUUM' >> per analogiam to partial indexes? > > No. > > But it gave me another idea. Perhaps equally infeasible, but I don't see why. > > What if there were a map of modified pages. So every time any tuple > was marked deleted it could be marked in the map as modified. VACUUM > would only have to look at these pages. And if it could mark as free > every tuple that was marked as deleted then it could unmark the > page. > > The only downside I see is that this could be a source of contention > on multi-processor machines running lots of concurrent > update/deletes. I was thinking the same thing after hearing fairly extensive "pooh-poohing" of the notion of vacuuming based on all the pages in the shared cache. This "hot list page table" would probably need to be a hash table. It rather parallels the FSM, including the way that it would need to be limited in size. -- wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com'). http://cbbrowne.com/info/lsf.html Rules of the Evil Overlord #57. "Before employing any captured artifacts or machinery, I will carefully read the owner's manual." From pgsql-performance-owner@postgresql.org Sun Jan 23 20:21:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D97653A3F27 for ; Sun, 23 Jan 2005 20:21: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 35045-03 for ; Sun, 23 Jan 2005 20:21:27 +0000 (GMT) Received: from cmailg2.svr.pol.co.uk (cmailg2.svr.pol.co.uk [195.92.195.172]) by svr1.postgresql.org (Postfix) with ESMTP id 13EA53A4CF1 for ; Sun, 23 Jan 2005 20:21:23 +0000 (GMT) Received: from modem-624.llama.dialup.pol.co.uk ([217.135.178.112] helo=192.168.0.102) by cmailg2.svr.pol.co.uk with esmtp (Exim 4.14) id 1CsoEY-00043M-6G; Sun, 23 Jan 2005 20:21:18 +0000 Subject: Re: PostgreSQL clustering VS MySQL clustering From: Simon Riggs To: Tatsuo Ishii Cc: Tom Lane , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org In-Reply-To: <25335.1106428223@sss.pgh.pa.us> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> Content-Type: text/plain Organization: 2nd Quadrant Date: Sun, 23 Jan 2005 20:15:52 +0000 Message-Id: <1106511352.31592.112.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/422 X-Sequence-Number: 10112 On Sat, 2005-01-22 at 16:10 -0500, Tom Lane wrote: > Tatsuo Ishii writes: > > Probably VACUUM works well for small to medium size tables, but not > > for huge ones. I'm considering about to implement "on the spot > > salvaging dead tuples". > > That's impossible on its face, except for the special case where the > same transaction inserts and deletes a tuple. In all other cases, the > transaction deleting a tuple cannot know whether it will commit. Perhaps Tatsuo has an idea... As Tom says, if you have only a single row version and then you update that row to create a second version, then we must not remove the first version, since it is effectively the Undo copy. However, if there were already 2+ row versions, then as Tatsuo suggests, it might be possible to use on the spot salvaging of dead tuples. It might be worth checking the Xid of the earlier row version(s), to see if they are now expired and could be removed immediately. However, if you had a high number of concurrent updaters, this extra effort would not be that useful, since the other row versions might still be transaction-in-progress versions. That would mean implementing this idea would be useful often, but not in the case of repeatedly updated rows. Changing the idea slightly might be better: if a row update would cause a block split, then if there is more than one row version then we vacuum the whole block first, then re-attempt the update. That way we wouldn't do the row every time, just when it becomes a problem. I'm suggesting putting a call to vacuum_page() into heap_update(), immediately before any call to RelationGetBufferForTuple(). We already know that page splitting is an expensive operation, so doing some work to try to avoid that could frequently pay off. This would be isolated to updating. This wouldn't remove the need for vacuuming, but it would act to prevent severe performance degradation caused by frequent re-updating. What do you think? -- Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Sun Jan 23 20:40:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 63CCB3A4C54 for ; Sun, 23 Jan 2005 20:40: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 14433-02 for ; Sun, 23 Jan 2005 20:40: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 533943A19A5 for ; Sun, 23 Jan 2005 20:40:11 +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 j0NKe32j006347; Sun, 23 Jan 2005 15:40:03 -0500 (EST) To: Simon Riggs Cc: Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-reply-to: <1106511352.31592.112.camel@localhost.localdomain> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> Comments: In-reply-to Simon Riggs message dated "Sun, 23 Jan 2005 20:15:52 +0000" Date: Sun, 23 Jan 2005 15:40:03 -0500 Message-ID: <6346.1106512803@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: 200501/423 X-Sequence-Number: 10113 Simon Riggs writes: > Changing the idea slightly might be better: if a row update would cause > a block split, then if there is more than one row version then we vacuum > the whole block first, then re-attempt the update. "Block split"? I think you are confusing tables with indexes. Chasing down prior versions of the same row is not very practical anyway, since there is no direct way to find them. One possibility is, if you tried to insert a row on a given page but there's not room, to look through the other rows on the same page to see if any are deletable (xmax below the GlobalXmin event horizon). This strikes me as a fairly expensive operation though, especially when you take into account the need to get rid of their index entries first. Moreover, the check would often be unproductive. The real issue with any such scheme is that you are putting maintenance costs into the critical paths of foreground processes that are executing user queries. I think that one of the primary advantages of the Postgres storage design is that we keep that work outside the critical path and delegate it to maintenance processes that can run in the background. We shouldn't lightly toss away that advantage. There was some discussion in Toronto this week about storing bitmaps that would tell VACUUM whether or not there was any need to visit individual pages of each table. Getting rid of useless scans through not-recently-changed areas of large tables would make for a significant reduction in the cost of VACUUM. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 23 22:18:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 85AA73A4F84 for ; Sun, 23 Jan 2005 22:18: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 86340-02 for ; Sun, 23 Jan 2005 22:18:36 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 8ED0D3A4F24 for ; Sun, 23 Jan 2005 22:18:37 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 3437E1C8FD; Sun, 23 Jan 2005 16:18:38 -0600 (CST) Date: Sun, 23 Jan 2005 16:18:38 -0600 From: "Jim C. Nasby" To: Christopher Browne Cc: pgsql-performance@postgresql.org Subject: Re: Cheaper VACUUMing Message-ID: <20050123221838.GC67721@decibel.org> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <758d5e7f050122011713f9e27f@mail.gmail.com> <758d5e7f0501220518477cedfa@mail.gmail.com> <87brbh753e.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/424 X-Sequence-Number: 10114 For reference, here's the discussion about this that took place on hackers: http://lnk.nu/archives.postgresql.org/142.php On Sun, Jan 23, 2005 at 01:16:20AM -0500, Christopher Browne wrote: > A long time ago, in a galaxy far, far away, gsstark@mit.edu (Greg Stark) wrote: > > Dawid Kuroczko writes: > > > >> Quick thought -- would it be to possible to implement a 'partial VACUUM' > >> per analogiam to partial indexes? > > > > No. > > > > But it gave me another idea. Perhaps equally infeasible, but I don't see why. > > > > What if there were a map of modified pages. So every time any tuple > > was marked deleted it could be marked in the map as modified. VACUUM > > would only have to look at these pages. And if it could mark as free > > every tuple that was marked as deleted then it could unmark the > > page. > > > > The only downside I see is that this could be a source of contention > > on multi-processor machines running lots of concurrent > > update/deletes. > > I was thinking the same thing after hearing fairly extensive > "pooh-poohing" of the notion of vacuuming based on all the pages in > the shared cache. > > This "hot list page table" would probably need to be a hash table. It > rather parallels the FSM, including the way that it would need to be > limited in size. > -- > wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com'). > http://cbbrowne.com/info/lsf.html > Rules of the Evil Overlord #57. "Before employing any captured > artifacts or machinery, I will carefully read the owner's manual." > > > ---------------------------(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 Sun Jan 23 22:21:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 94DB13A4C2D for ; Sun, 23 Jan 2005 22:21: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 86364-03 for ; Sun, 23 Jan 2005 22:21:32 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id D07AC3A4EB8 for ; Sun, 23 Jan 2005 22:21:34 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 86B8F1C8F3; Sun, 23 Jan 2005 16:21:34 -0600 (CST) Date: Sun, 23 Jan 2005 16:21:34 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050123222134.GD67721@decibel.org> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6346.1106512803@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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/425 X-Sequence-Number: 10115 On Sun, Jan 23, 2005 at 03:40:03PM -0500, Tom Lane wrote: > There was some discussion in Toronto this week about storing bitmaps > that would tell VACUUM whether or not there was any need to visit > individual pages of each table. Getting rid of useless scans through > not-recently-changed areas of large tables would make for a significant > reduction in the cost of VACUUM. FWIW, that's already on the TODO. See also http://lnk.nu/archives.postgresql.org/142.php. -- 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 Sun Jan 23 22:29:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4E0323A506A for ; Sun, 23 Jan 2005 22:29: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 87017-04 for ; Sun, 23 Jan 2005 22:29:40 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id 2413C3A4F38 for ; Sun, 23 Jan 2005 22:29:41 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id 2C0D71C8F3; Sun, 23 Jan 2005 16:29:42 -0600 (CST) Date: Sun, 23 Jan 2005 16:29:42 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: Odd number of rows expected Message-ID: <20050123222942.GE67721@decibel.org> References: <20050121203827.GW67721@decibel.org> <26465.1106450280@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26465.1106450280@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.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/426 X-Sequence-Number: 10116 On Sat, Jan 22, 2005 at 10:18:00PM -0500, Tom Lane wrote: > "Jim C. Nasby" writes: > > (SELECT b.bucket_id AS rrs_bucket_id, s.* > > FROM rrs.bucket b > > JOIN page_log.log s > > ON ( > > b.prev_end_time < log_time > > AND b.end_time >= log_time ) > > WHERE b.rrs_id = '1' > > AND b.end_time <= '2005-01-21 20:23:00+00' > > AND b.end_time > '1970-01-01 00:00:00+00' > > ) a > > > Basically, it seems that it doesn't understand that each row in log will > > match up with at most one row in bucket. There is a unique index on > > bucket(rrs_id, end_time), so it should be able to tell this. > > Why should it be able to tell that? Indexes: "rrs_bucket__rrs_id__end_time" unique, btree (rrs_id, end_time) Err, crap, I guess that wouldn't work, because of prev_end_time not being in there... In english, each bucket defines a specific time period, and no two buckets can over-lap (though there's no constraints defined to actually prevent that). So reality is that each row in page_log.log will in fact only match one row in bucket (at least for each value of rrs_id). Given that, would the optimizer make a better choice if it knew that (since it means a much smaller result set). Is there any way to tell the optimizer this is the case? Maybe what I ultimately need is a timestamp with interval datatype, that specifies an interval that's fixed in time. -- 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 Sun Jan 23 22:39:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 283173A501F for ; Sun, 23 Jan 2005 22:39: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 88005-03 for ; Sun, 23 Jan 2005 22:39:11 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id EA5163A51CF for ; Sun, 23 Jan 2005 22:39: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 j0NMdC4Z007192; Sun, 23 Jan 2005 17:39:12 -0500 (EST) To: "Jim C. Nasby" Cc: pgsql-performance@postgresql.org Subject: Re: Odd number of rows expected In-reply-to: <20050123222942.GE67721@decibel.org> References: <20050121203827.GW67721@decibel.org> <26465.1106450280@sss.pgh.pa.us> <20050123222942.GE67721@decibel.org> Comments: In-reply-to "Jim C. Nasby" message dated "Sun, 23 Jan 2005 16:29:42 -0600" Date: Sun, 23 Jan 2005 17:39:12 -0500 Message-ID: <7191.1106519952@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: 200501/427 X-Sequence-Number: 10117 "Jim C. Nasby" writes: > In english, each bucket defines a specific time period, and no two > buckets can over-lap (though there's no constraints defined to actually > prevent that). So reality is that each row in page_log.log will in fact > only match one row in bucket (at least for each value of rrs_id). > Given that, would the optimizer make a better choice if it knew that > (since it means a much smaller result set). Given that the join condition is not an equality, there's no hope of using hash or merge join; so the join itself is about as good as you're gonna get. With a more accurate rows estimate for the join result, it might have decided to use HashAggregate instead of Sort/GroupAggregate, but AFAICS that would not have made a huge difference ... at best maybe 25% of the total query time. > Is there any way to tell the > optimizer this is the case? Nope. This gets back to the old problem of not having any cross-column (cross-table in this case) statistics. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 23 22:43:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F07B23A4CEA for ; Sun, 23 Jan 2005 22:43: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 88627-01 for ; Sun, 23 Jan 2005 22:43:22 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id D2D8D3A4F50 for ; Sun, 23 Jan 2005 22:43:24 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6942119; Sun, 23 Jan 2005 14:45:06 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sun, 23 Jan 2005 14:42:52 -0800 User-Agent: KMail/1.6.2 Cc: Tatsuo Ishii , darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr References: <200501201949.24292.josh@agliodbs.com> <200501210947.53938.josh@agliodbs.com> <20050122.120128.74753619.t-ishii@sra.co.jp> In-Reply-To: <20050122.120128.74753619.t-ishii@sra.co.jp> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501231442.52830.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: 200501/428 X-Sequence-Number: 10118 Tatsuo, > I'm not clear what "pgPool only needs to monitor "update switching" by > > *connection* not by *table*" means. In your example: > > (1) 00:00 User A updates "My Profile" > > (2) 00:01 "My Profile" UPDATE finishes executing. > > (3) 00:02 User A sees "My Profile" re-displayed > > (6) 00:04 "My Profile":UserA cascades to the last Slave server > > I think (2) and (3) are on different connections, thus pgpool cannot > judge if SELECT in (3) should go only to the master or not. > > To solve the problem you need to make pgpool understand "web sessions" > not "database connections" and it seems impossible for pgpool to > understand "sessions". Depends on your connection pooling software, I suppose. Most connection pooling software only returns connections to the pool after a user has been inactive for some period ... generally more than 3 seconds. So connection continuity could be trusted. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 25 13:38:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DA5543A55A3 for ; Tue, 25 Jan 2005 13: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 59235-03 for ; Tue, 25 Jan 2005 13:37:08 +0000 (GMT) Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) by svr1.postgresql.org (Postfix) with ESMTP id 4EBA83A5578 for ; Tue, 25 Jan 2005 13:37:10 +0000 (GMT) Received: from fuji.krosing.net (localhost [127.0.0.1]) by fuji.krosing.net (8.13.1/8.13.1) with ESMTP id j0NNSgK4006674; Mon, 24 Jan 2005 01:28:42 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.13.1/8.13.1/Submit) id j0NNSUQ8006672; Mon, 24 Jan 2005 01:28:30 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: PostgreSQL clustering VS MySQL clustering From: Hannu Krosing To: Rod Taylor Cc: =?ISO-8859-1?Q?Herv=E9?= Piedvache , Christopher Kings-Lynne , Postgresql Performance In-Reply-To: <1106236978.35299.496.camel@home> References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> <1106236978.35299.496.camel@home> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Date: Mon, 24 Jan 2005 01:28:29 +0200 Message-Id: <1106522910.5790.1.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) 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: 200501/460 X-Sequence-Number: 10150 =DChel kenal p=E4eval (neljap=E4ev, 20. jaanuar 2005, 11:02-0500), kirjutas Rod Taylor: > Slony has some other issues with databases > 200GB in size as well > (well, it hates long running transactions -- and pg_dump is a regular > long running transaction) IIRC it hates pg_dump mainly on master. If you are able to run pg_dump from slave, it should be ok. --=20 Hannu Krosing From pgsql-performance-owner@postgresql.org Tue Jan 25 13:36:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5FA263A45E6 for ; Tue, 25 Jan 2005 13:36: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 58530-09 for ; Tue, 25 Jan 2005 13:36:21 +0000 (GMT) Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) by svr1.postgresql.org (Postfix) with ESMTP id 165083A5536 for ; Tue, 25 Jan 2005 13:36:23 +0000 (GMT) Received: from fuji.krosing.net (localhost [127.0.0.1]) by fuji.krosing.net (8.13.1/8.13.1) with ESMTP id j0NNiiec006695; Mon, 24 Jan 2005 01:44:44 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.13.1/8.13.1/Submit) id j0NNidUG006694; Mon, 24 Jan 2005 01:44:39 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: PostgreSQL clustering VS MySQL clustering From: Hannu Krosing To: =?ISO-8859-1?Q?Herv=E9?= Piedvache Cc: "Joshua D. Drake" , pgsql-performance@postgresql.org In-Reply-To: <200501201600.47583.herve@elma.fr> References: <200501201503.31241.herve@elma.fr> <41EFC3C0.6080903@commandprompt.com> <200501201600.47583.herve@elma.fr> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Date: Mon, 24 Jan 2005 01:44:39 +0200 Message-Id: <1106523879.5790.5.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) 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: 200501/459 X-Sequence-Number: 10149 =DChel kenal p=E4eval (neljap=E4ev, 20. jaanuar 2005, 16:00+0100), kirjutas Herv=E9 Piedvache: > > Will both do what you want. Replicator is easier to setup but > > Slony is free. >=20 > No ... as I have said ... how I'll manage a database getting a table of m= ay be=20 > 250 000 000 records ? I'll need incredible servers ... to get quick acces= s or=20 > index reading ... no ? >=20 > So what we would like to get is a pool of small servers able to make one=20 > virtual server ... for that is called a Cluster ... no ? >=20 > I know they are not using PostgreSQL ... but how a company like Google do= to=20 > get an incredible database in size and so quick access ? They use lots of boxes and lots custom software to implement a very specific kind of cluster. > regards, --=20 Hannu Krosing From pgsql-performance-owner@postgresql.org Mon Jan 24 00:26:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 788C53A5285 for ; Mon, 24 Jan 2005 00:21: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 00154-04 for ; Mon, 24 Jan 2005 00:21:51 +0000 (GMT) Received: from mail.esphion.com (mail.esphion.com [202.6.75.178]) by svr1.postgresql.org (Postfix) with ESMTP id 3ACF03A5244 for ; Mon, 24 Jan 2005 00:21:52 +0000 (GMT) Received: (qmail 29379 invoked from network); 24 Jan 2005 00:20:21 -0000 Received: from unknown (HELO conker.?none?) (10.0.1.137) by mail.esphion.com with SMTP; 24 Jan 2005 00:20:21 -0000 Received: (nullmailer pid 11695 invoked by uid 10001); Mon, 24 Jan 2005 00:21:50 -0000 Date: Mon, 24 Jan 2005 13:21:50 +1300 From: Guy Thornley To: Tom Lane Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050124002150.GA19730@conker.esphion.com> Reply-To: Guy Thornley References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6346.1106512803@sss.pgh.pa.us> User-Agent: Mutt/1.5.5.1+cvs20040105i 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: 200501/429 X-Sequence-Number: 10119 > The real issue with any such scheme is that you are putting maintenance > costs into the critical paths of foreground processes that are executing > user queries. I think that one of the primary advantages of the > Postgres storage design is that we keep that work outside the critical > path and delegate it to maintenance processes that can run in the > background. We shouldn't lightly toss away that advantage. As a rather naive user, I'd consider modifying the FSM so that it has pages with 'possibly freeable' space on them, as well as those with free space. This way when the pages of actually free space is depleted, the list of 'possibly freeable' pages could be vacuumed (as a batch for that relation) then placed on the actually-free list like vacuum currently does Since there is concern about critical path performance, there could be an extra backend process that would wake up perodically (or on a signal) and vacuum the pages, so theyre not processed inline with some transaction. Then grabbing a page with free space is the same as it is currently. Actually I was hoping to find some time to investigate this myself, but my employer is keeping me busy with other tasks ;/. Our particular data management problems could be mitigated much better with a data partitioning approach, anyway. On another note, is anybody investigating backing up the FSM with disk files so when the FSM size exceeds memory allocated, the appropriate data is swapped to disk? At least since 7.4 you no longer need a VACUUM when postgres starts, to learn about free space ;) - Guy Thornley From pgsql-performance-owner@postgresql.org Mon Jan 24 01:29:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D87853A4F57 for ; Mon, 24 Jan 2005 01:29: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 06370-06 for ; Mon, 24 Jan 2005 01:29:23 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3D3A33A52A8 for ; Mon, 24 Jan 2005 01:29:24 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id B7B2064317; Mon, 24 Jan 2005 10:29:18 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id 9FFC710CD06; Mon, 24 Jan 2005 10:29:18 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 80B3910CD04; Mon, 24 Jan 2005 10:29:18 +0900 (JST) Received: from localhost (IDENT:t-ishii@dhcp-171-173.sra.co.jp [133.137.171.173]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id KAA15656; Mon, 24 Jan 2005 10:29:18 +0900 Date: Mon, 24 Jan 2005 10:30:33 +0900 (JST) Message-Id: <20050124.103033.21930526.t-ishii@sra.co.jp> To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org, darcy@wavefire.com, jd@www.commandprompt.com, sfrost@snowman.net, herve@elma.fr Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <200501231442.52830.josh@agliodbs.com> References: <200501210947.53938.josh@agliodbs.com> <20050122.120128.74753619.t-ishii@sra.co.jp> <200501231442.52830.josh@agliodbs.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/430 X-Sequence-Number: 10120 > Tatsuo, > > > I'm not clear what "pgPool only needs to monitor "update switching" by > > > > *connection* not by *table*" means. In your example: > > > (1) 00:00 User A updates "My Profile" > > > (2) 00:01 "My Profile" UPDATE finishes executing. > > > (3) 00:02 User A sees "My Profile" re-displayed > > > (6) 00:04 "My Profile":UserA cascades to the last Slave server > > > > I think (2) and (3) are on different connections, thus pgpool cannot > > judge if SELECT in (3) should go only to the master or not. > > > > To solve the problem you need to make pgpool understand "web sessions" > > not "database connections" and it seems impossible for pgpool to > > understand "sessions". > > Depends on your connection pooling software, I suppose. Most connection > pooling software only returns connections to the pool after a user has been > inactive for some period ... generally more than 3 seconds. So connection > continuity could be trusted. Not sure what you mean by "most connection pooling software", but I'm sure that pgpool behaves differently. -- Tatsuo Ishii From pgsql-performance-owner@postgresql.org Tue Jan 25 13:38:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6D1B53A555C for ; Tue, 25 Jan 2005 13:36: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 59063-04 for ; Tue, 25 Jan 2005 13:36:13 +0000 (GMT) Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) by svr1.postgresql.org (Postfix) with ESMTP id 040123A5413 for ; Tue, 25 Jan 2005 13:36:15 +0000 (GMT) Received: from fuji.krosing.net (localhost [127.0.0.1]) by fuji.krosing.net (8.13.1/8.13.1) with ESMTP id j0O1uboE006884; Mon, 24 Jan 2005 03:56:39 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.13.1/8.13.1/Submit) id j0O1uQiJ006883; Mon, 24 Jan 2005 03:56:26 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: PostgreSQL clustering VS MySQL clustering From: Hannu Krosing To: Tom Lane Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org In-Reply-To: <6346.1106512803@sss.pgh.pa.us> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Date: Mon, 24 Jan 2005 03:56:25 +0200 Message-Id: <1106531786.5790.9.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) 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: 200501/461 X-Sequence-Number: 10151 =DChel kenal p=E4eval (p=FChap=E4ev, 23. jaanuar 2005, 15:40-0500), kirjuta= s Tom Lane: > Simon Riggs writes: > > Changing the idea slightly might be better: if a row update would cause > > a block split, then if there is more than one row version then we vacuu= m > > the whole block first, then re-attempt the update. >=20 > "Block split"? I think you are confusing tables with indexes. >=20 > Chasing down prior versions of the same row is not very practical > anyway, since there is no direct way to find them. >=20 > One possibility is, if you tried to insert a row on a given page but > there's not room, to look through the other rows on the same page to see > if any are deletable (xmax below the GlobalXmin event horizon). This > strikes me as a fairly expensive operation though, especially when you > take into account the need to get rid of their index entries first. Why is removing index entries essential ? In pg yuo always have to visit data page, so finding the wrong tuple there could just produce the same result as deleted tuple (which in this case it actually is). The cleaning of index entries could be left to the real vacuum. --=20 Hannu Krosing From pgsql-performance-owner@postgresql.org Mon Jan 24 02:51:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BBF93A5244 for ; Mon, 24 Jan 2005 02:51: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 15546-04 for ; Mon, 24 Jan 2005 02:51:28 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id E600B3A5022 for ; Mon, 24 Jan 2005 02:51:31 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id BED4E6207B; Mon, 24 Jan 2005 11:51:31 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id 9A8E210CD04; Mon, 24 Jan 2005 11:51:31 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id CE59C10CD07; Mon, 24 Jan 2005 11:51:30 +0900 (JST) Received: from localhost (IDENT:t-ishii@dhcp-171-173.sra.co.jp [133.137.171.173]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id LAA19288; Mon, 24 Jan 2005 11:51:29 +0900 Date: Mon, 24 Jan 2005 11:52:44 +0900 (JST) Message-Id: <20050124.115244.35008937.t-ishii@sra.co.jp> To: tgl@sss.pgh.pa.us Cc: marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <25335.1106428223@sss.pgh.pa.us> References: <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/431 X-Sequence-Number: 10121 > Tatsuo Ishii writes: > > Probably VACUUM works well for small to medium size tables, but not > > for huge ones. I'm considering about to implement "on the spot > > salvaging dead tuples". > > That's impossible on its face, except for the special case where the > same transaction inserts and deletes a tuple. In all other cases, the > transaction deleting a tuple cannot know whether it will commit. Of course. We need to keep a list of such that tuples until commit or abort. -- Tatsuo Ishii From pgsql-performance-owner@postgresql.org Mon Jan 24 07:57:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3F1CE3A5359 for ; Mon, 24 Jan 2005 07:57: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 58408-07 for ; Mon, 24 Jan 2005 07:57:03 +0000 (GMT) Received: from hotmail.com (bay14-dav8.bay14.hotmail.com [64.4.48.112]) by svr1.postgresql.org (Postfix) with ESMTP id BC0813A5323 for ; Mon, 24 Jan 2005 07:57:03 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 23 Jan 2005 23:57:01 -0800 Message-ID: Received: from 144.136.239.156 by BAY14-DAV8.phx.gbl with DAV; Mon, 24 Jan 2005 07:56:42 +0000 X-Originating-IP: [144.136.239.156] X-Originating-Email: [space_ball_one@hotmail.com] X-Sender: space_ball_one@hotmail.com From: "SpaceBallOne" To: Subject: poor performance of db? Date: Mon, 24 Jan 2005 15:56:41 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001D_01C5022D.4B8098F0" 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-OriginalArrivalTime: 24 Jan 2005 07:57:01.0360 (UTC) FILETIME=[494BB300:01C501EA] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=4.47 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, FORGED_MUA_OUTLOOK, HTML_30_40, HTML_MESSAGE, MSGID_FROM_MTA_HEADER X-Spam-Level: **** X-Archive-Number: 200501/432 X-Sequence-Number: 10122 This is a multi-part message in MIME format. ------=_NextPart_000_001D_01C5022D.4B8098F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello everyone, First time poster to the mailing list here.=20 We have been running pgsql for about a year now at a pretty basic level = (I guess) as a backend for custom web (intranet) application software. = Our database so far is a "huge" (note sarcasm) 10 Mb containing of about = 6 or so principle tables.=20 Our 'test' screen we've been using loads a 600kb HTML document which is = basically a summary of our client's orders. It took originally 11.5 = seconds to load in internet explorer (all 10.99 seconds were pretty much = taken up by postgres processes on a freebsd server).=20 I then re-wrote the page to use a single select query to call all the = information needed by PHP to draw the screen. That managed to shave it = down to 3.5 seconds... but this so far is as fast as I can get the page = to load. Have tried vacuuming and creating indexes but to no avail. = (increasing shared mem buffers yet to be done) Now heres the funny bit ...=20 Every time I tested an idea to speed it up, I got exactly the same = loading time on a Athlon 1800+, 256Mb RAM, 20Gb PATA computer as = compared to a Dual Opteron 246, 1Gb RAM, 70Gb WD Raptor SATA server. = Now, why a dual opteron machine can't perform any faster than a lowly = 1800+ athlon in numerous tests is completely beyond me ... increased = memory and RAID 0 disc configurations so far have not resulted in any = significant performance gain in the opteron server. Do these facts sound right? If postgres is meant to be a 200Gb = industrial strength database, should it really be taking this long = pulling 600kb worth of info from a 10Mb database? And why no performance = difference between two vastly different hardware spec'd computers??? Am = I missing some vital postgres.conf setting?? Any advice welcome. Thanks, Dave space_ball_one@hotmail.com ------=_NextPart_000_001D_01C5022D.4B8098F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello everyone,

First time = poster to the=20 mailing list here.
 
We have been running pgsql for about a = year now at=20 a pretty basic level (I guess) as a backend for custom=20 web (intranet) application software. Our database so far = is a=20 "huge" (note sarcasm) 10 Mb containing of about 6 or so principle=20 tables. 
 
Our 'test' screen we've been using = loads a 600kb=20 HTML document which is basically a summary of our client's orders. = It took=20 originally 11.5 seconds to load in internet explorer (all 10.99 seconds = were=20 pretty much taken up by postgres processes on a freebsd server). =
 
I then re-wrote the page to use a = single select=20 query to call all the information needed by PHP to draw the screen. = That=20 managed to shave it down to 3.5 seconds... but this so far is as fast as = I can=20 get the page to load. Have tried vacuuming and creating indexes but to = no avail.=20 (increasing shared mem buffers yet to be done)
 
Now heres the funny bit ... =

Every time I=20 tested an idea to speed it up, I got exactly the same loading time on a = Athlon=20 1800+, 256Mb RAM, 20Gb PATA computer as compared to a Dual Opteron 246, = 1Gb RAM,=20 70Gb WD Raptor SATA server. Now, why a dual opteron machine can't = perform=20 any faster than a lowly 1800+ athlon in numerous tests is completely = beyond me=20 .. increased memory and RAID 0 disc configurations so far have not = resulted in=20 any significant performance gain in the opteron server.
 
Do these facts sound right? If postgres = is meant to=20 be a 200Gb industrial strength database, should it really be taking this = long=20 pulling 600kb worth of info from a 10Mb database? And why no performance = difference between two vastly different hardware spec'd computers??? Am = I=20 missing some vital postgres.conf setting??

Any advice=20 welcome.

Thanks,
Dave
space_ball_one@hotmail.com=
 
------=_NextPart_000_001D_01C5022D.4B8098F0-- From pgsql-performance-owner@postgresql.org Mon Jan 24 08:47:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9FE7F3A53BF for ; Mon, 24 Jan 2005 08:47: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 66983-10 for ; Mon, 24 Jan 2005 08:47:09 +0000 (GMT) Received: from cmailg4.svr.pol.co.uk (cmailg4.svr.pol.co.uk [195.92.195.174]) by svr1.postgresql.org (Postfix) with ESMTP id 7BA963A5351 for ; Mon, 24 Jan 2005 08:47:09 +0000 (GMT) Received: from modem-42.leopard.dialup.pol.co.uk ([217.135.144.42] helo=192.168.0.102) by cmailg4.svr.pol.co.uk with esmtp (Exim 4.41) id 1CszsG-00062Y-RC; Mon, 24 Jan 2005 08:47:05 +0000 Subject: Faster and more frequent VACUUM (was PostgreSQL clustering VS MySQL clustering) From: Simon Riggs To: Tom Lane Cc: Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org In-Reply-To: <6346.1106512803@sss.pgh.pa.us> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> Content-Type: text/plain Organization: 2nd Quadrant Date: Mon, 24 Jan 2005 08:41:37 +0000 Message-Id: <1106556097.31592.139.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/433 X-Sequence-Number: 10123 On Sun, 2005-01-23 at 15:40 -0500, Tom Lane wrote: > Simon Riggs writes: > > Changing the idea slightly might be better: if a row update would cause > > a block split, then if there is more than one row version then we vacuum > > the whole block first, then re-attempt the update. > > "Block split"? I think you are confusing tables with indexes. Terminologically loose, as ever. :( I meant both tables and indexes and was referring to the part of the algorithm that is entered when we have a block-full situation. > Chasing down prior versions of the same row is not very practical > anyway, since there is no direct way to find them. > > One possibility is, if you tried to insert a row on a given page but > there's not room, to look through the other rows on the same page to see > if any are deletable (xmax below the GlobalXmin event horizon). This > strikes me as a fairly expensive operation though, especially when you > take into account the need to get rid of their index entries first. Thats what I was suggesting, vac the whole page, not just those rows. Doing it immediately greatly increases the chance that the index blocks would be in cache also. > Moreover, the check would often be unproductive. > The real issue with any such scheme is that you are putting maintenance > costs into the critical paths of foreground processes that are executing > user queries. I think that one of the primary advantages of the > Postgres storage design is that we keep that work outside the critical > path and delegate it to maintenance processes that can run in the > background. We shouldn't lightly toss away that advantage. Completely agree. ...which is why I was trying to find a place for such an operation in-front-of another expensive operation which is also currently on the critical path. That way there might be benefit rather than just additional overhead. > There was some discussion in Toronto this week about storing bitmaps > that would tell VACUUM whether or not there was any need to visit > individual pages of each table. Getting rid of useless scans through > not-recently-changed areas of large tables would make for a significant > reduction in the cost of VACUUM. ISTM there are two issues here, which are only somewhat related: - speed of VACUUM on large tables - ability to run VACUUM very frequently on very frequently updated tables The needs-maintenance bitmap idea hits both, whilst the on-the-spot idea only hits the second one, even if it does it +/- better. Gut feel says we would implement only one idea...so... On balance that indicates the need-maintenance bitmap is a better idea, and one for which we already have existing code. A few questions... - wouldn't we need a bitmap per relation? - wouldn't all the extra bitmaps need to be cached in shared_buffers, which could use up a good proportion of buffer cache space - maybe we should use a smaller block size and a different cache for it - how would we update the bitmap without creating a new LWlock that needs to be acquired for every block write and so reducing scalability? - would this be implemented as an option for each table, so that we could avoid the implementation overhead? (Or perhaps don't have a bitmap if table is less than 16 blocks?) -- Best Regards, Simon Riggs From pgsql-performance-owner@postgresql.org Mon Jan 24 09:18:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A385E3A5425 for ; Mon, 24 Jan 2005 09:18: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 73898-05 for ; Mon, 24 Jan 2005 09:18:10 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id 919853A5419 for ; Mon, 24 Jan 2005 09:18:10 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 57so152972wri for ; Mon, 24 Jan 2005 01:18:10 -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=mcQEcKxijcgcZfzXgwAnPRGwWs9EPoNcIqMsqafPinAJEGsvDkwa+rqpX/ykmOGHJ9NueCysBIEJHkr7X4za5UxSJzXiZkHd2SOATzz2b8btGRsWMQjiHx58pTZER+65RJ2l2CT6nNCF9UoEBY/JtC5Aw7b07MCi/bdoo7j679k= Received: by 10.54.26.35 with SMTP id 35mr117548wrz; Mon, 24 Jan 2005 01:18:10 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 24 Jan 2005 01:18:10 -0800 (PST) Message-ID: <2989532e05012401184b0c3ef9@mail.gmail.com> Date: Mon, 24 Jan 2005 14:48:10 +0530 From: Antony Paul Reply-To: Antony Paul To: pgsql-performance@postgresql.org Subject: How to boost performance of ilike queries ? 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.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/434 X-Sequence-Number: 10124 Hi, I have a query which is executed using ilike. The query values are received from user and it is executed using PreparedStatement. Currently all queries are executed as it is using iilike irrespective of whether it have a pattern matching character or not. Can using = instead of ilike boot performance ?. If creating index can help then how the index should be created on lower case or uppercase ?. rgds Antony Paul From pgsql-performance-owner@postgresql.org Mon Jan 24 09:23:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6BCDF3A5436 for ; Mon, 24 Jan 2005 09:23: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 74308-10 for ; Mon, 24 Jan 2005 09:23:07 +0000 (GMT) Received: from devel.greip.ee (devel.greip.ee [194.126.99.220]) by svr1.postgresql.org (Postfix) with ESMTP id 0ACA03A5409 for ; Mon, 24 Jan 2005 09:23:05 +0000 (GMT) Received: from [192.168.40.64] (unknown [192.168.40.64]) by devel.greip.ee (Postfix) with ESMTP id 7907C1B705; Mon, 24 Jan 2005 11:23:03 +0200 (EET) Message-ID: <41F4BE45.4040402@uptime.ee> Date: Mon, 24 Jan 2005 11:22:13 +0200 From: Andrei Reinus User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041222 X-Accept-Language: en-us, en MIME-Version: 1.0 To: SpaceBallOne Cc: pgsql-performance@postgresql.org Subject: Re: poor performance of db? References: In-Reply-To: X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------070205050907030705000202" 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: 200501/435 X-Sequence-Number: 10125 This is a multi-part message in MIME format. --------------070205050907030705000202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit SpaceBallOne wrote: > Hello everyone, > > First time poster to the mailing list here. > > We have been running pgsql for about a year now at a pretty basic > level (I guess) as a backend for custom > web (intranet) application software. Our database so far is a "huge" > (note sarcasm) 10 Mb containing of about 6 or so principle tables. > > Our 'test' screen we've been using loads a 600kb HTML document which > is basically a summary of our client's orders. It took originally 11.5 > seconds to load in internet explorer (all 10.99 seconds were pretty > much taken up by postgres processes on a freebsd server). > > I then re-wrote the page to use a single select query to call all the > information needed by PHP to draw the screen. That managed to shave it > down to 3.5 seconds... but this so far is as fast as I can get the > page to load. Have tried vacuuming and creating indexes but to no > avail. (increasing shared mem buffers yet to be done) > > Now heres the funny bit ... > > Every time I tested an idea to speed it up, I got exactly the same > loading time on a Athlon 1800+, 256Mb RAM, 20Gb PATA computer as > compared to a Dual Opteron 246, 1Gb RAM, 70Gb WD Raptor SATA server. > Now, why a dual opteron machine can't perform any faster than a lowly > 1800+ athlon in numerous tests is completely beyond me .. increased > memory and RAID 0 disc configurations so far have not resulted in any > significant performance gain in the opteron server. > > Do these facts sound right? If postgres is meant to be a 200Gb > industrial strength database, should it really be taking this long > pulling 600kb worth of info from a 10Mb database? And why no > performance difference between two vastly different hardware spec'd > computers??? Am I missing some vital postgres.conf setting?? > > Any advice welcome. > > Thanks, > Dave > space_ball_one@hotmail.com > Could you give us a bit more info. What you are trying to do. EXPLAIN ANALYZE would be great. In my experience first problem with the first db app is no indexes used in joining. -- -- Andrei Reinus --------------070205050907030705000202 Content-Type: text/x-vcard; charset=utf-8; name="andrei.reinus.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="andrei.reinus.vcf" begin:vcard fn:Andrei Reinus n:Reinus;Andrei org;quoted-printable:Uptime O=C3=9C;GreipCRM adr:;;Kompani 1C;Tartu;Tartu;;Estonia email;internet:andrei.reinus@uptime.ee title:Spetsiaaltarkvara arendaja tel;cell:+37253460005 x-mozilla-html:TRUE url:http://www.uptime.ee version:2.1 end:vcard --------------070205050907030705000202-- From pgsql-performance-owner@postgresql.org Mon Jan 24 09:59:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30DC73A546A for ; Mon, 24 Jan 2005 09:59: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 81293-05 for ; Mon, 24 Jan 2005 09:58:58 +0000 (GMT) Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) by svr1.postgresql.org (Postfix) with SMTP id 2BB1E3A5464 for ; Mon, 24 Jan 2005 09:58:57 +0000 (GMT) Received: (qmail 13716 invoked from network); 24 Jan 2005 09:58:55 -0000 Received: from unknown (HELO wizzard.pws.com.au) (russell@pws.com.au@138.217.55.142) by mail.pws.com.au with SMTP; 24 Jan 2005 09:58:55 -0000 From: Russell Smith To: Antony Paul Subject: Re: How to boost performance of ilike queries ? Date: Mon, 24 Jan 2005 20:58:54 +1100 User-Agent: KMail/1.7 Cc: pgsql-performance@postgresql.org References: <2989532e05012401184b0c3ef9@mail.gmail.com> In-Reply-To: <2989532e05012401184b0c3ef9@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501242058.54670.mr-russ@pws.com.au> 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: 200501/436 X-Sequence-Number: 10126 On Mon, 24 Jan 2005 08:18 pm, Antony Paul wrote: > Hi, > I have a query which is executed using ilike. The query values are > received from user and it is executed using PreparedStatement. > Currently all queries are executed as it is using iilike irrespective > of whether it have a pattern matching character or not. Can using = > instead of ilike boot performance ?. If creating index can help then > how the index should be created on lower case or uppercase ?. > It depends on the type of queries you are doing. changing it to something like lower(column) like lower('text%'), and creating an index on lower(column) will give you much better performance. If you have % in the middle of the query, it will still be slow, but I assume that is not the general case. I am not sure what the effect of it being prepared will be, however I've had much success with the method above without the queries being prepared. Others may be able to offer advice about if prepare will effect it. Regards Russell Smith From pgsql-performance-owner@postgresql.org Mon Jan 24 10:39:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42C973A543E for ; Mon, 24 Jan 2005 10:39: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 89834-02 for ; Mon, 24 Jan 2005 10:38:53 +0000 (GMT) Received: from my.endian.it (unknown [62.146.87.34]) by svr1.postgresql.org (Postfix) with ESMTP id D198A3A53EF for ; Mon, 24 Jan 2005 10:38:50 +0000 (GMT) Received: from [192.168.1.6] (host77-118.pool80180.interbusiness.it [80.180.118.77]) (authenticated (0 bits)) by my.endian.it (8.11.6/8.11.6) with ESMTP id j0OBMOt28244; Mon, 24 Jan 2005 12:22:24 +0100 Subject: Re: poor performance of db? From: Chris Mair To: SpaceBallOne Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain Message-Id: <1106563126.7157.51.camel@dell> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Mon, 24 Jan 2005 11:38:47 +0100 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: 200501/437 X-Sequence-Number: 10127 > I then re-wrote the page to use a single select query to call all the > information needed by PHP to draw the screen. That managed to shave it > down to 3.5 seconds... but this so far is as fast as I can get the > page to load. Have tried vacuuming and creating indexes but to no > avail. (increasing shared mem buffers yet to be done) If you call this select statement directly from psql instead of through the PHP thing, does timing change? (just to make sure, time is actually spent in the query and not somewhere else) PS: use \timing in psql to see timing information Bye, Chris. From pgsql-performance-owner@postgresql.org Mon Jan 24 14:01:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 038283A53AF for ; Mon, 24 Jan 2005 14:01: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 26907-02 for ; Mon, 24 Jan 2005 14:01:48 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 5A9443A5399 for ; Mon, 24 Jan 2005 14:01:50 +0000 (GMT) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: How to boost performance of ilike queries ? Date: Mon, 24 Jan 2005 09:01:49 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75D2@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] How to boost performance of ilike queries ? Thread-Index: AcUB/PTfNdGFbR9aSw2JD0dbhahJzwAHti/g From: "Merlin Moncure" To: "Russell Smith" Cc: 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: 200501/438 X-Sequence-Number: 10128 Russell wrote: > I am not sure what the effect of it being prepared will be, however I've > had much success > with the method above without the queries being prepared. Others may be > able to offer advice > about if prepare will effect it. >=20 There are two general cases I tend to use prepared queries. First case is when there is an extremely complex plan generation step that you want to skip. IMO, this is fairly rare in the normal course of doing things. Second case is when you have a relatively simple query that gets executed very, very frequently, such as select a,b,c from t where k. Even though the query plan is simple, using a prepared query can shave 5-15% off your query time depending on various factors (on a low latency network). If you fire off the statement a lot, this adds up. Not generally worthwhile to go this route if you are executing over a high latency network like the internet. If your application behavior can benefit from the second case, it can probably benefit from using parse/bind as well...use ExecPrepared, etc. libpq interface functions. The cumulative savings of using ExecPrepared() vs. using vanilla PQExec() (for simple queries over a high latency network) can be 50% or better. This is both from client's perspective and in server CPU load (especially when data is read from cache). This is most interesting to driver and middleware writers who broker data exchange between the application and the data. The performance minded application developer (who can make calls to the connection object) can take advantage of this however. Merlin From pgsql-performance-owner@postgresql.org Mon Jan 24 14:14:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9A42A3A4FF5 for ; Mon, 24 Jan 2005 14:14: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 29342-01 for ; Mon, 24 Jan 2005 14:14:33 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by svr1.postgresql.org (Postfix) with ESMTP id 109323A53A7 for ; Mon, 24 Jan 2005 14:14:36 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 57so178897wri for ; Mon, 24 Jan 2005 06:14:36 -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=O3K6YtnbUMxBTRP3z96hDy7TXZTjUH15vQ9G5sHIQbnNRSUlDruiL1Ev7KELsFgMonOvxvK87clPaUl1RHI8w5ngCvpcOtHMOtTmKFqPGIPlk8FyiPxNPRpZ3RqRUpWTfgDlJ+FjN3QKkQ6gpuwq/8/wxavBk8KwJcV6YChXM1E= Received: by 10.54.22.7 with SMTP id 7mr662762wrv; Mon, 24 Jan 2005 06:14:36 -0800 (PST) Received: by 10.54.31.32 with HTTP; Mon, 24 Jan 2005 06:14:36 -0800 (PST) Message-ID: <2989532e0501240614197b2ac0@mail.gmail.com> Date: Mon, 24 Jan 2005 19:44:36 +0530 From: Antony Paul Reply-To: Antony Paul To: Merlin Moncure Subject: Re: How to boost performance of ilike queries ? Cc: Russell Smith , pgsql-performance@postgresql.org In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75D2@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75D2@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/439 X-Sequence-Number: 10129 I used PreparedStatements to avoid SQL injection attack and it is the best way to do in JDBC. rgds Antony Paul On Mon, 24 Jan 2005 09:01:49 -0500, Merlin Moncure wrote: > Russell wrote: > > I am not sure what the effect of it being prepared will be, however > I've > > had much success > > with the method above without the queries being prepared. Others may > be > > able to offer advice > > about if prepare will effect it. > > > There are two general cases I tend to use prepared queries. First case > is when there is an extremely complex plan generation step that you want > to skip. IMO, this is fairly rare in the normal course of doing things. > > Second case is when you have a relatively simple query that gets > executed very, very frequently, such as select a,b,c from t where k. > Even though the query plan is simple, using a prepared query can shave > 5-15% off your query time depending on various factors (on a low latency > network). If you fire off the statement a lot, this adds up. Not > generally worthwhile to go this route if you are executing over a high > latency network like the internet. > > If your application behavior can benefit from the second case, it can > probably benefit from using parse/bind as well...use ExecPrepared, etc. > libpq interface functions. > > The cumulative savings of using ExecPrepared() vs. using vanilla > PQExec() (for simple queries over a high latency network) can be 50% or > better. This is both from client's perspective and in server CPU load > (especially when data is read from cache). This is most interesting to > driver and middleware writers who broker data exchange between the > application and the data. The performance minded application developer > (who can make calls to the connection object) can take advantage of this > however. > > Merlin > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Mon Jan 24 15:31:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C89AC3A5257 for ; Mon, 24 Jan 2005 15:31: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 44342-07 for ; Mon, 24 Jan 2005 15:31:01 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 778333A5564 for ; Mon, 24 Jan 2005 15:31:04 +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: Re: [SQL] OFFSET impact on Performance??? Date: Mon, 24 Jan 2005 10:30:22 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75D3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcT/N+4djEMtlVN7T0W+C9y89Jp0PAC75iXQ From: "Merlin Moncure" To: Cc: 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: 200501/440 X-Sequence-Number: 10130 Alex wrote: > How do you create a temporary view that has only a small subset of the > data from the DB init? (Links to docs are fine - I can read ;). My > query isn't all that complex, and my number of records might be from > 10 to 2k depending on how I implement it. Well, you can't. My point was that the traditional query/view approach is often more appropriate for these cases. =20 Cursors are really designed to provide an in-transaction working set. Because of this, they provide the luxury of absolute addressing which is normally impossible in SQL. =20 Queries allow for relative addressing, in other words 'fetch me the next c of x based on y'. This is a good thing, because it forces the application developer to consider changes that happen from other users while browsing a dataset. Applications that don't use transactions should not provide any guarantees about the data in between queries like the number of records matching a certain criteria. This is a trap that many developers fall into, especially when coming from flat file databases that use to allow this. This puts particularly nasty constraints on web application developers who are unable to hold a transaction between page refreshes. However this just a variant of SQL developer trap #2, which is that you are not supposed to hold a transaction open waiting for user input. In your particular case IMO what you really need is a materialized view. Currently, it is possible to rig them up in a fashion with plgsql that may or may not meet your requirements. Given some careful thought, mat-views can be used to solve all kinds of nasty performance related issues (and it all boils down to performance, otherwise we'd all just use limit/offset). =20 Merlin From pgsql-performance-owner@postgresql.org Mon Jan 24 15:46:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 58BF93A5425 for ; Mon, 24 Jan 2005 15:46: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 47293-09 for ; Mon, 24 Jan 2005 15:45:59 +0000 (GMT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 590173A550C for ; Mon, 24 Jan 2005 15:46:01 +0000 (GMT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.10.2+Sun/8.11.3) with ESMTP id j0OFjvJ21972; Mon, 24 Jan 2005 08:45:57 -0700 (MST) Message-ID: <41F51835.3040202@outputservices.com> Date: Mon, 24 Jan 2005 08:45:57 -0700 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tatsuo Ishii Cc: herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable 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: 200501/441 X-Sequence-Number: 10131 Tatsuo, I agree completely that vacuum falls apart on huge tables. We could=20 probably do the math and figure out what the ratio of updated rows per=20 total rows is each day, but on a constantly growing table, that ratio=20 gets smaller and smaller, making the impact of dead tuples in the table=20 proportionately less and less. If multi-version indexes are handled the same way as table rows, then=20 the indexes will also suffer the same fate, if not worse. For huge=20 tables, the b-tree depth can get fairly large. When a b-tree is of=20 depth X and the machine holds the first Y levels of the b-tree in=20 memory, then each table row selected requires a MINIMUM of (X-Y) disk=20 access *before* the table row is accessed. Substitute any numbers you=20 want for X and Y, but you will find that huge tables require many index=20 reads. Index updates are even worse. A table row update requires only a copy=20 of the row. An index update requires at least a copy of the leaf node,=20 and possibly more nodes if nodes must be split or collapsed. These=20 splits and collapses can cascade, causing many nodes to be affected. This whole process takes place for each and every index affected by the=20 change, which is every index on the table when a row is added or=20 deleted. All of this monkeying around takes place above and beyond the=20 simple change of the row data. Further, each and every affected index=20 page is dumped to WAL. Assuming the indexes have the same MVCC proprties of row data, then the=20 indexes would get dead tuples at a rate far higher than that of the=20 table data. So yes, vacuuming is a problem on large tables. It is a bigger problem=20 for indexes. On large tables, index I/O comprises most of the I/O mix. Don't take my word for it. Run a benchmark on Pg. Then, soft-link the=20 index files and the WAL directories to a RAM disk. Rerun the benchmark=20 and you will find that Pg far faster, much faster than if only the data=20 were on the RAM disk. Marty Tatsuo Ishii wrote: > IMO the bottle neck is not WAL but table/index bloat. Lots of updates > on large tables will produce lots of dead tuples. Problem is, There' > is no effective way to reuse these dead tuples since VACUUM on huge > tables takes longer time. 8.0 adds new vacuum delay > paramters. Unfortunately this does not help. It just make the > execution time of VACUUM longer, that means more and more dead tuples > are being made while updating. >=20 > Probably VACUUM works well for small to medium size tables, but not > for huge ones. I'm considering about to implement "on the spot > salvaging dead tuples". > -- > Tatsuo Ishii >=20 >=20 >>This is probably a lot easier than you would think. You say that your = >>DB will have lots of data, lots of updates and lots of reads. >> >>Very likely the disk bottleneck is mostly index reads and writes, with = >>some critical WAL fsync() calls. In the grand scheme of things, the=20 >>actual data is likely not accessed very often. >> >>The indexes can be put on a RAM disk tablespace and that's the end of=20 >>index problems -- just make sure you have enough memory available. Als= o=20 >>make sure that the machine can restart correctly after a crash: the=20 >>tablespace is dropped and recreated, along with the indexes. This will= =20 >>cause a machine restart to take some time. >> >>After that, if the WAL fsync() calls are becoming a problem, put the WA= L=20 >>files on a fast RAID array, etiher a card or external enclosure, that=20 >>has a good amount of battery-backed write cache. This way, the WAL=20 >>fsync() calls will flush quickly to the RAM and Pg can move on while th= e=20 >>RAID controller worries about putting the data to disk. With WAL, low = >>access time is usually more important than total throughput. >> >>The truth is that you could have this running for not much money. >> >>Good Luck, >>Marty >> >> >>>Le Jeudi 20 Janvier 2005 19:09, Bruno Almeida do Lago a =E9crit : >>> > Could you explain us what do you have in mind for that solution? I = mean, >>> > forget the PostgreSQL (or any other database) restrictions and=20 >>>explain us >>> > how this hardware would be. Where the data would be stored? >>> > >>> > I've something in mind for you, but first I need to understand your= =20 >>>needs! >>> >>>I just want to make a big database as explained in my first mail ... A= t the >>>beginning we will have aprox. 150 000 000 records ... each month we wi= ll=20 >>>add >>>about 4/8 millions new rows in constant flow during the day ... and in= same >>>time web users will access to the database in order to read those data= =2E >>>Stored data are quite close to data stored by google ... (we are not=20 >>>making a >>>google clone ... just a lot of data many small values and some big one= s ... >>>that's why I'm comparing with google for data storage). >>>Then we will have a search engine searching into those data ... >>> >>>Dealing about the hardware, for the moment we have only a bi-pentium X= eon >>>2.8Ghz with 4 Gb of RAM ... and we saw we had bad performance results = >>>... so >>>we are thinking about a new solution with maybe several servers (serve= r >>>design may vary from one to other) ... to get a kind of cluster to get= =20 >>>better >>>performance ... >>> >>>Am I clear ? >>> >>>Regards, >> >> >> >> >>---------------------------(end of broadcast)--------------------------= - >>TIP 2: you can get off all lists at once with the unregister command >> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org= ) >> >=20 From pgsql-performance-owner@postgresql.org Mon Jan 24 17:53:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D16CD3A55BC for ; Mon, 24 Jan 2005 17: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 74395-10 for ; Mon, 24 Jan 2005 17:53:19 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 26C673A5572 for ; Mon, 24 Jan 2005 17:53:19 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6945026; Mon, 24 Jan 2005 09:54:58 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL clustering Date: Mon, 24 Jan 2005 09:52:40 -0800 User-Agent: KMail/1.6.2 Cc: Tatsuo Ishii References: <200501210947.53938.josh@agliodbs.com> <200501231442.52830.josh@agliodbs.com> <20050124.103033.21930526.t-ishii@sra.co.jp> In-Reply-To: <20050124.103033.21930526.t-ishii@sra.co.jp> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501240952.40183.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: 200501/442 X-Sequence-Number: 10132 Tatsuo, > > Depends on your connection pooling software, I suppose. Most connection > > pooling software only returns connections to the pool after a user has > > been inactive for some period ... generally more than 3 seconds. So > > connection continuity could be trusted. > > Not sure what you mean by "most connection pooling software", but I'm > sure that pgpool behaves differently. Ah, clarity problem here. I'm talking about connection pooling tools from the client (webserver) side, such as Apache::DBI, PHP's pg_pconnect, Jakarta's connection pools, etc. Not pooling on the database server side, which is what pgPool provides. Most of these tools allocate a database connection to an HTTP/middleware client, and only release it after a specific period of inactivity. This means that you *could* count on "web-user==connection" for purposes of switching back and forth to the master -- as long as the connection-recycling timeout were set higher than the pgPool switch-off period. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jan 24 18:22:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 01A243A4D8F for ; Mon, 24 Jan 2005 18:22: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 80286-09 for ; Mon, 24 Jan 2005 18:22:22 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 01EC23A55B0 for ; Mon, 24 Jan 2005 18:22:22 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Mon, 24 Jan 2005 18:22:13 Z Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Josh Berkus Cc: pgsql-performance@postgresql.org, Tatsuo Ishii In-Reply-To: <200501240952.40183.josh@agliodbs.com> References: <200501210947.53938.josh@agliodbs.com> <200501231442.52830.josh@agliodbs.com> <20050124.103033.21930526.t-ishii@sra.co.jp> <200501240952.40183.josh@agliodbs.com> Content-Type: text/plain Date: Mon, 24 Jan 2005 18:24:05 +0000 Message-Id: <1106591045.22635.7.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: 200501/443 X-Sequence-Number: 10133 On Mon, 2005-01-24 at 09:52 -0800, Josh Berkus wrote: > [about keeping connections open in web context] > Ah, clarity problem here. I'm talking about connection pooling tools from > the client (webserver) side, such as Apache::DBI, PHP's pg_pconnect, > Jakarta's connection pools, etc. Not pooling on the database server side, > which is what pgPool provides. note that these sometimes do not provide connection pooling as such, just persistent connections (Apache::DBI) > Most of these tools allocate a database connection to an HTTP/middleware > client, and only release it after a specific period of inactivity. This > means that you *could* count on "web-user==connection" for purposes of > switching back and forth to the master -- as long as the connection-recycling > timeout were set higher than the pgPool switch-off period. no. you can only count on web-server-process==connection, but not web-user==connection, unless you can garantee that the same user client always connects to same web-server process. am i missing something ? gnari From pgsql-performance-owner@postgresql.org Tue Jan 25 17:47:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5A9C13A55E1 for ; Mon, 24 Jan 2005 18:28: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 81501-08 for ; Mon, 24 Jan 2005 18:28:26 +0000 (GMT) Received: from lata.dp.ua (ad-z2-14.dp.ukrtel.net [213.179.230.244]) by svr1.postgresql.org (Postfix) with ESMTP id 8D4683A5595 for ; Mon, 24 Jan 2005 18:28:25 +0000 (GMT) Received: from [192.168.0.16] (helo=alexd) by lata.dp.ua with esmtp (Exim 3.22 #1) id 1Ct8wq-0008En-00 for pgsql-performance@postgresql.org; Mon, 24 Jan 2005 20:28:24 +0200 From: "Alexander Dolgin" To: Subject: 200 times slower then MSSQL?? Date: Mon, 24 Jan 2005 20:33:39 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Thread-Index: AcUCQzjymbv/RvhoQQupt/MgwPTorw== Message-Id: 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: 200501/471 X-Sequence-Number: 10161 Hi all, We are developing some application that works with DB over JDBC. We've used MSSQL before and trying to migrate to PostgreSQL now. Unfortunately problems with performance are found. MSSQL with default configuration looks like much faster then PostgreSQL on the same hardware (PostgreSQL8 rc5 was used). I've tried to increase work_mem significant (work_mem = 262144) but it doesn't help. Here is result of simple benchmark. I have table CREATE TABLE elt_tcli_messagelog ( connectionname varchar(64), msgseqnum int4, connectionmessageid int4, logtimestamp varchar(64), isfromcounterparty char(1), msgtype varchar(64), possdupflag char(1), isoutofsequence char(1), ordtrnid varchar(64), ordrqstid varchar(64), counterrequestid varchar(64), clordid varchar(64), origclordid varchar(64), execid varchar(64), exectranstype varchar(64), exectype varchar(64), ordstatus varchar(64), lastqty float8, orderqty float8, cumqty float8, leavesqty float8, sendercompid varchar(64), targetcompid varchar(64), tradeaccthrchy varchar(64), tradeacctid varchar(64), routedtransactiondestination varchar(64), originatingconnectionname varchar(64), originatingconnectionmsgid int4, instrument varchar(64), portfolio varchar(64), prevseqnum int4, "Message" text, nonmetadatafields text ) with about 8000 rows. For this table query: SELECT MAX(MsgSeqNum),MAX(LogTimestamp) FROM ELT_tcli_MessageLog WHERE LogTimestamp >= '0' AND IsFromCounterParty = 'Y' AND IsOutOfSequence = 'N' AND ConnectionName = 'DB_BENCHMARK' AND LogTimestamp IN (SELECT MAX(LogTimestamp) FROM ELT_tcli_MessageLog WHERE MsgSeqNum > 0 AND IsFromCounterParty = 'Y' AND IsOutOfSequence = 'N' AND ConnectionName = 'DB_BENCHMARK') takes about 1 second on MSSQL Server and 257 seconds on PostgreSQL one. Does anybody have idea about reasons of such results? Thanks, Alexander Dolgin. From pgsql-performance-owner@postgresql.org Tue Jan 25 00:15:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91E3F3A45DE for ; Mon, 24 Jan 2005 23:38: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 04511-03 for ; Mon, 24 Jan 2005 23:38:41 +0000 (GMT) Received: by svr1.postgresql.org (Postfix, from userid 1001) id A370C3A5BF1; Tue, 25 Jan 2005 00:32:44 +0000 (GMT) Received: from web30304.mail.mud.yahoo.com (web30304.mail.mud.yahoo.com [68.142.200.97]) by svr1.postgresql.org (Postfix) with SMTP id D89A83A5647 for ; Mon, 24 Jan 2005 23:02:42 +0000 (GMT) Received: (qmail 18331 invoked by uid 60001); 24 Jan 2005 23:02:42 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=ic9UIq6Xv2rhStph8dFvI8tC+g059Rq77LN/0UnnoDWojvLy6wdrpwcKCCGx5CM83ppj0pErFLd8VcpH60fiduGaJwLPuA+9d/Ld1WAjppUd3uIkRshJyu1qq/YyKxx3ZzBzhrBCNZdZld2BOprxGuSL8oCLP21TrsYrXZLUvjQ= ; Message-ID: <20050124230242.18329.qmail@web30304.mail.mud.yahoo.com> Received: from [63.78.249.254] by web30304.mail.mud.yahoo.com via HTTP; Mon, 24 Jan 2005 15:02:42 PST Date: Mon, 24 Jan 2005 15:02:42 -0800 (PST) From: Litao Wu Subject: reltuples after vacuum and analyze 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.367 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD X-Spam-Level: * X-Archive-Number: 200501/445 X-Sequence-Number: 10135 Hi, I noticed that reltuples are way off if I vacuum the table and analyze the table. And the data (296901) after vacuum seems accurate while the reltuples (1.90744e+06) after anlayze is too wrong. My PG version is 7.3.2 (I know it is old). Any thought? Thanks, my_db=# analyze my_tab; ANALYZE my_db=# SELECT relname, relpages * 8 as size_kb, relfilenode, reltuples my_db=# FROM pg_class c1 my_db=# WHERE relkind = 'r' my_db=# AND relname = 'my_tab'; relname | size_kb | relfilenode | reltuples ------------------+---------+-------------+------------- my_tab | 394952 | 211002264 | 1.90744e+06 (1 row) my_db=# select count(*) from my_tab; count -------- 296694 (1 row) my_db=# vacuum verbose my_tab; INFO: --Relation public.my_tab-- INFO: Index my_tab_pkey: Pages 5909; Tuples 296901: Deleted 6921. CPU 0.20s/0.19u sec elapsed 4.76 sec. INFO: Index my_tab_hid_state_idx: Pages 5835; Tuples 297808: Deleted 6921. CPU 0.17s/0.07u sec elapsed 9.62 sec. INFO: Removed 6921 tuples in 310 pages. CPU 0.00s/0.01u sec elapsed 0.08 sec. INFO: Pages 49369: Changed 12, Empty 0; Tup 296901: Vac 6921, Keep 0, UnUsed 1431662. Total CPU 1.71s/0.47u sec elapsed 28.48 sec. VACUUM my_db=# SELECT relname, relpages * 8 as size_kb, relfilenode, reltuples my_db=# FROM pg_class c1 my_db=# WHERE relkind = 'r' my_db=# AND relname = 'my_tab'; relname | size_kb | relfilenode | reltuples ------------------+---------+-------------+----------- my_tab | 394952 | 211002264 | 296901 (1 row) my_db=# analyze my_tab; ANALYZE my_db=# SELECT relname, relpages * 8 as size_kb, relfilenode, reltuples my_db=# FROM pg_class c1 my_db=# WHERE relkind = 'r' my_db=# AND relname = 'my_tab'; relname | size_kb | relfilenode | reltuples ------------------+---------+-------------+------------- my_tab | 394952 | 211002264 | 1.90744e+06 (1 row) __________________________________ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail From pgsql-performance-owner@postgresql.org Tue Jan 25 00:05:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C52A23A5610 for ; Mon, 24 Jan 2005 23: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 23391-07 for ; Mon, 24 Jan 2005 23:48:21 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id DCD2D3A57AD for ; Mon, 24 Jan 2005 23:41:55 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6946400; Mon, 24 Jan 2005 15:43:38 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Ragnar =?utf-8?q?Hafsta=C3=B0?= Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL Date: Mon, 24 Jan 2005 15:45:51 -0800 User-Agent: KMail/1.7.1 Cc: pgsql-performance@postgresql.org, Tatsuo Ishii References: <200501210947.53938.josh@agliodbs.com> <200501240952.40183.josh@agliodbs.com> <1106591045.22635.7.camel@localhost.localdomain> In-Reply-To: <1106591045.22635.7.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501241545.51737.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/444 X-Sequence-Number: 10134 Ragnar, > note that these sometimes do not provide connection pooling as such, > just persistent connections (Apache::DBI) Yes, right. > no. you can only count on web-server-process==connection, but not > web-user==connection, unless you can garantee that the same user > client always connects to same web-server process. Are there ones that you use which might use several different connections to send a series of queries from a single web-user, less than 5 seconds apart? -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 25 00:41:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 956083A4FB8 for ; Tue, 25 Jan 2005 00:20: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 40145-10 for ; Tue, 25 Jan 2005 00:20:03 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9C4C03A4A74 for ; Tue, 25 Jan 2005 00:20:02 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id BA252626AD; Tue, 25 Jan 2005 09:20:01 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id A141110CD07; Tue, 25 Jan 2005 09:20:01 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 7B71710CD06; Tue, 25 Jan 2005 09:20:01 +0900 (JST) Received: from localhost (IDENT:t-ishii@dhcp-171-173.sra.co.jp [133.137.171.173]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id JAA02905; Tue, 25 Jan 2005 09:19:53 +0900 Date: Tue, 25 Jan 2005 09:21:09 +0900 (JST) Message-Id: <20050125.092109.71083385.t-ishii@sra.co.jp> To: gnari@simnet.is Cc: josh@agliodbs.com, pgsql-performance@postgresql.org Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL From: Tatsuo Ishii In-Reply-To: <1106591045.22635.7.camel@localhost.localdomain> References: <20050124.103033.21930526.t-ishii@sra.co.jp> <200501240952.40183.josh@agliodbs.com> <1106591045.22635.7.camel@localhost.localdomain> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.02 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/446 X-Sequence-Number: 10136 > On Mon, 2005-01-24 at 09:52 -0800, Josh Berkus wrote: > > [about keeping connections open in web context] > > Ah, clarity problem here. I'm talking about connection pooling tools from > > the client (webserver) side, such as Apache::DBI, PHP's pg_pconnect, > > Jakarta's connection pools, etc. Not pooling on the database server side, > > which is what pgPool provides. > > note that these sometimes do not provide connection pooling as such, > just persistent connections (Apache::DBI) Right. Same thing can be said to pg_pconnect. > > Most of these tools allocate a database connection to an HTTP/middleware > > client, and only release it after a specific period of inactivity. This > > means that you *could* count on "web-user==connection" for purposes of > > switching back and forth to the master -- as long as the connection-recycling > > timeout were set higher than the pgPool switch-off period. > > no. you can only count on web-server-process==connection, but not > web-user==connection, unless you can garantee that the same user > client always connects to same web-server process. I have same opinion. > am i missing something ? -- Tatsuo Ishii From pgsql-performance-owner@postgresql.org Tue Jan 25 00:52:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B96F63A4B4E for ; Tue, 25 Jan 2005 00:26: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 41151-05 for ; Tue, 25 Jan 2005 00:26:26 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3F43C3A4A00 for ; Tue, 25 Jan 2005 00:26: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 j0P0QQNe027554; Mon, 24 Jan 2005 19:26:27 -0500 (EST) To: Litao Wu Cc: pgsql-performance@postgresql.org Subject: Re: reltuples after vacuum and analyze In-reply-to: <20050124230242.18329.qmail@web30304.mail.mud.yahoo.com> References: <20050124230242.18329.qmail@web30304.mail.mud.yahoo.com> Comments: In-reply-to Litao Wu message dated "Mon, 24 Jan 2005 15:02:42 -0800" Date: Mon, 24 Jan 2005 19:26:26 -0500 Message-ID: <27553.1106612786@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: 200501/447 X-Sequence-Number: 10137 Litao Wu writes: > I noticed that reltuples are way off if > I vacuum the table and analyze the table. > And the data (296901) after vacuum seems > accurate while > the reltuples (1.90744e+06) > after anlayze is too wrong. VACUUM derives an exact count because it scans the whole table. ANALYZE samples just a subset of the table and extrapolates. It would appear that you've got radically different tuple densities in different parts of the table, and that's confusing ANALYZE. > My PG version is 7.3.2 (I know it is old). 8.0's ANALYZE uses a new sampling method that we think is less prone to this error, though of course any sampling method will fail some of the time. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 01:23:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 472F23A53AE for ; Tue, 25 Jan 2005 01:23: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 46932-07 for ; Tue, 25 Jan 2005 01:23:00 +0000 (GMT) Received: from hotmail.com (bay14-dav10.bay14.hotmail.com [64.4.48.114]) by svr1.postgresql.org (Postfix) with ESMTP id D15F73A4E21 for ; Tue, 25 Jan 2005 01:23:01 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 24 Jan 2005 17:23:00 -0800 Message-ID: Received: from 144.136.239.156 by BAY14-DAV10.phx.gbl with DAV; Tue, 25 Jan 2005 01:22:37 +0000 X-Originating-IP: [144.136.239.156] X-Originating-Email: [space_ball_one@hotmail.com] X-Sender: space_ball_one@hotmail.com From: "SpaceBallOne" To: References: <41F4BE45.4040402@uptime.ee> Subject: Re: poor performance of db? Date: Tue, 25 Jan 2005 09:22:36 +0800 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-OriginalArrivalTime: 25 Jan 2005 01:23:00.0751 (UTC) FILETIME=[68CEC9F0:01C5027C] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=4.098 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_MUA_OUTLOOK, MSGID_FROM_MTA_HEADER X-Spam-Level: **** X-Archive-Number: 200501/448 X-Sequence-Number: 10138 Thanks for the replies guys, Chris - very cool feature timing - didnt know about that one. Appears to be taking the following times in pulling up the page: web browser: 1.15 sec postgres: 1.52 sec other: 0.83 sec Andrew: Query looks like the following: explain analyse SELECT job.*, customer.*, ubd.suburb, location.*, street.street, location.designation_no, a1.initials as surveyor, a2.initials as draftor, prices.*, plans.* FROM job, login a1, login a2, prices, location, ubd, plans WHERE ( a1.code = job.surveyor_no AND a2.code = job.draftor_no AND job.customer_no = customer.customer_no AND job.location_no = location.location_no AND location.suburb_no = ubd.suburb_id AND location.street_no = street.street_no AND job.customer_no = customer.customer_no AND job.price_id = prices.pricelist_id AND job.price_revision = prices.revision AND location.plan_no = plans.number AND location.plan_type = plans.plantype AND ( (job.jobbookflag <> 'flagged') AND ( job.status = 'normal' ) )) ORDER BY job_no DESC; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=566.31..567.06 rows=298 width=2626) (actual time=1378.38..1380.08 rows=353 loops=1) Sort Key: job.job_no -> Hash Join (cost=232.59..554.06 rows=298 width=2626) (actual time=124.96..1374.12 rows=353 loops=1) Hash Cond: ("outer".suburb_no = "inner".suburb_id) -> Hash Join (cost=221.45..519.06 rows=288 width=2606) (actual time=118.60..1187.87 rows=353 loops=1) Hash Cond: ("outer".street_no = "inner".street_no) -> Hash Join (cost=204.79..496.64 rows=287 width=2587) (actual time=108.16..997.57 rows=353 loops=1) Hash Cond: ("outer".surveyor_no = "inner".code) -> Hash Join (cost=203.21..490.05 rows=287 width=2573) (actual time=106.89..823.47 rows=353 loops=1) Hash Cond: ("outer".customer_no = "inner".customer_no) -> Hash Join (cost=159.12..440.93 rows=287 width=2291) (actual time=92.16..654.51 rows=353 loops=1) Hash Cond: ("outer".draftor_no = "inner".code) -> Hash Join (cost=157.55..434.33 rows=287 width=2277) (actual time=90.96..507.34 rows=353 loops=1) Hash Cond: ("outer".price_id = "inner".pricelist_id) Join Filter: ("outer".price_revision = "inner".revision) -> Hash Join (cost=142.95..401.01 rows=336 width=2150) (actual time=82.57..377.87 rows=353 loops=1) Hash Cond: ("outer".plan_no = "inner".number) Join Filter: ("outer".plan_type = "inner".plantype) -> Hash Join (cost=25.66..272.20 rows=418 width=2110) (actual time=14.58..198.50 rows=353 loops=1) Hash Cond: ("outer".location_no = "inner".location_no) -> Seq Scan on job (cost=0.00..238.18 rows=418 width=2029) (actual time=0.31..95.21 rows=353 loops=1) Filter: ((jobbookflag <> 'flagged'::character varying) AND (status = 'normal'::character varying)) -> Hash (cost=23.53..23.53 rows=853 width=81) (actual time=13.91..13.91 rows=0 loops=1) -> Seq Scan on "location" (cost=0.00..23.53 rows=853 width=81) (actual time=0.03..8.92 rows=853 loops=1) -> Hash (cost=103.43..103.43 rows=5543 width=40) (actual time=67.55..67.55 rows=0 loops=1) -> Seq Scan on plans (cost=0.00..103.43 rows=5543 width=40) (actual time=0.01..36.89 rows=5544 loops=1) -> Hash (cost=13.68..13.68 rows=368 width=127) (actual time=7.98..7.98 rows=0 loops=1) -> Seq Scan on prices (cost=0.00..13.68 rows=368 width=127) (actual time=0.03..5.83 rows=368 loops=1) -> Hash (cost=1.46..1.46 rows=46 width=14) (actual time=0.57..0.57 rows=0 loops=1) -> Seq Scan on login a2 (cost=0.00..1.46 rows=46 width=14) (actual time=0.02..0.31 rows=46 loops=1) -> Hash (cost=42.07..42.07 rows=807 width=282) (actual time=14.24..14.24 rows=0 loops=1) -> Seq Scan on customer (cost=0.00..42.07 rows=807 width=282) (actual time=0.03..9.03 rows=807 loops=1) -> Hash (cost=1.46..1.46 rows=46 width=14) (actual time=0.57..0.57 rows=0 loops=1) -> Seq Scan on login a1 (cost=0.00..1.46 rows=46 width=14) (actual time=0.02..0.31 rows=46 loops=1) -> Hash (cost=14.53..14.53 rows=853 width=19) (actual time=9.79..9.79 rows=0 loops=1) -> Seq Scan on street (cost=0.00..14.53 rows=853 width=19) (actual time=0.01..5.12 rows=853 loops=1) -> Hash (cost=9.91..9.91 rows=491 width=20) (actual time=5.73..5.73 rows=0 loops=1) -> Seq Scan on ubd (cost=0.00..9.91 rows=491 width=20) (actual time=0.02..2.98 rows=491 loops=1) Total runtime: 1383.99 msec (39 rows) Time: 1445.80 ms I tried setting up 10-15 indexes yesterday, but couldn't see they were doing anything. I have since deleted them (on the premise that I didn't have a clue what I was doing). I'm not actually running any keys in this database... would that be a simpler way of running my queries? I only learnt postgres / unix from scratch a year ago so my db setup and queries is probably pretty messy :) Thanks, Dave space_ball_one@hotmail.com ----- Original Message ----- From: "Andrei Reinus" To: "SpaceBallOne" Cc: Sent: Monday, January 24, 2005 5:22 PM Subject: Re: [PERFORM] poor performance of db? > SpaceBallOne wrote: > >> Hello everyone, >> >> First time poster to the mailing list here. >> >> We have been running pgsql for about a year now at a pretty basic >> level (I guess) as a backend for custom >> web (intranet) application software. Our database so far is a "huge" >> (note sarcasm) 10 Mb containing of about 6 or so principle tables. >> >> Our 'test' screen we've been using loads a 600kb HTML document which >> is basically a summary of our client's orders. It took originally 11.5 >> seconds to load in internet explorer (all 10.99 seconds were pretty >> much taken up by postgres processes on a freebsd server). >> >> I then re-wrote the page to use a single select query to call all the >> information needed by PHP to draw the screen. That managed to shave it >> down to 3.5 seconds... but this so far is as fast as I can get the >> page to load. Have tried vacuuming and creating indexes but to no >> avail. (increasing shared mem buffers yet to be done) >> >> Now heres the funny bit ... >> >> Every time I tested an idea to speed it up, I got exactly the same >> loading time on a Athlon 1800+, 256Mb RAM, 20Gb PATA computer as >> compared to a Dual Opteron 246, 1Gb RAM, 70Gb WD Raptor SATA server. >> Now, why a dual opteron machine can't perform any faster than a lowly >> 1800+ athlon in numerous tests is completely beyond me .. increased >> memory and RAID 0 disc configurations so far have not resulted in any >> significant performance gain in the opteron server. >> >> Do these facts sound right? If postgres is meant to be a 200Gb >> industrial strength database, should it really be taking this long >> pulling 600kb worth of info from a 10Mb database? And why no >> performance difference between two vastly different hardware spec'd >> computers??? Am I missing some vital postgres.conf setting?? >> >> Any advice welcome. >> >> Thanks, >> Dave >> space_ball_one@hotmail.com >> > > Could you give us a bit more info. > What you are trying to do. EXPLAIN ANALYZE would be great. > In my experience first problem with the first db app is no indexes used > in joining. > > -- > -- Andrei Reinus > > -------------------------------------------------------------------------------- > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Tue Jan 25 02:46:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAD683A55E2 for ; Tue, 25 Jan 2005 02: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 55777-05 for ; Tue, 25 Jan 2005 02:32:00 +0000 (GMT) Received: from hotmail.com (bay14-dav14.bay14.hotmail.com [64.4.48.118]) by svr1.postgresql.org (Postfix) with ESMTP id 138D83A5524 for ; Tue, 25 Jan 2005 02:32:00 +0000 (GMT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 24 Jan 2005 18:32:00 -0800 Message-ID: Received: from 144.136.239.156 by BAY14-DAV14.phx.gbl with DAV; Tue, 25 Jan 2005 02:31:09 +0000 X-Originating-IP: [144.136.239.156] X-Originating-Email: [space_ball_one@hotmail.com] X-Sender: space_ball_one@hotmail.com From: "SpaceBallOne" To: References: <41F4BE45.4040402@uptime.ee> <41F5A740.4060404@arbash-meinel.com> Subject: Re: poor performance of db? Date: Tue, 25 Jan 2005 10:31:10 +0800 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-OriginalArrivalTime: 25 Jan 2005 02:32:00.0943 (UTC) FILETIME=[0C8DF3F0:01C50286] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=4.083 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_POST, FORGED_MUA_OUTLOOK, MSGID_FROM_MTA_HEADER X-Spam-Level: **** X-Archive-Number: 200501/449 X-Sequence-Number: 10139 Thanks for the reply John, There are approximately 800 rows total in our job table (which stays approximately the same because 'completed' jobs get moved to a 'job_archive' table).The other jobs not shown by the specific query could be on backorder status, temporary deleted status, etc etc. You are correct in assuming the _id and _no (stands for 'number') fields are unique - this was one of the first pages I built when I started learning postgres, so not knowing how to set up primary and foriegn keys at the time, I did it that way ... it is normalised to a point (probably rather sloppy, but its a juggling act between learning on the fly, what I'd like to have, and time constraints of being the only I.T. guy in the company!)... I think I will definitely focus on converting my database and php pages to using proper primary keys in postgres - especially if they automatically index themselves. I didn't do a vacuum analyse on them so that may explain why they didn't seem to do much. Thanks, Dave space_ball_one@hotmail.com ----- Original Message ----- From: "John Arbash Meinel" To: "SpaceBallOne" Sent: Tuesday, January 25, 2005 9:56 AM Subject: Re: [PERFORM] poor performance of db? SpaceBallOne wrote: > > > I tried setting up 10-15 indexes yesterday, but couldn't see they were > doing anything. I have since deleted them (on the premise that I > didn't have a clue what I was doing). Did you VACUUM ANALYZE after you created the indexes? It really depends on how many rows you need vs how many rows are in the table. If you are trying to show everything in the tables, then it won't help. I can tell that your query is returning 353 rows. How many rows total do you have? I think the rule is that indexes help when you need < 10% of your data. From what I can see, it looks like all of the *_no columns, and *_id columns (which are basically your keys), would be helped by having an index on them. > > I'm not actually running any keys in this database... would that be a > simpler way of running my queries? I only learnt postgres / unix from > scratch a year ago so my db setup and queries is probably pretty > messy :) > I would probably think that you would want a "primary key" on every table, and this would be your column for references. This way you can get referential integrity, *and* it automatically creates an index. For instance, the job table could be: create table job ( id serial primary key, surveyor_id integer references surveyor(id), draftor_id integer references draftor(id), ... ); Then your other tables would also need an id field. I can't say much more without looking deeper, but from the looks of it, all of your "_no" and "_id" references should probably be referencing a primary key on the other table. Personally, I always name it "id" and "_id", but if "_no" means something to you, then you certainly could keep it. If these entries are not unique, then probably your database isn't properly normalized. John =:-> > Thanks, > Dave > space_ball_one@hotmail.com > From pgsql-performance-owner@postgresql.org Tue Jan 25 04:00:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9626B3A4860 for ; Tue, 25 Jan 2005 03:11: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 61101-07 for ; Tue, 25 Jan 2005 03:11:02 +0000 (GMT) Received: from flake.decibel.org (flake.decibel.org [66.143.173.58]) by svr1.postgresql.org (Postfix) with ESMTP id B16643A56A7 for ; Tue, 25 Jan 2005 03:11:04 +0000 (GMT) Received: by flake.decibel.org (Postfix, from userid 1001) id E52C61C8FE; Mon, 24 Jan 2005 21:11:04 -0600 (CST) Date: Mon, 24 Jan 2005 21:11:04 -0600 From: "Jim C. Nasby" To: Tom Lane Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050125031104.GW67721@decibel.org> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6346.1106512803@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.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/451 X-Sequence-Number: 10141 On Sun, Jan 23, 2005 at 03:40:03PM -0500, Tom Lane wrote: > The real issue with any such scheme is that you are putting maintenance > costs into the critical paths of foreground processes that are executing > user queries. I think that one of the primary advantages of the > Postgres storage design is that we keep that work outside the critical > path and delegate it to maintenance processes that can run in the > background. We shouldn't lightly toss away that advantage. To pull out the oft-used "show me the numbers" card... has anyone done a study to see if keeping this stuff out of the 'critical path' actually helps overall system performance? While the current scheme initially speeds up transactions, eventually you have to run vacuum, which puts a big load on the system. If you can put off vacuuming until off-hours (assuming your system has off-hours), then this doesn't matter, but more and more we're seeing systems where vacuum is a big performance issue (hence recent work with the delay in vacuum so as not to swamp the IO system). If you vacuum as part of the transaction it's going to be more efficient of resources, because you have more of what you need right there (ie: odds are that you're on the same page as the old tuple). In cases like that it very likely makes a lot of sense to take a small hit in your transaction time up-front, instead of a larger hit doing a vacuum down the road. Of course, without numbers this is a bunch of hand-waving, but I don't think it's valid to assume that minimizing the amount of work you do in a transaction means better throughput without considering what it will cost to do the work you're putting off until later. -- 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 Tue Jan 25 04:00:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E07AE3A1A38 for ; Tue, 25 Jan 2005 03:15: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 61858-06 for ; Tue, 25 Jan 2005 03:15:33 +0000 (GMT) Received: from server07.icaen.uiowa.edu (server07.icaen.uiowa.edu [128.255.17.47]) by svr1.postgresql.org (Postfix) with ESMTP id C14173A56A9 for ; Tue, 25 Jan 2005 03:15:34 +0000 (GMT) Received: from server11.icaen.uiowa.edu (server11.icaen.uiowa.edu [128.255.17.51]) by server07.icaen.uiowa.edu (8.13.2/8.12.9) with ESMTP id j0P3FWFs007404; (envelope-from ) Mon, 24 Jan 2005 21:15:32 -0600 (CST) Received: from [192.168.1.101] (67-41-94-194.cdrr.qwest.net [67.41.94.194]) (authenticated user=jfmeinel) by server11.icaen.uiowa.edu (8.13.2/smtp-serv-1.7) with ESMTP id j0P3FThv009728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256); (envelope-from ) Mon, 24 Jan 2005 21:15:30 -0600 (CST) Message-ID: <41F5B9D0.2010803@arbash-meinel.com> Date: Mon, 24 Jan 2005 21:15:28 -0600 From: John Arbash Meinel User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: SpaceBallOne Cc: pgsql-performance@postgresql.org Subject: Re: poor performance of db? References: <41F4BE45.4040402@uptime.ee> <41F5A740.4060404@arbash-meinel.com> In-Reply-To: X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig82CD3C31C08974FDE64E27C7" X-Virus-Scanned: ClamAV 0.80/640/Thu Dec 23 12:48:27 2004 clamav-milter version 0.80j on clamav.icaen.uiowa.edu X-Virus-Scanned: ClamAV 0.80/655/Fri Jan 7 07:54:13 2005, clamav-milter version 0.75 on clamav.icaen.uiowa.edu X-Virus-Status: Clean X-Virus-Status: Clean 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: 200501/450 X-Sequence-Number: 10140 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig82CD3C31C08974FDE64E27C7 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit SpaceBallOne wrote: > Thanks for the reply John, > > There are approximately 800 rows total in our job table (which stays > approximately the same because 'completed' jobs get moved to a > 'job_archive' table).The other jobs not shown by the specific query > could be on backorder status, temporary deleted status, etc etc. > > You are correct in assuming the _id and _no (stands for 'number') > fields are unique - this was one of the first pages I built when I > started learning postgres, so not knowing how to set up primary and > foriegn keys at the time, I did it that way ... it is normalised to a > point (probably rather sloppy, but its a juggling act between learning > on the fly, what I'd like to have, and time constraints of being the > only I.T. guy in the company!)... > > I think I will definitely focus on converting my database and php > pages to using proper primary keys in postgres - especially if they > automatically index themselves. I didn't do a vacuum analyse on them > so that may explain why they didn't seem to do much. You probably can add them now if you don't want to do a lot of redesign. ALTER TABLE job ADD PRIMARY KEY (id); If they are not unique this will cause problems, but as they should be unique, I think it will work. I'm not sure how much help indexes will be if you only have 800 rows, and your queries use 300+ of them. You might need re-think the query/table design. You might try doing nested queries, or explicit joins, rather than one big query with a WHERE clause. Meaning do stuff like: SELECT (job JOIN customer ON job.customer_no = customer.customer_no) as jc JOIN location on jc.location_no = location.location_no ... I also see that the planner seems to mis-estimate the number of rows in some cases. Like here: > -> Hash (cost=14.53..14.53 rows=853 width=19) (actual > time=9.79..9.79 rows=0 loops=1) > -> Seq Scan on street (cost=0.00..14.53 rows=853 > width=19) (actual time=0.01..5.12 rows=853 loops=1) > -> Hash (cost=9.91..9.91 rows=491 width=20) (actual > time=5.73..5.73 rows=0 loops=1) > -> Seq Scan on ubd (cost=0.00..9.91 rows=491 width=20) > (actual time=0.02..2.98 rows=491 Where it thinks the hash will return all of the rows from the sequential scan, when in reality it returns none. I think problems with the planner fall into 3 categories. 1. You didn't VACUUM ANALYZE. 2. You did, but the planner doesn't keep sufficient statistics (ALTER TABLE job ALTER COLUMN no SET STATISTICS ) 3. You're join needs cross column statistics, which postgres doesn't support (yet). If you only have 800 rows, I don't think you have to worry about statistics, so that leaves things at 1 or 3. If you did do 1, then I don't know what to tell you. John =:-> PS> I'm not a guru at this stuff, so some of what I say may be wrong. But hopefully I point you in the right direction. > > Thanks, > Dave > space_ball_one@hotmail.com > --------------enig82CD3C31C08974FDE64E27C7 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 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB9bnQJdeBCYSNAAMRAntsAJ9FvH7bcFZm+ZraNeR8/dF3+Hj6UACfYdPY PPclQb8As+8QZhEaA+V+pkI= =Wi5q -----END PGP SIGNATURE----- --------------enig82CD3C31C08974FDE64E27C7-- From pgsql-performance-owner@postgresql.org Tue Jan 25 06:24:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4C54A3A5780 for ; Tue, 25 Jan 2005 06:24: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 89950-06 for ; Tue, 25 Jan 2005 06:24:01 +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 8D8453A586E for ; Tue, 25 Jan 2005 06:18:47 +0000 (GMT) Received: (from andrew@localhost) by pillette.com (8.11.6/8.11.6) id j0P6IBN19000; Mon, 24 Jan 2005 22:18:11 -0800 Date: Mon, 24 Jan 2005 22:18:11 -0800 From: andrew@pillette.com Message-Id: <200501250618.j0P6IBN19000@pillette.com> Subject: Re: poor performance of db? To: John Arbash Meinel Cc: SpaceBallOne , pgsql-performance@postgresql.org X-Originating-IP: 64.169.162.78 X-Mailer: Webmin 0.940 MIME-Version: 1.0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.205 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NO_REAL_NAME X-Spam-Level: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Archive-Number: 200501/452 X-Sequence-Number: 10142 This is a multi-part message in MIME format. --bound1106633891 Content-Type: text/plain Content-Transfer-Encoding: 7bit I'm also an autodidact on DB design, although it's well more than a year now. If you are planning to clean up the design, I strongly suggest getting a visual tool. Google for something like "database design tool". Some are extremely expensive (e.g. ERwin, which I think is renamed having been bought out). There's a very cheap shareware one that I won't mention by name because it crashed my machine consistently. Right now I'm using "Case Studio", which has some very eccentric UI (no one enforced consistency of UI across modules, which is rather ironic in a design tool) but capable and user-extensible. ERwin's manual also had the best explanation of denormalization I've read, short and to the point. The ability to make schema revisions quickly lets me concentrate on *better-written queries* and *improved table definition* without having to overcome inertia. --bound1106633891-- From pgsql-performance-owner@postgresql.org Tue Jan 25 08:24:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 866003A5697 for ; Tue, 25 Jan 2005 08:23: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 19369-06 for ; Tue, 25 Jan 2005 08:23:26 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id C9B6C3A5501 for ; Tue, 25 Jan 2005 08:23:27 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 57so34342wri for ; Tue, 25 Jan 2005 00:23: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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=UnDF2q83B+fBFOmdRCuyJmT4KWx2JoNpTvpaetHUBHYqBhzj9ILi6LgZPGHixgz+xO/aUlMcDHg9xwoZmstDsld52Mi5LQPwE5qlvdyLBzatSrNCun6bj8TbW0eQCCyD0inhKSMxEHtmWxsB9npHDlBmrq2rxqschaKhu7PsBBU= Received: by 10.54.36.22 with SMTP id j22mr191975wrj; Tue, 25 Jan 2005 00:23:26 -0800 (PST) Received: by 10.54.31.32 with HTTP; Tue, 25 Jan 2005 00:23:26 -0800 (PST) Message-ID: <2989532e05012500235c78fd47@mail.gmail.com> Date: Tue, 25 Jan 2005 13:53:26 +0530 From: Antony Paul Reply-To: Antony Paul To: Russell Smith Subject: Re: How to boost performance of ilike queries ? Cc: pgsql-performance@postgresql.org In-Reply-To: <200501242058.54670.mr-russ@pws.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05012401184b0c3ef9@mail.gmail.com> <200501242058.54670.mr-russ@pws.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/453 X-Sequence-Number: 10143 Creating an index and using lower(column) does not change the explain plan estimates. It seems that it is not using index for like or ilike queries irrespective of whether it have a pattern matching character in it or not. (using PostgreSQL 7.3.3) On googling I found this thread http://archives.postgresql.org/pgsql-sql/2004-11/msg00285.php It says that index is not used if the search string begins with a % symbol. rgds Antony Paul On Mon, 24 Jan 2005 20:58:54 +1100, Russell Smith wrote: > On Mon, 24 Jan 2005 08:18 pm, Antony Paul wrote: > > Hi, > > I have a query which is executed using ilike. The query values are > > received from user and it is executed using PreparedStatement. > > Currently all queries are executed as it is using iilike irrespective > > of whether it have a pattern matching character or not. Can using = > > instead of ilike boot performance ?. If creating index can help then > > how the index should be created on lower case or uppercase ?. > > > It depends on the type of queries you are doing. > > changing it to something like lower(column) like lower('text%'), and > creating an index on lower(column) will give you much better performance. > > If you have % in the middle of the query, it will still be slow, but I assume that is not > the general case. > > I am not sure what the effect of it being prepared will be, however I've had much success > with the method above without the queries being prepared. Others may be able to offer advice > about if prepare will effect it. > > Regards > > Russell Smith > From pgsql-performance-owner@postgresql.org Tue Jan 25 09:53:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 42A173A42CD for ; Tue, 25 Jan 2005 09:53: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 34733-03 for ; Tue, 25 Jan 2005 09:53:33 +0000 (GMT) Received: from pws.com.au (mail.pws.com.au [210.23.138.139]) by svr1.postgresql.org (Postfix) with SMTP id 40DD23A55B3 for ; Tue, 25 Jan 2005 09:53:33 +0000 (GMT) Received: (qmail 31625 invoked from network); 25 Jan 2005 08:53:09 -0000 Received: from unknown (HELO wizzard.pws.com.au) (russell@pws.com.au@138.217.55.142) by 210.23.138.139 with SMTP; 25 Jan 2005 08:53:09 -0000 From: Russell Smith To: Antony Paul Subject: Re: How to boost performance of ilike queries ? Date: Tue, 25 Jan 2005 19:49:12 +1100 User-Agent: KMail/1.7 References: <2989532e05012401184b0c3ef9@mail.gmail.com> <200501242058.54670.mr-russ@pws.com.au> <2989532e05012500235c78fd47@mail.gmail.com> In-Reply-To: <2989532e05012500235c78fd47@mail.gmail.com> Cc: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501251949.12874.mr-russ@pws.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/455 X-Sequence-Number: 10145 On Tue, 25 Jan 2005 07:23 pm, Antony Paul wrote: > Creating an index and using lower(column) does not change the explain > plan estimates. > It seems that it is not using index for like or ilike queries > irrespective of whether it have a pattern matching character in it or > not. (using PostgreSQL 7.3.3) > > On googling I found this thread > > http://archives.postgresql.org/pgsql-sql/2004-11/msg00285.php > > It says that index is not used if the search string begins with a % symbol. What exactly are the type of like queries you are going? there is a solution for having the % at the start, but you can win everyway. > > rgds > Antony Paul > > On Mon, 24 Jan 2005 20:58:54 +1100, Russell Smith wrote: > > On Mon, 24 Jan 2005 08:18 pm, Antony Paul wrote: > > > Hi, > > > I have a query which is executed using ilike. The query values are > > > received from user and it is executed using PreparedStatement. > > > Currently all queries are executed as it is using iilike irrespective > > > of whether it have a pattern matching character or not. Can using = > > > instead of ilike boot performance ?. If creating index can help then > > > how the index should be created on lower case or uppercase ?. > > > > > It depends on the type of queries you are doing. > > > > changing it to something like lower(column) like lower('text%'), and > > creating an index on lower(column) will give you much better performance. > > > > If you have % in the middle of the query, it will still be slow, but I assume that is not > > the general case. > > > > I am not sure what the effect of it being prepared will be, however I've had much success > > with the method above without the queries being prepared. Others may be able to offer advice > > about if prepare will effect it. > > > > Regards > > > > Russell Smith > > > > From pgsql-performance-owner@postgresql.org Tue Jan 25 09:50:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C7713A4DD7 for ; Tue, 25 Jan 2005 09:50: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 34411-03 for ; Tue, 25 Jan 2005 09:50:10 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id D4F3E3A469C for ; Tue, 25 Jan 2005 09:50:10 +0000 (GMT) Received: from gnari ([157.157.193.37] [157.157.193.37]) by quasar.skima.is with ESMTP; Tue, 25 Jan 2005 09:50:09 Z Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: pgsql-performance@postgresql.org In-Reply-To: <200501241545.51737.josh@agliodbs.com> References: <200501210947.53938.josh@agliodbs.com> <200501240952.40183.josh@agliodbs.com> <1106591045.22635.7.camel@localhost.localdomain> <200501241545.51737.josh@agliodbs.com> Content-Type: text/plain Date: Tue, 25 Jan 2005 09:52:06 +0000 Message-Id: <1106646726.22636.14.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: 200501/454 X-Sequence-Number: 10144 On Mon, 2005-01-24 at 15:45 -0800, Josh Berkus wrote: > [about keeping open DB connections between web-client connections] > [I wrote:] > > no. you can only count on web-server-process==connection, but not > > web-user==connection, unless you can garantee that the same user > > client always connects to same web-server process. > > Are there ones that you use which might use several different connections to > send a series of queries from a single web-user, less than 5 seconds apart? actually, it had never occurred to me to test all browsers in this reguard, but i can think of LWP::UserAgent. gnari From pgsql-performance-owner@postgresql.org Tue Jan 25 10:10:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6621B3A55D4 for ; Tue, 25 Jan 2005 10:10: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 37695-03 for ; Tue, 25 Jan 2005 10:09:57 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 788433A5552 for ; Tue, 25 Jan 2005 10:09:58 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so39922wra for ; Tue, 25 Jan 2005 02:09:56 -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=EhyNoKX29PQoydbes9nDE93R248MmtxFIT54kNdk1YJBppoLM/lQ4yDSaWIF4RX1P6rIuz3EQtjb4XO5xl578Lsb5jQY47bWZAbn5u2xPuPc/FiQw2+Y7xAQdlpXU9MYCCI4y4oDAvEUitP1CE7g67MXYFZKjFmd2dw5zt+pyNE= Received: by 10.54.32.22 with SMTP id f22mr19074wrf; Tue, 25 Jan 2005 02:09:56 -0800 (PST) Received: by 10.54.31.32 with HTTP; Tue, 25 Jan 2005 02:09:56 -0800 (PST) Message-ID: <2989532e05012502092288a062@mail.gmail.com> Date: Tue, 25 Jan 2005 15:39:56 +0530 From: Antony Paul Reply-To: Antony Paul To: Russell Smith Subject: Re: How to boost performance of ilike queries ? Cc: pgsql-performance@postgresql.org In-Reply-To: <200501251949.12874.mr-russ@pws.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <2989532e05012401184b0c3ef9@mail.gmail.com> <200501242058.54670.mr-russ@pws.com.au> <2989532e05012500235c78fd47@mail.gmail.com> <200501251949.12874.mr-russ@pws.com.au> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.54 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/456 X-Sequence-Number: 10146 Actually the query is created like this. User enters the query in a user interface. User can type any character in the query criteria. ie. % and _ can be at any place. User have the freedom to choose query columns as well. The query is agianst a single table . rgds Antony Paul On Tue, 25 Jan 2005 19:49:12 +1100, Russell Smith wrote: > On Tue, 25 Jan 2005 07:23 pm, Antony Paul wrote: > > Creating an index and using lower(column) does not change the explain > > plan estimates. > > It seems that it is not using index for like or ilike queries > > irrespective of whether it have a pattern matching character in it or > > not. (using PostgreSQL 7.3.3) > > > > On googling I found this thread > > > > http://archives.postgresql.org/pgsql-sql/2004-11/msg00285.php > > > > It says that index is not used if the search string begins with a % symbol. > > What exactly are the type of like queries you are going? there is a solution > for having the % at the start, but you can win everyway. > > > > > rgds > > Antony Paul > > > > On Mon, 24 Jan 2005 20:58:54 +1100, Russell Smith wrote: > > > On Mon, 24 Jan 2005 08:18 pm, Antony Paul wrote: > > > > Hi, > > > > I have a query which is executed using ilike. The query values are > > > > received from user and it is executed using PreparedStatement. > > > > Currently all queries are executed as it is using iilike irrespective > > > > of whether it have a pattern matching character or not. Can using = > > > > instead of ilike boot performance ?. If creating index can help then > > > > how the index should be created on lower case or uppercase ?. > > > > > > > It depends on the type of queries you are doing. > > > > > > changing it to something like lower(column) like lower('text%'), and > > > creating an index on lower(column) will give you much better performance. > > > > > > If you have % in the middle of the query, it will still be slow, but I assume that is not > > > the general case. > > > > > > I am not sure what the effect of it being prepared will be, however I've had much success > > > with the method above without the queries being prepared. Others may be able to offer advice > > > about if prepare will effect it. > > > > > > Regards > > > > > > Russell Smith > > > > > > > > From pgsql-performance-owner@postgresql.org Tue Jan 25 13:36:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A9F63A55A3 for ; Tue, 25 Jan 2005 13:35: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 58584-09 for ; Tue, 25 Jan 2005 13:35:42 +0000 (GMT) Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) by svr1.postgresql.org (Postfix) with ESMTP id 900363A5548 for ; Tue, 25 Jan 2005 13:35:44 +0000 (GMT) Received: from fuji.krosing.net (localhost [127.0.0.1]) by fuji.krosing.net (8.13.1/8.13.1) with ESMTP id j0PAgpL6010732; Tue, 25 Jan 2005 12:42:51 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.13.1/8.13.1/Submit) id j0PAgmMv010731; Tue, 25 Jan 2005 12:42:48 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: PostgreSQL clustering VS MySQL clustering From: Hannu Krosing To: Tatsuo Ishii Cc: tgl@sss.pgh.pa.us, marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org In-Reply-To: <20050124.115244.35008937.t-ishii@sra.co.jp> References: <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <20050124.115244.35008937.t-ishii@sra.co.jp> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Date: Tue, 25 Jan 2005 12:42:47 +0200 Message-Id: <1106649767.5790.18.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) 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: 200501/458 X-Sequence-Number: 10148 =DChel kenal p=E4eval (esmasp=E4ev, 24. jaanuar 2005, 11:52+0900), kirjutas Tatsuo Ishii: > > Tatsuo Ishii writes: > > > Probably VACUUM works well for small to medium size tables, but not > > > for huge ones. I'm considering about to implement "on the spot > > > salvaging dead tuples". > >=20 > > That's impossible on its face, except for the special case where the > > same transaction inserts and deletes a tuple. In all other cases, the > > transaction deleting a tuple cannot know whether it will commit. >=20 > Of course. We need to keep a list of such that tuples until commit or > abort. what about other transactions, which may have started before current one and be still running when current one commites ? I once proposed an extra parameter added to VACUUM FULL which determines how much free space to leave in each page vacuumed. If there were room the new tuple could be placed near the old one in most cases and thus avoid lots of disk head movement when updating huge tables in one go. ------------ Hannu Krosing From pgsql-performance-owner@postgresql.org Tue Jan 25 20:06:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3C7F63A5855 for ; Tue, 25 Jan 2005 20:06: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 14050-09 for ; Tue, 25 Jan 2005 20:06:41 +0000 (GMT) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr1.postgresql.org (Postfix) with ESMTP id 012903A5792 for ; Tue, 25 Jan 2005 20:06:34 +0000 (GMT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Tue, 25 Jan 2005 12:09:08 -0800 Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 25 Jan 2005 12:09:05 -0800 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005012512090430138 for ; Tue, 25 Jan 2005 12:09:04 -0800 X-ASG-Debug-ID: 1106683590-13699-23-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from mail1 (mail1.hq.corp [192.168.160.5]) by barracuda.tecarta.com (Spam Firewall) with SMTP id E1CAA201428B for ; Tue, 25 Jan 2005 12:06:30 -0800 (PST) Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 25 Jan 2005 12:08:59 -0800 Message-ID: <41F63424.1060904@sfnet.cc> Date: Tue, 25 Jan 2005 11:57:24 +0000 From: Steve Poe User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org X-ASG-Orig-Subj: Ideal disk setup for Postgresql 7.4? Subject: Ideal disk setup for Postgresql 7.4? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 Jan 2005 20:08:59.0139 (UTC) FILETIME=[B4BEB530:01C50319] X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com X-Barracuda-Spam-Score: -0.58 X-Barracuda-Spam-Status: No, SCORE=-0.58 using global scores of TAG_LEVEL=4.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_20, DATE_IN_PAST_06_12 X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.951 Rule breakdown below pts rule name description ---- ---------------------- ------------------------------------------- -1.43 BAYES_20 BODY: Bayesian spam probability is 20 to 30% [score: 0.2996] 0.85 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.276 tagged_above=0 required=5 tests=AWL, DATE_IN_PAST_06_12, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/484 X-Sequence-Number: 10174 I help manage an animal hospital of 100-employees Linux servers. I am new to database setup and tuning, I was hoping I could get some direction on a setting up drive array we're considering moving our database to. They're currently on a two-disk Adaptec RAID1 with Postgresql 7.4.2. The drive array is a 7-disk fibre channel on a Qlogic 2100 controller. I am currently testing RAID5 (sw). The main reason of moving to a drive array is the high level of context switches we get during the day (>30K for 20 mins per hour). The OS and database exist on the same disk but seperate parition (which probably makes little difference) additional info: On average, 30-35 vets/doctors are connecting to the database at any time from 7am - 7pm. The database is very active for the small company. Server Info: Centos 3.3 (RHEL 3.x equivelent) 4GB RAM Adaptec 2100S RAID Qlogic QLA2100 Fibre Any feedback/suggestions are greatly appreciated. Thanks. Steve Poe From pgsql-performance-owner@postgresql.org Tue Jan 25 13:01:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 92A193A5526 for ; Tue, 25 Jan 2005 13:01: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 55414-10 for ; Tue, 25 Jan 2005 13:01:43 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by svr1.postgresql.org (Postfix) with ESMTP id 6AF693A5508 for ; Tue, 25 Jan 2005 13:01:45 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so67873wri for ; Tue, 25 Jan 2005 05:01: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=NrGK8FaKXEBQ7em2urVp+Xn7G3V0wk/uYW1tJVU8SFPgs5diagJhp2yFtThC3y+yPs0zhUUqxN79eVMUgxWL0QjhHYzpyUcZSXxs7QZzawOywPkQSoJEZARImyg9WGu3wPNPz+r53WBPmsweUk5MWj8RafQivYN8la/cg1HnurY= Received: by 10.54.36.11 with SMTP id j11mr532597wrj; Tue, 25 Jan 2005 05:01:45 -0800 (PST) Received: by 10.54.31.32 with HTTP; Tue, 25 Jan 2005 05:01:45 -0800 (PST) Message-ID: <2989532e05012505011e5a0cfa@mail.gmail.com> Date: Tue, 25 Jan 2005 18:31:45 +0530 From: Antony Paul Reply-To: Antony Paul To: pgsql-performance@postgresql.org Subject: PostgreSQL not utilising available memory 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.54 tagged_above=0 required=5 tests=FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/457 X-Sequence-Number: 10147 Hi all, I am running PostgreSQL 7.3.3 on a RHL 7.0 box with PIII and 512 MB RAM. Recenlty I upgraded the kernel from 2.2.16 to 2.4.28. Now the problem is Postgres is using only half of the memory now while before upgrading the kernel it was using full memory plus swap. If Postgres use the full available memory will it run faster ?. I disabled Higmemory support while compiling kernel. >From Top total used free shared buffers cached Mem: 501 209 292 0 2 173 -/+ buffers/cache: 34 467 Swap: 501 0 501 rgds Antony Paul From pgsql-performance-owner@postgresql.org Tue Jan 25 14:01:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF4413A5413 for ; Tue, 25 Jan 2005 14:01: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 63319-07 for ; Tue, 25 Jan 2005 14:01:23 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 597FF3A4FB8 for ; Tue, 25 Jan 2005 14:01:25 +0000 (GMT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id AE9D135856; Tue, 25 Jan 2005 06:01:25 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id AD0CB3583B; Tue, 25 Jan 2005 06:01:25 -0800 (PST) Date: Tue, 25 Jan 2005 06:01:25 -0800 (PST) From: Stephan Szabo To: Antony Paul Cc: Russell Smith , pgsql-performance@postgresql.org Subject: Re: How to boost performance of ilike queries ? In-Reply-To: <2989532e05012500235c78fd47@mail.gmail.com> Message-ID: <20050125055555.J11415@megazone.bigpanda.com> References: <2989532e05012401184b0c3ef9@mail.gmail.com> <200501242058.54670.mr-russ@pws.com.au> <2989532e05012500235c78fd47@mail.gmail.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.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/462 X-Sequence-Number: 10152 On Tue, 25 Jan 2005, Antony Paul wrote: > Creating an index and using lower(column) does not change the explain > plan estimates. > It seems that it is not using index for like or ilike queries > irrespective of whether it have a pattern matching character in it or > not. (using PostgreSQL 7.3.3) I believe in 7.3.x an index is only considered for like in "C" locale, I think the *_pattern_op opclasses were added in 7.4 for which you can make indexes that are considered for non wildcard starting search strings in non "C" locales. And it may have trouble doing estimates before 8.0 on the functional index because of lack of statistics. You may want to consider an upgrade once 8.0 shakes out a bit. From pgsql-performance-owner@postgresql.org Tue Jan 25 14:18:19 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 89B143A4AFF for ; Tue, 25 Jan 2005 14:18: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 66121-03 for ; Tue, 25 Jan 2005 14:18:03 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id BB7093A4D7E for ; Tue, 25 Jan 2005 14:18:04 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id A446F62A2D; Tue, 25 Jan 2005 23:18:03 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id 8BAA910CD06; Tue, 25 Jan 2005 23:18:03 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 6A7FA10CD04; Tue, 25 Jan 2005 23:18:03 +0900 (JST) Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id XAA09039; Tue, 25 Jan 2005 23:18:03 +0900 Date: Tue, 25 Jan 2005 23:19:17 +0900 (JST) Message-Id: <20050125.231917.35659109.t-ishii@sra.co.jp> To: hannu@tm.ee Cc: tgl@sss.pgh.pa.us, marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering From: Tatsuo Ishii In-Reply-To: <1106649767.5790.18.camel@fuji.krosing.net> References: <25335.1106428223@sss.pgh.pa.us> <20050124.115244.35008937.t-ishii@sra.co.jp> <1106649767.5790.18.camel@fuji.krosing.net> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/463 X-Sequence-Number: 10153 > > > Tatsuo Ishii writes: > > > > Probably VACUUM works well for small to medium size tables, but not > > > > for huge ones. I'm considering about to implement "on the spot > > > > salvaging dead tuples". > > > > > > That's impossible on its face, except for the special case where the > > > same transaction inserts and deletes a tuple. In all other cases, the > > > transaction deleting a tuple cannot know whether it will commit. > > > > Of course. We need to keep a list of such that tuples until commit or > > abort. > > what about other transactions, which may have started before current one > and be still running when current one commites ? Then dead tuples should be left. Perhaps in this case we could register them in FSM or whatever for later processing. -- Tatsuo Ishii > I once proposed an extra parameter added to VACUUM FULL which determines > how much free space to leave in each page vacuumed. If there were room > the new tuple could be placed near the old one in most cases and thus > avoid lots of disk head movement when updating huge tables in one go. > > ------------ > > Hannu Krosing > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Tue Jan 25 15:25:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ACF243A576F for ; Tue, 25 Jan 2005 15:13: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 72150-04 for ; Tue, 25 Jan 2005 15:12:46 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 6E1E83A540F for ; Tue, 25 Jan 2005 15:10:51 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so314642wri for ; Tue, 25 Jan 2005 07:10:52 -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=eskBMGfjslkt4FKwL0/Y1IpvBXN04zrBhNkpmHHEo5xTz0thUhpBgiLMs+dlVT+DcInpZkvMGpikT38c+QNJr+KZTJb2CYya+//4Oax6Erv9eBAtjZu5WAGWNfKDFe1TfTSpN4O2d4L/IQ9nRf/OPRCSdIg3jVOzY0JIsqfxY2w= Received: by 10.54.53.6 with SMTP id b6mr48109wra; Tue, 25 Jan 2005 07:10:51 -0800 (PST) Received: by 10.54.4.71 with HTTP; Tue, 25 Jan 2005 07:10:50 -0800 (PST) Message-ID: <6c21003b05012507104989efed@mail.gmail.com> Date: Tue, 25 Jan 2005 09:10:50 -0600 From: Don Drake Reply-To: Don Drake To: pgsql-performance@postgresql.org Subject: Postgres stopped running (shmget failed) 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: 200501/464 X-Sequence-Number: 10154 My db server is running under high load recently and the number of connections during the morning hours is actually very high. This morning I found the postgres not running and the following in my log file: DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. HINT: In a moment you should be able to reconnect to the database and repeat your command. 2005-01-25 01:38:00 WARNING: terminating connection because of crash of another server process DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. HINT: In a moment you should be able to reconnect to the database and repeat your command. 2005-01-25 01:38:05 WARNING: terminating connection because of crash of another server process DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. HINT: In a moment you should be able to reconnect to the database and repeat your command. 2005-01-25 01:38:16 LOG: all server processes terminated; reinitializing 2005-01-25 01:38:22 FATAL: could not create shared memory segment: Cannot allocate memory DETAIL: Failed system call was shmget(key=5432001, size=273383424, 03600). HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currently 273383424 bytes), reduce PostgreSQL's shared_buffers parameter (currently 32768) and/or its max_connections parameter (currently 40). The PostgreSQL documentation contains more information about shared memory configuration. 2005-01-25 08:00:07 LOG: database system was interrupted at 2005-01-25 00:30:15 CST I'm confused to as to what is the problem. My shared memory kernel setting are as follows: [root@katie data]# tail /etc/sysctl.conf # Controls whether core dumps will append the PID to the core filename. # Useful for debugging multi-threaded applications. kernel.core_uses_pid = 1 # For POSTGRESQL -Drake 8/1/04 kernel.shmall = 2097152 kernel.shmmax = 1073741824 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 [root@katie data]# cat /proc/sys/kernel/shmall 2097152 [root@katie data]# cat /proc/sys/kernel/shmmax 1073741824 Here's my ipcs output after restarting the server: [root@katie data]# ipcs ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0052e2c1 196608 postgres 600 273383424 11 ------ Semaphore Arrays -------- key semid owner perms nsems 0x0052e2c1 589824 postgres 600 17 0x0052e2c2 622593 postgres 600 17 0x0052e2c3 655362 postgres 600 17 ------ Message Queues -------- key msqid owner perms used-bytes messages I have 2GB of RAM, is this telling me I need more RAM? There are some other processes running on this server besides postgres. Thanks. -Don -- Donald Drake President Drake Consulting http://www.drakeconsult.com/ 312-560-1574 From pgsql-performance-owner@postgresql.org Tue Jan 25 15:47:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D04D73A575E for ; Tue, 25 Jan 2005 15:42: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 76080-05 for ; Tue, 25 Jan 2005 15:41:55 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id DB8123A5738 for ; Tue, 25 Jan 2005 15:41:58 +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 j0PFfr3U003583; Tue, 25 Jan 2005 10:41:53 -0500 (EST) To: Hannu Krosing Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-reply-to: <1106531786.5790.9.camel@fuji.krosing.net> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> <1106531786.5790.9.camel@fuji.krosing.net> Comments: In-reply-to Hannu Krosing message dated "Mon, 24 Jan 2005 03:56:25 +0200" Date: Tue, 25 Jan 2005 10:41:53 -0500 Message-ID: <3582.1106667713@sss.pgh.pa.us> From: Tom Lane 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: 200501/465 X-Sequence-Number: 10155 Hannu Krosing writes: > Why is removing index entries essential ? Because once you re-use the tuple slot, any leftover index entries would be pointing to the wrong rows. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 16:19:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A2E903A5578 for ; Tue, 25 Jan 2005 16:19: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 81517-01 for ; Tue, 25 Jan 2005 16:19:03 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 055C03A5792 for ; Tue, 25 Jan 2005 16:18:08 +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 j0PGI5dt003963; Tue, 25 Jan 2005 11:18:05 -0500 (EST) To: Don Drake Cc: pgsql-performance@postgresql.org Subject: Re: Postgres stopped running (shmget failed) In-reply-to: <6c21003b05012507104989efed@mail.gmail.com> References: <6c21003b05012507104989efed@mail.gmail.com> Comments: In-reply-to Don Drake message dated "Tue, 25 Jan 2005 09:10:50 -0600" Date: Tue, 25 Jan 2005 11:18:05 -0500 Message-ID: <3962.1106669885@sss.pgh.pa.us> From: Tom Lane 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: 200501/466 X-Sequence-Number: 10156 Don Drake writes: > This morning I found the postgres not running and the following in my log file: > 2005-01-25 01:38:22 FATAL: could not create shared memory segment: > Cannot allocate memory > DETAIL: Failed system call was shmget(key=5432001, size=273383424, 03600). > HINT: This error usually means that PostgreSQL's request for a shared > memory segment exceeded available memory or swap space. To reduce the > request size (currently 273383424 bytes), reduce PostgreSQL's > shared_buffers parameter (currently 32768) and/or its max_connections > parameter (currently 40). I have seen this happen when the old shmem segment didn't get released for some reason, and your kernel settings are such that it won't allow creation of two shmem segments of that size at once. For robustness it's probably a good idea to make sure you *can* create two such segments at once, but for the moment getting rid of the old one with "ipcrm" should be enough to let you restart the postmaster. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 16:50:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 596C83A57D7 for ; Tue, 25 Jan 2005 16:50: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 85516-09 for ; Tue, 25 Jan 2005 16:49:57 +0000 (GMT) Received: from mail22.sea5.speakeasy.net (mail22.sea5.speakeasy.net [69.17.117.24]) by svr1.postgresql.org (Postfix) with ESMTP id D01BE3A57A7 for ; Tue, 25 Jan 2005 16:49:56 +0000 (GMT) Received: (qmail 22206 invoked from network); 25 Jan 2005 16:49:55 -0000 Received: from mail.kinesis-cem.com (HELO pdarley) ([64.81.9.230]) (envelope-sender ) by mail14.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 25 Jan 2005 16:49:55 -0000 From: "Peter Darley" To: , =?UTF-8?Q?Ragnar_Hafsta=C3=B0?= Cc: , "Tatsuo Ishii" Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL Date: Tue, 25 Jan 2005 08:49:58 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 In-Reply-To: <200501241545.51737.josh@agliodbs.com> 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: 200501/467 X-Sequence-Number: 10157 Josh, Please excuse how my client quotes things... > Are there ones that you use which might use several different = connections to=20 > send a series of queries from a single web-user, less than 5 seconds = apart? Using Apache/Perl I often have a situation where we're sending several = queries from the same user (web client) within seconds, or even = simultaneously, that use different connections. When someone logs in to our system they get a frameset that has 5 = windows, each of which is filled with data from queries. Since the = pages in the frames are requested separately by the client the system = doesn't insure that they go to the same process, and subsequently, that = they're not served by the same db connection. Session information is stored in the database (so it's easily = persistent across server processes), so it would be bad if a request for = a page was served by a db server that didn't yet have information about = the user (such as that they're logged in, etc.). If we ever have enough traffic to warrant it, we're going to go to a = load balancer that passes requests to different identical web servers, = at which point we won't even be getting requests from the same machine, = much less the same connection. Thanks, Peter Darley -----Original Message----- From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Josh Berkus Sent: Monday, January 24, 2005 3:46 PM To: Ragnar Hafsta=C3=B0 Cc: pgsql-performance@postgresql.org; Tatsuo Ishii Subject: Re: [PERFORM] PgPool changes WAS: PostgreSQL clustering VS MySQL Ragnar, > note that these sometimes do not provide connection pooling as such, > just persistent connections (Apache::DBI) Yes, right. > no. you can only count on web-server-process=3D=3Dconnection, but not > web-user=3D=3Dconnection, unless you can garantee that the same user > client always connects to same web-server process. Are there ones that you use which might use several different = connections to=20 send a series of queries from a single web-user, less than 5 seconds = apart? --=20 --Josh Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) From pgsql-performance-owner@postgresql.org Tue Jan 25 16:59:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 719963A5806 for ; Tue, 25 Jan 2005 16:59: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 86464-08 for ; Tue, 25 Jan 2005 16:59:21 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 96ABA3A5800 for ; Tue, 25 Jan 2005 16:59:21 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6949238; Tue, 25 Jan 2005 09:01:02 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL Date: Tue, 25 Jan 2005 08:58:37 -0800 User-Agent: KMail/1.6.2 Cc: "Peter Darley" , Ragnar =?utf-8?q?Hafsta=C3=B0?= , "Tatsuo Ishii" References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200501250858.37157.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/468 X-Sequence-Number: 10158 Peter, Ragnar, > > Are there ones that you use which might use several different connections > > to send a series of queries from a single web-user, less than 5 seconds > > apart? > > Using Apache/Perl I often have a situation where we're sending several > queries from the same user (web client) within seconds, or even > simultaneously, that use different connections. So from the sound of it, the connection methods I've been using are the exception rather than the rule. Darn, it worked well for us. :-( What this would point to is NOT being able to use Slony-I for database server pooling for most web applications. Yes? Users should look to pgCluster and C-JDBC instead. BTW, Tatsuo, what's the code relationship between pgPool and pgCluster, if any? --Josh -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Tue Jan 25 17:59:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9AAAB3A579B for ; Tue, 25 Jan 2005 17:53: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 95225-08 for ; Tue, 25 Jan 2005 17:53:27 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 3CAB23A57C6 for ; Tue, 25 Jan 2005 17:53:26 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0PHWVet097223; Tue, 25 Jan 2005 17:32:31 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.3]); Tue, 25 Jan 2005 17:52:28 +0000 Message-ID: <41F6875C.9040804@familyhealth.com.au> Date: Tue, 25 Jan 2005 17:52:28 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alexander Dolgin Cc: pgsql-performance@postgresql.org Subject: Re: 200 times slower then MSSQL?? References: In-Reply-To: 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.121 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200501/474 X-Sequence-Number: 10164 > with about 8000 rows. For this table query: > > SELECT MAX(MsgSeqNum),MAX(LogTimestamp) FROM ELT_tcli_MessageLog > WHERE LogTimestamp >= '0' AND IsFromCounterParty = 'Y' AND > IsOutOfSequence = 'N' > AND ConnectionName = 'DB_BENCHMARK' > AND LogTimestamp IN (SELECT MAX(LogTimestamp) > FROM ELT_tcli_MessageLog > WHERE MsgSeqNum > 0 AND IsFromCounterParty = 'Y' > > AND IsOutOfSequence = 'N' AND > ConnectionName = 'DB_BENCHMARK') > > takes about 1 second on MSSQL Server and 257 seconds on PostgreSQL one. > > Does anybody have idea about reasons of such results? 1. Have you run vaccum analyze recently? 2. Reply with the output of EXPLAIN ANALYZE SELECT... Chris From pgsql-performance-owner@postgresql.org Tue Jan 25 17:57:35 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00DE53A5818 for ; Tue, 25 Jan 2005 17:57: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 96383-03 for ; Tue, 25 Jan 2005 17:57: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 628AF3A584A for ; Tue, 25 Jan 2005 17:57: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 j0PHurg5005141; Tue, 25 Jan 2005 12:56:53 -0500 (EST) To: Randolf Richardson Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft In-reply-to: References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> <12826.1106290803@sss.pgh.pa.us> Comments: In-reply-to Randolf Richardson message dated "Fri, 21 Jan 2005 16:35:38 +0000" Date: Tue, 25 Jan 2005 12:56:53 -0500 Message-ID: <5140.1106675813@sss.pgh.pa.us> From: Tom Lane 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: 200501/472 X-Sequence-Number: 10162 Randolf Richardson writes: > ... the problem is that I have > to create a separate account and password for each .ORG internet domain > name now and can't just use one master account and password for all of > them, This is a registrar issue; if you don't like the user-interface your registrar provides, choose another one. It's got nothing to do with the backend registry, which is merely a database of the publicly visible (WHOIS) info about your domain. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 17:58:23 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AA22F3A57C8 for ; Tue, 25 Jan 2005 17:55: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 95933-02 for ; Tue, 25 Jan 2005 17:55:26 +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 6F8E93A45E6 for ; Tue, 25 Jan 2005 17:55:26 +0000 (GMT) Received: by gp.word-to-the-wise.com (Postfix, from userid 500) id 25F2B900011; Tue, 25 Jan 2005 09:59:20 -0800 (PST) Date: Tue, 25 Jan 2005 09:59:20 -0800 From: Steve Atkins To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-ID: <20050125175920.GA3392@gp.word-to-the-wise.com> References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> <12826.1106290803@sss.pgh.pa.us> 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: 200501/473 X-Sequence-Number: 10163 On Fri, Jan 21, 2005 at 04:35:38PM +0000, Randolf Richardson wrote: > Yes, indeed, that will be. My feeling is that Network Solutions > actually manages the .NET and .COM registries far better than anyone else > does, and when .ORG was switched away I didn't like the lack of flexibility > that I have always enjoyed with .NET and .COM -- the problem is that I have > to create a separate account and password for each .ORG internet domain > name now and can't just use one master account and password for all of > them, and if the same folks are going to be running .NET then I'm going to > wind up having more management to do for that one as well (and I'm not > talking about just a mere handlful of internet domain names either). Wildly off-topic, but that's registrar driven, not registry driven. I have a range of domains (.com, .net, .org and others) all accessed from a single login through a single registrar. You need to use a better registrar. As a bit of obPostgresql, though... While the registry for .org is run on Postgresql, the actual DNS is run on Oracle. That choice was driven by the availability of multi-master replication. Like many of the cases where the problem looks like it needs multi-master replication, though, it doesn't really need it. A single master at any one time, but with the ability to dub any of the slaves a new master at any time would be adequate. If that were available for Postgresql I'd choose it over Oracle were I doing a big distributed database backed system again. Cheers, Steve From pgsql-performance-owner@postgresql.org Tue Jan 25 18:03:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 470BC3A57B6 for ; Tue, 25 Jan 2005 18:02: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 98005-04 for ; Tue, 25 Jan 2005 18:02:35 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id C92283A5780 for ; Tue, 25 Jan 2005 18:02: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 j0PI2NIw005224; Tue, 25 Jan 2005 13:02:24 -0500 (EST) To: "Alexander Dolgin" Cc: pgsql-performance@postgresql.org Subject: Re: 200 times slower then MSSQL?? In-reply-to: References: Comments: In-reply-to "Alexander Dolgin" message dated "Mon, 24 Jan 2005 20:33:39 +0200" Date: Tue, 25 Jan 2005 13:02:23 -0500 Message-ID: <5223.1106676143@sss.pgh.pa.us> From: Tom Lane 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: 200501/475 X-Sequence-Number: 10165 "Alexander Dolgin" writes: > Does anybody have idea about reasons of such results? Try converting the MAX() functions to queries that will use indexes. See FAQ entry 4.7 "My queries are slow or don't make use of the indexes. Why?" regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 18:03:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 325493A581E for ; Tue, 25 Jan 2005 18:01: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 96645-07 for ; Tue, 25 Jan 2005 18:01:12 +0000 (GMT) Received: from school.digsys.bg (school.digsys.bg [193.68.6.1]) by svr1.postgresql.org (Postfix) with ESMTP id 5C71B3A57D8 for ; Tue, 25 Jan 2005 18:01:04 +0000 (GMT) Received: from faith.digsys.bg (sigma.digsys.bg [193.68.6.19]) by school.digsys.bg (8.11.6/8.10.1) with ESMTP id j0PHxjr15125; Tue, 25 Jan 2005 19:59:45 +0200 (EET) Message-ID: <41F68B54.7090206@faith.digsys.bg> Date: Tue, 25 Jan 2005 20:09:24 +0200 From: Kaloyan Iliev Iliev User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 X-Accept-Language: en-us, en, bg MIME-Version: 1.0 To: Alexander Dolgin , pgsql-performance@postgresql.org Subject: Re: 200 times slower then MSSQL?? References: In-Reply-To: Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/476 X-Sequence-Number: 10166 Hi, First it will be good if you supply some EXPLAIN ANALYZE results from your query. Second, do you created the indexes which can be used with WHERE conditions. And Third AFAK MAX doesn't use index. If you only need max then you can try: ORDER BY .... DESC and LIMIT 1. But you can't use this if you want to select the two max values at once. I am not an expert so if I am wrong, please someone to correct me. Kaloyan Alexander Dolgin wrote: >Hi all, > >We are developing some application that works with DB over JDBC. We've used >MSSQL before and trying to migrate to PostgreSQL now. Unfortunately problems >with performance are found. MSSQL with default configuration looks like much >faster then PostgreSQL on the same hardware (PostgreSQL8 rc5 was used). I've >tried to increase work_mem significant (work_mem = 262144) but it doesn't >help. >Here is result of simple benchmark. I have table >CREATE TABLE elt_tcli_messagelog >( > connectionname varchar(64), > msgseqnum int4, > connectionmessageid int4, > logtimestamp varchar(64), > isfromcounterparty char(1), > msgtype varchar(64), > possdupflag char(1), > isoutofsequence char(1), > ordtrnid varchar(64), > ordrqstid varchar(64), > counterrequestid varchar(64), > clordid varchar(64), > origclordid varchar(64), > execid varchar(64), > exectranstype varchar(64), > exectype varchar(64), > ordstatus varchar(64), > lastqty float8, > orderqty float8, > cumqty float8, > leavesqty float8, > sendercompid varchar(64), > targetcompid varchar(64), > tradeaccthrchy varchar(64), > tradeacctid varchar(64), > routedtransactiondestination varchar(64), > originatingconnectionname varchar(64), > originatingconnectionmsgid int4, > instrument varchar(64), > portfolio varchar(64), > prevseqnum int4, > "Message" text, > nonmetadatafields text >) > >with about 8000 rows. For this table query: > >SELECT MAX(MsgSeqNum),MAX(LogTimestamp) FROM ELT_tcli_MessageLog >WHERE LogTimestamp >= '0' AND IsFromCounterParty = 'Y' AND >IsOutOfSequence = 'N' > AND ConnectionName = 'DB_BENCHMARK' > AND LogTimestamp IN (SELECT MAX(LogTimestamp) > FROM ELT_tcli_MessageLog > WHERE MsgSeqNum > 0 AND IsFromCounterParty = 'Y' > > AND IsOutOfSequence = 'N' AND >ConnectionName = 'DB_BENCHMARK') > >takes about 1 second on MSSQL Server and 257 seconds on PostgreSQL one. > >Does anybody have idea about reasons of such results? > >Thanks, >Alexander Dolgin. > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > > > From pgsql-performance-owner@postgresql.org Tue Jan 25 18:20:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ADA1F3A5838 for ; Tue, 25 Jan 2005 18:19: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 00339-05 for ; Tue, 25 Jan 2005 18:19:56 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.193]) by svr1.postgresql.org (Postfix) with ESMTP id 6BDA03A5855 for ; Tue, 25 Jan 2005 18:19:49 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so86555wri for ; Tue, 25 Jan 2005 10:19:48 -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=RXiihjF3qIZlR5k5PoTL3/VK2Pknaq5rIAGid4PEnGdX8G/yOh9nUzergKnPqeKRFickNbuclwvdaHY+7v3COsRkgRrw9HxdiuHklQI8LNOQ4oThoMPDdYGaxFyYrbycnqfHummwhPIHxoP3OdMCqZvXUyf5/O2Yi5WUu7PoCqg= Received: by 10.54.20.70 with SMTP id 70mr46462wrt; Tue, 25 Jan 2005 10:19:48 -0800 (PST) Received: by 10.54.59.22 with HTTP; Tue, 25 Jan 2005 10:19:48 -0800 (PST) Message-ID: <330532b605012510193eb73b72@mail.gmail.com> Date: Tue, 25 Jan 2005 13:19:48 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: pgsql-performance@postgresql.org Subject: PG versus FreeBSD, startup and connections problems 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.045 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/477 X-Sequence-Number: 10167 Hi gang, I just inherited a FreeBSD box, and it is horribly sick. So we moved everything to a new machine (power supply failures) and finally got stuff running again. Ok, for two days (rimshot) Here are the two problems, and for the life of me I cannot find any documentation on either: 1) freebsd will only let PostgreSQL have 38 connections at a time, regardless of kernel settings or postgresql.conf settings. Where exactly (and how, exactly) does one remedy that problem? 2) As of this morning, the machine was down again, this time apache fired up normally but pg refuses to start - without errors. When I start with postmaster on the CLI I also get no errors, just no postmaster. Why am I not seeing the errors, is this a FreeBSD or PostgreSQL issue? For example: $ pg_ctl start postmaster successfully started $ pg_ctl status pg_ctl: postmaster or postgres not running OR: $ postmaster -D /usr/local/pgsql/data $ (no response) There are no errors in /var/log/pgsql either, so I have absolutely no idea how to troubleshoot :-( -- Mitch From pgsql-performance-owner@postgresql.org Tue Jan 25 18:29:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 052523A5770; Tue, 25 Jan 2005 18:29: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 01433-09; Tue, 25 Jan 2005 18:28:59 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 63E453A5780; Tue, 25 Jan 2005 18:28: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 1CtVQk-0002aQ-00; Tue, 25 Jan 2005 13:28:46 -0500 To: alex@neteconomist.com Cc: Richard Huxton , Andrei Bintintan , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> <33c6269f05012008391490448b@mail.gmail.com> In-Reply-To: <33c6269f05012008391490448b@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 25 Jan 2005 13:28:46 -0500 Message-ID: <87y8eh1hy9.fsf@stark.xeocode.com> Lines: 19 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.058 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/478 X-Sequence-Number: 10168 Alex Turner writes: > I am also very interesting in this very question.. Is there any way to > declare a persistant cursor that remains open between pg sessions? > This would be better than a temp table because you would not have to > do the initial select and insert into a fresh table and incur those IO > costs, which are often very heavy, and the reason why one would want > to use a cursor. TANSTAAFL. How would such a persistent cursor be implemented if not by building a temporary table somewhere behind the scenes? There could be some advantage if the data were stored in a temporary table marked as not having to be WAL logged. Instead it could be automatically cleared on every database start. -- greg From pgsql-performance-owner@postgresql.org Tue Jan 25 18:29:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AC2E43A5807 for ; Tue, 25 Jan 2005 18:29: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 01090-09 for ; Tue, 25 Jan 2005 18:29:29 +0000 (GMT) Received: from web30309.mail.mud.yahoo.com (web30309.mail.mud.yahoo.com [68.142.200.102]) by svr1.postgresql.org (Postfix) with SMTP id 46ECA3A57EE for ; Tue, 25 Jan 2005 18:29:27 +0000 (GMT) Received: (qmail 98346 invoked by uid 60001); 25 Jan 2005 18:29: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=jgwgnHjbudMFUN/MQ+t/EgNy8vA2CjGZHkCQaEda8PgNpIELWsLeEMjwny6A8Vr3tz3AehqWcnaqpez9QjUcyZpP2vcMZPhaswSx5dQ4SUAczQOOY7QVVHWfuuXumqoFW3+JGs4QDbnmOR2y7dd//yVcOcIRL2sCYwCIve2aimI= ; Message-ID: <20050125182926.98344.qmail@web30309.mail.mud.yahoo.com> Received: from [63.78.249.254] by web30309.mail.mud.yahoo.com via HTTP; Tue, 25 Jan 2005 10:29:26 PST Date: Tue, 25 Jan 2005 10:29:26 -0800 (PST) From: Litao Wu Subject: Re: reltuples after vacuum and analyze To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <27553.1106612786@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.639 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD X-Spam-Level: * X-Archive-Number: 200501/479 X-Sequence-Number: 10169 Thanks, Then how to explain relpages (size_kb in result returned)? SELECT relname, relpages * 8 as size_kb, relfilenode, reltuples FROM pg_class c1 WHERE relkind = 'r' AND relname = 'my_tab'; relname | size_kb | relfilenode | reltuples ------------------+---------+-------------+----------- my_tab | 30088 | 266181583 | 165724 analyze my_tab; relname | size_kb | relfilenode | reltuples ------------------+---------+-------------+------------- my_tab | 2023024 | 266181583 | 1.12323e+07 vacuum my_tab; SELECT relname, relpages * 8 as size_kb, relfilenode, reltuples FROM pg_class c1 WHERE relkind = 'r' AND relname = 'my_tab'; relname | size_kb | relfilenode | reltuples ------------------+---------+-------------+----------- my_tab | 2038016 | 266181583 | 189165 (1 row) --- Tom Lane wrote: > Litao Wu writes: > > I noticed that reltuples are way off if > > I vacuum the table and analyze the table. > > And the data (296901) after vacuum seems > > accurate while > > the reltuples (1.90744e+06) > > after anlayze is too wrong. > > VACUUM derives an exact count because it scans the > whole table. ANALYZE > samples just a subset of the table and extrapolates. > It would appear > that you've got radically different tuple densities > in different parts > of the table, and that's confusing ANALYZE. > > > My PG version is 7.3.2 (I know it is old). > > 8.0's ANALYZE uses a new sampling method that we > think is less prone > to this error, though of course any sampling method > will fail some of > the time. > > regards, tom lane > __________________________________ 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 Tue Jan 25 18:33:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AF3B3A5836 for ; Tue, 25 Jan 2005 18:33: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 01942-09 for ; Tue, 25 Jan 2005 18:33:07 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 9F6AF3A5816 for ; Tue, 25 Jan 2005 18:33:07 +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 j0PIX6QJ005590; Tue, 25 Jan 2005 13:33:07 -0500 (EST) To: Litao Wu Cc: pgsql-performance@postgresql.org Subject: Re: reltuples after vacuum and analyze In-reply-to: <20050125182926.98344.qmail@web30309.mail.mud.yahoo.com> References: <20050125182926.98344.qmail@web30309.mail.mud.yahoo.com> Comments: In-reply-to Litao Wu message dated "Tue, 25 Jan 2005 10:29:26 -0800" Date: Tue, 25 Jan 2005 13:33:06 -0500 Message-ID: <5589.1106677986@sss.pgh.pa.us> From: Tom Lane 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: 200501/480 X-Sequence-Number: 10170 Litao Wu writes: > Then how to explain relpages > (size_kb in result returned)? relpages should be accurate in either case, since we get that by asking the kernel (lseek). regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 18:48:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E850B3A579B for ; Tue, 25 Jan 2005 18:41: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 02543-10 for ; Tue, 25 Jan 2005 18:41:17 +0000 (GMT) Received: from web30303.mail.mud.yahoo.com (web30303.mail.mud.yahoo.com [68.142.200.96]) by svr1.postgresql.org (Postfix) with SMTP id E51E63A5792 for ; Tue, 25 Jan 2005 18:41:16 +0000 (GMT) Received: (qmail 1350 invoked by uid 60001); 25 Jan 2005 18:41:16 -0000 Message-ID: <20050125184116.1348.qmail@web30303.mail.mud.yahoo.com> Received: from [63.78.249.254] by web30303.mail.mud.yahoo.com via HTTP; Tue, 25 Jan 2005 10:41:16 PST Date: Tue, 25 Jan 2005 10:41:16 -0800 (PST) From: Litao Wu Subject: Re: reltuples after vacuum and analyze To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <5589.1106677986@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.802 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD X-Spam-Level: * X-Archive-Number: 200501/482 X-Sequence-Number: 10172 I know it is accurate. My question is why the table takes 2023024KB after analyzed? And why it does not shink to 30088 after vacuumed? I know "vacuum full verbose" will force it shrink to reasonable size. But I do not understand why "analyze" bloats the table size so big?? Please note all above commands are done within minutes and I truely do not believe the table of 189165 rows takes that much space. Furthermore, I notice last weekly "vacuum full" even did not reclaim the space back. Thanks, --- Tom Lane wrote: > Litao Wu writes: > > Then how to explain relpages > > (size_kb in result returned)? > > relpages should be accurate in either case, since we > get that by asking > the kernel (lseek). > > regards, tom lane > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From pgsql-performance-owner@postgresql.org Tue Jan 25 18:46:58 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 771D93A5451 for ; Tue, 25 Jan 2005 18:44: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 02999-07 for ; Tue, 25 Jan 2005 18:43:51 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 731763A5681 for ; Tue, 25 Jan 2005 18:43: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 j0PIhprG005693; Tue, 25 Jan 2005 13:43:51 -0500 (EST) To: Litao Wu Cc: pgsql-performance@postgresql.org Subject: Re: reltuples after vacuum and analyze In-reply-to: <20050125184116.1348.qmail@web30303.mail.mud.yahoo.com> References: <20050125184116.1348.qmail@web30303.mail.mud.yahoo.com> Comments: In-reply-to Litao Wu message dated "Tue, 25 Jan 2005 10:41:16 -0800" Date: Tue, 25 Jan 2005 13:43:51 -0500 Message-ID: <5692.1106678631@sss.pgh.pa.us> From: Tom Lane 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: 200501/481 X-Sequence-Number: 10171 Litao Wu writes: > reasonable size. But I do not understand > why "analyze" bloats the table size so > big?? ANALYZE won't bloat anything. I suppose you have other processes inserting or updating data in the table meanwhile. regards, tom lane From pgsql-performance-owner@postgresql.org Tue Jan 25 18:50:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B67693A584A for ; Tue, 25 Jan 2005 18:48: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 03310-06 for ; Tue, 25 Jan 2005 18:48:09 +0000 (GMT) Received: from web30309.mail.mud.yahoo.com (web30309.mail.mud.yahoo.com [68.142.200.102]) by svr1.postgresql.org (Postfix) with SMTP id ABA743A582F for ; Tue, 25 Jan 2005 18:48:08 +0000 (GMT) Received: (qmail 3868 invoked by uid 60001); 25 Jan 2005 18:48: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=A5eSyebUC3FDRiqBDzjoSlkAVcNYNRtA28O26aVf3yYeEB0SzNbB9DowM5J31hTzU66dhW4AUrQYgx7T/bjoUjlswGIAUaYcNgaJmlWPS8m9e9TCiOfAiKFXuLiNt0IgwKRUkvQH1GstKq3Lrv1ciCB/s4ghaSj2nKihYJvXk6U= ; Message-ID: <20050125184808.3866.qmail@web30309.mail.mud.yahoo.com> Received: from [63.78.249.254] by web30309.mail.mud.yahoo.com via HTTP; Tue, 25 Jan 2005 10:48:08 PST Date: Tue, 25 Jan 2005 10:48:08 -0800 (PST) From: Litao Wu Subject: Re: reltuples after vacuum and analyze To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <5692.1106678631@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.87 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_YAHOO_RCVD X-Spam-Level: * X-Archive-Number: 200501/483 X-Sequence-Number: 10173 Believe or not. The above command is my screen snapshot. I believe it is most possibably a PG bug! --- Tom Lane wrote: > Litao Wu writes: > > reasonable size. But I do not understand > > why "analyze" bloats the table size so > > big?? > > ANALYZE won't bloat anything. I suppose you have > other processes > inserting or updating data in the table meanwhile. > > regards, tom lane > __________________________________ Do you Yahoo!? All your favorites on one personal page � Try My Yahoo! http://my.yahoo.com From pgsql-performance-owner@postgresql.org Tue Jan 25 21:09:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B35043A58AF for ; Tue, 25 Jan 2005 21:09: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 20218-06 for ; Tue, 25 Jan 2005 21:09:09 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 6DD3C3A5876 for ; Tue, 25 Jan 2005 21:09:09 +0000 (GMT) Received: (qmail 26196 invoked from network); 25 Jan 2005 21:08:59 -0000 Received: from unknown (HELO ?10.0.10.28?) (10.0.10.28) by 0 with SMTP; 25 Jan 2005 21:08:59 -0000 Message-ID: <41F6B56A.9010103@coretech.co.nz> Date: Wed, 26 Jan 2005 10:08:58 +1300 From: Mark Kirkwood User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mitch Pirtle Cc: pgsql-performance@postgresql.org Subject: Re: PG versus FreeBSD, startup and connections problems References: <330532b605012510193eb73b72@mail.gmail.com> In-Reply-To: <330532b605012510193eb73b72@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/485 X-Sequence-Number: 10175 Mitch Pirtle wrote: >1) freebsd will only let PostgreSQL have 38 connections at a time, >regardless of kernel settings or postgresql.conf settings. Where >exactly (and how, exactly) does one remedy that problem? > > > What version of FreeBSD is the box running? Generally you need to change semaphores and shared memory settings, e.g. for 5.x or late 4.x : in /etc/sysctl.conf : kern.ipc.shmmax=100000000 kern.ipc.shmall=32768 (can be set online using systcl -w) Semaphores need to be set in /boot/loader.conf kern.ipc.semmni=256 kern.ipc.semmns=256 (can typed at the loader prompt using set) These settings should let you have ~100 connections and use about 100M of shared memory for shared_buffers. Early 4.x (I think) and before will need a kernel rebuild, see http://www.postgresql.org/docs/7.4/static/kernel-resources.html#SYSVIPC >2) As of this morning, the machine was down again, this time apache >fired up normally but pg refuses to start - without errors. When I >start with postmaster on the CLI I also get no errors, just no >postmaster. Why am I not seeing the errors, is this a FreeBSD or >PostgreSQL issue? > >For example: > >$ pg_ctl start >postmaster successfully started >$ pg_ctl status >pg_ctl: postmaster or postgres not running > >OR: > >$ postmaster -D /usr/local/pgsql/data >$ >(no response) > > > BTW - What version of Pg are you using? Check your postgresql.conf to see if all the output is going to syslog, e.g, syslog=2 If not, then unfortunately it is possible that whatever is causing the machine to be unstable has corrupted the data directory (so ...err... restore time). Starting the postmaster in debug mode will provide more output: $ postmaster -d 5 Additionally utilitites like 'strace' will give you a bit more info about where the startup process gets to. Do you know why the box went down? The freebsd-bugs or freebsd-stable list will help with respect to Freebsd crashing, see http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/eresources.html#ERESOURCES-MAIL regards Mark From pgsql-performance-owner@postgresql.org Tue Jan 25 21:50:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7CE173A5821 for ; Tue, 25 Jan 2005 21: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 24045-01 for ; Tue, 25 Jan 2005 21:50:09 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9732B3A5806 for ; Tue, 25 Jan 2005 21:50:10 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 351C8319CE; Tue, 25 Jan 2005 22:50:10 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Date: Tue, 25 Jan 2005 16:46:48 -0500 Organization: cbbrowne Computing Inc Lines: 25 Message-ID: References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> <12826.1106290803@sss.pgh.pa.us> <20050125175920.GA3392@gp.word-to-the-wise.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 (Corporate Culture, linux) Cancel-Lock: sha1:2bGeMEejh249i4No2o43696gP2g= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.081 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/486 X-Sequence-Number: 10176 Centuries ago, Nostradamus foresaw when steve@blighty.com (Steve Atkins) would write: > As a bit of obPostgresql, though... While the registry for .org is > run on Postgresql, the actual DNS is run on Oracle. That choice was > driven by the availability of multi-master replication. > > Like many of the cases where the problem looks like it needs > multi-master replication, though, it doesn't really need it. A > single master at any one time, but with the ability to dub any of > the slaves a new master at any time would be adequate. If that were > available for Postgresql I'd choose it over Oracle were I doing a > big distributed database backed system again. Well, this is something that actually _IS_ available for PostgreSQL in the form of Slony-I. Between "MOVE SET" (that does controlled takeover) and "FAILOVER" (that recovers from the situation where a 'master' node craters), this has indeed become available. Automating activation of the failover process isn't quite there yet, though that's mostly a matter that the methodology would involve considerable tuning of recovery scripts to system behaviour. -- select 'cbbrowne' || '@' || 'ntlug.org'; http://cbbrowne.com/info/slony.html Pay no attention to the PDP-11 behind the front panel. -- PGS, in reference to OZ From pgsql-performance-owner@postgresql.org Wed Jan 26 08:02:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 765423A5B07 for ; Wed, 26 Jan 2005 08:02: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 83535-04 for ; Wed, 26 Jan 2005 08:02:07 +0000 (GMT) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr1.postgresql.org (Postfix) with ESMTP id 66E0E3A3E21 for ; Wed, 26 Jan 2005 08:02:07 +0000 (GMT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Wed, 26 Jan 2005 00:04:41 -0800 Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 26 Jan 2005 00:04:39 -0800 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005012600043831837 for ; Wed, 26 Jan 2005 00:04:38 -0800 X-ASG-Debug-ID: 1106726523-9611-2-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from mail1 (mail1.hq.corp [192.168.160.5]) by barracuda.tecarta.com (Spam Firewall) with SMTP id BE2A3201429D for ; Wed, 26 Jan 2005 00:02:03 -0800 (PST) Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 26 Jan 2005 00:04:32 -0800 Message-ID: <41F6DBD8.2050008@sfnet.cc> Date: Tue, 25 Jan 2005 23:52:56 +0000 From: Steve Poe User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org X-ASG-Orig-Subj: Re: [PERFORM] Ideal disk setup for Postgresql 7.4? Subject: Re: Ideal disk setup for Postgresql 7.4? References: <41F63424.1060904@sfnet.cc> <200501251903.09734.josh@agliodbs.com> In-Reply-To: <200501251903.09734.josh@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Jan 2005 08:04:32.0190 (UTC) FILETIME=[AAD665E0:01C5037D] X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com X-Barracuda-Spam-Score: -0.06 X-Barracuda-Spam-Status: No, SCORE=-0.06 using global scores of TAG_LEVEL=4.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_30, DATE_IN_PAST_06_12 X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.954 Rule breakdown below pts rule name description ---- ---------------------- ------------------------------------------- -0.90 BAYES_30 BODY: Bayesian spam probability is 30 to 40% [score: 0.3530] 0.85 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.272 tagged_above=0 required=5 tests=AWL, DATE_IN_PAST_06_12, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/491 X-Sequence-Number: 10181 Josh, Thanks for your feedback, I appreciate it. >Check what I have to say at http://www.powerpostgresql.com/PerfList > > Will do. >>They're currently on a two-disk Adaptec RAID1 with Postgresql 7.4.2. >> >> > >And you've not upgraded to 7.4.6 because .... ? > > > Because the proprietary application running the business has not certified on it. Unfortunately, I am at the mercy of their support in case something goes wrong. >>The drive array is a 7-disk fibre channel on a Qlogic 2100 controller. I >>am currently testing RAID5 (sw). >> >> > >In general, RAID 5 is not so great for databases. See the article for more. > > > Okay, thanks. Even with 7-disks? I trust that. So, RAID 1+0 (sw) is probably the best option. I've run sw RAID personally for years without issue. I am a bit hesitant in doing sw RAID for a production server for a database --- probably because its not my server. Any thoughts on sw RAID for Postgresql? >>The main reason of moving to a drive array is the high level of context >>switches we get during the day (>30K for 20 mins per hour). The OS and >>database exist on the same disk but seperate parition (which probably >>makes little difference) >> >> > >Unfortunately, the context switches are probably due to a known issue in >PostgreSQL, and changing the drive array won't help this issue (it may help >other issues though). Search the archives of this list, and pgsql-hackers, >for "Context Switch Bug". > >For the CS bug, the only workaround right now is to avoid the query structures >that trigger it. > > Okay. Darn. While I don't write the queries for the application, I do interact with the company frequently. Their considering moving the queries into the database with PL/pgSQL. Currently their queries are done through ProvIV development using ODBC. Will context switching be minimized here by using PL/pgSQL? > > >>Server Info: >>Centos 3.3 (RHEL 3.x equivelent) >>4GB RAM >>Adaptec 2100S RAID >>Qlogic QLA2100 Fibre >> >> > >CPU? > > Dual Xeon 2.8 CPUs with HT turned off. Thanks again. Steve Poe From pgsql-performance-owner@postgresql.org Wed Jan 26 00:20:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D4A43A5905 for ; Wed, 26 Jan 2005 00:19: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 42360-01 for ; Wed, 26 Jan 2005 00:19:41 +0000 (GMT) Received: from mail27.sea5.speakeasy.net (mail27.sea5.speakeasy.net [69.17.117.29]) by svr1.postgresql.org (Postfix) with ESMTP id 841AC3A589D for ; Wed, 26 Jan 2005 00:19:42 +0000 (GMT) Received: (qmail 20104 invoked from network); 26 Jan 2005 00:19:42 -0000 Received: from mail.kinesis-cem.com (HELO pdarley) ([64.81.9.230]) (envelope-sender ) by mail27.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 26 Jan 2005 00:19:42 -0000 From: "Peter Darley" To: "Pgsql-Performance" Subject: Possibly slow query Date: Tue, 25 Jan 2005 16:19:42 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 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: 200501/487 X-Sequence-Number: 10177 Folks, I'm using PostgreSQL 7.4.1 on Linux, and I'm trying to figure out weather a query I have is going to be slow when I have more information in my tables. both tables involved will likely have ~500K rows within a year or so. Specifically I can't tell if I'm causing myself future problems with the subquery, and should maybe re-write the query to use a join. The reason I went with the subquery is that I don't know weather a row in Assignments will have a corresponding row in Assignment_Settings The query is: SELECT User_ID FROM Assignments A WHERE A.User_ID IS NOT NULL AND (SELECT Value FROM Assignment_Settings WHERE Setting='Status' AND Assignment_ID=A.Assignment_ID) IS NULL GROUP BY User_ID; The tables and an explain analyze of the query are as follows: neo=# \d assignments; Table "shopper.assignments" Column | Type | Modifiers ---------------+--------------------------------+--------------------------- ---------------------------------------------- assignment_id | integer | not null default nextval('shopper.assignments_assignment_id_seq'::text) sample_id | integer | not null user_id | integer | time | timestamp(0) without time zone | not null default now() address_id | integer | Indexes: "assignments_pkey" primary key, btree (assignment_id) "assignments_sample_id" unique, btree (sample_id) "assignments_address_id" btree (address_id) "assignments_user_id" btree (user_id) Triggers: assignments_check_assignment BEFORE INSERT ON assignments FOR EACH ROW EXECUTE PROCEDURE check_assignment() neo=# \d assignment_settings Table "shopper.assignment_settings" Column | Type | Modifiers -----------------------+------------------------+--------------------------- -------------------------------------------------------------- assignment_setting_id | integer | not null default nextval('shopper.assignment_settings_assignment_setting_id_seq'::text) assignment_id | integer | not null setting | character varying(250) | not null value | text | Indexes: "assignment_settings_pkey" primary key, btree (assignment_setting_id) "assignment_settings_assignment_id_setting" unique, btree (assignment_id, setting) neo=# explain analyze SELECT User_ID FROM Assignments A WHERE A.User_ID IS NOT NULL AND (SELECT Value FROM Assignment_Settings WHERE Setti ng='Status' AND Assignment_ID=A.Assignment_ID) IS NULL GROUP BY User_ID; QUERY PLAN ---------------------------------------------------------------------------- ------------------------------------------------ HashAggregate (cost=1.01..1.01 rows=1 width=4) (actual time=0.057..0.058 rows=1 loops=1) -> Seq Scan on assignments a (cost=0.00..1.01 rows=1 width=4) (actual time=0.033..0.040 rows=2 loops=1) Filter: ((user_id IS NOT NULL) AND ((subplan) IS NULL)) SubPlan -> Seq Scan on assignment_settings (cost=0.00..0.00 rows=1 width=13) (actual time=0.001..0.001 rows=0 loops=2) Filter: (((setting)::text = 'Status'::text) AND (assignment_id = $0)) Total runtime: 0.159 ms (7 rows) Thanks in advance for any help! Thanks, Peter Darley From pgsql-performance-owner@postgresql.org Wed Jan 26 01:08:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D73923A591D for ; Wed, 26 Jan 2005 01:07: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 40781-01 for ; Wed, 26 Jan 2005 01:07:49 +0000 (GMT) Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) by svr1.postgresql.org (Postfix) with ESMTP id D86973A5923 for ; Wed, 26 Jan 2005 01:07:50 +0000 (GMT) Received: from srascb.sra.co.jp (srascb [133.137.8.65]) by sraigw.sra.co.jp (Postfix) with ESMTP id 463C462C6A; Wed, 26 Jan 2005 10:07:50 +0900 (JST) Received: from srascb.sra.co.jp (localhost [127.0.0.1]) by localhost.sra.co.jp (Postfix) with ESMTP id 2DB0810CD06; Wed, 26 Jan 2005 10:07:50 +0900 (JST) Received: from sranhm.sra.co.jp (sranhm [133.137.44.16]) by srascb.sra.co.jp (Postfix) with ESMTP id 0E5EB10CD04; Wed, 26 Jan 2005 10:07:50 +0900 (JST) Received: from localhost (IDENT:t-ishii@srapc2345.sra.co.jp [133.137.44.184]) by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id KAA31378; Wed, 26 Jan 2005 10:07:50 +0900 Date: Wed, 26 Jan 2005 10:09:04 +0900 (JST) Message-Id: <20050126.100904.35010011.t-ishii@sra.co.jp> To: josh@agliodbs.com Cc: pgsql-performance@postgresql.org, pdarley@kinesis-cem.com, gnari@simnet.is, mitani@sraw.co.jp Subject: Re: PgPool changes WAS: PostgreSQL clustering VS MySQL From: Tatsuo Ishii In-Reply-To: <200501250858.37157.josh@agliodbs.com> References: <200501250858.37157.josh@agliodbs.com> X-Mailer: Mew version 2.3 on Emacs 20.7 / Mule 4.1 =?iso-2022-jp?B?KBskQjAqGyhCKQ==?= 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.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/488 X-Sequence-Number: 10178 > Peter, Ragnar, > > > > Are there ones that you use which might use several different connections > > > to send a series of queries from a single web-user, less than 5 seconds > > > apart? > > > > Using Apache/Perl I often have a situation where we're sending several > > queries from the same user (web client) within seconds, or even > > simultaneously, that use different connections. > > So from the sound of it, the connection methods I've been using are the > exception rather than the rule. Darn, it worked well for us. :-( > > What this would point to is NOT being able to use Slony-I for database server > pooling for most web applications. Yes? Users should look to pgCluster and > C-JDBC instead. Yup. That's the limitaion of async replication solutions. > BTW, Tatsuo, what's the code relationship between pgPool and pgCluster, if > any? PGCluster consists of three kind of servers, "load balance server", "cluster server"(modified PostgreSQL backend) and "replication server". I believe some of codes of pgpool are used in the load balance server to avoid "re-invent a wheel". This is a beauty of open source software project. -- Tatsuo Ishii From pgsql-performance-owner@postgresql.org Wed Jan 26 03:04:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6B6073A5915 for ; Wed, 26 Jan 2005 03:03: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 50230-09 for ; Wed, 26 Jan 2005 03:03:51 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id C7C1B3A5886 for ; Wed, 26 Jan 2005 03:03:54 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6951196; Tue, 25 Jan 2005 19:05:37 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Ideal disk setup for Postgresql 7.4? Date: Tue, 25 Jan 2005 19:03:09 -0800 User-Agent: KMail/1.6.2 Cc: Steve Poe References: <41F63424.1060904@sfnet.cc> In-Reply-To: <41F63424.1060904@sfnet.cc> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501251903.09734.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/489 X-Sequence-Number: 10179 Steve, > I help manage an animal hospital of 100-employees Linux servers. I am > new to database setup and tuning, I was hoping I could get some > direction on a setting up drive array we're considering moving our > database to. Check what I have to say at http://www.powerpostgresql.com/PerfList > They're currently on a two-disk Adaptec RAID1 with Postgresql 7.4.2. And you've not upgraded to 7.4.6 because .... ? > The drive array is a 7-disk fibre channel on a Qlogic 2100 controller. I > am currently testing RAID5 (sw). In general, RAID 5 is not so great for databases. See the article for more. > The main reason of moving to a drive array is the high level of context > switches we get during the day (>30K for 20 mins per hour). The OS and > database exist on the same disk but seperate parition (which probably > makes little difference) Unfortunately, the context switches are probably due to a known issue in PostgreSQL, and changing the drive array won't help this issue (it may help other issues though). Search the archives of this list, and pgsql-hackers, for "Context Switch Bug". For the CS bug, the only workaround right now is to avoid the query structures that trigger it. > Server Info: > Centos 3.3 (RHEL 3.x equivelent) > 4GB RAM > Adaptec 2100S RAID > Qlogic QLA2100 Fibre CPU? -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jan 26 04:24:41 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B24323A5A79 for ; Wed, 26 Jan 2005 04:24: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 56557-02 for ; Wed, 26 Jan 2005 04:24:23 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.199]) by svr1.postgresql.org (Postfix) with ESMTP id 305B03A5A5B for ; Wed, 26 Jan 2005 04:24:22 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so3916wri for ; Tue, 25 Jan 2005 20:24:15 -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=VIoJ+2NY8V46zcj6N7MYxHlfs2u92q8DhYipu0N6m0Lk8XgX2v3UbpaGDQbYXM1dSWknKQswodEE6nRHihRhmVK/pjZ3syLkFn0gLU8fw8ziVl6CRVOQcBfWGEHFNGtXD/8yVMsWokCbObyvb8ELfQChaTP+IoxlzV0JtWWusNQ= Received: by 10.54.48.73 with SMTP id v73mr16487wrv; Tue, 25 Jan 2005 20:24:15 -0800 (PST) Received: by 10.54.4.71 with HTTP; Tue, 25 Jan 2005 20:24:15 -0800 (PST) Message-ID: <6c21003b05012520241a9b3d48@mail.gmail.com> Date: Tue, 25 Jan 2005 22:24:15 -0600 From: Don Drake Reply-To: Don Drake To: Tom Lane Subject: Re: Postgres stopped running (shmget failed) Cc: pgsql-performance@postgresql.org In-Reply-To: <3962.1106669885@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6c21003b05012507104989efed@mail.gmail.com> <3962.1106669885@sss.pgh.pa.us> 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: 200501/490 X-Sequence-Number: 10180 On Tue, 25 Jan 2005 11:18:05 -0500, Tom Lane wrote: > Don Drake writes: > > This morning I found the postgres not running and the following in my log file: > > > 2005-01-25 01:38:22 FATAL: could not create shared memory segment: > > Cannot allocate memory > > DETAIL: Failed system call was shmget(key=5432001, size=273383424, 03600). > > HINT: This error usually means that PostgreSQL's request for a shared > > memory segment exceeded available memory or swap space. To reduce the > > request size (currently 273383424 bytes), reduce PostgreSQL's > > shared_buffers parameter (currently 32768) and/or its max_connections > > parameter (currently 40). > > I have seen this happen when the old shmem segment didn't get released > for some reason, and your kernel settings are such that it won't allow > creation of two shmem segments of that size at once. For robustness > it's probably a good idea to make sure you *can* create two such > segments at once, but for the moment getting rid of the old one with > "ipcrm" should be enough to let you restart the postmaster. > > regards, tom lane > I was able to just restart it, after the server died and before I restarted nothing showed up in the ipcs output. On an unrelated note, the value 273MB seems relatively low to me. The DB uses over 27GB for data and indexes, I would think it needs more shared memory. Thanks. -Don -- Donald Drake President Drake Consulting http://www.drakeconsult.com/ 312-560-1574 From pgsql-performance-owner@postgresql.org Wed Jan 26 09:36:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 402EE3A2C2C for ; Wed, 26 Jan 2005 09:36: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 92469-06 for ; Wed, 26 Jan 2005 09:36: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 0903B3A5B0D for ; Wed, 26 Jan 2005 09:36:03 +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 1CtjZd-000GR6-5X; Wed, 26 Jan 2005 09:34:54 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id E95B2178E4; Wed, 26 Jan 2005 09:36:01 +0000 (GMT) Message-ID: <41F76482.7080001@archonet.com> Date: Wed, 26 Jan 2005 09:36:02 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Darley Cc: Pgsql-Performance Subject: Re: Possibly slow query References: In-Reply-To: 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.071 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/492 X-Sequence-Number: 10182 Peter Darley wrote: > Folks, > > I'm using PostgreSQL 7.4.1 on Linux, and I'm trying to figure out weather a > query I have is going to be slow when I have more information in my tables. > both tables involved will likely have ~500K rows within a year or so. > > Specifically I can't tell if I'm causing myself future problems with the > subquery, and should maybe re-write the query to use a join. The reason I > went with the subquery is that I don't know weather a row in Assignments > will have a corresponding row in Assignment_Settings > > The query is: > SELECT User_ID > FROM Assignments A > WHERE A.User_ID IS NOT NULL > AND (SELECT Value FROM Assignment_Settings WHERE Setting='Status' AND > Assignment_ID=A.Assignment_ID) IS NULL > GROUP BY User_ID; You could always use a LEFT JOIN instead, like you say. I'd personally be tempted to select distinct user_id's then join, but it depends on how many of each. You're not going to know for sure whether you'll have problems without testing. Generate 500k rows of plausible looking test-data and give it a try. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Jan 26 09:37:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C2E493A5A17 for ; Wed, 26 Jan 2005 09:36: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 92983-02 for ; Wed, 26 Jan 2005 09:36:48 +0000 (GMT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id 110CB3A2C2C for ; Wed, 26 Jan 2005 09:36:49 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 4.42) id 1CtjbU-0004fm-Ao; Wed, 26 Jan 2005 09:36:48 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 079CE178E4; Wed, 26 Jan 2005 09:36:47 +0000 (GMT) Message-ID: <41F764AF.6030808@archonet.com> Date: Wed, 26 Jan 2005 09:36:47 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Darley Cc: Pgsql-Performance Subject: Re: Possibly slow query References: In-Reply-To: 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.071 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/493 X-Sequence-Number: 10183 Peter Darley wrote: > Folks, > > I'm using PostgreSQL 7.4.1 on Linux Oh, and move to the latest in the 7.4 series too. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Jan 26 09:41:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D7ED3A5B30 for ; Wed, 26 Jan 2005 09:41: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 93403-03 for ; Wed, 26 Jan 2005 09:41:29 +0000 (GMT) Received: from fuji.krosing.net (joltid-gw.joltid.org [195.50.194.24]) by svr1.postgresql.org (Postfix) with ESMTP id E83033A5B34 for ; Wed, 26 Jan 2005 09:41:29 +0000 (GMT) Received: from fuji.krosing.net (localhost.joltid.net [127.0.0.1]) by fuji.krosing.net (8.13.1/8.13.1) with ESMTP id j0Q9fLvY005868; Wed, 26 Jan 2005 11:41:21 +0200 Received: (from hannu@localhost) by fuji.krosing.net (8.13.1/8.13.1/Submit) id j0Q9fJtM005867; Wed, 26 Jan 2005 11:41:19 +0200 X-Authentication-Warning: fuji.krosing.net: hannu set sender to hannu@tm.ee using -f Subject: Re: PostgreSQL clustering VS MySQL clustering From: Hannu Krosing To: Tom Lane Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org In-Reply-To: <3582.1106667713@sss.pgh.pa.us> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> <1106531786.5790.9.camel@fuji.krosing.net> <3582.1106667713@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Date: Wed, 26 Jan 2005 11:41:18 +0200 Message-Id: <1106732479.5587.4.camel@fuji.krosing.net> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-3) 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: 200501/494 X-Sequence-Number: 10184 =DChel kenal p=E4eval (teisip=E4ev, 25. jaanuar 2005, 10:41-0500), kirjutas Tom Lane: > Hannu Krosing writes: > > Why is removing index entries essential ? >=20 > Because once you re-use the tuple slot, any leftover index entries would > be pointing to the wrong rows. That much I understood ;) But can't clearing up the index be left for "later" ?=20 Indexscan has to check the data tuple anyway, at least for visibility. would adding the check for field sameness in index and data tuples be too big performance hit ? > regards, tom lane >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? >=20 > http://www.postgresql.org/docs/faq --=20 Hannu Krosing From pgsql-performance-owner@postgresql.org Wed Jan 26 10:11:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8E5E63A592B; Wed, 26 Jan 2005 10:11: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 96726-02; Wed, 26 Jan 2005 10:11:46 +0000 (GMT) Received: from ar-sd.net (unknown [82.77.155.72]) by svr1.postgresql.org (Postfix) with ESMTP id F01E53A5B14; Wed, 26 Jan 2005 10:11:47 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by ar-sd.net (Postfix) with ESMTP id 2029EE3D0; Wed, 26 Jan 2005 12:06:52 +0200 (EET) Received: from ar-sd.net ([127.0.0.1]) by localhost (linz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31983-02; Wed, 26 Jan 2005 12:06:49 +0200 (EET) Received: from forge (unknown [192.168.0.11]) by ar-sd.net (Postfix) with SMTP id 6050BBB49; Wed, 26 Jan 2005 12:06:49 +0200 (EET) Message-ID: <015a01c5038f$73a70720$0b00a8c0@forge> From: "Andrei Bintintan" To: , "Greg Stark" Cc: "Richard Huxton" , , References: <019f01c4fee1$1b58d600$0b00a8c0@forge><41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge><41EFCC5B.5010302@archonet.com><33c6269f05012008391490448b@mail.gmail.com> <87y8eh1hy9.fsf@stark.xeocode.com> Subject: Re: [SQL] OFFSET impact on Performance??? Date: Wed, 26 Jan 2005 12:11:49 +0200 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 ar-sd.net X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/495 X-Sequence-Number: 10185 The problems still stays open. The thing is that I have about 20 - 30 clients that are using that SQL query where the offset and limit are involved. So, I cannot create a temp table, because that means that I'll have to make a temp table for each session... which is a very bad ideea. Cursors somehow the same. In my application the Where conditions can be very different for each user(session) apart. The only solution that I see in the moment is to work at the query, or to write a more complex where function to limit the results output. So no replace for Offset/Limit. Best regards, Andy. ----- Original Message ----- From: "Greg Stark" To: Cc: "Richard Huxton" ; "Andrei Bintintan" ; ; Sent: Tuesday, January 25, 2005 8:28 PM Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? > > Alex Turner writes: > >> I am also very interesting in this very question.. Is there any way to >> declare a persistant cursor that remains open between pg sessions? >> This would be better than a temp table because you would not have to >> do the initial select and insert into a fresh table and incur those IO >> costs, which are often very heavy, and the reason why one would want >> to use a cursor. > > TANSTAAFL. How would such a persistent cursor be implemented if not by > building a temporary table somewhere behind the scenes? > > There could be some advantage if the data were stored in a temporary table > marked as not having to be WAL logged. Instead it could be automatically > cleared on every database start. > > -- > greg > > From pgsql-performance-owner@postgresql.org Wed Jan 26 10:42:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B70EA3A5B7F; Wed, 26 Jan 2005 10:42: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 99070-05; Wed, 26 Jan 2005 10:41:56 +0000 (GMT) Received: from usbb-lacimss3.unisys.com (usbb-lacimss3.unisys.com [192.63.108.53]) by svr1.postgresql.org (Postfix) with ESMTP id E46603A5B6A; Wed, 26 Jan 2005 10:41:56 +0000 (GMT) Received: from USBB-LACGW3.na.uis.unisys.com ([129.224.98.43]unverified) by usbb-lacimss3 with InterScan Messaging Security Suite; Wed, 26 Jan 2005 05:47:39 -0500 Received: from USBB-LACGW3.na.uis.unisys.com ([129.224.98.44]) by USBB-LACGW3.na.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 05:40:44 -0500 Received: from gbmk-eugw2.eu.uis.unisys.com ([129.221.133.27]) by USBB-LACGW3.na.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 05:40:44 -0500 Received: from nlshl-exch1.eu.uis.unisys.com ([192.39.239.20]) by gbmk-eugw2.eu.uis.unisys.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 10:39:52 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: [SQL] OFFSET impact on Performance??? Date: Wed, 26 Jan 2005 11:36:35 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcUDkV6KlDCSZDmOSY6BcWQmd5LghQAAYoxp From: "Leeuw van der, Tim" To: "Andrei Bintintan" , , "Greg Stark" Cc: "Richard Huxton" , , X-OriginalArrivalTime: 26 Jan 2005 10:39:52.0541 (UTC) FILETIME=[5E3318D0:01C50393] 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: 200501/496 X-Sequence-Number: 10186 Hi, What you could do is create a table containing all the fields from your = SELECT, plus a per-session unique ID. Then you can store the query = results in there, and use SELECT with OFFSET / LIMIT on that table. The = WHERE clause for this temp-results table only needs to contain the = per-session unique id. This of course gives you a new problem: cleaning stale data out of the = temp-results table. And another new problem is that users will not see = new data appear on their screen until somehow the query is re-run (... = but that might even be desirable, actually, depending on how your users = do their work and what their work is). And of course better performance cannot be guaranteed until you try it. Would such a scheme give you any hope of improved performance, or would = it be too much of a nightmare? cheers, --Tim -----Original Message----- From: pgsql-performance-owner@postgresql.org on behalf of Andrei = Bintintan Sent: Wed 1/26/2005 11:11 AM To: alex@neteconomist.com; Greg Stark Cc: Richard Huxton; pgsql-sql@postgresql.org; = pgsql-performance@postgresql.org Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? =20 The problems still stays open. The thing is that I have about 20 - 30 clients that are using that SQL = query=20 where the offset and limit are involved. So, I cannot create a temp = table,=20 because that means that I'll have to make a temp table for each = session...=20 which is a very bad ideea. Cursors somehow the same. In my application = the=20 Where conditions can be very different for each user(session) apart. The only solution that I see in the moment is to work at the query, or = to=20 write a more complex where function to limit the results output. So no=20 replace for Offset/Limit. Best regards, Andy. ----- Original Message -----=20 From: "Greg Stark" To: Cc: "Richard Huxton" ; "Andrei Bintintan"=20 ; ;=20 Sent: Tuesday, January 25, 2005 8:28 PM Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? > > Alex Turner writes: > >> I am also very interesting in this very question.. Is there any way = to >> declare a persistant cursor that remains open between pg sessions? >> This would be better than a temp table because you would not have to >> do the initial select and insert into a fresh table and incur those = IO >> costs, which are often very heavy, and the reason why one would want >> to use a cursor. > > TANSTAAFL. How would such a persistent cursor be implemented if not by > building a temporary table somewhere behind the scenes? > > There could be some advantage if the data were stored in a temporary = table > marked as not having to be WAL logged. Instead it could be = automatically > cleared on every database start. > > --=20 > greg > >=20 ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq From pgsql-performance-owner@postgresql.org Wed Jan 26 15:47:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7C2943A5921 for ; Wed, 26 Jan 2005 15: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 33903-08 for ; Wed, 26 Jan 2005 15:46:51 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 14ECA3A516B for ; Wed, 26 Jan 2005 15:46:54 +0000 (GMT) Received: (qmail 26402 invoked from network); 26 Jan 2005 14:00:29 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by 82.67.9.10 with SMTP; 26 Jan 2005 14:00:29 +0100 To: "Greg Stark" , "Merlin Moncure" Cc: "Andrei Bintintan" , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> Message-ID: Date: Wed, 26 Jan 2005 13:58:18 +0100 From: PFC 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: <87brbiah0f.fsf@stark.xeocode.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.015 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/501 X-Sequence-Number: 10191 Supposing your searches display results which are rows coming from one specific table, you could create a cache table : search_id serial primary key index_n position of this result in the global result set result_id id of the resulting row. Then, making a search with 50k results would INSERT INTO cache ... SELECT FROM search query, with a way to set the index_n column, which can be a temporary sequence... Then to display your pages, SELECT from your table with index_n BETWEEN so and so, and join to the data table. If you're worried that it might take up too much space : store an integer array of result_id instead of just a result_id ; this way you insert fewer rows and save on disk space. Generate it with a custom aggregate... then just grab a row from this table, it contains all the id's of the rows to display. From pgsql-performance-owner@postgresql.org Wed Jan 26 21:16:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 324CF3A5834 for ; Wed, 26 Jan 2005 21:16: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 58726-07 for ; Wed, 26 Jan 2005 21:16:37 +0000 (GMT) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr1.postgresql.org (Postfix) with ESMTP id 945DB3A581E for ; Wed, 26 Jan 2005 21:16:37 +0000 (GMT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Wed, 26 Jan 2005 13:19:11 -0800 Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 26 Jan 2005 13:19:09 -0800 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005012613190901130 for ; Wed, 26 Jan 2005 13:19:09 -0800 X-ASG-Debug-ID: 1106774194-14021-5-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from mail2 (mail2.hq.corp [192.168.160.6]) by barracuda.tecarta.com (Spam Firewall) with SMTP id 48AE320147D1 for ; Wed, 26 Jan 2005 13:16:34 -0800 (PST) Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Wed, 26 Jan 2005 13:19:04 -0800 Message-ID: <41F79610.20003@sfnet.cc> Date: Wed, 26 Jan 2005 13:07:28 +0000 From: Steve Poe User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org X-ASG-Orig-Subj: Re: [PERFORM] Ideal disk setup for Postgresql 7.4? Subject: Re: Ideal disk setup for Postgresql 7.4? References: <41F63424.1060904@sfnet.cc> <200501251903.09734.josh@agliodbs.com> <41F6DBD8.2050008@sfnet.cc> <200501261003.15267.josh@agliodbs.com> In-Reply-To: <200501261003.15267.josh@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Jan 2005 21:19:04.0536 (UTC) FILETIME=[A9C51D80:01C503EC] X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com X-Barracuda-Spam-Score: -0.06 X-Barracuda-Spam-Status: No, SCORE=-0.06 using global scores of TAG_LEVEL=4.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_30, DATE_IN_PAST_06_12 X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.960 Rule breakdown below pts rule name description ---- ---------------------- ------------------------------------------- -0.90 BAYES_30 BODY: Bayesian spam probability is 30 to 40% [score: 0.3659] 0.85 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.269 tagged_above=0 required=5 tests=AWL, DATE_IN_PAST_06_12, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/516 X-Sequence-Number: 10206 >FWIW, 7.4.6 is a binary, drop-in place upgrade for 7.4.2. And 7.4.2 has known >bugs. However, I understand your situation. > > > As soon as we get the go-ahead, I will upgrade. I think the company is actually looking towards 8.0 certification. >>Okay, thanks. Even with 7-disks? I trust that. >> >> > >Well, it's less bad with 7 disks than it is with 3, certainly. However,there >is an obvious and quick gain to be had by splitting off the WAL logs onto >their own disk resource ... up to 14%+ performance in some applications. > > > Pardon my ignorance, but the WAL logs are comprised of pg_xlog and pg_clog? Their own disk resource, but not within the same channel of disks the database is on, right? >>So, RAID 1+0 (sw) is >>probably the best option. I've run sw RAID personally for years without >>issue. I am a bit hesitant in doing sw RAID for a production server for >>a database --- probably because its not my server. Any thoughts on sw >>RAID for Postgresql? >> >> > >Yes. See my article for one. In generaly, SW RAID on BSD or Linux works >well for PostgreSQL ... UNLESS your machine is already CPU-bound, in which >case it's a bad idea. If you're hitting the CS bug, it's definitely a bad >idea, because the SW RAID will increase context switching. > >So if your choice, on your system, is between sw RAID 10, and hw RAID 5, and >you're having excessive CSes, I'd stick with the HW RAID. > > > Okay. InCPU-bound servers, use hw RAID. Any hw raids to avoid? >>Okay. Darn. While I don't write the queries for the application, I do >>interact with the company frequently. Their considering moving the >>queries into the database with PL/pgSQL. Currently their queries are >>done through ProvIV development using ODBC. Will context switching be >>minimized here by using PL/pgSQL? >> >> > >Won't make a difference, actually. Should improve performance in other ways, >though, by reducing round-trip time on procedures. Feel free to recommend >the company to this list. > > > I think their too busy to monitor/watch this list. Not a put-down to them, but I have to do my own leg work to help decide what we're going to do. >>Dual Xeon 2.8 CPUs with HT turned off. >> >> > >Yeah, thought it was a Xeon. > > > If we went with a single CPU, like Athlon/Opertron64, would CS storming go away? Thanks. Steve Poe From pgsql-performance-owner@postgresql.org Wed Jan 26 13:48:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ED0BA3A589F for ; Wed, 26 Jan 2005 13:48: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 19144-09 for ; Wed, 26 Jan 2005 13:48:05 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 8BAD83A5801 for ; Wed, 26 Jan 2005 13:48:05 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so51775wra for ; Wed, 26 Jan 2005 05:47:33 -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=CTpsSkVu2vYa1GB5ky4Als6cYheGgdYqTxgeWB6hUYpj2P8kGTn8cwoDLlnPzCaLWkYaXvA34tXrvSC6csQ1qRZ+7v3wxw/rHXPiBGLqQ17CEKhZDv3Y7Xm6H3OFfHqPsQOXWEg4R3PpThntivOJ8yHExjC4oxnIYwOulxkFu/0= Received: by 10.54.33.31 with SMTP id g31mr232241wrg; Wed, 26 Jan 2005 05:47:33 -0800 (PST) Received: by 10.54.18.72 with HTTP; Wed, 26 Jan 2005 05:47:32 -0800 (PST) Message-ID: <33c6269f05012605473319ef40@mail.gmail.com> Date: Wed, 26 Jan 2005 08:47:32 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Andrei Bintintan Subject: Re: [SQL] OFFSET impact on Performance??? Cc: Greg Stark , Richard Huxton , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org In-Reply-To: <015a01c5038f$73a70720$0b00a8c0@forge> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> <33c6269f05012008391490448b@mail.gmail.com> <87y8eh1hy9.fsf@stark.xeocode.com> <015a01c5038f$73a70720$0b00a8c0@forge> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/497 X-Sequence-Number: 10187 As I read the docs, a temp table doesn't solve our problem, as it does not persist between sessions. With a web page there is no guarentee that you will receive the same connection between requests, so a temp table doesn't solve the problem. It looks like you either have to create a real table (which is undesirable becuase it has to be physicaly synced, and TTFB will be very poor) or create an application tier in between the web tier and the database tier to allow data to persist between requests tied to a unique session id. Looks like the solutions to this problem is not RDBMS IMHO. Alex Turner NetEconomist On Wed, 26 Jan 2005 12:11:49 +0200, Andrei Bintintan wrote: > The problems still stays open. > > The thing is that I have about 20 - 30 clients that are using that SQL query > where the offset and limit are involved. So, I cannot create a temp table, > because that means that I'll have to make a temp table for each session... > which is a very bad ideea. Cursors somehow the same. In my application the > Where conditions can be very different for each user(session) apart. > > The only solution that I see in the moment is to work at the query, or to > write a more complex where function to limit the results output. So no > replace for Offset/Limit. > > Best regards, > Andy. > > > ----- Original Message ----- > From: "Greg Stark" > To: > Cc: "Richard Huxton" ; "Andrei Bintintan" > ; ; > > Sent: Tuesday, January 25, 2005 8:28 PM > Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? > > > > > > Alex Turner writes: > > > >> I am also very interesting in this very question.. Is there any way to > >> declare a persistant cursor that remains open between pg sessions? > >> This would be better than a temp table because you would not have to > >> do the initial select and insert into a fresh table and incur those IO > >> costs, which are often very heavy, and the reason why one would want > >> to use a cursor. > > > > TANSTAAFL. How would such a persistent cursor be implemented if not by > > building a temporary table somewhere behind the scenes? > > > > There could be some advantage if the data were stored in a temporary table > > marked as not having to be WAL logged. Instead it could be automatically > > cleared on every database start. > > > > -- > > greg > > > > > > From pgsql-performance-owner@postgresql.org Wed Jan 26 13:57:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2624F3A5873; Wed, 26 Jan 2005 13:57: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 19836-10; Wed, 26 Jan 2005 13:57: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 0ED823A581C; Wed, 26 Jan 2005 13:57:04 +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 1CtneE-000CrY-3E; Wed, 26 Jan 2005 13:55:54 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 7C096166B1; Wed, 26 Jan 2005 13:57:00 +0000 (GMT) Message-ID: <41F7A1AC.1060406@archonet.com> Date: Wed, 26 Jan 2005 13:57:00 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: alex@neteconomist.com Cc: Andrei Bintintan , Greg Stark , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> <33c6269f05012008391490448b@mail.gmail.com> <87y8eh1hy9.fsf@stark.xeocode.com> <015a01c5038f$73a70720$0b00a8c0@forge> <33c6269f05012605473319ef40@mail.gmail.com> In-Reply-To: <33c6269f05012605473319ef40@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.071 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/498 X-Sequence-Number: 10188 Alex Turner wrote: > As I read the docs, a temp table doesn't solve our problem, as it does > not persist between sessions. With a web page there is no guarentee > that you will receive the same connection between requests, so a temp > table doesn't solve the problem. It looks like you either have to > create a real table (which is undesirable becuase it has to be > physicaly synced, and TTFB will be very poor) or create an application > tier in between the web tier and the database tier to allow data to > persist between requests tied to a unique session id. > > Looks like the solutions to this problem is not RDBMS IMHO. It's less the RDBMS than the web application. You're trying to mix a stateful setup (the application) with a stateless presentation layer (the web). If you're using PHP (which doesn't offer a "real" middle layer) you might want to look at memcached. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Jan 26 15:16:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7CCFA3A5BFC for ; Wed, 26 Jan 2005 15:16: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 30264-03 for ; Wed, 26 Jan 2005 15:16:20 +0000 (GMT) Received: from mail28.sea5.speakeasy.net (mail28.sea5.speakeasy.net [69.17.117.30]) by svr1.postgresql.org (Postfix) with ESMTP id AAD633A58E6 for ; Wed, 26 Jan 2005 15:16:22 +0000 (GMT) Received: (qmail 18445 invoked from network); 26 Jan 2005 15:16:22 -0000 Received: from mail.kinesis-cem.com (HELO pdarley) ([64.81.9.230]) (envelope-sender ) by mail28.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 26 Jan 2005 15:16:22 -0000 From: "Peter Darley" To: "Richard Huxton" Cc: "Pgsql-Performance" Subject: Re: Possibly slow query Date: Wed, 26 Jan 2005 07:16:25 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <41F76482.7080001@archonet.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 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: 200501/499 X-Sequence-Number: 10189 Richard, I tried a left join, which has to be a little weird, because there may or may not be a corresponding row in Assignment_Settings for each Assignment, and they may or may not have Setting='Status', so I came up with: SELECT User_ID FROM Assignments A NATURAL LEFT JOIN (SELECT * FROM Assignment_Settings WHERE Setting='Status') ASet WHERE A.User_ID IS NOT NULL AND ASet.Assignment_ID IS NULL GROUP BY User_ID; Which explain analyze is saying takes 0.816 ms as compared to 0.163 ms for my other query. So, I'm not sure that I'm writing the best LEFT JOIN that I can. Also, I suspect that these ratios wouldn't hold as the data got bigger and started using indexes, etc. I'll mock up a couple of tables with a bunch of data and see how things go. It would be nice to understand WHY I get the results I get, which I'm not sure I will. I'm not sure what you mean by selecting a distinct User_ID first. Since I'm joining the tables on Assignment_ID, I'm not sure how I'd do a distinct before the join (because I'd lose Assignment_ID). I was also under the impression that group by was likely to be faster than a distinct, tho I can't really recall where I got that idea from. Thanks for your suggestions! Peter Darley -----Original Message----- From: Richard Huxton [mailto:dev@archonet.com] Sent: Wednesday, January 26, 2005 1:36 AM To: Peter Darley Cc: Pgsql-Performance Subject: Re: [PERFORM] Possibly slow query Peter Darley wrote: > Folks, > > I'm using PostgreSQL 7.4.1 on Linux, and I'm trying to figure out weather a > query I have is going to be slow when I have more information in my tables. > both tables involved will likely have ~500K rows within a year or so. > > Specifically I can't tell if I'm causing myself future problems with the > subquery, and should maybe re-write the query to use a join. The reason I > went with the subquery is that I don't know weather a row in Assignments > will have a corresponding row in Assignment_Settings > > The query is: > SELECT User_ID > FROM Assignments A > WHERE A.User_ID IS NOT NULL > AND (SELECT Value FROM Assignment_Settings WHERE Setting='Status' AND > Assignment_ID=A.Assignment_ID) IS NULL > GROUP BY User_ID; You could always use a LEFT JOIN instead, like you say. I'd personally be tempted to select distinct user_id's then join, but it depends on how many of each. You're not going to know for sure whether you'll have problems without testing. Generate 500k rows of plausible looking test-data and give it a try. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Wed Jan 26 15:17:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E35603A5C0A for ; Wed, 26 Jan 2005 15:17: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 30129-09 for ; Wed, 26 Jan 2005 15:17: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 7B8B93A5C25 for ; Wed, 26 Jan 2005 15:17: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 j0QFHh0q014871; Wed, 26 Jan 2005 10:17:44 -0500 (EST) To: Hannu Krosing Cc: Simon Riggs , Tatsuo Ishii , marty@outputservices.com, herve@elma.fr, pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-reply-to: <1106732479.5587.4.camel@fuji.krosing.net> References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> <1106531786.5790.9.camel@fuji.krosing.net> <3582.1106667713@sss.pgh.pa.us> <1106732479.5587.4.camel@fuji.krosing.net> Comments: In-reply-to Hannu Krosing message dated "Wed, 26 Jan 2005 11:41:18 +0200" Date: Wed, 26 Jan 2005 10:17:43 -0500 Message-ID: <14870.1106752663@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: 200501/500 X-Sequence-Number: 10190 Hannu Krosing writes: > But can't clearing up the index be left for "later" ? Based on what? Are you going to store the information about what has to be cleaned up somewhere else, and if so where? > Indexscan has to check the data tuple anyway, at least for visibility. > would adding the check for field sameness in index and data tuples be > too big performance hit ? It does pretty much suck, especially when you think about functional indexes on expensive functions. regards, tom lane From pgsql-performance-owner@postgresql.org Wed Jan 26 16:44:55 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49E423A5C96 for ; Wed, 26 Jan 2005 16:44: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 41552-08 for ; Wed, 26 Jan 2005 16:44:50 +0000 (GMT) Received: from TWMAIL.ESNCC.COM (unknown [66.173.159.28]) by svr1.postgresql.org (Postfix) with ESMTP id 0ACF03A5C94 for ; Wed, 26 Jan 2005 16:44:46 +0000 (GMT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Subject: SQL Performance Guidelines X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Date: Wed, 26 Jan 2005 11:44:45 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: SQL Performance Guidelines Thread-Index: AcUDxldqKlSkqdOpQxKiHUlGPFq6ww== From: "Van Ingen, Lane" To: X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/502 X-Sequence-Number: 10192 RG9lcyBhbnlib2R5IGtub3cgd2hlcmUgSSBjYW4gbGF5IG15IGhhbmRzIG9uIHNvbWUgZ3VpZGVs aW5lcyB0byBnZXQgYmVzdCBTUUwgcGVyZm9ybWFuY2UNCm91dCBvZiBQb3N0Z3JlU1FMPyBXZSBh cmUgYWJvdXQgdG8gZ2V0IGludG8gYSBwcm9qZWN0IHRoYXQgd2lsbCBiZSBuZXcgZnJvbSB0aGUg Z3JvdW5kIHVwIChhbmRcd2UgYXJlIHVzaW5nIFBvc3RncmVzIGZvciB0aGUgZmlyc3QgdGltZSku IFdvdWxkIGxpa2UgdG8gc2hhcmUgc29tZSBndWlkZWxpbmVzIHdpdGggZGV2ZWxvcGVycyBvbiBi ZXN0IHByYWN0aWNlcw0KaW4gUG9zdGdyZXM/IFRoYW5rcyBmb3IgeW91ciBoZWxwLg0K From pgsql-performance-owner@postgresql.org Wed Jan 26 18:04:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CC97F3A5CA1 for ; Wed, 26 Jan 2005 18:04: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 66484-02 for ; Wed, 26 Jan 2005 18:04:05 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id E0D7B3A5C8F for ; Wed, 26 Jan 2005 18:04:05 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6953639 for pgsql-performance@postgresql.org; Wed, 26 Jan 2005 10:05:46 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Ideal disk setup for Postgresql 7.4? Date: Wed, 26 Jan 2005 10:03:15 -0800 User-Agent: KMail/1.6.2 References: <41F63424.1060904@sfnet.cc> <200501251903.09734.josh@agliodbs.com> <41F6DBD8.2050008@sfnet.cc> In-Reply-To: <41F6DBD8.2050008@sfnet.cc> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501261003.15267.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/503 X-Sequence-Number: 10193 Steve, > Because the proprietary application running the business has not > certified on it. Unfortunately, I am at the mercy of their support in > case something goes wrong. FWIW, 7.4.6 is a binary, drop-in place upgrade for 7.4.2. And 7.4.2 has known bugs. However, I understand your situation. > Okay, thanks. Even with 7-disks? I trust that. Well, it's less bad with 7 disks than it is with 3, certainly. However,there is an obvious and quick gain to be had by splitting off the WAL logs onto their own disk resource ... up to 14%+ performance in some applications. > So, RAID 1+0 (sw) is > probably the best option. I've run sw RAID personally for years without > issue. I am a bit hesitant in doing sw RAID for a production server for > a database --- probably because its not my server. Any thoughts on sw > RAID for Postgresql? Yes. See my article for one. In generaly, SW RAID on BSD or Linux works well for PostgreSQL ... UNLESS your machine is already CPU-bound, in which case it's a bad idea. If you're hitting the CS bug, it's definitely a bad idea, because the SW RAID will increase context switching. So if your choice, on your system, is between sw RAID 10, and hw RAID 5, and you're having excessive CSes, I'd stick with the HW RAID. > Okay. Darn. While I don't write the queries for the application, I do > interact with the company frequently. Their considering moving the > queries into the database with PL/pgSQL. Currently their queries are > done through ProvIV development using ODBC. Will context switching be > minimized here by using PL/pgSQL? Won't make a difference, actually. Should improve performance in other ways, though, by reducing round-trip time on procedures. Feel free to recommend the company to this list. > Dual Xeon 2.8 CPUs with HT turned off. Yeah, thought it was a Xeon. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Wed Jan 26 18:27:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B55843A5B42 for ; Wed, 26 Jan 2005 18:27: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 12579-09 for ; Wed, 26 Jan 2005 18:27:13 +0000 (GMT) Received: from TWMAIL.ESNCC.COM (unknown [66.173.159.28]) by svr1.postgresql.org (Postfix) with ESMTP id 6135D3A5A0D for ; Wed, 26 Jan 2005 18:27:09 +0000 (GMT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Subject: Re: SQL Performance Guidelines X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Date: Wed, 26 Jan 2005 13:27:08 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: SQL Performance Guidelines Thread-Index: AcUDxldqKlSkqdOpQxKiHUlGPFq6wwADaMLF From: "Van Ingen, Lane" To: "Van Ingen, Lane" , X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/504 X-Sequence-Number: 10194 Q2xhcmlmaWNhdGlvbjogSSBhbSB0YWxraW5nIGFib3V0IFNRTCBjb2RpbmcgcHJhY3RpY2VzIGlu IFBvc3RncmVzIChob3cgdG8gd3JpdGUgcXVlcmllcyBmb3IgYmVzdCANCnJlc3VsdHMpLCBub3Qg IHR1bmluZy1yZWxhdGVkIGNvbnNpZGVyYXRpb25zIChhbHRob3VnaCB0aGF0IHdvdWxkIGJlIHdl bGNvbWVkIHRvbykuDQogDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLSANCkZyb206IHBnc3Fs LXBlcmZvcm1hbmNlLW93bmVyQHBvc3RncmVzcWwub3JnIG9uIGJlaGFsZiBvZiBWYW4gSW5nZW4s IExhbmUgDQpTZW50OiBXZWQgMS8yNi8yMDA1IDExOjQ0IEFNIA0KVG86IHBnc3FsLXBlcmZvcm1h bmNlQHBvc3RncmVzcWwub3JnIA0KQ2M6IA0KU3ViamVjdDogW1BFUkZPUk1dIFNRTCBQZXJmb3Jt YW5jZSBHdWlkZWxpbmVzDQoNCkRvZXMgYW55Ym9keSBrbm93IHdoZXJlIEkgY2FuIGxheSBteSBo YW5kcyBvbiBzb21lIGd1aWRlbGluZXMgdG8gZ2V0IGJlc3QgU1FMIHBlcmZvcm1hbmNlDQpvdXQg b2YgUG9zdGdyZVNRTD8gV2UgYXJlIGFib3V0IHRvIGdldCBpbnRvIGEgcHJvamVjdCB0aGF0IHdp bGwgYmUgbmV3IGZyb20gdGhlIGdyb3VuZCB1cCAoYW5kXHdlIGFyZSB1c2luZyBQb3N0Z3JlcyBm b3IgdGhlIGZpcnN0IHRpbWUpLiBXb3VsZCBsaWtlIHRvIHNoYXJlIHNvbWUgZ3VpZGVsaW5lcyB3 aXRoIGRldmVsb3BlcnMgb24gYmVzdCBwcmFjdGljZXMNCmluIFBvc3RncmVzPyBUaGFua3MgZm9y IHlvdXIgaGVscC4NCg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKGVuZCBvZiBicm9hZGNh c3QpLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQpUSVAgNzogZG9uJ3QgZm9yZ2V0IHRvIGlu Y3JlYXNlIHlvdXIgZnJlZSBzcGFjZSBtYXAgc2V0dGluZ3MNCg0K From pgsql-performance-owner@postgresql.org Wed Jan 26 18:36:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DECC53A5CFB for ; Wed, 26 Jan 2005 18:35: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 32105-10 for ; Wed, 26 Jan 2005 18:35:30 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id 29B5A3A5CF3 for ; Wed, 26 Jan 2005 18:35:30 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so139030wra for ; Wed, 26 Jan 2005 10:35:27 -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=jB70OHJ5NFqPGvovETAQxuuDVbwA9o3cdteFngSAlPKjonc3osRhdaJM5OK3r5zXW4cP5Hy510/45+beTFVhmHT7YRhp7fqNcSgyD4tmfdXdfjfj/vtJqk9qwMRSxnIKCT+eL+YQepwu4+xgabg8T0JdrEWA41j9cbUqvQ8GPHQ= Received: by 10.54.51.70 with SMTP id y70mr393714wry; Wed, 26 Jan 2005 10:35:27 -0800 (PST) Received: by 10.54.18.72 with HTTP; Wed, 26 Jan 2005 10:35:27 -0800 (PST) Message-ID: <33c6269f0501261035bc87695@mail.gmail.com> Date: Wed, 26 Jan 2005 13:35:27 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: PFC Subject: Re: [SQL] OFFSET impact on Performance??? Cc: Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.039 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/505 X-Sequence-Number: 10195 The problem with this approach is TTFB (Time to first Byte). The initial query is very slow, but additional requests are fast. In most situations we do not want the user to have to wait a disproportionate amount of time for the initial query. If this is the first time using the system this will be the impression that will stick with them. I guess we could experiment and see how much extra time creating a cache table will take... Alex Turner NetEconomist On Wed, 26 Jan 2005 13:58:18 +0100, PFC wrote: > > Supposing your searches display results which are rows coming from one > specific table, you could create a cache table : > > search_id serial primary key > index_n position of this result in the global result set > result_id id of the resulting row. > > Then, making a search with 50k results would INSERT INTO cache ... SELECT > FROM search query, with a way to set the index_n column, which can be a > temporary sequence... > > Then to display your pages, SELECT from your table with index_n BETWEEN so > and so, and join to the data table. > > If you're worried that it might take up too much space : store an integer > array of result_id instead of just a result_id ; this way you insert fewer > rows and save on disk space. Generate it with a custom aggregate... then > just grab a row from this table, it contains all the id's of the rows to > display. > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > From pgsql-performance-owner@postgresql.org Wed Jan 26 18:49:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 508F73A5C8F for ; Wed, 26 Jan 2005 18:49: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 34975-09 for ; Wed, 26 Jan 2005 18:49:33 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 2632B3A5B29 for ; Wed, 26 Jan 2005 18:49: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 X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 Subject: Re: [SQL] OFFSET impact on Performance??? Date: Wed, 26 Jan 2005 13:49:33 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75E8@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcUD1sFbx39F3VJCQB24//2a78DPjwAAHHZg From: "Merlin Moncure" To: Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.365 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, URIBL_SBL X-Spam-Level: X-Archive-Number: 200501/506 X-Sequence-Number: 10196 > The problem with this approach is TTFB (Time to first Byte). The > initial query is very slow, but additional requests are fast. In most > situations we do not want the user to have to wait a disproportionate > amount of time for the initial query. If this is the first time using > the system this will be the impression that will stick with them. I > guess we could experiment and see how much extra time creating a cache > table will take... Have you read this? http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html Don't know your exact situation, but this is always worth considering in those hard to optimize corner cases. Moving this stuff into the application space or 'middleware' is going to be a lot of pain and aggravation. Merlin From pgsql-performance-owner@postgresql.org Wed Jan 26 18:51:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8B3943A593E for ; Wed, 26 Jan 2005 18:51: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 38386-03 for ; Wed, 26 Jan 2005 18:51:25 +0000 (GMT) Received: from omu-eweb1.solutionary.com (omu-eweb1.solutionary.com [207.188.34.4]) by svr1.postgresql.org (Postfix) with ESMTP id 145803A5CA8 for ; Wed, 26 Jan 2005 18:51:24 +0000 (GMT) Received: from OMU-EXCH1.solutionary.com ([207.188.36.31]) by omu-eweb1.solutionary.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 26 Jan 2005 12:51:14 -0600 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C503D8.02D2E8EE" X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Upgrading from from 7.4.2 to 8.0 Date: Wed, 26 Jan 2005 12:51:14 -0600 Message-ID: <9697D58F4D8FF94892AF75A0A5D8CCCC01C1EE5B@OMU-EXCH1.solutionary.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Upgrading from from 7.4.2 to 8.0 Thread-Index: AcUD2AKfUjvNyUrpSueWML/PqAtnRQ== From: "James Gunzelman" To: X-OriginalArrivalTime: 26 Jan 2005 18:51:14.0654 (UTC) FILETIME=[02E887E0:01C503D8] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.357 tagged_above=0 required=5 tests=HTML_MESSAGE, HTML_TEXT_AFTER_BODY, HTML_TEXT_AFTER_HTML X-Spam-Level: X-Archive-Number: 200501/507 X-Sequence-Number: 10197 This is a multi-part message in MIME format. ------_=_NextPart_001_01C503D8.02D2E8EE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Will I have to dump and reload all my databases when migrating from 7.4.2 to 8.0? =20 ____________________________________ =20 Jim Gunzelman Senior Software Engineer =20 phone: 402.361.3078 fax: 402.361.3178 e-mail: JamesGunzelmane@Solutionary.com =20 Solutionary, Inc. www.Solutionary.com =20 =20 Making Security Manageable 24x7 _____________________________________ =20 Confidentiality Notice The content of this communication, along with any attachments, is covered by federal and state law governing electronic communications and may contain confidential and legally privileged information. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, use or copying of the information contained herein is strictly prohibited. If you have received this communication in error, please immediately contact us by telephone at (402) 361-3000 or e-mail security@solutionary.com. Thank you. =20 Copyright 2000-2005, Solutionary, Inc. All rights reserved. ActiveGuard, eV3, Solutionary and the Solutionary logo are registered trademarks of Solutionary, Inc. =20 =20 =20 ------_=_NextPart_001_01C503D8.02D2E8EE Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message
Will I = have to dump=20 and reload all my databases when migrating from 7.4.2 to=20 8.0?
 

____________________________________

 

Jim = Gunzelman

Senior Software=20 Engineer

 

phone: 402.361.3078   fax: = 402.361.3178

e-mail: =20 JamesGunzelmane@Solutionary.com

 

Solutionary,=20 Inc.

www.Solutionary.com      =20

 

Making Security Manageable = 24x7

_____________________________________

 

Confidentiality=20 Notice

The content = of this=20 communication, along with any attachments, is covered by federal and = state law=20 governing electronic communications and may contain confidential and = legally=20 privileged information.  = If the=20 reader of this message is not the intended recipient, you are hereby = notified=20 that any dissemination, distribution, use or copying of the information=20 contained herein is strictly prohibited. =20 If you have received this communication in error, please = immediately=20 contact us by telephone at (402) 361-3000 or e-mail=20 security@solutionary.com.  = Thank=20 you.

 

Copyright 2000-2005, = Solutionary,=20 Inc. All rights reserved.  ActiveGuard, eV3, Solutionary = and the=20 Solutionary logo are registered trademarks of Solutionary,=20 Inc.

 

 

 
=00 ------_=_NextPart_001_01C503D8.02D2E8EE-- From pgsql-performance-owner@postgresql.org Wed Jan 26 19:25:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D0EA13A5D14 for ; Wed, 26 Jan 2005 19:25: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 48225-10 for ; Wed, 26 Jan 2005 19:25:16 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 897C33A5CFA for ; Wed, 26 Jan 2005 19:25:15 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so191210wri for ; Wed, 26 Jan 2005 11:24:40 -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=cvJ/3sOloSrCQkOKNGUHGpJoI2WRriP5OAlRTV72ZX41MAoAxIdJ8UF92YC9rP1L0d4CkJNCGGU6SdM3Jtf0vBp+jVIJfaxA9zkermH4H4u3hdR/bmeV3QxYZ+PQ/k3b/dHC1mduEmInG6OrKCdPn0NCTZwCM4nvXqmO0SRGae4= Received: by 10.54.20.25 with SMTP id 25mr539189wrt; Wed, 26 Jan 2005 11:24:40 -0800 (PST) Received: by 10.54.59.22 with HTTP; Wed, 26 Jan 2005 11:24:40 -0800 (PST) Message-ID: <330532b605012611247a9db8e3@mail.gmail.com> Date: Wed, 26 Jan 2005 14:24:40 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: pgsql-performance@postgresql.org Subject: Re: PG versus FreeBSD, startup and connections problems In-Reply-To: <41F6B56A.9010103@coretech.co.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <330532b605012510193eb73b72@mail.gmail.com> <41F6B56A.9010103@coretech.co.nz> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/508 X-Sequence-Number: 10198 Just a quick shout-out to Mark, as you provided the winning answer. I found numerous mailing list discussions and web pages, but all were either fragmented or out of date. Again, many thanks! -- Mitch On Wed, 26 Jan 2005 10:08:58 +1300, Mark Kirkwood wrote: > > in /etc/sysctl.conf : > kern.ipc.shmmax=100000000 > kern.ipc.shmall=32768 > (can be set online using systcl -w) > > Semaphores need to be set in /boot/loader.conf > kern.ipc.semmni=256 > kern.ipc.semmns=256 > (can typed at the loader prompt using set) > > These settings should let you have ~100 connections and use about 100M > of shared memory for shared_buffers. From pgsql-performance-owner@postgresql.org Wed Jan 26 19:43:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 819443A5CE6 for ; Wed, 26 Jan 2005 19:43: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 49665-07 for ; Wed, 26 Jan 2005 19:43:15 +0000 (GMT) Received: from main.gmane.org (main.gmane.org [80.91.229.2]) by svr1.postgresql.org (Postfix) with ESMTP id E4E563A593E for ; Wed, 26 Jan 2005 19:43:15 +0000 (GMT) Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Ctt4H-0005Hy-00 for ; Wed, 26 Jan 2005 20:43:14 +0100 Received: from sp-260-1.net4.netcentrix.net ([4.21.254.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Jan 2005 20:43:09 +0100 Received: from doug by sp-260-1.net4.netcentrix.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 26 Jan 2005 20:43:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: Doug McNaught Subject: Re: Upgrading from from 7.4.2 to 8.0 Date: Wed, 26 Jan 2005 14:42:57 -0500 Lines: 8 Message-ID: <878y6g9dtq.fsf@asmodeus.mcnaught.org> References: <9697D58F4D8FF94892AF75A0A5D8CCCC01C1EE5B@OMU-EXCH1.solutionary.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: sp-260-1.net4.netcentrix.net User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/20.7 (gnu/linux) Cancel-Lock: sha1:+TE6SJO22koQMRVrJ1fDidBGXtE= X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/509 X-Sequence-Number: 10199 "James Gunzelman" writes: > Will I have to dump and reload all my databases when migrating from > 7.4.2 to 8.0? Yes. -Doug From pgsql-performance-owner@postgresql.org Wed Jan 26 19:44:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7FEE53A5D1C for ; Wed, 26 Jan 2005 19:44: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 50158-08 for ; Wed, 26 Jan 2005 19:44:48 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id A66FB3A5D16 for ; Wed, 26 Jan 2005 19:44:47 +0000 (GMT) Received: (qmail 12517 invoked from network); 26 Jan 2005 20:45:03 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 26 Jan 2005 20:45:03 +0100 Date: Wed, 26 Jan 2005 20:46:49 +0100 To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> <20050125031104.GW67721@decibel.org> From: PFC 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: <20050125031104.GW67721@decibel.org> User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/510 X-Sequence-Number: 10200 http://borg.postgresql.org/docs/8.0/interactive/storage-page-layout.html > If you vacuum as part of the transaction it's going to be more efficient > of resources, because you have more of what you need right there (ie: > odds are that you're on the same page as the old tuple). In cases like > that it very likely makes a lot of sense to take a small hit in your > transaction time up-front, instead of a larger hit doing a vacuum down > the road. Some pros would be that you're going to make a disk write anyway because the page is modified, so why not vacuum that page while it's there. If the machine is CPU bound you lose, if it's IO bound you save some IO, but the cost of index updates has to be taken into account... It prompted a few questions : Note : temp contains 128k (131072) values generated from a sequence. create table test (id serial primary key, a integer, z integer, e integer, r integer, t integer, y integer ) without oids; insert into test (id,a,z,e,r,t,y) select id,0,0,0,0,0,0 from temp; INSERT 0 131072 explain analyze update test set y=1; Seq Scan on test (cost=0.00..2226.84 rows=126284 width=30) (ac Seq Scan on test (cost=0.00..2274.72 rows=131072 width=30) (actual time=0.046..964.590 rows=131072 loops=1) Total runtime: 15628.143 ms tual time=0.047..617.553 rows=131072 loops=1) Total runtime: 4432.509 ms explain analyze update test set y=1; Seq Scan on test (cost=0.00..4453.68 rows=252568 width=30) (actual time=52.198..611.594 rows=131072 loops=1) Total runtime: 5739.064 ms explain analyze update test set y=1; Seq Scan on test (cost=0.00..6680.52 rows=378852 width=30) (actual time=127.301..848.762 rows=131072 loops=1) Total runtime: 6548.206 ms Gets slower as more and more dead tuples accumulate... normal as this is a seq scan. Note the row estimations getting bigger with the table size... vacuum full test; explain analyze update test set y=1; Seq Scan on test (cost=0.00..2274.72 rows=131072 width=30) (actual time=0.019..779.864 rows=131072 loops=1) Total runtime: 5600.311 ms vacuum full test; explain analyze update test set y=1; Seq Scan on test (cost=0.00..2274.72 rows=131072 width=30) (actual time=0.039..1021.847 rows=131072 loops=1) Total runtime: 5126.590 ms -> Seems vacuum full does its job.... vacuum test; explain analyze update test set y=1; Seq Scan on test (cost=0.00..3894.08 rows=196608 width=30) (actual time=36.491..860.135 rows=131072 loops=1) Total runtime: 7293.698 ms vacuum test; explain analyze update test set y=1; Seq Scan on test (cost=0.00..3894.08 rows=196608 width=30) (actual time=0.044..657.125 rows=131072 loops=1) Total runtime: 5934.141 ms vacuum analyze test; explain analyze update test set y=1; Seq Scan on test (cost=0.00..3894.08 rows=196608 width=30) (actual time=0.018..871.132 rows=131072 loops=1) Total runtime: 5548.053 ms -> here vacuum is about as slow as vacuum full (which is normal as the whole table is updated) however the row estimation is still off even after ANALYZE. Let's create a few indices : vacuum full test; create index testa on test(a); create index testz on test(z); create index teste on test(e); create index testr on test(r); create index testt on test(t); -- we don't create an index on y vacuum full test; explain analyze update test set a=id; Seq Scan on test (cost=0.00..2274.72 rows=131072 width=30) (actual time=0.044..846.102 rows=131072 loops=1) Total runtime: 14998.307 ms We see that the index updating time has made this query a lot slower. This is normal, but : vacuum full test; explain analyze update test set a=id; Seq Scan on test (cost=0.00..2274.72 rows=131072 width=30) (actual time=0.045..1387.626 rows=131072 loops=1) Total runtime: 17644.368 ms Now, we updated ALL rows but didn't actually change a single value. However it took about the same time as the first one. I guess the updates all really took place, even if all it did was copy the rows with new transaction ID's. Now, let's update a column which is not indexed : vacuum full test; explain analyze update test set y=id; Seq Scan on test (cost=0.00..2274.72 rows=131072 width=30) (actual time=0.046..964.590 rows=131072 loops=1) Total runtime: 15628.143 ms Takes 'bout the same time : the indexes still have to be updated to reference the new rows after all. So, here is something annoying with the current approach : Updating rows in a table bloats ALL indices, not just those whose indexed values have been actually updated. So if you have a table with many indexed fields and you often update some obscure timestamp field, all the indices will bloat, which will of course be corrected by VACUUM, but vacuum will have extra work to do. I don't have suggestions, just questions : Is there a way that an update to the indices can be avoided if the indexed values do not change ? Would it depend if an updated tuple can be stored on the same page it was before (along with the old version) ? If the answer is Yes : - would saving the cost of updating the indexes pay off over vacuuming the page on the run to try to squeeze the new tuple version in ? - would it be interesting to specify for each table a target % of free space ('air holes') in pages for vacuum to try to achieve, in order to be able to insert updated row versions on the same page they were before, and save index updates ? Regards... From pgsql-performance-owner@postgresql.org Wed Jan 26 19:48:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D2043A5D25 for ; Wed, 26 Jan 2005 19:48: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 50794-01 for ; Wed, 26 Jan 2005 19:48:40 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 7A8193A5D1B for ; Wed, 26 Jan 2005 19:48:41 +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 1Ctt9P-0000Ao-00; Wed, 26 Jan 2005 14:48:27 -0500 To: alex@neteconomist.com Cc: PFC , Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> In-Reply-To: <33c6269f0501261035bc87695@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 26 Jan 2005 14:48:27 -0500 Message-ID: <871xc8ynsk.fsf@stark.xeocode.com> Lines: 31 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.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/511 X-Sequence-Number: 10201 Alex Turner writes: > The problem with this approach is TTFB (Time to first Byte). The > initial query is very slow, but additional requests are fast. In most > situations we do not want the user to have to wait a disproportionate > amount of time for the initial query. If this is the first time using > the system this will be the impression that will stick with them. I > guess we could experiment and see how much extra time creating a cache > table will take... You could cheat and do queries with an offset of 0 directly but also start up a background job to fetch the complete results and cache them. queries with a non-zero offset would have to wait until the complete cache is built. You have to be careful about people arriving from bookmarks to non-zero offsets and people hitting reload before the cache is finished being built. As someone else suggested you could look into other systems for storing the cache. If you don't need to join against other database tables and you don't need the reliability of a database then there are faster solutions like memcached for example. (The problem of joining against database tables is even solvable, look up pgmemcached. No idea how it performs though.) But I think you're running into a fundamental tension here. The feature you're looking for: being able to jump around in an arbitrary non-indexed query result set which can be arbitrarily large, requires a lot of work. All you can do is shift around *when* that work is done. There's not going to be any way to avoid doing the work entirely. -- greg From pgsql-performance-owner@postgresql.org Wed Jan 26 19:51:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E94373A5CF0 for ; Wed, 26 Jan 2005 19: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 50733-09 for ; Wed, 26 Jan 2005 19:51:32 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 369EB3A5CE6 for ; Wed, 26 Jan 2005 19:51:32 +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 j0QJpQDl015649 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Jan 2005 12:51:28 -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 j0QJpPN8084238; Wed, 26 Jan 2005 12:51:25 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j0QJpPll084237; Wed, 26 Jan 2005 12:51:25 -0700 (MST) (envelope-from mfuhr) Date: Wed, 26 Jan 2005 12:51:25 -0700 From: Michael Fuhr To: James Gunzelman Cc: pgsql-performance@postgresql.org Subject: Re: Upgrading from from 7.4.2 to 8.0 Message-ID: <20050126195125.GA84102@winnie.fuhr.org> References: <9697D58F4D8FF94892AF75A0A5D8CCCC01C1EE5B@OMU-EXCH1.solutionary.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9697D58F4D8FF94892AF75A0A5D8CCCC01C1EE5B@OMU-EXCH1.solutionary.com> 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: 200501/512 X-Sequence-Number: 10202 On Wed, Jan 26, 2005 at 12:51:14PM -0600, James Gunzelman wrote: > Will I have to dump and reload all my databases when migrating from > 7.4.2 to 8.0? Yes -- the Release Notes mention it under "Migration to version 8.0": http://www.postgresql.org/docs/8.0/static/release.html#RELEASE-8-0 Those unfamiliar with doing an upgrade might want to read "If You Are Upgrading" in the "Installation Instructions" chapter of the documenation, and "Migration Between Releases" in the "Backup and Restore" chapter: http://www.postgresql.org/docs/8.0/static/install-upgrading.html http://www.postgresql.org/docs/8.0/static/migration.html (Install or upgrade questions should probably go to pgsql-admin or pgsql-general instead of pgsql-performance.) -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Wed Jan 26 20:00:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DBB623A5D31 for ; Wed, 26 Jan 2005 20:00: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 51607-06 for ; Wed, 26 Jan 2005 20:00:42 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id D59913A5CC8 for ; Wed, 26 Jan 2005 20:00:41 +0000 (GMT) Received: (qmail 13519 invoked from network); 26 Jan 2005 21:00:56 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 26 Jan 2005 21:00:56 +0100 Date: Wed, 26 Jan 2005 21:02:42 +0100 To: SpaceBallOne , pgsql-performance@postgresql.org Subject: Re: poor performance of db? References: From: PFC 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: User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/513 X-Sequence-Number: 10203 > Every time I tested an idea to speed it up, I got exactly the same > loading time on a Athlon 1800+, 256Mb RAM, 20Gb PATA computer as > compared to a Dual Opteron 246, 1Gb RAM, 70Gb WD Raptor SATA server. > Now, why a dual opteron machine can't perform any faster than a lowly > 1800+ athlon in numerous tests is completely beyond me ... increased > memory and RAID 0 disc configurations so far have not resulted in any > significant performance gain in the opteron server. How many rows does the query return ? Maybe a lot of time is spent, hidden in the PHP libraries, converting the rows returned by psql into PHP objects. You should try that : EXPLAIN ANALYZE SELECT your query -> time is T1 CREATE TABLE cache AS SELECT your query EXPLAIN ANALYZE SELECT * FROM cache -> time is T2 (probably very small) Now in your PHP script replace SELECT your query by SELECT * FROM cache. How much does the final page time changes ? This will tell you the time spend in the postgres engine, not in data transmission and PHPing. It will tell wat you can gain optimizing the query. From pgsql-performance-owner@postgresql.org Wed Jan 26 20:14:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A14D13A578F for ; Wed, 26 Jan 2005 20:14: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 54144-04 for ; Wed, 26 Jan 2005 20:14:41 +0000 (GMT) Received: from window.monsterlabs.com (window.monsterlabs.com [216.183.105.176]) by svr1.postgresql.org (Postfix) with SMTP id 333843A572C for ; Wed, 26 Jan 2005 20:14:41 +0000 (GMT) Received: (qmail 1968 invoked from network); 26 Jan 2005 20:14:40 -0000 Received: from w080.z064003242.bna-tn.dsl.cnc.net (HELO ?192.168.1.22?) (64.3.242.80) by 0 with SMTP; 26 Jan 2005 20:14:40 -0000 In-Reply-To: <20050126195125.GA84102@winnie.fuhr.org> References: <9697D58F4D8FF94892AF75A0A5D8CCCC01C1EE5B@OMU-EXCH1.solutionary.com> <20050126195125.GA84102@winnie.fuhr.org> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9a5a0440c005682cf2963293f6fc779d@sitening.com> Content-Transfer-Encoding: 7bit Cc: pgsql-performance@postgresql.org, James Gunzelman From: Thomas F.O'Connell Subject: Re: Upgrading from from 7.4.2 to 8.0 Date: Wed, 26 Jan 2005 14:14:35 -0600 To: Michael Fuhr X-Mailer: Apple Mail (2.619.2) 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: 200501/514 X-Sequence-Number: 10204 It should be noted that users who use Slony can create a subscriber node running 8.0 that subscribes to a node running 7.4.x and can transition with only the downtime required for failover. This obviates the need for a dump/restore. See . -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 On Jan 26, 2005, at 1:51 PM, Michael Fuhr wrote: > On Wed, Jan 26, 2005 at 12:51:14PM -0600, James Gunzelman wrote: > >> Will I have to dump and reload all my databases when migrating from >> 7.4.2 to 8.0? > > Yes -- the Release Notes mention it under "Migration to version 8.0": > > http://www.postgresql.org/docs/8.0/static/release.html#RELEASE-8-0 > > Those unfamiliar with doing an upgrade might want to read "If You > Are Upgrading" in the "Installation Instructions" chapter of the > documenation, and "Migration Between Releases" in the "Backup and > Restore" chapter: > > http://www.postgresql.org/docs/8.0/static/install-upgrading.html > http://www.postgresql.org/docs/8.0/static/migration.html > > (Install or upgrade questions should probably go to pgsql-admin or > pgsql-general instead of pgsql-performance.) > > -- > Michael Fuhr > http://www.fuhr.org/~mfuhr/ From pgsql-performance-owner@postgresql.org Wed Jan 26 21:08:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 89E8E3A57E2 for ; Wed, 26 Jan 2005 21:08: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 57117-07 for ; Wed, 26 Jan 2005 21:08:16 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 117EF3A57DB for ; Wed, 26 Jan 2005 21:08:16 +0000 (GMT) Received: (qmail 17684 invoked from network); 26 Jan 2005 22:08:32 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 26 Jan 2005 22:08:32 +0100 To: "Alexander Dolgin" , pgsql-performance@postgresql.org Subject: Re: 200 times slower then MSSQL?? References: Message-ID: Date: Wed, 26 Jan 2005 22:10:19 +0100 From: PFC 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: User-Agent: Opera M2/7.54 (Linux, build 751) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200501/515 X-Sequence-Number: 10205 > with about 8000 rows. For this table query: > > SELECT MAX(MsgSeqNum),MAX(LogTimestamp) FROM ELT_tcli_MessageLog > WHERE LogTimestamp >= '0' AND IsFromCounterParty = 'Y' AND > IsOutOfSequence = 'N' > AND ConnectionName = 'DB_BENCHMARK' > AND LogTimestamp IN (SELECT MAX(LogTimestamp) > FROM ELT_tcli_MessageLog > WHERE MsgSeqNum > 0 AND IsFromCounterParty = > 'Y' > > AND IsOutOfSequence = 'N' AND > ConnectionName = 'DB_BENCHMARK') > Can you explain (with words) what this query is supposed to return ? It is probably possible to write it in an entirely different way. Basically your problem is that max() in postgres does not use an index the way you think it should. "SELECT max(x) FROM t" should be written "SELECT x FROM t ORDER BY x DESC LIMIT 1" to use the index. Depending on additional Where conditions, you should add other columns to your index and also order-by clause. From pgsql-performance-owner@postgresql.org Wed Jan 26 21:22:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 408E03A588E for ; Wed, 26 Jan 2005 21:22: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 58985-06 for ; Wed, 26 Jan 2005 21:22:30 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id A21763A581E for ; Wed, 26 Jan 2005 21:22:31 +0000 (GMT) Received: (qmail 18554 invoked from network); 26 Jan 2005 22:22:48 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 26 Jan 2005 22:22:48 +0100 Date: Wed, 26 Jan 2005 22:24:34 +0100 To: alex@neteconomist.com Subject: Re: [SQL] OFFSET impact on Performance??? Cc: "Greg Stark" , "Merlin Moncure" , "Andrei Bintintan" , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> From: PFC 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: <33c6269f0501261035bc87695@mail.gmail.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.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/517 X-Sequence-Number: 10207 > The problem with this approach is TTFB (Time to first Byte). The > initial query is very slow, but additional requests are fast. In most > situations we do not want the user to have to wait a disproportionate > amount of time for the initial query. If this is the first time using > the system this will be the impression that will stick with them. I > guess we could experiment and see how much extra time creating a cache > table will take... Do it on the second page then ;) Seriously : - If you want to display the result count and page count, you'll need to do the whole query anyway, so you might as well save the results. - inserting the result id's in a temp table one by one will be slow, but you can do this : select array_accum(id) from temp group by id/20 limit 3; array_accum --------------------------------------------------------------- {1,2,4,8,16,17,9,18,19,5,10,11,3,6,12,13,7,14,15} {32,33,34,35,36,37,38,39,20,21,22,23,24,25,26,27,28,29,30,31} {40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59} - a really big search of 131072 results : create table cache (id serial primary key, value integer[]); explain analyze insert into cache (value) select array_accum(id) from temp group by id/100; Subquery Scan "*SELECT*" (cost=14382.02..17986.50 rows=131072 width=32) (actual time=961.746..1446.630 rows=1311 loops=1) -> GroupAggregate (cost=14382.02..16020.42 rows=131072 width=4) (actual time=961.607..1423.803 rows=1311 loops=1) -> Sort (cost=14382.02..14709.70 rows=131072 width=4) (actual time=961.181..1077.662 rows=131072 loops=1) Sort Key: (id / 100) -> Seq Scan on "temp" (cost=0.00..2216.40 rows=131072 width=4) (actual time=0.032..291.652 rows=131072 loops=1) Total runtime: 1493.304 ms Note that the "SELECT..." part takes 1400 ms, and the INSERT part takes the rest, which is really small. It's the sort which takes most of the time, but you'll be doing it anyway to get your results in order, so it comes free to you. This will generate 1000 pages with 100 results on each. If your searches yield say 1000 results it'll be perfectly fine and can target times in the sub-100 ms for caching the results (not counting the total query time of course !) Using arrays is the key here, because inserting all the results as individual rows in the table is gonna be a whole lot slower ! From pgsql-performance-owner@postgresql.org Wed Jan 26 21:39:56 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C00F73A5933 for ; Wed, 26 Jan 2005 21:39: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 60649-09 for ; Wed, 26 Jan 2005 21:39: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 7512B3A5894 for ; Wed, 26 Jan 2005 21:39: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 j0QLdo26020268; Wed, 26 Jan 2005 16:39:50 -0500 (EST) To: Steve Poe Cc: Josh Berkus , pgsql-performance@postgresql.org Subject: Re: Ideal disk setup for Postgresql 7.4? In-reply-to: <41F79610.20003@sfnet.cc> References: <41F63424.1060904@sfnet.cc> <200501251903.09734.josh@agliodbs.com> <41F6DBD8.2050008@sfnet.cc> <200501261003.15267.josh@agliodbs.com> <41F79610.20003@sfnet.cc> Comments: In-reply-to Steve Poe message dated "Wed, 26 Jan 2005 13:07:28 +0000" Date: Wed, 26 Jan 2005 16:39:49 -0500 Message-ID: <20267.1106775589@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: 200501/518 X-Sequence-Number: 10208 Steve Poe writes: >> Well, it's less bad with 7 disks than it is with 3, certainly. However,there >> is an obvious and quick gain to be had by splitting off the WAL logs onto >> their own disk resource ... up to 14%+ performance in some applications. >> > Pardon my ignorance, but the WAL logs are comprised of pg_xlog and > pg_clog? Their own disk resource, but not within the same channel of > disks the database is on, right? Just pg_xlog. Ideally you don't want any other traffic on the physical disk pg_xlog is on --- the idea is that the write heads need to stay over the current xlog file. I don't think it hurts too much to share a controller channel though. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jan 27 07:59:14 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 636403A5C15 for ; Thu, 27 Jan 2005 07:59: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 08782-05 for ; Thu, 27 Jan 2005 07:59:08 +0000 (GMT) Received: from mail.tecarta.com (66.238.115.135.ptr.us.xo.net [66.238.115.135]) by svr1.postgresql.org (Postfix) with ESMTP id BA5DF3A5BCE for ; Thu, 27 Jan 2005 07:59:08 +0000 (GMT) Received: from mail pickup service by mail.tecarta.com with Microsoft SMTPSVC; Thu, 27 Jan 2005 00:01:42 -0800 Received: from mail.tecarta.com ([192.168.160.2]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 27 Jan 2005 00:01:35 -0800 Received: from barracuda.tecarta.com ([192.168.160.200]) by mail.tecarta.com (SAVSMTP 3.1.0.29) with SMTP id M2005012700013402756 for ; Thu, 27 Jan 2005 00:01:34 -0800 X-ASG-Debug-ID: 1106812740-7300-1-0 X-Barracuda-URL: http://192.168.160.200:8000/cgi-bin/mark.cgi Received: from mail2 (mail2.hq.corp [192.168.160.6]) by barracuda.tecarta.com (Spam Firewall) with SMTP id 8E53120147EF for ; Wed, 26 Jan 2005 23:59:00 -0800 (PST) Received: from [192.168.0.13] ([63.206.203.145]) by mail.tecarta.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 27 Jan 2005 00:01:33 -0800 Message-ID: <41F82CA2.5070604@sfnet.cc> Date: Wed, 26 Jan 2005 23:49:54 +0000 From: Steve Poe User-Agent: Mozilla Thunderbird 1.0 (X11/20041228) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Josh Berkus Cc: pgsql-performance@postgresql.org X-ASG-Orig-Subj: Re: [PERFORM] Ideal disk setup for Postgresql 7.4? Subject: Re: Ideal disk setup for Postgresql 7.4? References: <41F63424.1060904@sfnet.cc> <200501261003.15267.josh@agliodbs.com> <41F79610.20003@sfnet.cc> <200501261849.15176.josh@agliodbs.com> In-Reply-To: <200501261849.15176.josh@agliodbs.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 27 Jan 2005 08:01:33.0674 (UTC) FILETIME=[6AD8C4A0:01C50446] X-Virus-Scanned: by Barracuda Spam Firewall at tecarta.com X-Barracuda-Spam-Score: -0.65 X-Barracuda-Spam-Status: No, SCORE=-0.65 using global scores of TAG_LEVEL=4.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=7.0 tests=BAYES_10, DATE_IN_PAST_06_12 X-Barracuda-Spam-Report: Code version 2.64, rules version 2.1.963 Rule breakdown below pts rule name description ---- ---------------------- ------------------------------------------- -1.50 BAYES_10 BODY: Bayesian spam probability is 10 to 20% [score: 0.1967] 0.85 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.268 tagged_above=0 required=5 tests=AWL, DATE_IN_PAST_06_12, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/525 X-Sequence-Number: 10215 Josh, Thanks again for the feedback. >Well, the list of ones which are good is shorter: pretty much LSI and 3Ware >(for SATA). You can suffer with Adaptec if you have to. > > > Good. We don't plan on using IDE, but I've pondered Firewire. >>If we went with a single CPU, like Athlon/Opertron64, would CS >>storming go away? >> >> > >Yes. And then you might be able to use SW Raid. Of course, you may lose >performance in other areas with the 1 processor. > > > Good to know. You mentioned earlier that to get around the CS bug, avoid the query structures which trigger it. Dumb question: How do you isolate this? Is there a way in a Postgresql query to only look at 1 processor only in a dual-CPU setup? FYI:Our company has an near-identical server (SCSI and IDE)for testing purposes of the animal hopsital application that is used. If there are any test patches to Postgresql to deal with CS storm, we can test it out if this is possible. Any likelyhood this CS storm will be understood in the next couple months? Thanks. Steve Poe From pgsql-performance-owner@postgresql.org Thu Jan 27 01:28:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B000B3A5B5E for ; Thu, 27 Jan 2005 01:27: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 82400-10 for ; Thu, 27 Jan 2005 01:27:39 +0000 (GMT) Received: from ylpvm43.prodigy.net (ylpvm43-ext.prodigy.net [207.115.57.74]) by svr1.postgresql.org (Postfix) with ESMTP id 9AAEF3A5675 for ; Thu, 27 Jan 2005 01:27:41 +0000 (GMT) Received: from one (adsl-68-126-81-199.dsl.pltn13.pacbell.net [68.126.81.199]) by ylpvm43.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id j0R1Rr2Y014499; Wed, 26 Jan 2005 20:27:53 -0500 Received: from [192.168.69.8] (rondesktop [192.168.69.8]) by one (Postfix) with ESMTP id C1ED0F1A3B; Wed, 26 Jan 2005 17:27:40 -0800 (PST) Date: Wed, 26 Jan 2005 17:27:59 -0800 (PST) From: Ron Mayer X-X-Sender: mayer@greenie.cheapcomplexdevices.com To: pgsql-performance@postgresql.org Cc: rm_pg@cheapcomplexdevices.com Subject: Should the optimizer see this? In-Reply-To: <20050126201804.956D45AF69A@svr4.postgresql.org> Message-ID: References: <20050126201804.956D45AF69A@svr4.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.05 tagged_above=0 required=5 tests=RCVD_IN_SBL X-Spam-Level: * X-Archive-Number: 200501/519 X-Sequence-Number: 10209 Short summary... the second query runs faster, and I think they should be identical queries. Should the optimizer have found this optimization? I have two identical (or so I believe) queries; one where I explicitly add a "is not null" comparison; and one where I think it would implicitly only find not-null columns. The queries are select * from rt4, rt5 where rt4.tigerfile = rt5.tigerfile and feat = feat3; and select * from (select * from rt4 where feat3 is not null) as rt4, rt5 where rt4.tigerfile = rt5.tigerfile and feat = feat3; I would have thought that the optimizer would see that if feat3 is null (which it usually is), it doesn't need to keep those rows and sort them -- but it seems (looking both at explain analyze and "du" on the tmp directory) that in the first query it is indeed sorting all the rows --- even the ones with feat3=null. The tables are the Census Tiger Line data explained in detail here: http://www.census.gov/geo/www/tiger/tiger2003/TGR2003.pdf I can attach the create statemnts for the tables if people think they'd help. Basically, table rt4 has a column called feat3 which is usually null, and table rt5 has a column called feat which is never null. Both tables have a few million rows. No indexes were used, since I'm joining everything to everything, they shouldn't have helped anyway. However vacuum analyze was run, and (as seen in the second query) the stats did know that the column feat3 was mostly null. ===================================================================================================== fli=# fli=# explain analyze select * from rt4, rt5 where rt4.tigerfile = rt5.tigerfile and feat = feat3; fli-# fli-# fli-# fli-# QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=1922903.02..1967385.35 rows=117698 width=100) (actual time=179246.872..218920.724 rows=153091 loops=1) Merge Cond: (("outer".feat3 = "inner".feat) AND ("outer".tigerfile = "inner".tigerfile)) -> Sort (cost=876532.10..888964.80 rows=4973079 width=45) (actual time=57213.327..67313.216 rows=4971022 loops=1) Sort Key: rt4.feat3, rt4.tigerfile -> Seq Scan on rt4 (cost=0.00..94198.79 rows=4973079 width=45) (actual time=0.053..10433.883 rows=4971022 loops=1) -> Sort (cost=1046370.92..1060457.95 rows=5634813 width=55) (actual time=122033.463..134037.127 rows=5767675 loops=1) Sort Key: rt5.feat, rt5.tigerfile -> Seq Scan on rt5 (cost=0.00..127146.13 rows=5634813 width=55) (actual time=0.016..22538.958 rows=5635077 loops=1) Total runtime: 219632.580 ms (9 rows) fli=# fli=# fli=# fli=# explain analyze select * from (select * from rt4 where feat3 is not null) as rt4, rt5 where rt4.tigerfile = rt5.tigerfile and feat = feat3; fli-# fli-# fli-# fli-# QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------- Merge Join (cost=1152466.47..1194789.77 rows=3296 width=100) (actual time=125982.562..145927.220 rows=153091 loops=1) Merge Cond: (("outer".feat3 = "inner".feat) AND ("outer".tigerfile = "inner".tigerfile)) -> Sort (cost=106095.56..106443.67 rows=139247 width=45) (actual time=11729.319..11823.006 rows=153091 loops=1) Sort Key: tgr.rt4.feat3, tgr.rt4.tigerfile -> Seq Scan on rt4 (cost=0.00..94198.79 rows=139247 width=45) (actual time=32.404..10893.373 rows=153091 loops=1) Filter: (feat3 IS NOT NULL) -> Sort (cost=1046370.92..1060457.95 rows=5634813 width=55) (actual time=114253.157..126650.225 rows=5767675 loops=1) Sort Key: rt5.feat, rt5.tigerfile -> Seq Scan on rt5 (cost=0.00..127146.13 rows=5634813 width=55) (actual time=0.012..19253.431 rows=5635077 loops=1) Total runtime: 146480.294 ms (10 rows) fli=# fli=# fli=# From pgsql-performance-owner@postgresql.org Sat Jan 29 21:41:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DBB903A5933 for ; Thu, 27 Jan 2005 02: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 87763-08 for ; Thu, 27 Jan 2005 02:17:18 +0000 (GMT) Received: from fep7.cogeco.net (smtp.cogeco.net [216.221.81.25]) by svr1.postgresql.org (Postfix) with ESMTP id 75A983A5D3F for ; Thu, 27 Jan 2005 02:17:20 +0000 (GMT) Received: from windsortransportationclub.com (d57-59-156.home.cgocable.net [24.57.59.156]) by fep7.cogeco.net (Postfix) with SMTP id 03E5CA77 for ; Wed, 26 Jan 2005 21:17:19 -0500 (EST) Received: (qmail 11258 invoked from network); 27 Jan 2005 02:46:51 -0000 Received: from d36-66-205.home1.cgocable.net (HELO a96dfxb4kjzogw) (24.36.66.205) by 0 with SMTP; 27 Jan 2005 02:46:51 -0000 Message-ID: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> From: "Ken Egervari" To: Subject: Performance problem with semi-large tables Date: Wed, 26 Jan 2005 21:17:23 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0013_01C503EC.6DE1FFE0" 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-Archive-Number: 200501/609 X-Sequence-Number: 10299 This is a multi-part message in MIME format. ------=_NextPart_000_0013_01C503EC.6DE1FFE0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi everyone. I'm new to this forum and was wondering if anyone would be kind enough = to help me out with a pretty severe performance issue. I believe the = problem to be rather generic, so I'll put it in generic terms. Since = I'm at home and not a work (but this is really bugging me), I can't post = any specifics. However, I think my explaination will suffice. I have a 2 tables that are are getting large and will only get larger = with time (expoentially as more users sign on to the system). Right the = now, a table called 'shipment' contains about 16,000 rows and = 'shipment_status' contains about 32,500 rows. These aren't massive rows = (I keep reading about tables with millions), but they will definately = get into 6 digits by next year and query performance is quite poor. Now, from what I can understand about tuning, you want to specify good = filters, provide good indexes on the driving filter as well as any = referencial keys that are used while joining. This has helped me solve = performance problems many times in the past (for example, changing a = query speed from 2 seconds to 21 milliseconds). =20 However, I am now tuning queries that operate on these two tables and = the filters aren't very good (the best is a filter ratio of 0.125) and = the number of rows returned is very large (not taking into consideration = limits). For example, consider something like this query that takes ~1 second to = finish: select s.*, ss.* from shipment s, shipment_status ss, release_code r where s.current_status_id =3D ss.id and ss.release_code_id =3D r.id and r.filtered_column =3D '5' order by ss.date desc limit 100; Release code is just a very small table of 8 rows by looking at the = production data, hence the 0.125 filter ratio. However, the data = distribution is not normal since the filtered column actually pulls out = about 54% of the rows in shipment_status when it joins. Postgres seems = to be doing a sequencial scan to pull out all of these rows. Next, it = joins approx 17550 rows to shipment. Since this query has a limit, it = only returns the first 100, which seems like a waste. Now, for this query, I know I can filter out the date instead to speed = it up. For example, I can probably search for all the shipments in the = last 3 days instead of limiting it to 100. But since this isn't a real = production query, I only wanted to show it as an example since many = times I cannot do a filter by the date (and the sort may be date or = something else irrelavant). I'm just stressed out how I can make queries like this more efficient = since all I see is a bunch of hash joins and sequencial scans taking all = kinds of time. I guess here are my 2 questions: 1. Should I just change beg to change the requirements so that I can = make more specific queries and more screens to access those? 2. Can you recommend ways so that postgres acts on big tables more = efficiently? I'm not really interested in this specific case (I just = made it up). I'm more interested in general solutions to this general = problem of big table sizes with bad filters and where join orders don't = seem to help much. Thank you very much for your help. Best Regards, Ken Egervari ------=_NextPart_000_0013_01C503EC.6DE1FFE0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi everyone.
 
I'm new to this forum and was wondering = if anyone=20 would be kind enough to help me out with a pretty severe performance=20 issue.  I believe the problem to be rather generic, so I'll put it = in=20 generic terms.  Since I'm at home and not a work (but this is = really=20 bugging me), I can't post any specifics.  However, I think my = explaination=20 will suffice.
 
I have a 2 tables that are are getting = large and=20 will only get larger with time (expoentially as more users sign on to = the=20 system).  Right the now, a table called 'shipment' contains about = 16,000=20 rows and 'shipment_status' contains about 32,500 rows.  These = aren't=20 massive rows (I keep reading about tables with millions), but they will=20 definately get into 6 digits by next year and query performance is quite = poor.
 
Now, from what I can understand about = tuning, you=20 want to specify good filters, provide good indexes on the driving filter = as well=20 as any referencial keys that are used while joining.  This has = helped me=20 solve performance problems many times in the past (for example, changing = a query=20 speed from 2 seconds to 21 milliseconds). 
 
However, I am now tuning queries that = operate on=20 these two tables and the filters aren't very good (the best is a filter = ratio of=20 0.125) and the number of rows returned is very large (not taking into=20 consideration limits).
 
For example, consider something = like this=20 query that takes ~1 second to finish:
 
select s.*, ss.*
from shipment s, shipment_status ss, = release_code=20 r
where s.current_status_id =3D = ss.id
   and ss.release_code_id =3D = r.id
   and r.filtered_column =3D=20 '5'
order by ss.date desc
limit 100;
 
Release code is just a very small table = of 8 rows=20 by looking at the production data, hence the 0.125 filter ratio.  = However,=20 the data distribution is not normal since the filtered column actually = pulls out=20 about 54% of the rows in shipment_status when it joins.  Postgres = seems to=20 be doing a sequencial scan to pull out all of these rows.  Next, it = joins=20 approx 17550 rows to shipment.  Since this query has a limit, it = only=20 returns the first 100, which seems like a waste.
 
Now, for this query, I know I can = filter out the=20 date instead to speed it up.  For example, I can probably search = for all=20 the shipments in the last 3 days instead of limiting it to 100.  = But since=20 this isn't a real production query, I only wanted to show it as an = example since=20 many times I cannot do a filter by the date (and the sort may be date or = something else irrelavant).
 
I'm just stressed out how I can make = queries like=20 this more efficient since all I see is a bunch of hash joins and = sequencial=20 scans taking all kinds of time.
 
I guess here are my 2 = questions:
 
1. Should I just change beg to change = the=20 requirements so that I can make more specific queries and more screens = to access=20 those?
2. Can you recommend ways so that = postgres acts on=20 big tables more efficiently?  I'm not really interested in this = specific=20 case (I just made it up).  I'm more interested in general solutions = to this=20 general problem of big table sizes with bad filters and where join = orders don't=20 seem to help much.
 
Thank you very much for your=20 help.
 
Best Regards,
Ken Egervari
------=_NextPart_000_0013_01C503EC.6DE1FFE0-- From pgsql-performance-owner@postgresql.org Thu Jan 27 02:31:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4ACFB3A5933 for ; Thu, 27 Jan 2005 02:31: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 88357-10 for ; Thu, 27 Jan 2005 02:31: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 0ADBB3A2C2C for ; Thu, 27 Jan 2005 02:31: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 j0R2VL1J002523; Wed, 26 Jan 2005 21:31:21 -0500 (EST) To: Ron Mayer Cc: pgsql-performance@postgresql.org Subject: Re: Should the optimizer see this? In-reply-to: References: <20050126201804.956D45AF69A@svr4.postgresql.org> Comments: In-reply-to Ron Mayer message dated "Wed, 26 Jan 2005 17:27:59 -0800" Date: Wed, 26 Jan 2005 21:31:20 -0500 Message-ID: <2522.1106793080@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: 200501/520 X-Sequence-Number: 10210 Ron Mayer writes: > Should the optimizer have found this optimization? I can't get excited about it. Joining on a column that's mostly nulls doesn't seem like a common thing to do. regards, tom lane From pgsql-performance-owner@postgresql.org Thu Jan 27 02:50:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A3A853A5D60 for ; Thu, 27 Jan 2005 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 15897-01 for ; Thu, 27 Jan 2005 02:50:04 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 854113A5D5C for ; Thu, 27 Jan 2005 02:50:06 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6955451; Wed, 26 Jan 2005 18:51:48 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Ideal disk setup for Postgresql 7.4? Date: Wed, 26 Jan 2005 18:49:14 -0800 User-Agent: KMail/1.6.2 Cc: Steve Poe References: <41F63424.1060904@sfnet.cc> <200501261003.15267.josh@agliodbs.com> <41F79610.20003@sfnet.cc> In-Reply-To: <41F79610.20003@sfnet.cc> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501261849.15176.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/521 X-Sequence-Number: 10211 Steve, > Okay. InCPU-bound servers, use hw RAID. Any hw raids to avoid? Well, the list of ones which are good is shorter: pretty much LSI and 3Ware (for SATA). You can suffer with Adaptec if you have to. > If we went with a single CPU, like Athlon/Opertron64, would CS > storming go away? Yes. And then you might be able to use SW Raid. Of course, you may lose performance in other areas with the 1 processor. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jan 27 03:53:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 182263A5933 for ; Thu, 27 Jan 2005 03:50: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 81472-07 for ; Thu, 27 Jan 2005 03:50:41 +0000 (GMT) Received: from gizmo01bw.bigpond.com (gizmo01bw.bigpond.com [144.140.70.11]) by svr1.postgresql.org (Postfix) with SMTP id 893773A58F8 for ; Thu, 27 Jan 2005 03:50:40 +0000 (GMT) Received: (qmail 27048 invoked from network); 27 Jan 2005 03:50:37 -0000 Received: from unknown (HELO bwmam09.bigpond.com) (144.135.24.94) by gizmo01bw.bigpond.com with SMTP; 27 Jan 2005 03:50:37 -0000 Received: from cpe-203-45-184-181.qld.bigpond.net.au ([203.45.184.181]) by bwmam09.bigpond.com(MAM REL_3_4_2a 144/26733581) with SMTP id 26733581; Thu, 27 Jan 2005 13:50:37 +1000 Message-ID: <41F86501.1060006@bigpond.net.au> Date: Thu, 27 Jan 2005 13:50:25 +1000 From: David Brown User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrei Bintintan Subject: Re: OFFSET impact on Performance??? References: <019f01c4fee1$1b58d600$0b00a8c0@forge> In-Reply-To: <019f01c4fee1$1b58d600$0b00a8c0@forge> 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=1.676 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_WHOIS X-Spam-Level: * X-Archive-Number: 200501/522 X-Sequence-Number: 10212 Although larger offsets have some effect, your real problem is the sort (of 42693 rows). Try: SELECT r.id_order FROM report r WHERE r.id_order IN (SELECT id FROM orders WHERE id_status = 6 ORDER BY 1 LIMIT 10 OFFSET 1000) ORDER BY 1 The subquery doesn't *have* to sort because the table is already ordered on the primary key. You can still add a join to orders outside the subselect without significant cost. Incidentally, I don't know how you got the first plan - it should include a sort as well. Andrei Bintintan wrote: > explain analyze > SELECT o.id > FROM report r > INNER JOIN orders o ON o.id=r.id_order AND o.id_status=6 > ORDER BY 1 LIMIT 10 OFFSET 10 > > Limit (cost=44.37..88.75 rows=10 width=4) (actual time=0.160..0.275 rows=10 loops=1) > -> Merge Join (cost=0.00..182150.17 rows=41049 width=4) (actual time=0.041..0.260 rows=20 loops=1) > Merge Cond: ("outer".id_order = "inner".id) > -> Index Scan using report_id_order_idx on report r (cost=0.00..157550.90 rows=42862 width=4) (actual time=0.018..0.075 rows=20 loops=1) > -> Index Scan using orders_pkey on orders o (cost=0.00..24127.04 rows=42501 width=4) (actual time=0.013..0.078 rows=20 loops=1) > Filter: (id_status = 6) > Total runtime: 0.373 ms > > explain analyze > SELECT o.id > FROM report r > INNER JOIN orders o ON o.id=r.id_order AND o.id_status=6 > ORDER BY 1 LIMIT 10 OFFSET 1000000 > Limit (cost=31216.85..31216.85 rows=1 width=4) (actual time=1168.152..1168.152 rows=0 loops=1) > -> Sort (cost=31114.23..31216.85 rows=41049 width=4) (actual time=1121.769..1152.246 rows=42693 loops=1) > Sort Key: o.id > -> Hash Join (cost=2329.99..27684.03 rows=41049 width=4) (actual time=441.879..925.498 rows=42693 loops=1) > Hash Cond: ("outer".id_order = "inner".id) > -> Seq Scan on report r (cost=0.00..23860.62 rows=42862 width=4) (actual time=38.634..366.035 rows=42864 loops=1) > -> Hash (cost=2077.74..2077.74 rows=42501 width=4) (actual time=140.200..140.200 rows=0 loops=1) > -> Seq Scan on orders o (cost=0.00..2077.74 rows=42501 width=4) (actual time=0.059..96.890 rows=42693 loops=1) > Filter: (id_status = 6) > Total runtime: 1170.586 ms From pgsql-performance-owner@postgresql.org Thu Jan 27 04:42:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4C04A3A5DA3 for ; Thu, 27 Jan 2005 04:42: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 87000-09 for ; Thu, 27 Jan 2005 04:42:30 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 3E55E3A5933 for ; Thu, 27 Jan 2005 04:42:29 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so240389wra for ; Wed, 26 Jan 2005 20:42:21 -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=dj1wMZd/uaEXsD/xWS75BAVqTkzcHvqkATyhIe7RvjzREE84yS1faIscQyjRSUYptAS8vHBJC5h5shzPdZkAplvOPg/ktsrP2VzyrAG7OPTTHC4fxDPn65GYej418SenLLIF55gL6s5SSGYUDNhpjXjPnisAXnIamR4o11vdAOs= Received: by 10.54.51.70 with SMTP id y70mr289876wry; Wed, 26 Jan 2005 20:42:21 -0800 (PST) Received: by 10.54.18.72 with HTTP; Wed, 26 Jan 2005 20:42:21 -0800 (PST) Message-ID: <33c6269f05012620427c1ccc40@mail.gmail.com> Date: Wed, 26 Jan 2005 23:42:21 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: PFC Subject: Re: [SQL] OFFSET impact on Performance??? Cc: Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/523 X-Sequence-Number: 10213 Thats a really good idea, just store a list of the sorted ids in the temp table - small amount of data for insert... I like it! Alex Turner NetEconomist On Wed, 26 Jan 2005 22:24:34 +0100, PFC wrote: > > The problem with this approach is TTFB (Time to first Byte). The > > initial query is very slow, but additional requests are fast. In most > > situations we do not want the user to have to wait a disproportionate > > amount of time for the initial query. If this is the first time using > > the system this will be the impression that will stick with them. I > > guess we could experiment and see how much extra time creating a cache > > table will take... > > Do it on the second page then ;) > > Seriously : > - If you want to display the result count and page count, you'll need to > do the whole query anyway, so you might as well save the results. > - inserting the result id's in a temp table one by one will be slow, but > you can do this : > > select array_accum(id) from temp group by id/20 limit 3; > array_accum > --------------------------------------------------------------- > {1,2,4,8,16,17,9,18,19,5,10,11,3,6,12,13,7,14,15} > {32,33,34,35,36,37,38,39,20,21,22,23,24,25,26,27,28,29,30,31} > {40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59} > > - a really big search of 131072 results : > create table cache (id serial primary key, value integer[]); > explain analyze insert into cache (value) select array_accum(id) from temp > group by id/100; > Subquery Scan "*SELECT*" (cost=14382.02..17986.50 rows=131072 width=32) > (actual time=961.746..1446.630 rows=1311 loops=1) > -> GroupAggregate (cost=14382.02..16020.42 rows=131072 width=4) > (actual time=961.607..1423.803 rows=1311 loops=1) > -> Sort (cost=14382.02..14709.70 rows=131072 width=4) (actual > time=961.181..1077.662 rows=131072 loops=1) > Sort Key: (id / 100) > -> Seq Scan on "temp" (cost=0.00..2216.40 rows=131072 > width=4) (actual time=0.032..291.652 rows=131072 loops=1) > Total runtime: 1493.304 ms > > Note that the "SELECT..." part takes 1400 ms, and the INSERT part takes > the rest, which is really small. It's the sort which takes most of the > time, but you'll be doing it anyway to get your results in order, so it > comes free to you. This will generate 1000 pages with 100 results on each. > If your searches yield say 1000 results it'll be perfectly fine and can > target times in the sub-100 ms for caching the results (not counting the > total query time of course !) > > Using arrays is the key here, because inserting all the results as > individual rows in the table is gonna be a whole lot slower ! > > From pgsql-performance-owner@postgresql.org Thu Jan 27 05:50:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8C22B3A5DAB for ; Thu, 27 Jan 2005 05:50: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 95451-01 for ; Thu, 27 Jan 2005 05:50:29 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id B43A03A5DF7 for ; Thu, 27 Jan 2005 05:50:29 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id EBEB6313E5; Thu, 27 Jan 2005 06:50:28 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 27 Jan 2005 00:10:24 -0500 Organization: cbbrowne Computing Inc Lines: 61 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A75D3@Herge.rcsinc.local> 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 (Corporate Culture, linux) Cancel-Lock: sha1:/hkjkmWSoNhoRHZXrjXWpcQDbWk= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.077 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/524 X-Sequence-Number: 10214 In an attempt to throw the authorities off his trail, merlin.moncure@rcsonline.com ("Merlin Moncure") transmitted: > Alex wrote: >> How do you create a temporary view that has only a small subset of the >> data from the DB init? (Links to docs are fine - I can read ;). My >> query isn't all that complex, and my number of records might be from >> 10 to 2k depending on how I implement it. > > Well, you can't. My point was that the traditional query/view > approach is often more appropriate for these cases. Actually, you can if you assume you can "temporarily materialize" that view. You take the initial query and materialize it into a temporary table which can then be used to browse "detail." Thus, suppose you've got a case where the selection criteria draw in 8000 objects/transactions, of which you only want to fit 20/page. It's ugly and slow to process the 15th page, and you essentially reprocess the whole set from scratch each time: select [details] from [big table] where [criteria] order by [something] offset 280 limit 20; Instead, you might start out by doing: select [key fields] into temp table my_query from [big table] where [criteria]; create index my_query_idx on my_query(interesting fields); With 8000 records, the number of pages in the table will correspond roughly to the number of bytes per record which is probably pretty small. Then, you use a join on my_query to pull the bits you want: select [big table.details] from [big table], [select * from my_query order by [something] offset 280 limit 20] where [join criteria between my_query and big table] order by [something]; For this to be fast is predicated on my_query being compact, but that should surely be so. The big table may be 20 million records; for the result set to be even vaguely browsable means that my_query ought to be relatively small so you can pull subsets reasonably efficiently. This actually has a merit over looking at a dynamic, possibly-changing big table that you won't unexpectedly see the result set changing size. This strikes me as a pretty slick way to handle "data warehouse-style" browsing... -- output = ("cbbrowne" "@" "gmail.com") http://www.ntlug.org/~cbbrowne/oses.html The first cup of coffee recapitulates phylogeny. From pgsql-performance-owner@postgresql.org Thu Jan 27 08:02:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D23713A5D46 for ; Thu, 27 Jan 2005 08:02: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 10249-06 for ; Thu, 27 Jan 2005 08:02:32 +0000 (GMT) Received: from mail.west.spy.net (adsl-69-230-8-158.dsl.pltn13.pacbell.net [69.230.8.158]) by svr1.postgresql.org (Postfix) with ESMTP id 142293A5D02 for ; Thu, 27 Jan 2005 08:02:30 +0000 (GMT) Received: from [192.168.1.50] (dustinti.west.spy.net [192.168.1.50]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client did not present a certificate) by mail.west.spy.net (Postfix) with ESMTP id A4DFD40; Thu, 27 Jan 2005 00:02:29 -0800 (PST) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: From: Dustin Sallings Subject: Re: SQL Performance Guidelines Date: Thu, 27 Jan 2005 00:02:29 -0800 To: "Van Ingen, Lane" X-Mailer: Apple Mail (2.619) 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: 200501/526 X-Sequence-Number: 10216 On Jan 26, 2005, at 10:27, Van Ingen, Lane wrote: > Clarification: I am talking about SQL coding practices in Postgres > (how to write queries for best > results), not tuning-related considerations (although that would be > welcomed too). Your question is a bit too vague. At this point in your development, all that really can be said is to understand relational database concepts in general, and use explain a lot when developing queries. (Oh, and don't forget to analyze before asking specific questions). > -----Original Message----- > From: pgsql-performance-owner@postgresql.org on behalf of Van Ingen, > Lane > Sent: Wed 1/26/2005 11:44 AM > To: pgsql-performance@postgresql.org > Cc: > Subject: [PERFORM] SQL Performance Guidelines > > Does anybody know where I can lay my hands on some guidelines to get > best SQL performance > out of PostgreSQL? We are about to get into a project that will be new > from the ground up (and\we are using Postgres for the first time). > Would like to share some guidelines with developers on best practices > in Postgres? Thanks for your help. > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From pgsql-performance-owner@postgresql.org Thu Jan 27 08:20:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BCBC3A598E for ; Thu, 27 Jan 2005 08:19: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 13567-05 for ; Thu, 27 Jan 2005 08:19:40 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by svr1.postgresql.org (Postfix) with ESMTP id 57F363A5CFB for ; Thu, 27 Jan 2005 08:19:40 +0000 (GMT) Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1Cu4sN-0001Hq-00 for pgsql-performance@postgresql.org; Thu, 27 Jan 2005 09:19:39 +0100 Received: from [217.235.161.8] (helo=p4.local) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1Cu4sN-0001h1-00 for pgsql-performance@postgresql.org; Thu, 27 Jan 2005 09:19:39 +0100 Received: from [127.0.0.1] (localhost [127.0.0.1]) by p4.local (Postfix) with ESMTP id 80B7740B5 for ; Thu, 27 Jan 2005 09:19:38 +0100 (CET) Message-ID: <41F8A41A.5020301@freenet.de> Date: Thu, 27 Jan 2005 09:19:38 +0100 From: =?ISO-8859-1?Q?Sebastian_B=F6ck?= User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20041225 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Optimizing Outer Joins Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:9060023f140952ea5098d12d38573a7d X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.782 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/527 X-Sequence-Number: 10217 Hello, if i have the following (simple) table layout: create table a ( id serial primary key ); create table b ( id integer references a, test text ); create view c as select a.id,b.test from a left join b on a.id = b.id; So if i do a select * from c i get the following: test=# EXPLAIN SELECT * from g; QUERY PLAN ---------------------------------------------------------------- Hash Left Join (cost=2.45..8.91 rows=8 width=36) Hash Cond: ("outer".id = "inner".id) -> Seq Scan on a (cost=0.00..1.08 rows=8 width=4) -> Hash (cost=2.16..2.16 rows=116 width=36) -> Seq Scan on b (cost=0.00..2.16 rows=116 width=36) and a select id from c executes as test=# EXPLAIN SELECT id from g; QUERY PLAN --------------------------------------------------------------- Hash Left Join (cost=2.45..7.02 rows=8 width=4) Hash Cond: ("outer".id = "inner".id) -> Seq Scan on a (cost=0.00..1.08 rows=8 width=4) -> Hash (cost=2.16..2.16 rows=116 width=4) -> Seq Scan on b (cost=0.00..2.16 rows=116 width=4) so the only difference is the width estimation. But why is the scan on table b performed? If i understand it correctly this is unnecessary because the result contains only rows from table a. Is there a way to tell postgres not to do the extra work. My aim is to speed up lookup to complex joins. Thanks Sebastian From pgsql-performance-owner@postgresql.org Thu Jan 27 09:52:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A1CC53A5D14 for ; Thu, 27 Jan 2005 09:52: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 31635-02 for ; Thu, 27 Jan 2005 09:52:18 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 1193C3A18B7 for ; Thu, 27 Jan 2005 09:52:19 +0000 (GMT) Received: (qmail 8098 invoked from network); 27 Jan 2005 10:52:36 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 27 Jan 2005 10:52:36 +0100 To: alex@neteconomist.com Cc: "Greg Stark" , "Merlin Moncure" , "Andrei Bintintan" , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> Message-ID: Date: Thu, 27 Jan 2005 10:54:25 +0100 From: PFC 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: <33c6269f05012620427c1ccc40@mail.gmail.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.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/528 X-Sequence-Number: 10218 > Thats a really good idea, just store a list of the sorted ids in the > temp table - small amount of data for insert... I like it! > > Alex Turner > NetEconomist The best part is that you can skip the LIMIT/OFFSET entirely if you put page numbers in your cache table while inserting into it, via a temporary sequence or something. Retrieving the results will then be very fast, but beware that SELECT * FROM table WHERE id =ANY( array ) won't use an index, so you'll have to trick the thing by generating a query with IN, or joining against a SRF returning the elements of the array one by one, which might be better. From pgsql-performance-owner@postgresql.org Thu Jan 27 10:19:00 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E4153A5E0C for ; Thu, 27 Jan 2005 10:18: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 35221-08 for ; Thu, 27 Jan 2005 10:18:52 +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 4C6CC3A5B21 for ; Thu, 27 Jan 2005 10:18:53 +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 1Cu6jh-000PPv-1l; Thu, 27 Jan 2005 10:18:52 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id EE480159B7; Thu, 27 Jan 2005 10:18:38 +0000 (GMT) Message-ID: <41F8BFFB.5020605@archonet.com> Date: Thu, 27 Jan 2005 10:18:35 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Sebastian_B=F6ck?= Cc: pgsql-performance@postgresql.org Subject: Re: Optimizing Outer Joins References: <41F8A41A.5020301@freenet.de> In-Reply-To: <41F8A41A.5020301@freenet.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/529 X-Sequence-Number: 10219 Sebastian B�ck wrote: > Hello, > > if i have the following (simple) table layout: > > create table a ( > id serial primary key > ); > > create table b ( > id integer references a, > test text > ); > > create view c as > select a.id,b.test from a > left join b > on a.id = b.id; > test=# EXPLAIN SELECT * from g; > test=# EXPLAIN SELECT id from g; > so the only difference is the width estimation. > > But why is the scan on table b performed? > If i understand it correctly this is unnecessary because the > result contains only rows from table a. It's only unnecessary in the case where there is a 1:1 correspondence between a.id and b.id - if you had more than one matching row in "b" then there'd be repeated rows from "a" in the result. Not sure if PG can tell what the situation is regarding references and pkeys, but in your example you don't have one anyway. -- Richard Huxton Archonet Ltd From pgsql-performance-owner@postgresql.org Thu Jan 27 10:34:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAEE63A5E1F for ; Thu, 27 Jan 2005 10:34: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 37493-02 for ; Thu, 27 Jan 2005 10:34:06 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id CD62F3A5E08 for ; Thu, 27 Jan 2005 10:34:00 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j0RAX05Q028730; Thu, 27 Jan 2005 13:33:00 +0300 (MSK) Date: Thu, 27 Jan 2005 13:33:00 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: PFC Cc: alex@neteconomist.com, Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? In-Reply-To: Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.369 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/530 X-Sequence-Number: 10220 On Thu, 27 Jan 2005, PFC wrote: > >> Thats a really good idea, just store a list of the sorted ids in the >> temp table - small amount of data for insert... I like it! >> >> Alex Turner >> NetEconomist > > The best part is that you can skip the LIMIT/OFFSET entirely if you > put page numbers in your cache table while inserting into it, via a temporary > sequence or something. Retrieving the results will then be very fast, but > beware that SELECT * FROM table WHERE id =ANY( array ) won't use an index, so contrib/intarray provides index access to such queries. > you'll have to trick the thing by generating a query with IN, or joining > against a SRF returning the elements of the array one by one, which might be > better. > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Thu Jan 27 10:50:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 159743A5E04 for ; Thu, 27 Jan 2005 10:50: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 39792-01 for ; Thu, 27 Jan 2005 10:50:43 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 2DD563A5E36 for ; Thu, 27 Jan 2005 10:50:44 +0000 (GMT) Received: (qmail 11148 invoked from network); 27 Jan 2005 11:51:01 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 27 Jan 2005 11:51:01 +0100 To: "Oleg Bartunov" Cc: alex@neteconomist.com, "Greg Stark" , "Merlin Moncure" , "Andrei Bintintan" , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> Message-ID: From: PFC 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: Thu, 27 Jan 2005 11:52:50 +0100 In-Reply-To: User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/531 X-Sequence-Number: 10221 >> The best part is that you can skip the LIMIT/OFFSET entirely if you >> put page numbers in your cache table while inserting into it, via a >> temporary sequence or something. Retrieving the results will then be >> very fast, but beware that SELECT * FROM table WHERE id =ANY( array ) >> won't use an index, so > > contrib/intarray provides index access to such queries. Can you provide an example of such a query ? I've looked at the operators for intarray without finding it. Thanks. From pgsql-performance-owner@postgresql.org Thu Jan 27 11:20:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8F4353A5E41 for ; Thu, 27 Jan 2005 11:20: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 44106-01 for ; Thu, 27 Jan 2005 11:20:35 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id 549EE3A5C74 for ; Thu, 27 Jan 2005 11:20:27 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j0RBJZ5Q029601; Thu, 27 Jan 2005 14:19:35 +0300 (MSK) Date: Thu, 27 Jan 2005 14:19:35 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: PFC Cc: alex@neteconomist.com, Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? In-Reply-To: Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.368 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/532 X-Sequence-Number: 10222 On Thu, 27 Jan 2005, PFC wrote: > >>> The best part is that you can skip the LIMIT/OFFSET entirely if you >>> put page numbers in your cache table while inserting into it, via a >>> temporary sequence or something. Retrieving the results will then be very >>> fast, but beware that SELECT * FROM table WHERE id =ANY( array ) won't use >>> an index, so >> >> contrib/intarray provides index access to such queries. > > Can you provide an example of such a query ? I've looked at the > operators for intarray without finding it. for example, http://www.sai.msu.su/~megera/postgres/gist/code/7.3/README.intarray see OPERATIONS and EXAMPLE USAGE: SELECT * FROM table WHERE id && int[] > Thanks. > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Thu Jan 27 12:57:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 855F93A5EA2 for ; Thu, 27 Jan 2005 12:57: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 53789-08 for ; Thu, 27 Jan 2005 12:57:23 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 181423A5ECE for ; Thu, 27 Jan 2005 12:57:24 +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 1Cu9D1-0003U0-00; Thu, 27 Jan 2005 07:57:15 -0500 To: Oleg Bartunov Cc: PFC , alex@neteconomist.com, Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 27 Jan 2005 07:57:15 -0500 Message-ID: <87zmyvvxlg.fsf@stark.xeocode.com> Lines: 55 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.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/533 X-Sequence-Number: 10223 Oleg Bartunov writes: > On Thu, 27 Jan 2005, PFC wrote: > > > > > > > beware that SELECT * FROM table WHERE id =ANY( array ) won't use an index, > > > contrib/intarray provides index access to such queries. > > > > Can you provide an example of such a query ? I've looked at the operators > > for intarray without finding it. > > for example, > http://www.sai.msu.su/~megera/postgres/gist/code/7.3/README.intarray > see OPERATIONS and EXAMPLE USAGE: > > SELECT * FROM table WHERE id && int[] I don't think that helps him. He wants the join to the *other* table to use an index. It would be nice if the IN plan used an index for =ANY(array) just like it does for =ANY(subquery) but I'm not sure the statistics are there. It might not be a bad plan to just assume arrays are never going to be millions of elements long though. There is a way to achieve this using "int_array_enum" from another contrib module, "intagg". My current project uses something similar to this except the arrays are precomputed. When I went to 7.4 the new array support obsoleted everything else I was using from the "intagg" and "array" contrib moduels except for this one instance where intagg is still necessary. It is a bit awkward but it works: slo=> EXPLAIN SELECT * FROM foo JOIN (SELECT int_array_enum(foo_ids) AS foo_id FROM cache WHERE cache_id = 1) AS x USING (foo_id) ; QUERY PLAN -------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..6.40 rows=1 width=726) -> Subquery Scan x (cost=0.00..3.18 rows=1 width=4) -> Index Scan using idx_cache on cache (cost=0.00..3.17 rows=1 width=30) Index Cond: (cache_id = 1) -> Index Scan using foo_pkey on foo (cost=0.00..3.21 rows=1 width=726) Index Cond: (foo.foo_id = "outer".foo_id) (6 rows) (query and plan edited for clarity and for paranoia purposes) -- greg From pgsql-performance-owner@postgresql.org Thu Jan 27 13:09:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3D5193A5E94 for ; Thu, 27 Jan 2005 13: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 54796-10 for ; Thu, 27 Jan 2005 13:09:06 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 87DD73A5E5D for ; Thu, 27 Jan 2005 13:09:07 +0000 (GMT) Received: (qmail 18596 invoked from network); 27 Jan 2005 14:09:24 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 27 Jan 2005 14:09:24 +0100 Date: Thu, 27 Jan 2005 14:11:13 +0100 To: "Oleg Bartunov" Subject: Re: [SQL] OFFSET impact on Performance??? Cc: alex@neteconomist.com, "Greg Stark" , "Merlin Moncure" , "Andrei Bintintan" , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> From: PFC 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: User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/534 X-Sequence-Number: 10224 > for example, > http://www.sai.msu.su/~megera/postgres/gist/code/7.3/README.intarray > see OPERATIONS and EXAMPLE USAGE: > Thanks, I already know this documentation and have used intarray before (I find it absolutely fabulous in the right application, it has a great potential for getting out of tight situations which would involve huge unmanageable pivot or attributes tables). Its only drawback is that the gist index creation time is slow and sometimes just... takes forever until the disk is full. However, it seems that integer && integer[] does not exist : > SELECT * FROM table WHERE id && int[] explain analyze select * from temp t where id && ( '{1,2,3,4,5,6,7,8,9,10,11,12}'::integer[] ); ERREUR: L'operateur n'existe pas : integer && integer[] ASTUCE : Aucun operateur correspond au nom donne et aux types d'arguments. Vous devez ajouter des conversions explicites de type. I have already used this type of intarray indexes, but you have to create a special gist index with the gist__int_ops on the column, and the column has to be an array. In my case the column is just a SERIAL PRIMARY KEY, and should stay this way, and I don't want to create a functional index in array[id] just for this feature ; so I guess I can't use the && operator. Am I mistaken ? My index is the standard btree here. It would be nice if the =ANY() could use the index just like IN does ; besides at planning time the length of the array is known which makes it behave quite just like IN(). So I'll use either an EXECUTE'd plpgsql-generated query (IN (....)) , which I don't like because it's a kludge ; or this other solution which I find more elegant : CREATE OR REPLACE FUNCTION tools.array_srf( INTEGER[] ) RETURNS SETOF INTEGER RETURNS NULL ON NULL INPUT LANGUAGE plpgsql AS $$ DECLARE _data ALIAS FOR $1; _i INTEGER; BEGIN FOR _i IN 1..icount(_data) LOOP RETURN NEXT _data[_i]; END LOOP; RETURN; END; $$; ----------------------------------------------------------------------------------- explain analyze select * from temp t where id =ANY( '{1,2,3,4,5,6,7,8,9,10,11,12}' ); Seq Scan on "temp" t (cost=0.00..5165.52 rows=65536 width=8) (actual time=0.030..173.319 rows=12 loops=1) Filter: (id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12}'::integer[])) Total runtime: 173.391 ms ----------------------------------------------------------------------------------- explain analyze select * from temp t where id IN( 1,2,3,4,5,6,7,8,9,10,11,12 ); Index Scan using temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey on "temp" t (cost=0.00..36.49 rows=12 width=8) (actual time=0.046..0.137 rows=12 loops=1) Index Cond: ((id = 1) OR (id = 2) OR (id = 3) OR (id = 4) OR (id = 5) OR (id = 6) OR (id = 7) OR (id = 8) OR (id = 9) OR (id = 10) OR (id = 11) OR (id = 12)) Total runtime: 0.292 ms ----------------------------------------------------------------------------------- explain analyze select * from temp t where id in (select * from tools.array_srf('{1,2,3,4,5,6,7,8,9,10,11,12}')); Nested Loop (cost=15.00..620.20 rows=200 width=8) (actual time=0.211..0.368 rows=12 loops=1) -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual time=0.160..0.173 rows=12 loops=1) -> Function Scan on array_srf (cost=0.00..12.50 rows=1000 width=4) (actual time=0.127..0.139 rows=12 loops=1) -> Index Scan using temp_pkey on "temp" t (cost=0.00..3.01 rows=1 width=8) (actual time=0.010..0.012 rows=1 loops=12) Index Cond: (t.id = "outer".array_srf) Total runtime: 0.494 ms ----------------------------------------------------------------------------------- explain analyze select * from temp t, (select * from tools.array_srf('{1,2,3,4,5,6,7,8,9,10,11,12}')) foo where foo.array_srf = t.id; Merge Join (cost=62.33..2824.80 rows=1000 width=12) (actual time=0.215..0.286 rows=12 loops=1) Merge Cond: ("outer".id = "inner".array_srf) -> Index Scan using temp_pkey on "temp" t (cost=0.00..2419.79 rows=131072 width=8) (actual time=0.032..0.056 rows=13 loops=1) -> Sort (cost=62.33..64.83 rows=1000 width=4) (actual time=0.169..0.173 rows=12 loops=1) Sort Key: array_srf.array_srf -> Function Scan on array_srf (cost=0.00..12.50 rows=1000 width=4) (actual time=0.127..0.139 rows=12 loops=1) Total runtime: 0.391 ms ----------------------------------------------------------------------------------- Note that the meaning is different ; the IN removes duplicates in the array but the join does not. From pgsql-performance-owner@postgresql.org Thu Jan 27 13:45:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 316803A5EE1 for ; Thu, 27 Jan 2005 13:45: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 60325-05 for ; Thu, 27 Jan 2005 13:45:05 +0000 (GMT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by svr1.postgresql.org (Postfix) with ESMTP id B34B63A5EC1 for ; Thu, 27 Jan 2005 13:44:59 +0000 (GMT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.12.10/8.12.10) with ESMTP id j0RDi45Q002747; Thu, 27 Jan 2005 16:44:04 +0300 (MSK) Date: Thu, 27 Jan 2005 16:44:04 +0300 (MSK) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: PFC Cc: alex@neteconomist.com, Greg Stark , Merlin Moncure , Andrei Bintintan , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? In-Reply-To: Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.367 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/535 X-Sequence-Number: 10225 On Thu, 27 Jan 2005, PFC wrote: > > >> for example, >> http://www.sai.msu.su/~megera/postgres/gist/code/7.3/README.intarray >> see OPERATIONS and EXAMPLE USAGE: >> > > Thanks, I already know this documentation and have used intarray > before (I find it absolutely fabulous in the right application, it has a > great potential for getting out of tight situations which would involve huge > unmanageable pivot or attributes tables). Its only drawback is that the gist > index creation time is slow and sometimes just... takes forever until the > disk is full. > However, it seems that integer && integer[] does not exist : Try intset(id) && int[]. intset is an undocumented function :) I'm going to add intset() to README. > >> SELECT * FROM table WHERE id && int[] > > explain analyze select * from temp t where id && ( > '{1,2,3,4,5,6,7,8,9,10,11,12}'::integer[] ); > ERREUR: L'operateur n'existe pas : integer && integer[] > ASTUCE : Aucun operateur correspond au nom donne et aux types d'arguments. > Vous devez ajouter des conversions explicites de type. > > I have already used this type of intarray indexes, but you have to > create a special gist index with the gist__int_ops on the column, and the > column has to be an array. In my case the column is just a SERIAL PRIMARY > KEY, and should stay this way, and I don't want to create a functional index > in array[id] just for this feature ; so I guess I can't use the && operator. > Am I mistaken ? My index is the standard btree here. > It would be nice if the =ANY() could use the index just like > IN does ; besides at planning time the length of the array is known which > makes it behave quite just like IN(). > > So I'll use either an EXECUTE'd plpgsql-generated query (IN (....)) , > which I don't like because it's a kludge ; or this other solution which I > find more elegant : > > CREATE OR REPLACE FUNCTION tools.array_srf( INTEGER[] ) > RETURNS SETOF INTEGER RETURNS NULL ON NULL INPUT > LANGUAGE plpgsql AS > $$ > DECLARE > _data ALIAS FOR $1; > _i INTEGER; > BEGIN > FOR _i IN 1..icount(_data) LOOP > RETURN NEXT _data[_i]; > END LOOP; > RETURN; > END; > $$; > > ----------------------------------------------------------------------------------- > explain analyze select * from temp t where id =ANY( > '{1,2,3,4,5,6,7,8,9,10,11,12}' ); > Seq Scan on "temp" t (cost=0.00..5165.52 rows=65536 width=8) (actual > time=0.030..173.319 rows=12 loops=1) > Filter: (id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12}'::integer[])) > Total runtime: 173.391 ms > > ----------------------------------------------------------------------------------- > explain analyze select * from temp t where id IN( 1,2,3,4,5,6,7,8,9,10,11,12 > ); > Index Scan using temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, > temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, temp_pkey, > temp_pkey on "temp" t (cost=0.00..36.49 rows=12 width=8) (actual > time=0.046..0.137 rows=12 loops=1) > Index Cond: ((id = 1) OR (id = 2) OR (id = 3) OR (id = 4) OR (id = 5) OR > (id = 6) OR (id = 7) OR (id = 8) OR (id = 9) OR (id = 10) OR (id = 11) OR (id > = 12)) > Total runtime: 0.292 ms > > ----------------------------------------------------------------------------------- > explain analyze select * from temp t where id in (select * from > tools.array_srf('{1,2,3,4,5,6,7,8,9,10,11,12}')); > Nested Loop (cost=15.00..620.20 rows=200 width=8) (actual time=0.211..0.368 > rows=12 loops=1) > -> HashAggregate (cost=15.00..15.00 rows=200 width=4) (actual > time=0.160..0.173 rows=12 loops=1) > -> Function Scan on array_srf (cost=0.00..12.50 rows=1000 width=4) > (actual time=0.127..0.139 rows=12 loops=1) > -> Index Scan using temp_pkey on "temp" t (cost=0.00..3.01 rows=1 > width=8) (actual time=0.010..0.012 rows=1 loops=12) > Index Cond: (t.id = "outer".array_srf) > Total runtime: 0.494 ms > > ----------------------------------------------------------------------------------- > explain analyze select * from temp t, (select * from > tools.array_srf('{1,2,3,4,5,6,7,8,9,10,11,12}')) foo where foo.array_srf = > t.id; > > Merge Join (cost=62.33..2824.80 rows=1000 width=12) (actual > time=0.215..0.286 rows=12 loops=1) > Merge Cond: ("outer".id = "inner".array_srf) > -> Index Scan using temp_pkey on "temp" t (cost=0.00..2419.79 > rows=131072 width=8) (actual time=0.032..0.056 rows=13 loops=1) > -> Sort (cost=62.33..64.83 rows=1000 width=4) (actual time=0.169..0.173 > rows=12 loops=1) > Sort Key: array_srf.array_srf > -> Function Scan on array_srf (cost=0.00..12.50 rows=1000 width=4) > (actual time=0.127..0.139 rows=12 loops=1) > Total runtime: 0.391 ms > > ----------------------------------------------------------------------------------- > Note that the meaning is different ; the IN removes duplicates in the array > but the join does not. > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 From pgsql-performance-owner@postgresql.org Thu Jan 27 14:36:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4F44D3A5D84 for ; Thu, 27 Jan 2005 14:36: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 66895-04 for ; Thu, 27 Jan 2005 14:36:00 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 61C4B3A5EC7 for ; Thu, 27 Jan 2005 14:36:02 +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: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 27 Jan 2005 09:35:09 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75EC@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcUENQvthYautz5YSEugrkWqWJi4LQAR0i8w From: "Merlin Moncure" To: "Christopher Browne" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/536 X-Sequence-Number: 10226 > Actually, you can if you assume you can "temporarily materialize" that > view. > > Then, you use a join on my_query to pull the bits you want: >=20 > select [big table.details] from [big table], > [select * from my_query order by [something] offset 280 limit 20] > where [join criteria between my_query and big table] > order by [something]; >=20 I think that's a pretty reasonable compromise between a true materialized solution and brute force limit/offset. Still, the performance of a snapshot materialized view indexed around your query simply can't be beat, although you have to pay a hefty price in complexity, maintenance, and coherency. Merlin From pgsql-performance-owner@postgresql.org Thu Jan 27 14:50:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 976FE3A5EF6 for ; Thu, 27 Jan 2005 14:50: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 68708-02 for ; Thu, 27 Jan 2005 14:50:35 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id 962373A5F12 for ; Thu, 27 Jan 2005 14:50:37 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so262146wri for ; Thu, 27 Jan 2005 06:50:32 -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=sswD8VyVYHnl10KPP7F3/ODpv9hOG/3GAosXs9bhPUDrazR1JALeGw9VyAR6WOr5h4dPsUWl5glGFo0u8djAnSyJy1nMQtXuRpZ7qj+OFWJWLCgujmDVIZxwAtozeHDVYZPEuTj6g3I+ThK2l4WtuNnuXgWmjZfFSPexRrVIDPI= Received: by 10.54.20.36 with SMTP id 36mr79381wrt; Thu, 27 Jan 2005 06:50:32 -0800 (PST) Received: by 10.54.59.22 with HTTP; Thu, 27 Jan 2005 06:50:32 -0800 (PST) Message-ID: <330532b605012706502e298c77@mail.gmail.com> Date: Thu, 27 Jan 2005 09:50:32 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: pgsql-performance@postgresql.org Subject: Re: SQL Performance Guidelines 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.042 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/537 X-Sequence-Number: 10227 On Thu, 27 Jan 2005 00:02:29 -0800, Dustin Sallings wrote: > > On Jan 26, 2005, at 10:27, Van Ingen, Lane wrote: > > > Clarification: I am talking about SQL coding practices in Postgres > > (how to write queries for best > > results), not tuning-related considerations (although that would be > > welcomed too). > > Your question is a bit too vague. At this point in your development, > all that really can be said is to understand relational database > concepts in general, and use explain a lot when developing queries. > (Oh, and don't forget to analyze before asking specific questions). I disagree - there are plenty of tricks that are PostgreSQL only, and many people on this list have that knowledge but it is not documented anywhere, or is hidden within thousands of mailing list posts. For example, IIRC when joining an integer column with a SERIAL column, you must expicitly cast it as an integer or the planner will not use the indexes, right? (This is a guess, as I remember reading something like this and thinking, "How in the world is someone supposed to figure that out, even with EXPLAIN?") There is another thread about how a query using a WHERE NOT NULL clause is faster than one without. These things are PostgreSQL specific, and documenting them would go a long way towards educating the switchover crowd. The closest thing I have seen to this is the PostgreSQL Gotchas page: http://sql-info.de/postgresql/postgres-gotchas.html HTH, -- Mitch From pgsql-performance-owner@postgresql.org Thu Jan 27 15:20:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 64B8F3A5C41 for ; Thu, 27 Jan 2005 15:20: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 72954-06 for ; Thu, 27 Jan 2005 15:20:48 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 331043A5F06 for ; Thu, 27 Jan 2005 15:20:48 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0RExVSq035581; Thu, 27 Jan 2005 14:59:39 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.5]); Thu, 27 Jan 2005 15:19:41 +0000 Message-ID: <41F9068D.4080507@familyhealth.com.au> Date: Thu, 27 Jan 2005 15:19:41 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Mitch Pirtle Cc: pgsql-performance@postgresql.org Subject: Re: SQL Performance Guidelines References: <330532b605012706502e298c77@mail.gmail.com> In-Reply-To: <330532b605012706502e298c77@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.02 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/538 X-Sequence-Number: 10228 > For example, IIRC when joining an integer column with a SERIAL column, > you must expicitly cast it as an integer or the planner will not use > the indexes, right? (This is a guess, as I remember reading something > like this and thinking, "How in the world is someone supposed to > figure that out, even with EXPLAIN?") That's not true at all. Perhaps you're thinking about BIGSERIAL and int8 indexes - something that's been addressed in 8.0. Chris From pgsql-performance-owner@postgresql.org Thu Jan 27 15:23:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 44B553A5C41 for ; Thu, 27 Jan 2005 15:23: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 73793-02 for ; Thu, 27 Jan 2005 15:23:34 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.196]) by svr1.postgresql.org (Postfix) with ESMTP id DFCA63A5F60 for ; Thu, 27 Jan 2005 15:23:37 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so264889wri for ; Thu, 27 Jan 2005 07:23:34 -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=cOM6eISvCQeup4mxzgdrhLwcdnfEM8Gf9Bq9OcnvLBtIQb4yewBywoH2IjhtGaAC6aWLG4Znhj+rISzZy/lewQwS333cHs10S0HE78gD329jSOWUOuhU3wEfbgonPHMNIyYGZug8BXv88Q8E7NTA73aYFixmOFaGpbUTITnLu5w= Received: by 10.54.20.36 with SMTP id 36mr93918wrt; Thu, 27 Jan 2005 07:23:34 -0800 (PST) Received: by 10.54.20.47 with HTTP; Thu, 27 Jan 2005 07:23:34 -0800 (PST) Message-ID: <1dc7f0e305012707234159cfc8@mail.gmail.com> Date: Thu, 27 Jan 2005 10:23:34 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: PERFORM Subject: Flattening a kind of 'dynamic' table 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: 200501/539 X-Sequence-Number: 10229 Good morning, I have a table that links two tables and I need to flatten one. (Please, if I'm just not in the good forum for this, tell me. This is a performance issue for me, but you might consider this as an SQL question. Feel free to direct me at the good mailling-list.) design.products ---> design.product_department_time <--- design.departments This allows us to fixe a given required time by department for a given product. - Departments are defined by the user - Products also - Time is input for a department (0 and NULL are impossible). Here a normal listing of design.product_department_time: product_id | department_id | req_time ------------+---------------+---------- 906 | A | 3000 906 | C | 3000 906 | D | 1935 907 | A | 1500 907 | C | 1500 907 | D | 4575 924 | A | 6000 924 | C | 1575 I need to JOIN this data with the product listing we have to produce and multiply the quantity with this time by departments, and all that in a row. So departments entries become columns. I did the following (I formated the query to help out): SELECT product_id, sum(CASE WHEN department_id = 'A' THEN req_time END) AS a, sum(CASE WHEN department_id = 'C' THEN req_time END) AS c, sum(CASE WHEN department_id = 'D' THEN req_time END) AS d FROM design.product_department_time GROUP BY product_id; product_id | a | c | d ------------+------+------+------ 924 | 6000 | 1575 | 907 | 1500 | 1500 | 4575 906 | 3000 | 3000 | 1935 Now in my software I know all the departments, so programatically I build a query with a CASE for each department (just like the above). This is nice, this is working, there is less than 10 departements for now and about 250 jobs actives in the system. So PostgeSQL will not die. (My example is more simple because this was an hard-coded test case, but I would create a case entry for each department.) But I am wondering what is the most efficient way to do what I need? After that I need to link (LEFT JOIN) this data with the jobs in the system. Each job has a product_id related to it, so USING (product_id) and I multiply the time of each department with the quantity there is to product. So someone can know how much work time there is to do by departments. Thanks for any input, comments, tips, help, positive criticism to learn more, etc. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Thu Jan 27 15:45:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 217573A5F1C for ; Thu, 27 Jan 2005 15:45: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 76390-02 for ; Thu, 27 Jan 2005 15:45:29 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 9E8763A5E0A for ; Thu, 27 Jan 2005 15:45:32 +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: Re: Flattening a kind of 'dynamic' table Date: Thu, 27 Jan 2005 10:44:45 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75ED@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Flattening a kind of 'dynamic' table Thread-Index: AcUEhHFXx4SXr/kKQAmHpsF8huY0WAAAKD5g From: "Merlin Moncure" To: "Alexandre Leclerc" Cc: "PERFORM" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/540 X-Sequence-Number: 10230 Alexandre wrote: > Here a normal listing of design.product_department_time: > product_id | department_id | req_time > ------------+---------------+---------- > 906 | A | 3000 > 906 | C | 3000 > 906 | D | 1935 > 907 | A | 1500 > 907 | C | 1500 > 907 | D | 4575 > 924 | A | 6000 > 924 | C | 1575 > product_id | a | c | d > ------------+------+------+------ > 924 | 6000 | 1575 | > 907 | 1500 | 1500 | 4575 > 906 | 3000 | 3000 | 1935 ok, you have a couple of different options here. The first thing that jumps out at me is to use arrays to cheat using arrays. Let's start with the normalized result set. select product_id, department_id, sum(req_time) group by product_id, department_id =20 product_id | department_id | sum =20 924 a 6000 924 c 1575 907 a 1500 [...] This should be no slower (in fact faster) then your original query and does not have to be re-coded when you add new departments (you have a department table, right?). If you absolutely must have 1 record/product, you can cheat using arrays: select q.product_id,=20 array_accum(q.department_id) as depts, array_accum(q.req_time) as times from=20 ( select product_id, department_id, sum(req_time) as req_time group by product_id, department_id ) q group by q.product_id; =09 select product_id, array_accum(department_id) sum(req_time) group by product_id product_id | department_id | sum =20 924 {a, c} {1500, 1575} [...] disclaimer 1: I never checked syntax disclaimer 2: you may have to add array_accum to pg (check docs) Merlin From pgsql-performance-owner@postgresql.org Thu Jan 27 16:27:49 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A117E3A5ECE for ; Thu, 27 Jan 2005 16:27: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 80944-07 for ; Thu, 27 Jan 2005 16:27:44 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.204]) by svr1.postgresql.org (Postfix) with ESMTP id 39A293A5EB2 for ; Thu, 27 Jan 2005 16:27:41 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id a36so259863rnf for ; Thu, 27 Jan 2005 08:27:40 -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=askPc8msrb3Dx/qyQ+AHJLtXMOXWude8rSgIqLPGvRTcrRQAsJRa+5ClMjmEP9zkOEWiyb08XtKyn+s8Zjni+2yzHEA869HQAYj8vSb0rq/hBWMuZwwga9bndKejVkLQkc3E3pxKTxg8XT/WDgm5tos6jiy3duR5sYR3OwC88oM= Received: by 10.38.209.66 with SMTP id h66mr7520rng; Thu, 27 Jan 2005 08:27:40 -0800 (PST) Received: by 10.38.163.47 with HTTP; Thu, 27 Jan 2005 08:27:40 -0800 (PST) Message-ID: <758d5e7f050127082755f9af12@mail.gmail.com> Date: Thu, 27 Jan 2005 17:27:40 +0100 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: Alexandre Leclerc Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <1dc7f0e305012707234159cfc8@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.549 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/541 X-Sequence-Number: 10231 On Thu, 27 Jan 2005 10:23:34 -0500, Alexandre Leclerc wrote: > Here a normal listing of design.product_department_time: > product_id | department_id | req_time > ------------+---------------+---------- > 906 | A | 3000 > 906 | C | 3000 > 906 | D | 1935 > 907 | A | 1500 > 907 | C | 1500 > 907 | D | 4575 > 924 | A | 6000 > 924 | C | 1575 Well, I did something like this recently; it can be done though maybe not very efficiently... Unfortunately we will need a rowtype with all the departaments: CREATE DOMAIN departaments AS (a int, b int, c int, d int, ...); A function aggregate for this type: CREATE FUNCTION dep_agg(ds departaments, args text[]) RETURNS departaments AS $$ BEGIN IF args[1] = 'A' THEN ds.a = args[2]; -- I think it is not possible to do ds.$args[1] = args[2] equivalent. ELSIF args[1] = 'B' THEN ds.b = args[2]; ELSIF args[1] = 'C' THEN ds.c = args[2]; ELSIF args[1] = 'D' THEN ds.d = args[2]; END IF; RETURN ds; END; $$ LANUGAGE plpgsql; THEN an aggregate: CREATE AGGREGATE dep_aggregate (basetype = text[], stype = departaments, sfunc =dep_agg); AND then a view for sugar: CREATE VIEW prod_dep_time VIEW AS SELECT product_id, (dep_aggregate(ARRAY[departament_id, req_time]::text[])).* FROM product_department_time GROUP BY product_id; And voila. :) Couple of comments: -- aggregate takes array[] since making "multicolumn" aggregates is not possible, as far as I know. -- I did not check the code, yet I did manage to make it work some time before. You may need to use "ROWS" or something in the function definition; I don't remember and can't check it right now. -- comments welcome. :) Regards, Dawid From pgsql-performance-owner@postgresql.org Thu Jan 27 16:42:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 19EE13A5F2E for ; Thu, 27 Jan 2005 16: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 82160-06 for ; Thu, 27 Jan 2005 16:42:25 +0000 (GMT) Received: from server.cityscape3d.com (unknown [217.206.144.18]) by svr1.postgresql.org (Postfix) with ESMTP id 0E7423A5F1A for ; Thu, 27 Jan 2005 16:42:21 +0000 (GMT) Received: from [192.168.1.117] ([192.168.1.117]) by server.cityscape3d.com (8.12.11/8.11.6) with ESMTP id j0RGL5bR036777; Thu, 27 Jan 2005 16:21:06 GMT (envelope-from chriskl@familyhealth.com.au) Received: from 127.0.0.1 (AVG SMTP 7.0.302 [265.7.5]); Thu, 27 Jan 2005 16:41:15 +0000 Message-ID: <41F919AB.5070901@familyhealth.com.au> Date: Thu, 27 Jan 2005 16:41:15 +0000 From: Christopher Kings-Lynne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dawid Kuroczko Cc: Alexandre Leclerc , PERFORM Subject: Re: Flattening a kind of 'dynamic' table References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> In-Reply-To: <758d5e7f050127082755f9af12@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.019 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/543 X-Sequence-Number: 10233 > Unfortunately we will need a rowtype with all the departaments: > CREATE DOMAIN departaments AS (a int, b int, c int, d int, ...); I think you mean CREATE TYPE departments... Chris From pgsql-performance-owner@postgresql.org Thu Jan 27 16:42:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2306A3A5DB5 for ; Thu, 27 Jan 2005 16:42: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 82598-02 for ; Thu, 27 Jan 2005 16:42:09 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 71F213A57D9 for ; Thu, 27 Jan 2005 16:42:08 +0000 (GMT) Received: (qmail 27907 invoked from network); 27 Jan 2005 17:42:25 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 27 Jan 2005 17:42:25 +0100 Date: Thu, 27 Jan 2005 17:44:15 +0100 To: "Oleg Bartunov" Subject: Re: [SQL] OFFSET impact on Performance??? Cc: alex@neteconomist.com, "Greg Stark" , "Merlin Moncure" , "Andrei Bintintan" , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> From: PFC 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: User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/542 X-Sequence-Number: 10232 >> However, it seems that integer && integer[] does not exist : > > Try intset(id) && int[]. intset is an undocumented function :) > I'm going to add intset() to README. > >> >>> SELECT * FROM table WHERE id && int[] Mm. intset(x) seems to be like array[x] ? Actually what I want is the opposite. I have a btree index on an integer column ; I wanted to use this index and not create a functional index... which is why I wanted to use =ANY(). If I had a gist index on an integer array column, I would of course use what you suggest, but this is not the case... Anyway I think the SRF function solution works well, I like it. Note that int_agg_final_array() crashes my postgres, see my message in psql/general Regards, Pierre From pgsql-performance-owner@postgresql.org Thu Jan 27 16:57:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E96893A5EE3 for ; Thu, 27 Jan 2005 16:57: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 84015-03 for ; Thu, 27 Jan 2005 16:57:00 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 8C0873A5EA3 for ; Thu, 27 Jan 2005 16:56:59 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6957581; Thu, 27 Jan 2005 08:58:42 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Ideal disk setup for Postgresql 7.4? Date: Thu, 27 Jan 2005 08:56:03 -0800 User-Agent: KMail/1.6.2 Cc: Steve Poe References: <41F63424.1060904@sfnet.cc> <200501261849.15176.josh@agliodbs.com> <41F82CA2.5070604@sfnet.cc> In-Reply-To: <41F82CA2.5070604@sfnet.cc> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501270856.03632.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/544 X-Sequence-Number: 10234 Steve, > You mentioned earlier that to get around the CS bug, avoid the query > structures which trigger it. Dumb question: How do you isolate this? In real terms, it's generally triggered by a query joining against a very large table requiring a seq scan. You can probably find the "bad queries" just by using PQA, and looking for select, delete and update queries which last over 60 seconds. > Is there a way in a Postgresql query to only look at 1 processor only in > a dual-CPU setup? That would be an OS question. I personally can't see how. > Any likelyhood this CS storm will be understood in the next couple months? It's well understood. See the archives of this list. The problem is that implementing the solution is very, very hard -- 100+ hours from a top-notch programmer. I'm still hoping to find a corporate sponsor for the issue ... -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Thu Jan 27 17:03:16 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A94BD3A5F53 for ; Thu, 27 Jan 2005 17:03: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 84162-08 for ; Thu, 27 Jan 2005 17:03:09 +0000 (GMT) Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by svr1.postgresql.org (Postfix) with ESMTP id B13C83A5F3D for ; Thu, 27 Jan 2005 17:03:06 +0000 (GMT) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:204:e2ff:fe39:8e2b] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.34) id 1CuD2u-0003U7-T4 for pgsql-performance@postgresql.org; Thu, 27 Jan 2005 18:03:05 +0100 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1CuD2u-0001bV-00 for ; Thu, 27 Jan 2005 18:03:04 +0100 Date: Thu, 27 Jan 2005 18:03:04 +0100 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: Ideal disk setup for Postgresql 7.4? Message-ID: <20050127170304.GB5795@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <41F63424.1060904@sfnet.cc> <200501261849.15176.josh@agliodbs.com> <41F82CA2.5070604@sfnet.cc> <200501270856.03632.josh@agliodbs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200501270856.03632.josh@agliodbs.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: 200501/545 X-Sequence-Number: 10235 On Thu, Jan 27, 2005 at 08:56:03AM -0800, Josh Berkus wrote: > It's well understood. See the archives of this list. The problem is that > implementing the solution is very, very hard -- 100+ hours from a top-notch > programmer. I'm still hoping to find a corporate sponsor for the issue ... Hm, I must have missed something -- all I read earlier (and in the archives) indicated that it was _not_ well understood... Care to give URLs giving the answer away? /* Steinar */ -- Homepage: http://www.sesse.net/ From pgsql-performance-owner@postgresql.org Thu Jan 27 17:36:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7F6933A5F4B for ; Thu, 27 Jan 2005 17:36: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 88667-05 for ; Thu, 27 Jan 2005 17:36:35 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 24AF53A5F7D for ; Thu, 27 Jan 2005 17:36:35 +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: Re: Ideal disk setup for Postgresql 7.4? Date: Thu, 27 Jan 2005 12:35:32 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75EE@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Ideal disk setup for Postgresql 7.4? Thread-Index: AcUDfbDB3n6EPsI1RHmOKw5dcFuOBQBFpbrw From: "Merlin Moncure" To: "Steve Poe" Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/546 X-Sequence-Number: 10236 Steve wrote: > Okay. Darn. While I don't write the queries for the application, I do > interact with the company frequently. Their considering moving the > queries into the database with PL/pgSQL. Currently their queries are > done through ProvIV development using ODBC. Will context switching be > minimized here by using PL/pgSQL? Yes, yes, yes! :-) Or maybe, depending on what you are doing. Moving application code into the database has the potential to supercharge your system depending on how it is structured. Our company has done very detailed performance measurements on the subject. We converted our COBOL based ERP to PostgreSQL by writing a libpq wrapper to allow our COBOL runtime to read/write queries to the database. If you don't know much about COBOL, let's just say it has a 'one record at a time' mentality. (read a record...do something...read a record...do something...). It is these cases that really want to be moved into the server. Here are some rough performance numbers, but they are a pretty good reflection why pl/pgsql is so good. The procedure in question here will build a bill of materials for a fairly complex product assembly in an order entry system. Since all users hate waiting for things, this is a performance sensitive operation. The baseline time is the COBOL app's pre-conversion-to-sql time to build the BOM. =20 BOM-ISAM: 8 seconds Using SQL queries instead of ISAM statements, our time suddenly leaps to BOM-SQL: 20 seocnds. A long, long, time ago, we implemented prepared statements into our driver using the parameterized interface. BOM-SQL (prepared): 10 seconds We converted the COBOL code to pl/pgsql. The logic is the same, however easy record aggregations were taken via refcursors were made where possible. BOM-PL/PGSQL: 1 second Even the commercial COBOL vendor's file system driver can't beat that time when the application is running on the server. Also, pl/pgsql routines are not latency sensitive, so they can be run over the internet etc. In addition, having the server execute the business logic actually *reduced* the cpu load on the server by greatly reducing the time the server spent switching back and forth from network/processing. Of course, ours is an extreme case but IMO, the benefits are real. Merlin From pgsql-performance-owner@postgresql.org Thu Jan 27 17:43:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 72B6E3A5F84 for ; Thu, 27 Jan 2005 17: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 89112-08 for ; Thu, 27 Jan 2005 17:43:29 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.201]) by svr1.postgresql.org (Postfix) with ESMTP id E75F83A5F49 for ; Thu, 27 Jan 2005 17:43:28 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so277830wri for ; Thu, 27 Jan 2005 09:43:25 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=YfRdaZZqz52YknNrp85eRvObTScMvCbx1BwY7c6A3s4TUPivb1F9WMVFadZu5NKR8BsBskoRbKk8ttnie/E/ffGyArXBFzE+jcOGFSWPkRrtm3V7sSW5qwNyC3pJC1RSxO8lJTIIYBEt3Vbj8un+M9YN08CtMkbkFSqtnr+D7eU= Received: by 10.54.20.36 with SMTP id 36mr150235wrt; Thu, 27 Jan 2005 09:43:25 -0800 (PST) Received: by 10.54.20.47 with HTTP; Thu, 27 Jan 2005 09:43:25 -0800 (PST) Message-ID: <1dc7f0e30501270943c8ad16@mail.gmail.com> Date: Thu, 27 Jan 2005 12:43:25 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Merlin Moncure Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75ED@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75ED@Herge.rcsinc.local> 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: 200501/547 X-Sequence-Number: 10237 On Thu, 27 Jan 2005 10:44:45 -0500, Merlin Moncure wrote: > Alexandre wrote: > > Here a normal listing of design.product_department_time: > > product_id | department_id | req_time > > ------------+---------------+---------- > > 906 | A | 3000 > > 906 | C | 3000 > > 906 | D | 1935 > > 907 | A | 1500 > > 907 | C | 1500 > > 907 | D | 4575 > > 924 | A | 6000 > > 924 | C | 1575 > > product_id | a | c | d > > ------------+------+------+------ > > 924 | 6000 | 1575 | > > 907 | 1500 | 1500 | 4575 > > 906 | 3000 | 3000 | 1935 > > ok, you have a couple of different options here. The first thing that > jumps out at me is to use arrays to cheat using arrays. > Let's start with the normalized result set. > > select product_id, department_id, sum(req_time) group by product_id, > department_id > > product_id | department_id | sum > 924 a 6000 > 924 c 1575 > 907 a 1500 > [...] Hello Merlin, First of all, thanks for your time. Yes this is exactly what I'm doing right now (if I understand well your point here). All records in design.product_department_time are unique for each (product_id, req_time) combo and 0-null values are not possible. This is the first listing you have. In my query I added the sum() and GROUP BY stuff to avoid having such a listing: product_id | a | c | d ------------+------+------+------ 906 | 3000 | | 906 | | 3000 | 906 | | | 1935 907 | 1500 | | 907 | | 1500 | 907 | | | 4575 924 | 6000 | | 924 | | 1575 | So that for a given product_id I have all the times by departments in a single row (second listing I posted). > If you absolutely must have 1 record/product, you can cheat using > arrays: > > select q.product_id, > array_accum(q.department_id) as depts, > array_accum(q.req_time) as times > from > ( > select product_id, department_id, sum(req_time) as req_time > group by product_id, department_id > ) q > group by q.product_id; > > select product_id, array_accum(department_id) sum(req_time) group by > product_id > > product_id | department_id | sum > 924 {a, c} {1500, 1575} > [...] I did not used arrays because I didn't think about it, but I don't know if this is still the most efficient way. My software will have to work out the data, unless the array expands in good columns. But I'm not an expert at all. I try to do good DB design, but sometimes this is more complicated to work with the data. Here is the table definition if it can help: design.products (product_id serial PRIMARY KEY, ...); prod.departments (department_id varchar(3) PRIMARY KEY, ...); design.product_department_time ( product_id integer REFERENCES design.products ON DELETE CASCADE ON UPDATE CASCADE, department_id varchar(3) REFERENCES prod.departments ON DELETE CASCADE ON UPDATE CASCADE, req_time integer NOT NULL DEFAULT 0 CHECK (req_time >= 0), CONSTRAINT product_department_time_pkey PRIMARY KEY (product_id, department_id) ); And i also have a jobs table which has one product_id attached to one job with the required quantity to produce. So I must shouw the user how much time this will require by departments for each jobs. :) This is a nice report, but I don't want to kill the database each time the user want to see it. Thanks for your contrib so far, this will help me looking for other ways doing it. I'm always ready to hear more! Regards. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Thu Jan 27 17:44:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 08AC03A5F4B for ; Thu, 27 Jan 2005 17:44: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 89743-01 for ; Thu, 27 Jan 2005 17:43:57 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id AA3193A5DA4 for ; Thu, 27 Jan 2005 17:43:56 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so277893wri for ; Thu, 27 Jan 2005 09:43:56 -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=dR+pqYiNknWQqBe9JGCimnH1yQd4tDyqXPNzJ8t6uh7LeeIHb5UghCF7hpcn+jYXSiqYXW5AORaUhluWB2fKtBgfli5FIinWjksTaMqab3HboHPFIb1NLWlgCpXP+F+gWCubtq0qwfhTnrfmXNMxRzs50RnNkOkJSD9mYAet4Hk= Received: by 10.54.20.25 with SMTP id 25mr88252wrt; Thu, 27 Jan 2005 09:43:56 -0800 (PST) Received: by 10.54.20.47 with HTTP; Thu, 27 Jan 2005 09:43:56 -0800 (PST) Message-ID: <1dc7f0e30501270943683ced12@mail.gmail.com> Date: Thu, 27 Jan 2005 12:43:56 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Dawid Kuroczko Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <758d5e7f050127082755f9af12@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/548 X-Sequence-Number: 10238 On Thu, 27 Jan 2005 17:27:40 +0100, Dawid Kuroczko wrote: > On Thu, 27 Jan 2005 10:23:34 -0500, Alexandre Leclerc > wrote: > > Here a normal listing of design.product_department_time: > > product_id | department_id | req_time > > ------------+---------------+---------- > > 906 | A | 3000 > > 906 | C | 3000 > > 906 | D | 1935 > > 907 | A | 1500 > > 907 | C | 1500 > > 907 | D | 4575 > > 924 | A | 6000 > > 924 | C | 1575 > > Well, I did something like this recently; it can be done though > maybe not very efficiently... > > Unfortunately we will need a rowtype with all the departaments: > CREATE DOMAIN departaments AS (a int, b int, c int, d int, ...); Thank you for this help Dawid, I'll have to take some time to look at this suggestion. If I must create a domain with all the departments I'll have a problem because the user is creating and deleting departments as it pleases him. Any counter-ideas? Regards. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Thu Jan 27 18:03:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 255983A5F7E for ; Thu, 27 Jan 2005 18:03: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 93221-10 for ; Thu, 27 Jan 2005 18:03:36 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 2E3803A5F79 for ; Thu, 27 Jan 2005 18:03:34 +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: Re: Flattening a kind of 'dynamic' table Date: Thu, 27 Jan 2005 13:02:48 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75F0@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Flattening a kind of 'dynamic' table Thread-Index: AcUEmCctxehlyTinQSqsfHXLeVNB0wAADlMw From: "Merlin Moncure" To: "Alexandre Leclerc" Cc: "PERFORM" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/549 X-Sequence-Number: 10239 Alexandre wrote: > On Thu, 27 Jan 2005 10:44:45 -0500, Merlin Moncure > wrote: > > Alexandre wrote: > > ok, you have a couple of different options here. The first thing that > > jumps out at me is to use arrays to cheat using arrays. > > Let's start with the normalized result set. > > > > select product_id, department_id, sum(req_time) group by product_id, > > department_id > > > > product_id | department_id | sum > > 924 a 6000 > > 924 c 1575 > > 907 a 1500 > > [...] >=20 > Hello Merlin, >=20 > First of all, thanks for your time. Yes this is exactly what I'm doing > right now (if I understand well your point here). All records in > design.product_department_time are unique for each (product_id, > req_time) combo and 0-null values are not possible. This is the first > listing you have. Right. I expanding departments into columns is basically a dead end. First of all, SQL is not really designed to do this, and second of all (comments continued below) > product_id | a | c | d > ------------+------+------+------ > 906 | 3000 | | > 906 | | 3000 | > 906 | | | 1935 > 907 | 1500 | | > 907 | | 1500 | > 907 | | | 4575 > 924 | 6000 | | > 924 | | 1575 | the above table is more expensive to group than the normalized version above because it is much, much longer. This will get worse and worse as you add more departments. So, whatever you end up doing, I'd advise against expanding rows from a table into columns of a result except for very, very special cases. This is not one of those cases. > I did not used arrays because I didn't think about it, but I don't > know if this is still the most efficient way. My software will have to > work out the data, unless the array expands in good columns. But I'm > not an expert at all. I try to do good DB design, but sometimes this > is more complicated to work with the data. Arrays are a quick'n'dirty way to de-normalize a result set. According to me, de-normalization is o.k. for result sets *only*. Generally, it is inappropriate to de-normalize any persistent object in the database, such as a view (or especially) a table. de-normalizing sets can sometimes simplify client-side coding issues or provide a performance benefit at the query stage (or slow it down, so be careful!) > And i also have a jobs table which has one product_id attached to one > job with the required quantity to produce. So I must shouw the user > how much time this will require by departments for each jobs. :) This > is a nice report, but I don't want to kill the database each time the > user want to see it. You always have the option to do this in code. This basically means ordering the result set and writing a nested loop to pass over the data. If you happen to be using a report engine (and it sounds like you are), some engines can simplify this via a grouping criteria, some can't. If parsing an array string is a pain I happen to have a C++ class handy that can compose/decompose a postgresql array string if: a: no more than 1 dimension and=20 b: array bounds are known Let me know if you need it and I'll send it over. Merlin From pgsql-performance-owner@postgresql.org Thu Jan 27 18:26:38 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 551913A5EFA for ; Thu, 27 Jan 2005 18:26: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 95179-09 for ; Thu, 27 Jan 2005 18:26:32 +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 679B13A5E5C for ; Thu, 27 Jan 2005 18:26:31 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp103.rog.mail.re2.yahoo.com with SMTP; 27 Jan 2005 18:26:30 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 6F96C3F9D; Thu, 27 Jan 2005 13:26:28 -0500 (EST) Date: Thu, 27 Jan 2005 13:26:28 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-ID: <20050127182628.GA6355@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org References: <20050109180452.03723387.frank@wiles.org> <41EFF265.40902@cheapcomplexdevices.com> <12826.1106290803@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12826.1106290803@sss.pgh.pa.us> User-Agent: Mutt/1.5.6+20040907i 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: 200501/550 X-Sequence-Number: 10240 On Fri, Jan 21, 2005 at 02:00:03AM -0500, Tom Lane wrote: > got absolutely zero flak about their use of Postgres in connection > with the .mobi bid, after having endured very substantial bombardment Well, "absolutely zero" is probably overstating it, but Tom is right that PostgreSQL is not the sort of major, gee-it's-strange technology it once was. PostgreSQL is indeed established technology in the ICANN world now, and I don't think anyone has an argument that it can't run a registry without trouble. I certainly believe that PostgreSQL is a fine technology for this. And it scales just fine; we added a million domains to .info over a couple days in September, and the effect on performance was unmeasurable (we'd have added them faster, but the bottleneck was actually the client). A domain add in our case is on the order of 10 database write operations; that isn't a huge load, of course, compared to large real-time manufacturing data collection or other such applications. (Compared to those kinds of applications, the entire set of Internet registry systems, including all the registrars, is not that big.) Incidentally, someone in this thread was concerned about having to maintain a separate password for each .org domain. It's true that that is a registrar, rather than a registry, issue; but it may also be a case where the back end is getting exposed. The .org registry uses a new protocol, EPP, to manage objects. One of the features of EPP is that it gives a kind of password (it's called authInfo) to each domain. The idea is that the registrant knows this authInfo, and also the currently-sponsoring registrar. If the registrant wants to switch to another registrar, s/he can give the authInfo to the new registrar, who can then use the authInfo in validating a transfer request. This is intended to prevent the practice (relatively widespread, alas, under the old protocol) where an unscrupulous party requests transfers for a (substantial number of) domain(s) without any authorization. (This very thing has happened recently to a somewhat famous domain on the Internet. I'll leave it to the gentle reader to do the required googling. The word "panix" might be of assistance.) So the additional passwords actually do have a purpose; but different registrars handle this feature differently. My suggestion is either to talk to your registrar or change registrars (or both) to get the behaviour you like. There are hundreds of registrars for both .info and .org, so finding one which acts the way you want shouldn't be too tricky. Anyway, this is pretty far off topic. But in answer to the original question, Afilias does indeed use PostgreSQL for this, and is happy to talk on the record about it. A -- Andrew Sullivan | ajs@crankycanuck.ca The fact that technology doesn't work is no bar to success in the marketplace. --Philip Greenspun From pgsql-performance-owner@postgresql.org Thu Jan 27 18:27:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1EF5E3A5F76 for ; Thu, 27 Jan 2005 18:27: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 95664-08 for ; Thu, 27 Jan 2005 18:27:34 +0000 (GMT) Received: from smtp105.rog.mail.re2.yahoo.com (smtp105.rog.mail.re2.yahoo.com [206.190.36.83]) by svr1.postgresql.org (Postfix) with SMTP id 842A83A5F20 for ; Thu, 27 Jan 2005 18:27:33 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp105.rog.mail.re2.yahoo.com with SMTP; 27 Jan 2005 18:27:32 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 968473F9D; Thu, 27 Jan 2005 13:27:31 -0500 (EST) Date: Thu, 27 Jan 2005 13:27:31 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Cc: Kevin Brown Subject: Re: PostgreSQL vs. Oracle vs. Microsoft Message-ID: <20050127182731.GB6355@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org, Kevin Brown References: <1105333466.41e20cda39716@webmail.rawbw.com> <20050121232329.GA7164@filer> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050121232329.GA7164@filer> User-Agent: Mutt/1.5.6+20040907i 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: 200501/551 X-Sequence-Number: 10241 On Fri, Jan 21, 2005 at 03:23:30PM -0800, Kevin Brown wrote: > beefier CPU setup would be in order. But in my (limited) experience, > the disk subsystem is likely to be a bottleneck long before the CPU is > in the general case, especially these days as disk subsystems haven't > improved in performance nearly as quickly as CPUs have. Indeed. And you can go through an awful lot of budget buying solid state storage ;-) A -- Andrew Sullivan | ajs@crankycanuck.ca I remember when computers were frustrating because they *did* exactly what you told them to. That actually seems sort of quaint now. --J.D. Baldwin From pgsql-performance-owner@postgresql.org Thu Jan 27 18:33:54 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 166933A5F98 for ; Thu, 27 Jan 2005 18:33: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 96537-03 for ; Thu, 27 Jan 2005 18:33:41 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 653153A5F08 for ; Thu, 27 Jan 2005 18:33:41 +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 1CuESU-0004qX-00; Thu, 27 Jan 2005 13:33:34 -0500 To: PFC Cc: "Oleg Bartunov" , alex@neteconomist.com, "Greg Stark" , "Merlin Moncure" , "Andrei Bintintan" , pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 27 Jan 2005 13:33:33 -0500 Message-ID: <87d5vqwwle.fsf@stark.xeocode.com> Lines: 44 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.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/552 X-Sequence-Number: 10242 PFC writes: > intset(x) seems to be like array[x] ? > Actually what I want is the opposite. What you want is called UNNEST. It didn't get done in time for 8.0. But if what you have is an array of integers the int_array_enum() function I quoted in the other post is basically that. > Note that int_agg_final_array() crashes my postgres, see my message in > psql/general You don't really need the int_array_aggregate function any more. You can write your own aggregate using the new array operators: test=> create or replace function array_push (anyarray, anyelement) returns anyarray as 'select $1 || $2' language sql immutable strict; CREATE FUNCTION test=> create aggregate array_aggregate (basetype=anyelement, sfunc=array_push, stype=anyarray, initcond = '{}'); CREATE AGGREGATE Of course it's about 50x slower than the C implementation though: test=> select icount(array_aggregate (foo_id)) from foo; icount -------- 15127 (1 row) Time: 688.419 ms test=> select icount(int_array_aggregate (foo_id)) from foo; icount -------- 15127 (1 row) Time: 13.680 ms (And no, that's not a caching artifact; the whole table is cached for both trials) -- greg From pgsql-performance-owner@postgresql.org Thu Jan 27 19:09:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CA6283A5F94 for ; Thu, 27 Jan 2005 19:09: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 00100-10 for ; Thu, 27 Jan 2005 19:09:48 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 8F1523A5FC8 for ; Thu, 27 Jan 2005 19:09:47 +0000 (GMT) Received: (qmail 2750 invoked from network); 27 Jan 2005 20:10:05 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 27 Jan 2005 20:10:05 +0100 To: pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> <33c6269f0501261035bc87695@mail.gmail.com> <33c6269f05012620427c1ccc40@mail.gmail.com> <87d5vqwwle.fsf@stark.xeocode.com> Message-ID: Date: Thu, 27 Jan 2005 20:11:55 +0100 From: PFC 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: <87d5vqwwle.fsf@stark.xeocode.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.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/553 X-Sequence-Number: 10243 > What you want is called UNNEST. It didn't get done in time for 8.0. But > if > what you have is an array of integers the int_array_enum() function I > quoted > in the other post is basically that. Yes, I used it, thanks. That's what I wanted. The query plans are good. > You don't really need the int_array_aggregate function any more. You can > write > your own aggregate using the new array operators: > Of course it's about 50x slower than the C implementation though: Heh. I'll keep using int_array_aggregate ;) Have a nice day. From pgsql-performance-owner@postgresql.org Thu Jan 27 19:13:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 484AE3A5F74 for ; Thu, 27 Jan 2005 19:13: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 01261-01 for ; Thu, 27 Jan 2005 19:13:02 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 7F8683A5E86 for ; Thu, 27 Jan 2005 19:13:02 +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: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 27 Jan 2005 14:13:02 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75F3@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] [SQL] OFFSET impact on Performance??? Thread-Index: AcUEnsrGXPwPSJWjTVukzeO4pqEdXwABMpVw From: "Merlin Moncure" To: Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/554 X-Sequence-Number: 10244 Greg Stark wrote: =20 > test=3D> create or replace function array_push (anyarray, anyelement) > returns anyarray as 'select $1 || $2' language sql immutable strict; > CREATE FUNCTION > test=3D> create aggregate array_aggregate (basetype=3Danyelement, > sfunc=3Darray_push, stype=3Danyarray, initcond =3D '{}'); > CREATE AGGREGATE what about=20 CREATE AGGREGATE array_accum ( sfunc =3D array_append, basetype =3D anyelement, stype =3D anyarray, initcond =3D '{}' ); ? Merlin From pgsql-performance-owner@postgresql.org Thu Jan 27 20:05:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 463B43A5F88 for ; Thu, 27 Jan 2005 20:03: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 05191-06 for ; Thu, 27 Jan 2005 20:02:51 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 2951D3A5FF1 for ; Thu, 27 Jan 2005 20:02:51 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so290403wri for ; Thu, 27 Jan 2005 12:02:51 -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=KEXKIKzyR1DTD/BcDRHVyfcq+ebs9pdrx1j6WQfvo21r7eG/01s8H+bNXXx/ZQiKLCET9JVETUTga2HnDw3Rtnu8boPELnSGRgWkMLcHGhkd1oDQ44eKd61FIqdDHhQIRv/yPZy+INIKorfv9eaEFK9kgwFe+TD+eA+c8uVDLHw= Received: by 10.54.59.30 with SMTP id h30mr150304wra; Thu, 27 Jan 2005 12:02:48 -0800 (PST) Received: by 10.54.20.47 with HTTP; Thu, 27 Jan 2005 12:02:48 -0800 (PST) Message-ID: <1dc7f0e305012712024c1c8d30@mail.gmail.com> Date: Thu, 27 Jan 2005 15:02:48 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Merlin Moncure Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75F0@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75F0@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/555 X-Sequence-Number: 10245 On Thu, 27 Jan 2005 13:02:48 -0500, Merlin Moncure wrote: > Alexandre wrote: > > On Thu, 27 Jan 2005 10:44:45 -0500, Merlin Moncure > > wrote: > > > Alexandre wrote: > > > Let's start with the normalized result set. > > > > > > product_id | department_id | sum > > > 924 a 6000 > > > 924 c 1575 > > > 907 a 1500 > > > [...] > > > Right. I expanding departments into columns is basically a dead end. > First of all, SQL is not really designed to do this, and second of all > (comments continued below) Ok, I got it. The basic message is to avoid making columns out of rows like I'm doing right now, that "de-normalizing" in an array is the way to go. So I should query and get the results in an array then after my application will parse the array into the good columns. (I'm developping a software.) If I still got it wrong, this is because the 'geek' section of my brain is in vacation: leave a message and when it'll come back, it'll explain all this to me! :) So I found the array_accum function in the doc, so I did create it. CREATE AGGREGATE array_accum ( sfunc = array_append, basetype = anyelement, stype = anyarray, initcond = '{}' ); Then I created this new select: SELECT product_id, array_accum(department_id) as a_department_id, array_accum(req_time) as a_req_time FROM (SELECT * FROM design.product_department_time) AS tmp GROUP BY product_id; It gives: product_id | a_department_id | a_req_time ------------+-----------------+------------------ 924 | {A,C} | {6000,1575} 907 | {A,C,D} | {1500,1500,4575} 906 | {A,C,D} | {3000,3000,1935} So, the performance should be much better using this agregate approach? No I thing I'll merge the results in my software, unless you think that at this point doing a LEFT JOIN with my jobs table is the way to go, beacuse the performance will be good. (Personally I don't know the answer of this one.) > If parsing an array string is a pain I happen to have a C++ class handy > that can compose/decompose a postgresql array string if: > a: no more than 1 dimension and > b: array bounds are known > > Let me know if you need it and I'll send it over. Thank you for your offer. I think parsing an array is the easiest thing to do for me in all this. :) If I encounter any problem, I'll drop you a mail. Regards. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Thu Jan 27 21:07:13 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 08D2E3A6001 for ; Thu, 27 Jan 2005 21:06: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 14588-01 for ; Thu, 27 Jan 2005 21:06:35 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id 715193A6020 for ; Thu, 27 Jan 2005 21:06:35 +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: Re: Flattening a kind of 'dynamic' table Date: Thu, 27 Jan 2005 16:05:09 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75F4@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Flattening a kind of 'dynamic' table Thread-Index: AcUEqy7WO0Y4NmA3TQKWAQszT5OlvwAB9Hyw From: "Merlin Moncure" To: "Alexandre Leclerc" Cc: "PERFORM" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/556 X-Sequence-Number: 10246 Alexandre wrote: > > > > > Right. I expanding departments into columns is basically a dead end. > > First of all, SQL is not really designed to do this, and second of all > > (comments continued below) >=20 > Ok, I got it. The basic message is to avoid making columns out of rows yes. This is wrong. > like I'm doing right now, that "de-normalizing" in an array is the way > to go.=20 Only sometimes. Looping application code is another tactic. There may be other things to do as well that don't involve arrays or application code. Consider arrays a (very postgresql specific) tool in your expanding toolchest. De-normalization is a loaded term because we are only presenting queried data in an alternate format (normalization normally applying to data structured within the database). There are many people on this list who will tell you not to de-normalize anything, ever (and most of the time, you shouldn't!). =20 Merlin From pgsql-performance-owner@postgresql.org Thu Jan 27 21:37:11 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 520673A6072 for ; Thu, 27 Jan 2005 21:37: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 16756-09 for ; Thu, 27 Jan 2005 21:37:01 +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 187803A6065 for ; Thu, 27 Jan 2005 21:37:02 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp104.rog.mail.re2.yahoo.com with SMTP; 27 Jan 2005 21:37:00 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 6ECB53F9D; Thu, 27 Jan 2005 16:36:59 -0500 (EST) Date: Thu, 27 Jan 2005 16:36:59 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: Swapping on Solaris Message-ID: <20050127213659.GC6355@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org References: <042a01c4fdaf$fbb3b860$0200a8c0@WORKSTATION> <41EE0F05.9080901@coretech.co.nz> <25392.193.190.212.113.1106128630.squirrel@193.190.212.113> <011f01c4fe37$2ea10f20$0200a8c0@WORKSTATION> <41EE7FE2.7030808@rentec.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41EE7FE2.7030808@rentec.com> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/557 X-Sequence-Number: 10247 On Wed, Jan 19, 2005 at 10:42:26AM -0500, Alan Stange wrote: > > I'm fairly sure that the pi and po numbers include file IO in Solaris, > because of the unified VM and file systems. That's correct. 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-performance-owner@postgresql.org Thu Jan 27 22:07:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 888043A60B9 for ; Thu, 27 Jan 2005 22:07: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 21146-02 for ; Thu, 27 Jan 2005 22:07:19 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.197]) by svr1.postgresql.org (Postfix) with ESMTP id 6B0C73A6085 for ; Thu, 27 Jan 2005 22:07:19 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so300451wri for ; Thu, 27 Jan 2005 14:07:19 -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=KJWA2c3XfAVxTm2Y+bBkvgNt9Bam7nP+jNeXmMUIttFgUe9w0UeLulspjuCRkWYLlqgHNraH74GfZUGUKNVppAeuvyS7B6K0TKQUREFvxuRUA87dJv5NdKWVpP4/xnXAJfO+M/bvxd99CpE/XOFWuTTQwiF5cTDEg9gItpT+g8Y= Received: by 10.54.20.25 with SMTP id 25mr46307wrt; Thu, 27 Jan 2005 14:07:19 -0800 (PST) Received: by 10.54.20.47 with HTTP; Thu, 27 Jan 2005 14:07:19 -0800 (PST) Message-ID: <1dc7f0e3050127140746eeb3e7@mail.gmail.com> Date: Thu, 27 Jan 2005 17:07:19 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Merlin Moncure Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75F4@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75F4@Herge.rcsinc.local> 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: 200501/558 X-Sequence-Number: 10248 On Thu, 27 Jan 2005 16:05:09 -0500, Merlin Moncure wrote: > Alexandre wrote: > > like I'm doing right now, that "de-normalizing" in an array is the way > > to go. > > Only sometimes. Looping application code is another tactic. There may > be other things to do as well that don't involve arrays or application > code. Consider arrays a (very postgresql specific) tool in your > expanding toolchest. I take good notes of that. All this opened to me other ways for solutions, so I'm glad of that. I'll take more time to think about all that. > De-normalization is a loaded term because we are only presenting queried > data in an alternate format (normalization normally applying to data > structured within the database). There are many people on this list who > will tell you not to de-normalize anything, ever (and most of the time, > you shouldn't!). Thank you for all you help and time for this. Best regards. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Fri Jan 28 00:15:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F3FF43A6113 for ; Fri, 28 Jan 2005 00:14: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 33768-06 for ; Fri, 28 Jan 2005 00:14:49 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 96ABC3A6109 for ; Fri, 28 Jan 2005 00:14:50 +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 1CuJmh-0006Sh-00; Thu, 27 Jan 2005 19:14:47 -0500 To: "Merlin Moncure" Cc: , Subject: Re: [SQL] OFFSET impact on Performance??? References: <6EE64EF3AB31D5448D0007DD34EEB3412A75F3@Herge.rcsinc.local> In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75F3@Herge.rcsinc.local> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 27 Jan 2005 19:14:46 -0500 Message-ID: <87651iv289.fsf@stark.xeocode.com> Lines: 22 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.057 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/559 X-Sequence-Number: 10249 "Merlin Moncure" writes: > what about > CREATE AGGREGATE array_accum ( > sfunc = array_append, > basetype = anyelement, > stype = anyarray, > initcond = '{}' > ); huh, that is faster. It's only 14x slower than the C implementation. For completeness, here are the fastest times I get after repeating a few times each: 13.97 ms contrib/intagg C implementation 194.76 ms aggregate using array_append 723.15 ms aggregate with SQL state function -- greg From pgsql-performance-owner@postgresql.org Fri Jan 28 04:00:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BF8283A5F69 for ; Fri, 28 Jan 2005 03:59: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 95110-01 for ; Fri, 28 Jan 2005 03:59:48 +0000 (GMT) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by svr1.postgresql.org (Postfix) with ESMTP id 943F63A61B0 for ; Fri, 28 Jan 2005 03:59:47 +0000 (GMT) Received: from sysexperts.com (c-24-6-183-218.client.comcast.net[24.6.183.218]) by comcast.net (sccrmhc13) with ESMTP id <2005012803594301600h925me>; Fri, 28 Jan 2005 03:59:44 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Thu, 27 Jan 2005 19:59:39 -0800 id 000E155C.41F9B8AB.00002A83 Date: Thu, 27 Jan 2005 19:59:39 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? Message-ID: <20050128035938.GA31166@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <6EE64EF3AB31D5448D0007DD34EEB3412A75CB@Herge.rcsinc.local> <87brbiah0f.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: Organization: Frobozzco International User-Agent: Mutt/1.5.6+20040907i 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: 200501/560 X-Sequence-Number: 10250 PFC wrote: > > Supposing your searches display results which are rows coming from one > specific table, you could create a cache table : > > search_id serial primary key > index_n position of this result in the global result set > result_id id of the resulting row. > > Then, making a search with 50k results would INSERT INTO cache ... SELECT > FROM search query, with a way to set the index_n column, which can be a > temporary sequence... > > Then to display your pages, SELECT from your table with index_n BETWEEN so > and so, and join to the data table. This is a nice way of doing a fast materialized view. But it looked to me like one of the requirements of the original poster is that the result set being displayed has to be "current" as of the page display time. If inserts to the original table have been committed between the time the current page was displayed and "now", the next page view is supposed to show them. That basically means rerunning the query that was used to build the cache table. But perhaps the original poster is willing to live with the idea that new rows won't show up in the result set, as long as updates show up (because the cache table is just a fancy index) and deletes "work" (because the join against the data table will show only rows that are common between both). -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Fri Jan 28 05:18:02 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id BB4BD3A6168 for ; Fri, 28 Jan 2005 05:18: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 01461-03 for ; Fri, 28 Jan 2005 05:17:58 +0000 (GMT) Received: from web14424.mail.yahoo.com (web14424.mail.yahoo.com [216.136.174.220]) by svr1.postgresql.org (Postfix) with SMTP id 69A073A4280 for ; Fri, 28 Jan 2005 05:17:57 +0000 (GMT) Received: (qmail 54354 invoked by uid 60001); 28 Jan 2005 05:17:56 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=jvQTg6zErl353siic9EkXYhzXeT4cRteZcGuj9n/rvoGDn7AkyKQ7l73zvAXv2JXGncThyU+zT5pHu4fy7U3eYFxNaqKpPPHn/MBwbnN2q/JwP8oVzvlbeLyirFaR7iRX88IZDveRFrca/Cwf4a5nANh7eqkTBH105/eKLGCENY= ; Message-ID: <20050128051756.54352.qmail@web14424.mail.yahoo.com> Received: from [196.40.10.250] by web14424.mail.yahoo.com via HTTP; Thu, 27 Jan 2005 21:17:56 PST Date: Thu, 27 Jan 2005 21:17:56 -0800 (PST) From: Zavier Sheran Subject: slow count() 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: 200501/561 X-Sequence-Number: 10251 quote from manual: -- Unfortunately, there is no similarly trivial query that can be used to improve the performance of count() when applied to the entire table -- does count(1) also cause a sequential scan of the entire table? It should be able to just use the primary keys. -Zavier ===== --- zavier.net - Internet Solutions --- __________________________________ Do you Yahoo!? Yahoo! Mail - now with 250MB free storage. Learn more. http://info.mail.yahoo.com/mail_250 From pgsql-performance-owner@postgresql.org Fri Jan 28 05:22:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AB9603A61D2 for ; Fri, 28 Jan 2005 05:22: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 01476-07 for ; Fri, 28 Jan 2005 05:22:40 +0000 (GMT) Received: from window.monsterlabs.com (window.monsterlabs.com [216.183.105.176]) by svr1.postgresql.org (Postfix) with SMTP id 51F9F3A61C7 for ; Fri, 28 Jan 2005 05:22:39 +0000 (GMT) Received: (qmail 10507 invoked from network); 28 Jan 2005 05:22:38 -0000 Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) (209.149.56.238) by 0 with SMTP; 28 Jan 2005 05:22:38 -0000 Mime-Version: 1.0 (Apple Message framework v619.2) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; format=flowed To: PgSQL - Performance From: Thomas F.O'Connell Subject: Triggers During COPY Date: Thu, 27 Jan 2005 23:22:33 -0600 X-Mailer: Apple Mail (2.619.2) 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: 200501/562 X-Sequence-Number: 10252 I'm involved in an implementation of doing trigger-based counting as a substitute for count( * ) in real time in an application. My trigger-based counts seem to be working fine and dramatically improve the performance of the display of the counts in the application layer. The problem comes in importing new data into the tables for which the counts are maintained. The current import process does some preprocessing and then does a COPY from the filesystem to one of the tables on which counts are maintained. This means that for each row being inserted by COPY, a trigger is fired. This didn't seem like a big deal to me until testing began on realistic data sets. For a 5,000-record import, preprocessing plus the COPY took about 5 minutes. Once the triggers used for maintaining the counts were added, this grew to 25 minutes. While I knew there would be a slowdown per row affected, I expected something closer to 2x than to 5x. It's not unrealistic for this system to require data imports on the order of 100,000 records. Whereas this would've taken at most an hour and a half before (preprocessing takes a couple of minutes, so the actual original COPY takes closer to 2-3 minutes, or just over 1500 rows per minute), the new version is likely to take more than 7 hours, which seems unreasonable to me. Additionally, the process is fairly CPU intensive. I've examined the plans, and, as far as I can tell, the trigger functions are being prepared and using the indexes on the involved tables, which are hundreds of thousands of rows in the worst cases. The basic structure of the functions is a status lookup SELECT (to determine whether a count needs to be updated and which one) and one or two UPDATE statements (depending on whether both an increment and a decrement need to be performed). As I said, it looks like this basic format is using indexes appropriately. Is there anything I could be overlooking that would tweak some more performance out of this scenario? Would it be absurd to drop the triggers during import and recreate them afterward and update the counts in a summary update based on information from the import process? -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 Fri Jan 28 05:24:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CC2903A61D9 for ; Fri, 28 Jan 2005 05:24: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 01341-09 for ; Fri, 28 Jan 2005 05:24:13 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 1435E3A61C8 for ; Fri, 28 Jan 2005 05:24:12 +0000 (GMT) Received: (qmail 11415 invoked by uid 500); 28 Jan 2005 05:38:34 -0000 Date: Thu, 27 Jan 2005 23:38:34 -0600 From: Bruno Wolff III To: Zavier Sheran Cc: pgsql-performance@postgresql.org Subject: Re: slow count() Message-ID: <20050128053834.GA11394@wolff.to> Mail-Followup-To: Zavier Sheran , pgsql-performance@postgresql.org References: <20050128051756.54352.qmail@web14424.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050128051756.54352.qmail@web14424.mail.yahoo.com> 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: 200501/563 X-Sequence-Number: 10253 On Thu, Jan 27, 2005 at 21:17:56 -0800, Zavier Sheran wrote: > quote from manual: > -- > Unfortunately, there is no similarly trivial query > that can be used to improve the performance of count() > when applied to the entire table > -- > > does count(1) also cause a sequential scan of the > entire table? It should be able to just use the > primary keys. No it can't just use the index file, so that an index scan will be slower than the sequential scan unless there is a where clause restricting the number of rows to a small fraction (about 5%) of the table. Search the archives for if you want to read more about this. From pgsql-performance-owner@postgresql.org Fri Jan 28 05:38:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 372173A61C6 for ; Fri, 28 Jan 2005 05:38: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 02612-07 for ; Fri, 28 Jan 2005 05:37:53 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 5DD463A6192 for ; Fri, 28 Jan 2005 05:37:52 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6960060; Thu, 27 Jan 2005 21:39:34 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Thomas F.O'Connell Subject: Re: Triggers During COPY Date: Thu, 27 Jan 2005 21:41:49 -0800 User-Agent: KMail/1.7.1 Cc: PgSQL - Performance References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501272141.49531.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.053 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/564 X-Sequence-Number: 10254 Thomas, > Would it be absurd to drop the triggers during import and recreate them > afterward and update the counts in a summ> ary update based on > information from the import process? That's what I'd do. Also, might I suggest storing the counts in memcached (see the pgmemached project on pgFoundry) rather than in a table? -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 28 05:51:47 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 39DC53A6120 for ; Fri, 28 Jan 2005 05:51: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 03927-07 for ; Fri, 28 Jan 2005 05:51:35 +0000 (GMT) Received: from mail.coretech.co.nz (coretech.co.nz [202.36.204.41]) by svr1.postgresql.org (Postfix) with ESMTP id 8E5613A61D6 for ; Fri, 28 Jan 2005 05:51:34 +0000 (GMT) Received: (qmail 16735 invoked from network); 28 Jan 2005 05:51:28 -0000 Received: from 218-101-14-73.paradise.net.nz (HELO ?192.168.1.11?) (218.101.14.73) by 0 with SMTP; 28 Jan 2005 05:51:28 -0000 Message-ID: <41F9D3D9.40909@coretech.co.nz> Date: Fri, 28 Jan 2005 18:55:37 +1300 From: Mark Kirkwood User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Thomas F.O'Connell" Cc: PgSQL - Performance Subject: Re: Triggers During COPY References: In-Reply-To: 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: 200501/565 X-Sequence-Number: 10255 Thomas F.O'Connell wrote: > > The problem comes in importing new data into the tables for which the > counts are maintained. The current import process does some > preprocessing and then does a COPY from the filesystem to one of the > tables on which counts are maintained. This means that for each row > being inserted by COPY, a trigger is fired. This didn't seem like a big > deal to me until testing began on realistic data sets. > > For a 5,000-record import, preprocessing plus the COPY took about 5 > minutes. Once the triggers used for maintaining the counts were added, > this grew to 25 minutes. While I knew there would be a slowdown per row > affected, I expected something closer to 2x than to 5x. > rformance out of this scenario? > Have been seeing similar behavior whilst testing sample code for the 8.0 docs (summary table plpgsql trigger example). I think the nub of the problem is dead tuples bloat in the summary / count table, so each additional triggered update becomes more and more expensive as time goes on. I suspect the performance decrease is exponential with the no of rows to be processed. > Would it be absurd to drop the triggers during import and recreate them > afterward and update the counts in a summary update based on information > from the import process? > > That's the conclusion I came to :-) regards Mark From pgsql-performance-owner@postgresql.org Fri Jan 28 06:29:15 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0E6BC3A61F2 for ; Fri, 28 Jan 2005 06:29: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 07933-04 for ; Fri, 28 Jan 2005 06:29:04 +0000 (GMT) Received: from window.monsterlabs.com (window.monsterlabs.com [216.183.105.176]) by svr1.postgresql.org (Postfix) with SMTP id 33BD03A61D5 for ; Fri, 28 Jan 2005 06:29:03 +0000 (GMT) Received: (qmail 933 invoked from network); 28 Jan 2005 06:29:03 -0000 Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) (209.149.56.238) by 0 with SMTP; 28 Jan 2005 06:29:03 -0000 In-Reply-To: <200501272141.49531.josh@agliodbs.com> References: <200501272141.49531.josh@agliodbs.com> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <0f81625232fe6b2256328804be50c7ae@sitening.com> Content-Transfer-Encoding: 7bit Cc: PgSQL - Performance From: Thomas F.O'Connell Subject: Re: Triggers During COPY Date: Fri, 28 Jan 2005 00:28:58 -0600 To: josh@agliodbs.com X-Mailer: Apple Mail (2.619.2) 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: 200501/566 X-Sequence-Number: 10256 I forgot to mention that I'm running 7.4.6. The README includes the caveat that pgmemcache is designed for use with 8.0. My instinct is to be hesitant using something like that in a production environment without some confidence that people have done so with good and reliable success or without more extensive testing than I'm likely to have time for primarily because support for 7.4.x is never likely to increase. Thanks for the tip, though. For the time being, it sounds like I'll probably try to implement the drop/create trigger setup during import. -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 On Jan 27, 2005, at 11:41 PM, Josh Berkus wrote: > Thomas, > >> Would it be absurd to drop the triggers during import and recreate >> them >> afterward and update the counts in a summ> ary update based on >> information from the import process? > > That's what I'd do. > > Also, might I suggest storing the counts in memcached (see the > pgmemached > project on pgFoundry) rather than in a table? > > -- > --Josh > > Josh Berkus > Aglio Database Solutions > San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 28 08:08:12 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 63A613A621A for ; Fri, 28 Jan 2005 08:08: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 20596-06 for ; Fri, 28 Jan 2005 08:08:00 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.204]) by svr1.postgresql.org (Postfix) with ESMTP id 7067F3A620D for ; Fri, 28 Jan 2005 08:08:00 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id z35so383182rne for ; Fri, 28 Jan 2005 00:08:00 -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=UANjU94SOvGQvIcYaEbG4PsKtwOtAj3YLc6J0hHNa2u28crvUXFsLTWAZI1D8NBr/9+prb51odm86GTAKO9S5ZwaYyRz9WOcKmDnvDSdGPHROHvDgxk/0huUeV53RozVz/qD5jnHSxh69Kdl8ctWzMZjTFtC/FS8ebiQbZMRVbM= Received: by 10.38.209.66 with SMTP id h66mr63678rng; Fri, 28 Jan 2005 00:07:59 -0800 (PST) Received: by 10.38.163.47 with HTTP; Fri, 28 Jan 2005 00:07:59 -0800 (PST) Message-ID: <758d5e7f050128000716f28a59@mail.gmail.com> Date: Fri, 28 Jan 2005 09:07:59 +0100 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: Alexandre Leclerc Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <1dc7f0e30501270943683ced12@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.548 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/567 X-Sequence-Number: 10257 On Thu, 27 Jan 2005 12:43:56 -0500, Alexandre Leclerc wrote: > On Thu, 27 Jan 2005 17:27:40 +0100, Dawid Kuroczko wrote: > > On Thu, 27 Jan 2005 10:23:34 -0500, Alexandre Leclerc > > wrote: > > > Here a normal listing of design.product_department_time: > > > product_id | department_id | req_time > > > ------------+---------------+---------- > > > 906 | A | 3000 > > > 906 | C | 3000 > > > 906 | D | 1935 > > > 907 | A | 1500 > > > 907 | C | 1500 > > > 907 | D | 4575 > > > 924 | A | 6000 > > > 924 | C | 1575 > > > > Well, I did something like this recently; it can be done though > > maybe not very efficiently... > > > > Unfortunately we will need a rowtype with all the departaments: > > CREATE DOMAIN departaments AS (a int, b int, c int, d int, ...); > Thank you for this help Dawid, I'll have to take some time to look at > this suggestion. If I must create a domain with all the departments > I'll have a problem because the user is creating and deleting > departments as it pleases him. > > Any counter-ideas? I have exactly the same problem with my proposal [1] I just wish there would be some "native" rows-to-columns aggregate. The other approach I used was something like this: SELECT product_id, a, b, c FROM (SELECT product_id, a FROM pdt) AS a FULL OUTER JOIN USING(product_id) (SELECT product_id, b FROM pdt) AS b FULL OUTER JOIN USING(product_id) (SELECT product_id, c FROM pdt) AS c; ...or similar (I'm typing from memory ;)). Anyway it was good for getting whole table, but performance well, wasn't the gratest. ;)). Regards, Dawid [1]: I was thinking about a trigger on a "departaments" table, and then recreating the aggregate and view as needed, but it isn't the kind of dynamic I had in mind. ;) From pgsql-performance-owner@postgresql.org Sat Jan 29 12:26:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B059A3A5E84 for ; Sat, 29 Jan 2005 12:26: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 78228-03 for ; Sat, 29 Jan 2005 12:26:09 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.173]) by svr1.postgresql.org (Postfix) with ESMTP id 39AC83A6393 for ; Sat, 29 Jan 2005 12:26:11 +0000 (GMT) Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1Curg1-00080B-00; Sat, 29 Jan 2005 13:26:09 +0100 Received: from [217.235.166.92] (helo=p4.local) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1Curg1-0004l0-00; Sat, 29 Jan 2005 13:26:09 +0100 Received: from [172.16.1.6] (ibook.local [172.16.1.6]) by p4.local (Postfix) with ESMTP id CEE6340CC; Sat, 29 Jan 2005 13:26:09 +0100 (CET) Message-ID: <41FA3065.70003@freenet.de> Date: Fri, 28 Jan 2005 13:30:29 +0100 From: =?ISO-8859-1?Q?Sebastian_B=F6ck?= User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard Huxton Cc: pgsql-performance@postgresql.org Subject: Re: Optimizing Outer Joins References: <41F8A41A.5020301@freenet.de> <41F8BFFB.5020605@archonet.com> In-Reply-To: <41F8BFFB.5020605@archonet.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:9060023f140952ea5098d12d38573a7d X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.531 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200501/606 X-Sequence-Number: 10296 Richard Huxton wrote: > Sebastian B=F6ck wrote: >> But why is the scan on table b performed? >> If i understand it correctly this is unnecessary because the >> result contains only rows from table a. >=20 >=20 > It's only unnecessary in the case where there is a 1:1 correspondence=20 > between a.id and b.id - if you had more than one matching row in "b"=20 > then there'd be repeated rows from "a" in the result. Not sure if PG ca= n=20 > tell what the situation is regarding references and pkeys, but in your= =20 > example you don't have one anyway. Ok, is there a way to avoid the extra scan if only one row is returned (distinc on for example)? What would be great is if a subselect could work with more than one column returning. Is there a way to achieve this? Thanks Sebastian From pgsql-performance-owner@postgresql.org Fri Jan 28 14:26:01 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A40A93A62B3 for ; Fri, 28 Jan 2005 14:25: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 55740-02 for ; Fri, 28 Jan 2005 14:25:54 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 174B53A62BE for ; Fri, 28 Jan 2005 14:25:57 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so344921wri for ; Fri, 28 Jan 2005 06:25:57 -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=SUL1xgv1+PuwTYAxT9edqAOqFtvZphctwZEAYx0hNBR2lKXm9nc6+ZqS2OhrQ/xdHilf5RuUMPuVrMy70gKEQPlIQEUjdvJXwVwni4YKxd5LebOJlsf8HHEeVr18RbcKqR1i5raTQUPCmEyKJ3rk1qsehVStnDhDzBJOjORXows= Received: by 10.54.59.30 with SMTP id h30mr282457wra; Fri, 28 Jan 2005 06:25:57 -0800 (PST) Received: by 10.54.20.47 with HTTP; Fri, 28 Jan 2005 06:25:55 -0800 (PST) Message-ID: <1dc7f0e305012806254e8540f4@mail.gmail.com> Date: Fri, 28 Jan 2005 09:25:55 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Dawid Kuroczko Subject: Re: Flattening a kind of 'dynamic' table Cc: PERFORM In-Reply-To: <758d5e7f050128000716f28a59@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> <758d5e7f050128000716f28a59@mail.gmail.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: 200501/568 X-Sequence-Number: 10258 On Fri, 28 Jan 2005 09:07:59 +0100, Dawid Kuroczko wrote: > On Thu, 27 Jan 2005 12:43:56 -0500, Alexandre Leclerc > wrote: > > On Thu, 27 Jan 2005 17:27:40 +0100, Dawid Kuroczko wrote: > > > On Thu, 27 Jan 2005 10:23:34 -0500, Alexandre Leclerc > > > wrote: > > > > Here a normal listing of design.product_department_time: > > > > product_id | department_id | req_time > > > > ------------+---------------+---------- > > > > 906 | A | 3000 > > > > 906 | C | 3000 > > > > 906 | D | 1935 > > > > 907 | A | 1500 > > > > 907 | C | 1500 > > > > 907 | D | 4575 > > > > 924 | A | 6000 > > > > 924 | C | 1575 > > > > > > Well, I did something like this recently; it can be done though > > > maybe not very efficiently... > > > > > > Unfortunately we will need a rowtype with all the departaments: > > > CREATE DOMAIN departaments AS (a int, b int, c int, d int, ...); > > Thank you for this help Dawid, I'll have to take some time to look at > > this suggestion. If I must create a domain with all the departments > > I'll have a problem because the user is creating and deleting > > departments as it pleases him. > > > > Any counter-ideas? > > I have exactly the same problem with my proposal [1] > I just wish there would be some "native" rows-to-columns > aggregate. > > [1]: I was thinking about a trigger on a "departaments" table, > and then recreating the aggregate and view as needed, but > it isn't the kind of dynamic I had in mind. ;) Yep, this is the only thing I also tought: a trigger to add / remove columns when the user add or remove a department... but this is not exactly what I wanted (this is not a very nice db design, from my perspective). Thank you for you help. -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Fri Jan 28 15:16:05 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5653E3A62DF for ; Fri, 28 Jan 2005 15:16: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 60607-09 for ; Fri, 28 Jan 2005 15:15:49 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id C2A193A61D1 for ; Fri, 28 Jan 2005 15:15:51 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 9548556013 for ; Fri, 28 Jan 2005 10:15:48 -0500 (EST) Message-ID: <41FA5726.7040502@deg.cc> Date: Fri, 28 Jan 2005 10:15:50 -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: PERFORM Subject: Poor Performance on Postgres 8.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/569 X-Sequence-Number: 10259 Hi Folks , I am running this query on postgres 8 beta version and it is not using the right index, where as if i run the same query on postgres 7.4 version it uses the right index . Here are the explain analyze output for both the versions. can anyone explain this ? tks. tables: attribute table has 200k records, string table has 190 records \d common.attribute Table "common.attribute" Column | Type | Modifiers ----------------+-----------------------------+------------------------------------------------------- attributeid | integer | not null default nextval('COMMON.ATTRIBUTESEQ'::text) fknamestringid | integer | not null stringvalue | text | integervalue | integer | numericvalue | numeric(14,2) | datevalue | timestamp without time zone | booleanvalue | boolean | bigstringvalue | text | Indexes: "pk_attribute_attributeid" primary key, btree (attributeid) "uk_attribute_fkstringid_stringvalue_integervalue_numericvalue_d" unique, btree (fknamestringid, stringvalue, integervalue, numericvalue, datevalue) "idx_attribute_fknamestringid" btree (fknamestringid) Foreign-key constraints: "fk_attribute_string" FOREIGN KEY (fknamestringid) REFERENCES common.string(stringid) \d common.string Table "common.string" Column | Type | Modifiers ----------+---------+---------------------------------------------------- stringid | integer | not null default nextval('COMMON.STRINGSEQ'::text) value | text | Indexes: "pk_string_stringid" primary key, btree (stringid) Query select attribute0_.attributeid as attribut1_, attribute0_.stringvalue as stringva2_, attribute0_.bigStringvalue as bigStrin3_, attribute0_.integervalue as integerv4_, attribute0_.numericvalue as numericv5_, attribute0_.datevalue as datevalue, attribute0_.booleanvalue as booleanv7_, attribute0_.fknamestringid as fknamest8_ from common.attribute attribute0_, common.string text1_ where (text1_.value='squareFeet' and attribute0_.fknamestringid=text1_.stringid) and (numericValue='775.0') Explain Analyze from 7.4 QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..501.96 rows=1 width=100) (actual time=127.420..135.914 rows=1 loops=1) -> Seq Scan on string text1_ (cost=0.00..12.31 rows=2 width=4) (actual time=68.421..68.466 rows=1 loops=1) Filter: (value = 'squareFeet'::text) -> Index Scan using idx_attribute_fknamestringid on attribute attribute0_ (cost=0.00..244.81 rows=1 width=100) (actual time=58.963..67.406 rows=1 loops=1) Index Cond: (attribute0_.fknamestringid = "outer".stringid) Filter: (numericvalue = 775.0) Total runtime: 136.056 ms Explain Analyze from 8 beta QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..5440.85 rows=1 width=109) (actual time=27.313..440.469 rows=1 loops=1) -> Seq Scan on attribute attribute0_ (cost=0.00..5437.82 rows=1 width=109) (actual time=26.987..440.053 rows=2 loops=1) Filter: (numericvalue = 775.0) -> Index Scan using pk_string_stringid on string text1_ (cost=0.00..3.02 rows=1 width=4) (actual time=0.169..0.172 rows=0 loops=2) Index Cond: ("outer".fknamestringid = text1_.stringid) Filter: (value = 'squareFeet'::text) Total runtime: 440.648 ms From pgsql-performance-owner@postgresql.org Fri Jan 28 15:30:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6C7443A6315 for ; Fri, 28 Jan 2005 15:30: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 62633-03 for ; Fri, 28 Jan 2005 15:29:57 +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 80CCC3A62FF for ; Fri, 28 Jan 2005 15:29:59 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp104.rog.mail.re2.yahoo.com with SMTP; 28 Jan 2005 15:29:59 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 326A73F9C; Fri, 28 Jan 2005 10:29:58 -0500 (EST) Date: Fri, 28 Jan 2005 10:29:58 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128152958.GA9076@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501201602.39568.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200501201602.39568.herve@elma.fr> User-Agent: Mutt/1.5.6+20040907i 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: 200501/570 X-Sequence-Number: 10260 On Thu, Jan 20, 2005 at 04:02:39PM +0100, Herv� Piedvache wrote: > > I don't insist about have data in RAM .... but when you use PostgreSQL with > big database you know that for quick access just for reading the index file > for example it's better to have many RAM as possible ... I just want to be > able to get a quick access with a growing and growind database ... Well, in any case, you need much better hardware than you're looking at. I mean, dual Xeon with 2 Gig isn't hardly big iron. Why don't you try benchmarking on a honking big box -- IBM P690 or a big Sun (I'd counsel against that, though) or something like that? Or even some Opterons. Dual Xeon is probablt your very worst choice at the moment. A -- Andrew Sullivan | ajs@crankycanuck.ca Information security isn't a technological problem. It's an economics problem. --Bruce Schneier From pgsql-performance-owner@postgresql.org Fri Jan 28 15:31:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 097413A60FB for ; Fri, 28 Jan 2005 15: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 62701-07 for ; Fri, 28 Jan 2005 15:31:35 +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 116673A62D3 for ; Fri, 28 Jan 2005 15:31:38 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp104.rog.mail.re2.yahoo.com with SMTP; 28 Jan 2005 15:31:39 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 782693F9C; Fri, 28 Jan 2005 10:31:38 -0500 (EST) Date: Fri, 28 Jan 2005 10:31:38 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128153138.GB9076@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/571 X-Sequence-Number: 10261 On Thu, Jan 20, 2005 at 10:40:02PM -0200, Bruno Almeida do Lago wrote: > > I was thinking the same! I'd like to know how other databases such as Oracle > do it. You mean "how Oracle does it". They're the only ones in the market that really have this technology. 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 Fri Jan 28 15:33:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A4293A6321 for ; Fri, 28 Jan 2005 15:33: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 63045-08 for ; Fri, 28 Jan 2005 15:33:07 +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 EDA753A62F2 for ; Fri, 28 Jan 2005 15:33:06 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp104.rog.mail.re2.yahoo.com with SMTP; 28 Jan 2005 15:33:04 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id DD9A93F9C; Fri, 28 Jan 2005 10:33:03 -0500 (EST) Date: Fri, 28 Jan 2005 10:33:03 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128153303.GC9076@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <200501201536.08656.herve@elma.fr> <4C477AFA-6AF2-11D9-9D52-000D9366F0C4@torgo.978.org> <200501201554.23462.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200501201554.23462.herve@elma.fr> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/572 X-Sequence-Number: 10262 On Thu, Jan 20, 2005 at 03:54:23PM +0100, Herv� Piedvache wrote: > Slony do not use RAM ... but PostgreSQL will need RAM for accessing a database > of 50 Gb ... so having two servers with the same configuration replicated by > slony do not slove the problem of the scalability of the database ... You could use SSD for your storage. That'd make it go rather quickly even if it had to seek on disk. A -- Andrew Sullivan | ajs@crankycanuck.ca The plural of anecdote is not data. --Roger Brinner From pgsql-performance-owner@postgresql.org Fri Jan 28 15:34:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 289513A6334 for ; Fri, 28 Jan 2005 15:34: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 63185-05 for ; Fri, 28 Jan 2005 15:34:23 +0000 (GMT) Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by svr1.postgresql.org (Postfix) with SMTP id 0A4D03A632F for ; Fri, 28 Jan 2005 15:34:26 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp100.rog.mail.re2.yahoo.com with SMTP; 28 Jan 2005 15:34:26 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 8B5A73F9E; Fri, 28 Jan 2005 10:34:25 -0500 (EST) Date: Fri, 28 Jan 2005 10:34:25 -0500 From: Andrew Sullivan To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128153425.GD9076@phlogiston.dyndns.org> Mail-Followup-To: pgsql-performance@postgresql.org References: <200501201503.31241.herve@elma.fr> <41EFC722.2050401@familyhealth.com.au> <41EFC8B5.9040902@commandprompt.com> <200501201607.51659.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <200501201607.51659.herve@elma.fr> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/573 X-Sequence-Number: 10263 On Thu, Jan 20, 2005 at 04:07:51PM +0100, Herv� Piedvache wrote: > Yes seems to be the only solution ... but I'm a little disapointed about > this ... could you explain me why there is not this kind of > functionnality ... it seems to be a real need for big applications no ? I hate to be snarky, but the reason there isn't this kind of system just hanging around is that it's a Very Hard Problem. I spent 2 days last week in a room with some of the smartest people I know, and there was widespread agreement that what you want is a very tough problem. A -- Andrew Sullivan | ajs@crankycanuck.ca In the future this spectacle of the middle classes shocking the avant- garde will probably become the textbook definition of Postmodernism. --Brad Holland From pgsql-performance-owner@postgresql.org Fri Jan 28 15:36:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06A9D3A62B3 for ; Fri, 28 Jan 2005 15:36: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 63133-08 for ; Fri, 28 Jan 2005 15:36:19 +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 0BA633A632F for ; Fri, 28 Jan 2005 15:36:21 +0000 (GMT) Received: from unknown (HELO phlogiston.dydns.org) (a.sullivan@rogers.com@216.75.167.195 with login) by smtp103.rog.mail.re2.yahoo.com with SMTP; 28 Jan 2005 15:36:21 -0000 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 9EE583F9E; Fri, 28 Jan 2005 10:36:20 -0500 (EST) Date: Fri, 28 Jan 2005 10:36:20 -0500 From: Andrew Sullivan To: Postgresql Performance Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128153620.GE9076@phlogiston.dyndns.org> Mail-Followup-To: Postgresql Performance References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> <1106236978.35299.496.camel@home> <1106522910.5790.1.camel@fuji.krosing.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1106522910.5790.1.camel@fuji.krosing.net> User-Agent: Mutt/1.5.6+20040907i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/574 X-Sequence-Number: 10264 On Mon, Jan 24, 2005 at 01:28:29AM +0200, Hannu Krosing wrote: > > IIRC it hates pg_dump mainly on master. If you are able to run pg_dump > from slave, it should be ok. For the sake of the archives, that's not really a good idea. There is some work afoot to solve it, but at the moment dumping from a slave gives you a useless database dump. A -- Andrew Sullivan | ajs@crankycanuck.ca The fact that technology doesn't work is no bar to success in the marketplace. --Philip Greenspun From pgsql-performance-owner@postgresql.org Fri Jan 28 15:40:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AAE1C3A60FB for ; Fri, 28 Jan 2005 15:40: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 63711-06 for ; Fri, 28 Jan 2005 15:39:48 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id 140953A634C for ; Fri, 28 Jan 2005 15:39:51 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so460012wra for ; Fri, 28 Jan 2005 07:39:52 -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=rviPLqth8Hdf86DCpPJ12212TznDxzqsoytxuM1+qvo33Jut1Mw+DSDtw15JEKGNwSHvWVTvEQxwHkwaJ++FaOBBNZxB/klbvVWBsmz438kMCfzcpjW+IlOlb5FJWPUUiszz7LwHQd+4HiLzgv2ip3TnAcPhDXlKnxAZK11nyCY= Received: by 10.54.38.67 with SMTP id l67mr151002wrl; Fri, 28 Jan 2005 07:39:52 -0800 (PST) Received: by 10.54.18.72 with HTTP; Fri, 28 Jan 2005 07:39:52 -0800 (PST) Message-ID: <33c6269f0501280739344f6a18@mail.gmail.com> Date: Fri, 28 Jan 2005 10:39:52 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: PostgreSQL Perfomance Subject: Bitmap indexes 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.038 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/575 X-Sequence-Number: 10265 I was wondering about index types. Oracle has an index type called a 'bitmap' index. They describe this as an index for low cardinality fields, where only the cardinal values are indexed in a b-tree, and then it uses a bitmap below that to describe rows. They say that this type of index is very fast when combined with queries that used the indexed row in 'AND' clauses in a sql statement as the index can 'mask' the results very fast. I have not been able to benchmark the actual effectiveness of this kind of index, but I was wondering if anyone has had experience with this an believes it might be a useful feature for postgres? Yes I have a vested interest in this because alot of my searches are masked against low cardinality fields 'Y' or 'N' type things where this could potentialy benefit me... Alex Turner NetEconomist From pgsql-performance-owner@postgresql.org Fri Jan 28 16:00:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0A2F73A635F for ; Fri, 28 Jan 2005 16: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 65445-01 for ; Fri, 28 Jan 2005 16:00:03 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by svr1.postgresql.org (Postfix) with ESMTP id 954963A62F9 for ; Fri, 28 Jan 2005 15:59:59 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so462998wra for ; Fri, 28 Jan 2005 07:59: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=f4FQyerM0ceUYvVdXbn9eoQQzgmGdMPSpE0SVMnmYwVyu4utNDV0u31nL+CtrazH8TlOz/5wpEtHKSOd3Nzmmelzi4tKlTiun++AI08cDkMwRuByTr8past6j6xbESsuRSHvIEFWATeT41+5YQ8YzkOvWlg7zBe2u8yu1dKgyRA= Received: by 10.54.33.62 with SMTP id g62mr78929wrg; Fri, 28 Jan 2005 07:59:58 -0800 (PST) Received: by 10.54.18.72 with HTTP; Fri, 28 Jan 2005 07:59:58 -0800 (PST) Message-ID: <33c6269f0501280759d309de3@mail.gmail.com> Date: Fri, 28 Jan 2005 10:59:58 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering In-Reply-To: <20050128153138.GB9076@phlogiston.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> <20050128153138.GB9076@phlogiston.dyndns.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/576 X-Sequence-Number: 10266 At this point I will interject a couple of benchmark numbers based on a new system we just configured as food for thought. System A (old system): Compaq Proliant Dual Pentium III 933 with Smart Array 5300, one RAID 1, one 3 Disk RAID 5 on 10k RPM drives, 2GB PC133 RAM. Original Price: $6500 System B (new system): Self Built Dual Opteron 242 with 2x3ware 9500S-8MI SATA, one RAID 1 (OS), one 4 drive RAID 10 (pg_xlog), one 6 drive RAID 10 (data) on 10k RPM Raptors, 4GB PC3200 RAM. Current price $7200 System A for our large insert job: 125 minutes System B for our large insert job: 10 minutes. There is no logical way there should be a 12x performance difference between these two systems, maybe 2x or even 4x, but not 12x Bad controler cards/configuration will seriously ruin your day. 3ware escalade cards are very well supported on linux, and work excellently. Compaq smart array cards are not. Bonnie++ benchmarks show a 9MB/sec write, 29MB/sec read on the RAID 5, but a 172MB/sec write on the 6xRAID 10, and 66MB/sec write on the RAID 1 on the 3ware. With the right configuration you can get very serious throughput. The new system is processing over 2500 insert transactions per second. We don't need more RAM with this config. The disks are fast enough. 2500 transaction/second is pretty damn fast. Alex Turner On Fri, 28 Jan 2005 10:31:38 -0500, Andrew Sullivan wrote: > On Thu, Jan 20, 2005 at 10:40:02PM -0200, Bruno Almeida do Lago wrote: > > > > I was thinking the same! I'd like to know how other databases such as Oracle > > do it. > > You mean "how Oracle does it". They're the only ones in the market > that really have this technology. > > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > From pgsql-performance-owner@postgresql.org Fri Jan 28 16:02:50 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 552F53A6320 for ; Fri, 28 Jan 2005 16:02: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 65445-05 for ; Fri, 28 Jan 2005 16:02:39 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 67BA43A62C9 for ; Fri, 28 Jan 2005 16:02:37 +0000 (GMT) Received: (qmail 13401 invoked from network); 28 Jan 2005 17:02:54 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 28 Jan 2005 17:02:54 +0100 To: alex@neteconomist.com, "PostgreSQL Perfomance" Subject: Re: Bitmap indexes References: <33c6269f0501280739344f6a18@mail.gmail.com> Message-ID: From: PFC 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: Fri, 28 Jan 2005 17:04:48 +0100 In-Reply-To: <33c6269f0501280739344f6a18@mail.gmail.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.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/577 X-Sequence-Number: 10267 contrib/intarray has an index type which could be what you need. > I was wondering about index types. Oracle has an index type called a > 'bitmap' index. They describe this as an index for low cardinality > fields, where only the cardinal values are indexed in a b-tree, and > then it uses a bitmap below that to describe rows. They say that this > type of index is very fast when combined with queries that used the > indexed row in 'AND' clauses in a sql statement as the index can > 'mask' the results very fast. I have not been able to benchmark the > actual effectiveness of this kind of index, but I was wondering if > anyone has had experience with this an believes it might be a useful > feature for postgres? > > Yes I have a vested interest in this because alot of my searches are > masked against low cardinality fields 'Y' or 'N' type things where > this could potentialy benefit me... > > Alex Turner > NetEconomist > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > From pgsql-performance-owner@postgresql.org Fri Jan 28 16:13:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A673B3A6355 for ; Fri, 28 Jan 2005 16:13: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 66445-07 for ; Fri, 28 Jan 2005 16:13:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2A6AD3A635C for ; Fri, 28 Jan 2005 16:13: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 j0SGDkLJ002473; Fri, 28 Jan 2005 11:13:46 -0500 (EST) To: alex@neteconomist.com Cc: PostgreSQL Perfomance Subject: Re: Bitmap indexes In-reply-to: <33c6269f0501280739344f6a18@mail.gmail.com> References: <33c6269f0501280739344f6a18@mail.gmail.com> Comments: In-reply-to Alex Turner message dated "Fri, 28 Jan 2005 10:39:52 -0500" Date: Fri, 28 Jan 2005 11:13:46 -0500 Message-ID: <2472.1106928826@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: 200501/578 X-Sequence-Number: 10268 Alex Turner writes: > I was wondering about index types. Oracle has an index type called a > 'bitmap' index. There's a great deal about this in the list archives (probably more in pgsql-hackers than in -performance). Most of the current interest has to do with building in-memory bitmaps on the fly, as a way of decoupling index and heap scan processing. Which is not quite what you're talking about but should be pretty effective for low-cardinality cases. In particular it'd allow AND and OR combination of multiple indexes, which we do poorly or not at all at the moment. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 28 16:17:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4FFC83A6362 for ; Fri, 28 Jan 2005 16:17: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 67212-01 for ; Fri, 28 Jan 2005 16:17:14 +0000 (GMT) Received: from frank.wiles.org (frank.wiles.org [24.124.39.75]) by svr1.postgresql.org (Postfix) with ESMTP id 15D003A632C for ; Fri, 28 Jan 2005 16:17:12 +0000 (GMT) Received: from kungfu (frank.wiles.org [127.0.0.1]) by frank.wiles.org (8.13.1/8.13.1) with SMTP id j0SGIEMR028317; Fri, 28 Jan 2005 10:18:14 -0600 Date: Fri, 28 Jan 2005 10:17:24 -0600 From: Frank Wiles To: alex@neteconomist.com Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-Id: <20050128101724.6777241d.frank@wiles.org> In-Reply-To: <33c6269f0501280759d309de3@mail.gmail.com> References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> <20050128153138.GB9076@phlogiston.dyndns.org> <33c6269f0501280759d309de3@mail.gmail.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: 200501/579 X-Sequence-Number: 10269 On Fri, 28 Jan 2005 10:59:58 -0500 Alex Turner wrote: > At this point I will interject a couple of benchmark numbers based on > a new system we just configured as food for thought. > > System A (old system): > Compaq Proliant Dual Pentium III 933 with Smart Array 5300, one RAID > 1, one 3 Disk RAID 5 on 10k RPM drives, 2GB PC133 RAM. Original > Price: $6500 > > System B (new system): > Self Built Dual Opteron 242 with 2x3ware 9500S-8MI SATA, one RAID 1 > (OS), one 4 drive RAID 10 (pg_xlog), one 6 drive RAID 10 (data) on 10k > RPM Raptors, 4GB PC3200 RAM. Current price $7200 > > System A for our large insert job: 125 minutes > System B for our large insert job: 10 minutes. > > There is no logical way there should be a 12x performance difference > between these two systems, maybe 2x or even 4x, but not 12x > > Bad controler cards/configuration will seriously ruin your day. 3ware > escalade cards are very well supported on linux, and work excellently. > Compaq smart array cards are not. Bonnie++ benchmarks show a 9MB/sec > write, 29MB/sec read on the RAID 5, but a 172MB/sec write on the > 6xRAID 10, and 66MB/sec write on the RAID 1 on the 3ware. > > With the right configuration you can get very serious throughput. The > new system is processing over 2500 insert transactions per second. We > don't need more RAM with this config. The disks are fast enough. > 2500 transaction/second is pretty damn fast. I agree that badly supported or configured cards can ruin your performance. However, don't you think moving pg_xlog onto a separate RAID and increasing your number of spindles from 3 to 6 on the data RAID would also have a significant impact on performance, no matter what card was used? I'm not sure you can give all the credit to the card on this one. --------------------------------- Frank Wiles http://www.wiles.org --------------------------------- From pgsql-performance-owner@postgresql.org Fri Jan 28 16:20:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E293E3A632C for ; Fri, 28 Jan 2005 16: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 66942-08 for ; Fri, 28 Jan 2005 16:20:14 +0000 (GMT) Received: from Herge.rcsinc.local (mail.rcsonline.com [205.217.85.91]) by svr1.postgresql.org (Postfix) with ESMTP id A2CA83A6320 for ; Fri, 28 Jan 2005 16:20:13 +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: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 28 Jan 2005 11:19:44 -0500 Message-ID: <6EE64EF3AB31D5448D0007DD34EEB3412A75F5@Herge.rcsinc.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] PostgreSQL clustering VS MySQL clustering Thread-Index: AcUFU2FbdpmnEn8tT/KDk0mdys9zDQAAZaqA From: "Merlin Moncure" To: Cc: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/580 X-Sequence-Number: 10270 > With the right configuration you can get very serious throughput. The > new system is processing over 2500 insert transactions per second. We > don't need more RAM with this config. The disks are fast enough. > 2500 transaction/second is pretty damn fast. fsync on/off? Merlin From pgsql-performance-owner@postgresql.org Fri Jan 28 16:23:28 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 306553A635F for ; Fri, 28 Jan 2005 16:23: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 67742-02 for ; Fri, 28 Jan 2005 16:23:19 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B44733A6330 for ; Fri, 28 Jan 2005 16:23:18 +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 j0SGNGPV002582; Fri, 28 Jan 2005 11:23:16 -0500 (EST) To: Pallav Kalva Cc: PERFORM Subject: Re: Poor Performance on Postgres 8.0 In-reply-to: <41FA5726.7040502@deg.cc> References: <41FA5726.7040502@deg.cc> Comments: In-reply-to Pallav Kalva message dated "Fri, 28 Jan 2005 10:15:50 -0500" Date: Fri, 28 Jan 2005 11:23:16 -0500 Message-ID: <2581.1106929396@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: 200501/581 X-Sequence-Number: 10271 Pallav Kalva writes: > I am running this query on postgres 8 beta version and it is not > using the right index, where as if i run the same query on postgres 7.4 > version it uses the right index . 1. Beta which, exactly? 2. Have you ANALYZEd both tables lately? 3. If so, try this to see what it thinks the cost of the reverse plan is: begin; alter table common.string drop constraint pk_string_stringid; explain analyze ... same query ... rollback; regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 28 16:34:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 27A1E3A6355 for ; Fri, 28 Jan 2005 16:34: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 68760-04 for ; Fri, 28 Jan 2005 16:34:29 +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 A8A9E3A6320 for ; Fri, 28 Jan 2005 16:34:28 +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 2532404; Fri, 28 Jan 2005 09:35:44 -0800 Message-ID: <41FA6993.5000702@joeconway.com> Date: Fri, 28 Jan 2005 08:34:27 -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: Alexandre Leclerc Cc: Dawid Kuroczko , PERFORM Subject: Re: Flattening a kind of 'dynamic' table References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> <758d5e7f050128000716f28a59@mail.gmail.com> <1dc7f0e305012806254e8540f4@mail.gmail.com> In-Reply-To: <1dc7f0e305012806254e8540f4@mail.gmail.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.048 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/582 X-Sequence-Number: 10272 Alexandre Leclerc wrote: >>>>>Here a normal listing of design.product_department_time: >>>>> product_id | department_id | req_time >>>>>------------+---------------+---------- >>>>> 906 | A | 3000 >>>>> 906 | C | 3000 >>>>> 906 | D | 1935 >>>>> 907 | A | 1500 >>>>> 907 | C | 1500 >>>>> 907 | D | 4575 >>>>> 924 | A | 6000 >>>>> 924 | C | 1575 Sorry for jumping in on this thread so late -- I haven't been able to keep up with the lists lately. If I understand what you want correctly, you should be able to use crosstab from contrib/tablefunc: create table product_department_time(product_id int, department_id text, req_time int); insert into product_department_time values(906, 'A', 3000); insert into product_department_time values(906, 'C', 3000); insert into product_department_time values(906, 'D', 1935); insert into product_department_time values(907, 'A', 1500); insert into product_department_time values(907, 'C', 1500); insert into product_department_time values(907, 'D', 4575); insert into product_department_time values(924, 'A', 6000); insert into product_department_time values(924, 'C', 1575); select * from crosstab( 'select product_id, department_id, req_time from product_department_time order by 1', 'select ''A'' union all select ''C'' union all select ''D''' ) as (product_id int, a int, c int, d int); product_id | a | c | d ------------+------+------+------ 906 | 3000 | 3000 | 1935 907 | 1500 | 1500 | 4575 924 | 6000 | 1575 | (3 rows) You could make this dynamic for new values of department_id by wrapping it with a PL/pgSQL function. HTH, Joe From pgsql-performance-owner@postgresql.org Sat Jan 29 21:43:03 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 25E8E3A6370 for ; Fri, 28 Jan 2005 16:55: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 70480-03 for ; Fri, 28 Jan 2005 16:55:11 +0000 (GMT) Received: from tektite.k12usa.com (tektite.k12hq.com [65.112.222.24]) by svr1.postgresql.org (Postfix) with SMTP id 436933A626D for ; Fri, 28 Jan 2005 16:55:10 +0000 (GMT) Received: (qmail 3020 invoked by uid 1001); 28 Jan 2005 16:54:57 -0000 Date: Fri, 28 Jan 2005 11:54:57 -0500 From: Christopher Weimann To: alex@neteconomist.com Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128165457.GA2280@tektite.k12usa.internal> References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> <20050128153138.GB9076@phlogiston.dyndns.org> <33c6269f0501280759d309de3@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33c6269f0501280759d309de3@mail.gmail.com> User-Agent: Mutt/1.4.2.1i 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: 200501/610 X-Sequence-Number: 10300 On 01/28/2005-10:59AM, Alex Turner wrote: > At this point I will interject a couple of benchmark numbers based on > a new system we just configured as food for thought. > > System A (old system): > Compaq Proliant Dual Pentium III 933 with Smart Array 5300, one RAID > 1, one 3 Disk RAID 5 on 10k RPM drives, 2GB PC133 RAM. Original > Price: $6500 > > System B (new system): > Self Built Dual Opteron 242 with 2x3ware 9500S-8MI SATA, one RAID 1 > (OS), one 4 drive RAID 10 (pg_xlog), one 6 drive RAID 10 (data) on 10k > RPM Raptors, 4GB PC3200 RAM. Current price $7200 > > System A for our large insert job: 125 minutes > System B for our large insert job: 10 minutes. > > There is no logical way there should be a 12x performance difference > between these two systems, maybe 2x or even 4x, but not 12x > Your system A has the absolute worst case Raid 5, 3 drives. The more drives you add to Raid 5 the better it gets but it will never beat Raid 10. On top of it being the worst case, pg_xlog is not on a separate spindle. Your system B has a MUCH better config. Raid 10 is faster than Raid 5 to begin with but on top of that you have more drives involved plus pg_xlog is on a separate spindle. I'd say I am not surprised by your performance difference. > Bad controler cards/configuration will seriously ruin your day. 3ware > escalade cards are very well supported on linux, and work excellently. > Compaq smart array cards are not. Bonnie++ benchmarks show a 9MB/sec > write, 29MB/sec read on the RAID 5, but a 172MB/sec write on the > 6xRAID 10, and 66MB/sec write on the RAID 1 on the 3ware. > What does bonnie say about the Raid 1 on the Compaq? Comparing the two Raid 1s is really the only valid comparison that can be made between these two machines. Other than that you are comparing apples to snow shovels. From pgsql-performance-owner@postgresql.org Fri Jan 28 16:58:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D15973A62B8 for ; Fri, 28 Jan 2005 16:58: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 70511-10 for ; Fri, 28 Jan 2005 16:58:20 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 38D363A62FD for ; Fri, 28 Jan 2005 16:58:19 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 27103560E7; Fri, 28 Jan 2005 11:58:15 -0500 (EST) Message-ID: <41FA6F29.9060009@deg.cc> Date: Fri, 28 Jan 2005 11:58:17 -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: PERFORM Subject: Re: Poor Performance on Postgres 8.0 References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> In-Reply-To: <2581.1106929396@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=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/583 X-Sequence-Number: 10273 Tom Lane wrote: >Pallav Kalva writes: > > >> I am running this query on postgres 8 beta version and it is not >>using the right index, where as if i run the same query on postgres 7.4 >>version it uses the right index . >> >> > >1. Beta which, exactly? > Beta 4 > >2. Have you ANALYZEd both tables lately? > Yes > >3. If so, try this to see what it thinks the cost of the reverse plan >is: > > begin; > alter table common.string drop constraint pk_string_stringid; > explain analyze ... same query ... > rollback; > what do u mean by rollback exactly ? i can drop the pk constraint and run explain analyze and see how it behaves. > > regards, tom lane > > > From pgsql-performance-owner@postgresql.org Fri Jan 28 17:02:45 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66AD43A5DA5 for ; Fri, 28 Jan 2005 17:02: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 70716-08 for ; Fri, 28 Jan 2005 17:02: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 3FFD73A5C0F for ; Fri, 28 Jan 2005 17:02:33 +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 j0SH2UCj008991; Fri, 28 Jan 2005 12:02:31 -0500 (EST) To: Pallav Kalva Cc: PERFORM Subject: Re: Poor Performance on Postgres 8.0 In-reply-to: <41FA6F29.9060009@deg.cc> References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> Comments: In-reply-to Pallav Kalva message dated "Fri, 28 Jan 2005 11:58:17 -0500" Date: Fri, 28 Jan 2005 12:02:30 -0500 Message-ID: <8990.1106931750@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: 200501/584 X-Sequence-Number: 10274 Pallav Kalva writes: >> begin; >> alter table common.string drop constraint pk_string_stringid; >> explain analyze ... same query ... >> rollback; >> > what do u mean by rollback exactly ? i can drop the pk constraint > and run explain analyze and see how it behaves. The point of the rollback is that you don't really make the pk constraint go away. It is gone from the perspective of the EXPLAIN, but after you rollback it's back again. Easier than rebuilding it... regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 28 17:12:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DD56E3A5C0F for ; Fri, 28 Jan 2005 17:12: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 71798-04 for ; Fri, 28 Jan 2005 17:12:06 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id A30A73A5B46 for ; Fri, 28 Jan 2005 17:12:05 +0000 (GMT) Received: (qmail 21553 invoked from network); 28 Jan 2005 18:12:20 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 28 Jan 2005 18:12:20 +0100 To: "PostgreSQL Perfomance" Subject: Re: Bitmap indexes References: <33c6269f0501280739344f6a18@mail.gmail.com> <2472.1106928826@sss.pgh.pa.us> Message-ID: Date: Fri, 28 Jan 2005 18:14:14 +0100 From: PFC 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: <2472.1106928826@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.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/585 X-Sequence-Number: 10275 > There's a great deal about this in the list archives (probably more in > pgsql-hackers than in -performance). Most of the current interest has > to do with building in-memory bitmaps on the fly, as a way of decoupling > index and heap scan processing. Which is not quite what you're talking > about but should be pretty effective for low-cardinality cases. In > particular it'd allow AND and OR combination of multiple indexes, which > we do poorly or not at all at the moment. Is this called a star join ? It would also allow to access the data pages in a more sequential order if the rows are not required to be retrieved in index order, which would potentially be a large speedup for index scans concerning more than the usual very small percentage of rows in a table : if several rows to be retrieved are on the same page, it would visit this page only once. From pgsql-performance-owner@postgresql.org Fri Jan 28 17:17:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 053E13A5AD6 for ; Fri, 28 Jan 2005 17:17: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 71833-09 for ; Fri, 28 Jan 2005 17:17:29 +0000 (GMT) Received: from window.monsterlabs.com (window.monsterlabs.com [216.183.105.176]) by svr1.postgresql.org (Postfix) with SMTP id 8A5633A5E4C for ; Fri, 28 Jan 2005 17:17:28 +0000 (GMT) Received: (qmail 31872 invoked from network); 28 Jan 2005 17:17:27 -0000 Received: from host-209.149.56.238.nashville.net (HELO ?10.0.1.2?) (209.149.56.238) by 0 with SMTP; 28 Jan 2005 17:17:27 -0000 In-Reply-To: <200501272141.49531.josh@agliodbs.com> References: <200501272141.49531.josh@agliodbs.com> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: PgSQL - Performance From: Thomas F.O'Connell Subject: Re: Triggers During COPY Date: Fri, 28 Jan 2005 11:17:23 -0600 To: josh@agliodbs.com X-Mailer: Apple Mail (2.619.2) 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: 200501/586 X-Sequence-Number: 10276 As far as dropping/recreating triggers, there seem to be two strategies: 1. Perform the drop-import-create operation in a transaction, thereby guaranteeing the accuracy of the counts but presumably locking the table during the operation, which could take many minutes (up to an hour or two) in extreme cases. 2. Drop the triggers, import, create the triggers, and update with the import count, recognizing that other updates could've occurred without accumulating updates during the import process, then later (nightly, maybe?) do a full update to recalibrate the counts. In this case the count( * ) involved could also lock the table for a bit pending the sequential scan(s) if the update is performed in a transaction. Otherwise, again, there is a realistic possibility of inaccurate counts occurring and persisting between calibrations. Is there a best practice anywhere here? -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 On Jan 27, 2005, at 11:41 PM, Josh Berkus wrote: > Thomas, > >> Would it be absurd to drop the triggers during import and recreate >> them >> afterward and update the counts in a summ> ary update based on >> information from the import process? > > That's what I'd do. > > -- > --Josh > > Josh Berkus > Aglio Database Solutions > San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 28 17:49:39 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4ACD53A5E10 for ; Fri, 28 Jan 2005 17:49: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 74585-02 for ; Fri, 28 Jan 2005 17:49:33 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id AF2143A5E4C for ; Fri, 28 Jan 2005 17:49:33 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6962024; Fri, 28 Jan 2005 09:51:15 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Triggers During COPY Date: Fri, 28 Jan 2005 09:48:31 -0800 User-Agent: KMail/1.6.2 Cc: Thomas F.O'Connell References: <200501272141.49531.josh@agliodbs.com> <0f81625232fe6b2256328804be50c7ae@sitening.com> In-Reply-To: <0f81625232fe6b2256328804be50c7ae@sitening.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200501280948.31246.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/587 X-Sequence-Number: 10277 Thomas, > I forgot to mention that I'm running 7.4.6. The README includes the > caveat that pgmemcache is designed for use with 8.0. Well, you could always hire Sean to backport it. > 1. Perform the drop-import-create operation in a transaction, thereby > guaranteeing the accuracy of the counts but presumably locking the > table during the operation, which could take many minutes (up to an > hour or two) in extreme cases. What other operations are ocurring on the table concurrent with the COPY? Copy isn't really intended to be run in parallel with regular insert/update on the same table, AFAIK. > 2. Drop the triggers, import, create the triggers, and update with the > import count, recognizing that other updates could've occurred without > accumulating updates during the import process, then later (nightly, > maybe?) do a full update to recalibrate the counts. In this case the > count( * ) involved could also lock the table for a bit pending the > sequential scan(s) if the update is performed in a transaction. > Otherwise, again, there is a realistic possibility of inaccurate counts > occurring and persisting between calibrations. Alternately: bulk load the new rows into a "holding" table. Do counts on that table. Then, as one transaction, drop the triggers, merge the holding table with the live table and update the counts, and restore the triggers. Alternately: Move the copy out of triggers into middleware where you can deal with it more flexibly. Alternately: Resign yourself to the idea that keeping running statistics is incompatible with doing a fast bulk load, and buy faster/better hardware. -- Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Fri Jan 28 18:16:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9F4BA3A5FB1 for ; Fri, 28 Jan 2005 18:15: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 78306-04 for ; Fri, 28 Jan 2005 18:15:52 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.198]) by svr1.postgresql.org (Postfix) with ESMTP id B110E3A60E5 for ; Fri, 28 Jan 2005 18:15:45 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so363171wri for ; Fri, 28 Jan 2005 10:15:45 -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=CJKgCS2j4wct4q1tL1cSjyyFnahdQX0qznTtM7YPVCCEHHaZHlZSy6Gy/C2TTmSVEsk5GKma9rq4s1hYkceiTcvpguRCBo4yCpjrZ482NjOFvCjoOGw/ERkE2zOdCslOmJUYdx3UvoUNhJL6/91mFqIIBc0mD3KAagWpBYCmzTE= Received: by 10.54.59.30 with SMTP id h30mr361720wra; Fri, 28 Jan 2005 10:15:44 -0800 (PST) Received: by 10.54.20.47 with HTTP; Fri, 28 Jan 2005 10:15:44 -0800 (PST) Message-ID: <1dc7f0e3050128101569232b5b@mail.gmail.com> Date: Fri, 28 Jan 2005 13:15:44 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Joe Conway Subject: Re: Flattening a kind of 'dynamic' table Cc: Dawid Kuroczko , PERFORM In-Reply-To: <41FA6993.5000702@joeconway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> <758d5e7f050128000716f28a59@mail.gmail.com> <1dc7f0e305012806254e8540f4@mail.gmail.com> <41FA6993.5000702@joeconway.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/588 X-Sequence-Number: 10278 On Fri, 28 Jan 2005 08:34:27 -0800, Joe Conway wrote: > Alexandre Leclerc wrote: > >>>>>Here a normal listing of design.product_department_time: > >>>>> product_id | department_id | req_time > >>>>>------------+---------------+---------- > >>>>> 906 | A | 3000 > >>>>> 906 | C | 3000 > >>>>> 906 | D | 1935 > >>>>> 907 | A | 1500 > >>>>> 907 | C | 1500 > >>>>> 907 | D | 4575 > >>>>> 924 | A | 6000 > >>>>> 924 | C | 1575 > > Sorry for jumping in on this thread so late -- I haven't been able to > keep up with the lists lately. > > If I understand what you want correctly, you should be able to use > crosstab from contrib/tablefunc: I'm a little bit confused on how to install this contirb. I know my contrib package is installed, but I don't know how to make it work in postgresql. (Using 7.4.5-1mdk on Mandrake Linux.) -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Fri Jan 28 18:24:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2F6A93A5DE7 for ; Fri, 28 Jan 2005 18:24: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 79513-10 for ; Fri, 28 Jan 2005 18:24:39 +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 287363A5F80 for ; Fri, 28 Jan 2005 18:24:38 +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 2532710; Fri, 28 Jan 2005 11:25:54 -0800 Message-ID: <41FA8365.9080602@joeconway.com> Date: Fri, 28 Jan 2005 10:24:37 -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: Alexandre Leclerc Cc: Dawid Kuroczko , PERFORM Subject: Re: Flattening a kind of 'dynamic' table References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> <758d5e7f050128000716f28a59@mail.gmail.com> <1dc7f0e305012806254e8540f4@mail.gmail.com> <41FA6993.5000702@joeconway.com> <1dc7f0e3050128101569232b5b@mail.gmail.com> In-Reply-To: <1dc7f0e3050128101569232b5b@mail.gmail.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.048 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/589 X-Sequence-Number: 10279 Alexandre Leclerc wrote: > I'm a little bit confused on how to install this contirb. I know my > contrib package is installed, but I don't know how to make it work in > postgresql. (Using 7.4.5-1mdk on Mandrake Linux.) > Find the file tablefunc.sql and redirect it into your database, e.g. psql mydatabase < /path/to/contrib/scripts/tablefunc.sql I have no idea where that would be on Mandrake, but you could probably do: locate tablefunc.sql On Fedora Core 1 I find it here: /usr/share/pgsql/contrib/tablefunc.sql Also find and read README.tablefunc. HTH, Joe From pgsql-performance-owner@postgresql.org Fri Jan 28 18:38:31 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 79AA73A5E4C for ; Fri, 28 Jan 2005 18:38: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 81714-04 for ; Fri, 28 Jan 2005 18:38:18 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id A449E3A5C0F for ; Fri, 28 Jan 2005 18:38:18 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 139505610F; Fri, 28 Jan 2005 13:38:13 -0500 (EST) Message-ID: <41FA8697.1030200@deg.cc> Date: Fri, 28 Jan 2005 13:38:15 -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: PERFORM Subject: Re: Poor Performance on Postgres 8.0 References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> In-Reply-To: <8990.1106931750@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: 200501/590 X-Sequence-Number: 10280 Hi Tom, I dropped the primary key constraint and ran the explain analyze on the same query and here is what i get seq scans on both the tables , still doesnt make use of the index on common.attribute table . QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=0.00..5609.19 rows=1 width=104) (actual time=11.875..319.358 rows=1 loops=1) Join Filter: ("outer".fknamestringid = "inner".stringid) -> Seq Scan on attribute attribute0_ (cost=0.00..5604.76 rows=1 width=104) (actual time=11.541..318.649 rows=2 loops=1) Filter: (numericvalue = 775.0) -> Seq Scan on string text1_ (cost=0.00..4.41 rows=1 width=4) (actual time=0.277..0.319 rows=1 loops=2) Filter: (value = 'squareFeet'::text) Total runtime: 319.496 ms Tom Lane wrote: >Pallav Kalva writes: > > >>>begin; >>>alter table common.string drop constraint pk_string_stringid; >>>explain analyze ... same query ... >>>rollback; >>> >>> >>> >> what do u mean by rollback exactly ? i can drop the pk constraint >>and run explain analyze and see how it behaves. >> >> > >The point of the rollback is that you don't really make the pk >constraint go away. It is gone from the perspective of the EXPLAIN, >but after you rollback it's back again. Easier than rebuilding it... > > regards, tom lane > > > From pgsql-performance-owner@postgresql.org Fri Jan 28 19:27:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7368D3A6038 for ; Fri, 28 Jan 2005 19:27: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 89974-01 for ; Fri, 28 Jan 2005 19:27:02 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.202]) by svr1.postgresql.org (Postfix) with ESMTP id 90B5D3A5FBE for ; Fri, 28 Jan 2005 19:26:57 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 40so368434wri for ; Fri, 28 Jan 2005 11:26:57 -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=X0yzOzYsAzkBkH3VnjUKMMn3h6oGCYGpEPYgwHvJu5LpIf/LnrUVbcap9n7AE6NevsVIMX2qWXPhNlt6XGhMUzV/xBymwwgPLEpClSaQSIgj3vY1yl7NJU7yhjQSgfzP0+mWXduub7RSCu5QHLvax9ZeHUZilFNNDYPUXcSDTC8= Received: by 10.54.59.30 with SMTP id h30mr384191wra; Fri, 28 Jan 2005 11:26:57 -0800 (PST) Received: by 10.54.20.47 with HTTP; Fri, 28 Jan 2005 11:26:57 -0800 (PST) Message-ID: <1dc7f0e305012811261b98beda@mail.gmail.com> Date: Fri, 28 Jan 2005 14:26:57 -0500 From: Alexandre Leclerc Reply-To: Alexandre Leclerc To: Joe Conway Subject: Re: Flattening a kind of 'dynamic' table Cc: Dawid Kuroczko , PERFORM In-Reply-To: <41FA8365.9080602@joeconway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> <758d5e7f050128000716f28a59@mail.gmail.com> <1dc7f0e305012806254e8540f4@mail.gmail.com> <41FA6993.5000702@joeconway.com> <1dc7f0e3050128101569232b5b@mail.gmail.com> <41FA8365.9080602@joeconway.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: 200501/591 X-Sequence-Number: 10281 On Fri, 28 Jan 2005 10:24:37 -0800, Joe Conway wrote: > Alexandre Leclerc wrote: > > I'm a little bit confused on how to install this contirb. I know my > > contrib package is installed, but I don't know how to make it work in > > postgresql. (Using 7.4.5-1mdk on Mandrake Linux.) > > > locate tablefunc.sql Thank you. The RPM was not installing, but I manage to extract it's contact and grap the .sql file in the contrib. So I installed the function manually. Now it's time to evaluate performance of this! Thanks for your help! -- Alexandre Leclerc From pgsql-performance-owner@postgresql.org Fri Jan 28 20:04:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B3153A60F9 for ; Fri, 28 Jan 2005 20:04: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 96232-02 for ; Fri, 28 Jan 2005 20:04:06 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 138133A6053 for ; Fri, 28 Jan 2005 20:04:06 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 3DE6D31DA0; Fri, 28 Jan 2005 21:04:06 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: Bitmap indexes Date: Fri, 28 Jan 2005 14:45:17 -0500 Organization: Afilias Canada - Operations Group Lines: 42 Message-ID: <60r7k5cp82.fsf@dba2.int.libertyrms.com> References: <33c6269f0501280739344f6a18@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:r75Tn06eM8lbi/x4gXQRIkqnR4I= To: pgsql-performance@postgresql.org 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: 200501/595 X-Sequence-Number: 10285 armtuk@gmail.com (Alex Turner) writes: > I was wondering about index types. Oracle has an index type called a > 'bitmap' index. They describe this as an index for low cardinality > fields, where only the cardinal values are indexed in a b-tree, and > then it uses a bitmap below that to describe rows. They say that this > type of index is very fast when combined with queries that used the > indexed row in 'AND' clauses in a sql statement as the index can > 'mask' the results very fast. I have not been able to benchmark the > actual effectiveness of this kind of index, but I was wondering if > anyone has had experience with this an believes it might be a useful > feature for postgres? > > Yes I have a vested interest in this because alot of my searches are > masked against low cardinality fields 'Y' or 'N' type things where > this could potentialy benefit me... There are some ideas on this; nothing likely to be implemented in the very short term. If you do a lot of queries on this sort of basis, there's something in PostgreSQL known as a "partial index" that could be used to improve some queries. What you might do is something like: create index partial_y_for_field_a on some_table (id_column) where field_a = 'Y'; create index partial_n_for_field_a on some_table (id_column) where field_a = 'N'; That could provide speedup for queries that might do joins on id_column where your query has the qualifiers "where field_a = 'Y'" or "where field_a = 'N'". That's not going to provide a generalized answer to "star queries," but it is an immediate answer for some cases. -- "cbbrowne","@","ca.afilias.info" Christopher Browne (416) 673-4124 (land) From pgsql-performance-owner@postgresql.org Fri Jan 28 19:49:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF92A3A5FF7 for ; Fri, 28 Jan 2005 19: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 93533-04 for ; Fri, 28 Jan 2005 19:48: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 0B77D3A5C0F for ; Fri, 28 Jan 2005 19:48: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 j0SJmZnK022897; Fri, 28 Jan 2005 14:48:35 -0500 (EST) To: Pallav Kalva Cc: PERFORM Subject: Re: Poor Performance on Postgres 8.0 In-reply-to: <41FA8697.1030200@deg.cc> References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> Comments: In-reply-to Pallav Kalva message dated "Fri, 28 Jan 2005 13:38:15 -0500" Date: Fri, 28 Jan 2005 14:48:35 -0500 Message-ID: <22896.1106941715@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: 200501/592 X-Sequence-Number: 10282 Pallav Kalva writes: > still doesnt make use of the index on common.attribute table . What do you get from just plain explain analyze select * from common.string text1_ where text1_.value='squareFeet'; I get the impression that it must think this will yield a lot of rows. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 28 20:04:52 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A2FCA3A60D7 for ; Fri, 28 Jan 2005 20:04: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 95859-06 for ; Fri, 28 Jan 2005 20:04:06 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id 2ADD63A6065 for ; Fri, 28 Jan 2005 20:04:07 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id C9DBF31DA1; Fri, 28 Jan 2005 21:04:06 +0100 (MET) From: Christopher Browne X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 28 Jan 2005 14:49:29 -0500 Organization: Afilias Canada - Operations Group Lines: 27 Message-ID: <60k6pxcp12.fsf@dba2.int.libertyrms.com> References: <200501201503.31241.herve@elma.fr> <41EFBF05.6000509@familyhealth.com.au> <200501201536.08656.herve@elma.fr> <1106236978.35299.496.camel@home> <1106522910.5790.1.camel@fuji.krosing.net> <20050128153620.GE9076@phlogiston.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Corporate Culture, linux) Cancel-Lock: sha1:R4bPywuR/szsGOYo/PAEAg0GDBE= To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.043 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/596 X-Sequence-Number: 10286 ajs@crankycanuck.ca (Andrew Sullivan) writes: > On Mon, Jan 24, 2005 at 01:28:29AM +0200, Hannu Krosing wrote: >> >> IIRC it hates pg_dump mainly on master. If you are able to run pg_dump >> from slave, it should be ok. > > For the sake of the archives, that's not really a good idea. There > is some work afoot to solve it, but at the moment dumping from a > slave gives you a useless database dump. That overstates things a tad; I think it's worth elaborating on a bit. There's a problem with the results of dumping the _schema_ from a Slony-I 'subscriber' node; you want to get the schema from the origin node. The problem has to do with triggers; Slony-I suppresses RI triggers and such like on subscriber nodes in a fashion that leaves the dumped schema a bit broken with regard to triggers. But there's nothing wrong with the idea of using "pg_dump --data-only" against a subscriber node to get you the data without putting a load on the origin. And then pulling the schema from the origin, which oughtn't be terribly expensive there. -- "cbbrowne","@","ca.afilias.info" Christopher Browne (416) 673-4124 (land) From pgsql-performance-owner@postgresql.org Fri Jan 28 19:58:04 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E05923A60E3 for ; Fri, 28 Jan 2005 19:57: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 94642-09 for ; Fri, 28 Jan 2005 19:57:33 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id CCFF53A6099 for ; Fri, 28 Jan 2005 19:57:33 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 5284E5610F; Fri, 28 Jan 2005 14:57:28 -0500 (EST) Message-ID: <41FA992B.2090405@deg.cc> Date: Fri, 28 Jan 2005 14:57:31 -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: PERFORM Subject: Re: Poor Performance on Postgres 8.0 References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> <22896.1106941715@sss.pgh.pa.us> In-Reply-To: <22896.1106941715@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: 200501/593 X-Sequence-Number: 10283 explain analyze select * from common.string text1_ where text1_.value='squareFeet'; QUERY PLAN -------------------------------------------------------------------------------------------------------- Seq Scan on string text1_ (cost=0.00..4.41 rows=1 width=21) (actual time=0.283..0.322 rows=1 loops=1) Filter: (value = 'squareFeet'::text) Total runtime: 0.492 ms I am not worried about this table as common.string has only 190 records, where as the other table common.attribute which is very big (200k records) i want it to use index scan on it . The matching column in common.attribute table has only 175 distinct records in common.attribute table , do you think that's the problem ? here is the full query again select attribute0_.attributeid as attribut1_, attribute0_.stringvalue as stringva2_, attribute0_.bigStringvalue as bigStrin3_, attribute0_.integervalue as integerv4_, attribute0_.numericvalue as numericv5_, attribute0_.datevalue as datevalue, attribute0_.booleanvalue as booleanv7_, attribute0_.fknamestringid as fknamest8_ from common.attribute attribute0_, common.string text1_ where (text1_.value='squareFeet' and attribute0_.fknamestringid=text1_.stringid) and (numericValue='775.0') Tom Lane wrote: >Pallav Kalva writes: > > >>still doesnt make use of the index on common.attribute table . >> >> > >What do you get from just plain > >explain analyze select * from common.string text1_ >where text1_.value='squareFeet'; > >I get the impression that it must think this will yield a lot of rows. > > regards, tom lane > > > From pgsql-performance-owner@postgresql.org Fri Jan 28 19:59:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 44B4E3A6101 for ; Fri, 28 Jan 2005 19:59: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 95400-03 for ; Fri, 28 Jan 2005 19:59:06 +0000 (GMT) Received: from rproxy.gmail.com (rproxy.gmail.com [64.233.170.200]) by svr1.postgresql.org (Postfix) with ESMTP id 987463A609F for ; Fri, 28 Jan 2005 19:59:06 +0000 (GMT) Received: by rproxy.gmail.com with SMTP id z35so500383rne for ; Fri, 28 Jan 2005 11:59:05 -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=MCVUIH4kqWBq0XdZ6Ko1PuOb0c7Xe/6xCHGypsplyOLJFW7txu4CLZO3LC9SOuEgivg2mTwZhnX3Lm9hrxlPYUxGfjT3c3Hk+PJvQ4Ascde2CUXypDLRg2tgXpcO+T7/mw0Uj5bMxeWVvt/h9TZa3Eryis+0D42XgXzwaw78nn4= Received: by 10.38.96.43 with SMTP id t43mr76938rnb; Fri, 28 Jan 2005 11:59:05 -0800 (PST) Received: by 10.38.163.47 with HTTP; Fri, 28 Jan 2005 11:59:05 -0800 (PST) Message-ID: <758d5e7f050128115932474f7f@mail.gmail.com> Date: Fri, 28 Jan 2005 20:59:05 +0100 From: Dawid Kuroczko Reply-To: Dawid Kuroczko To: Joe Conway Subject: Re: Flattening a kind of 'dynamic' table Cc: Alexandre Leclerc , PERFORM In-Reply-To: <41FA8365.9080602@joeconway.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <1dc7f0e305012707234159cfc8@mail.gmail.com> <758d5e7f050127082755f9af12@mail.gmail.com> <1dc7f0e30501270943683ced12@mail.gmail.com> <758d5e7f050128000716f28a59@mail.gmail.com> <1dc7f0e305012806254e8540f4@mail.gmail.com> <41FA6993.5000702@joeconway.com> <1dc7f0e3050128101569232b5b@mail.gmail.com> <41FA8365.9080602@joeconway.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.548 tagged_above=0 required=5 tests=AWL, FROM_ENDS_IN_NUMS, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/594 X-Sequence-Number: 10284 On Fri, 28 Jan 2005 10:24:37 -0800, Joe Conway wrote: > Alexandre Leclerc wrote: > > I'm a little bit confused on how to install this contirb. I know my > > contrib package is installed, but I don't know how to make it work in > > postgresql. (Using 7.4.5-1mdk on Mandrake Linux.) > > > > Find the file tablefunc.sql and redirect it into your database, e.g. > > psql mydatabase < /path/to/contrib/scripts/tablefunc.sql > > I have no idea where that would be on Mandrake, but you could probably do: > > locate tablefunc.sql > > On Fedora Core 1 I find it here: > /usr/share/pgsql/contrib/tablefunc.sql > > Also find and read README.tablefunc. > > HTH, WHOA! Yess! Exactly the thing! Amazing! :))) Regards, Dawid From pgsql-performance-owner@postgresql.org Fri Jan 28 20:46:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38F093A5FC3 for ; Fri, 28 Jan 2005 20:46: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 01470-09 for ; Fri, 28 Jan 2005 20:46:16 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by svr1.postgresql.org (Postfix) with ESMTP id 6DEA83A5DE7 for ; Fri, 28 Jan 2005 20:46:15 +0000 (GMT) Received: from sysexperts.com (c-24-6-183-218.client.comcast.net[24.6.183.218]) by comcast.net (sccrmhc11) with ESMTP id <2005012820461201100ch5i7e>; Fri, 28 Jan 2005 20:46:12 +0000 Received: from localhost (localhost [127.0.0.1]) (uid 1000) by filer with local; Fri, 28 Jan 2005 12:46:10 -0800 id 0004103A.41FAA492.00000CB3 Date: Fri, 28 Jan 2005 12:46:10 -0800 From: Kevin Brown To: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050128204610.GB31166@filer> Mail-Followup-To: Kevin Brown , pgsql-performance@postgresql.org References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <20050122.121300.41631131.t-ishii@sra.co.jp> <25335.1106428223@sss.pgh.pa.us> <1106511352.31592.112.camel@localhost.localdomain> <6346.1106512803@sss.pgh.pa.us> <20050125031104.GW67721@decibel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline In-Reply-To: Organization: Frobozzco International User-Agent: Mutt/1.5.6+20040907i 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: 200501/597 X-Sequence-Number: 10287 PFC wrote: > So, here is something annoying with the current approach : Updating rows > in a table bloats ALL indices, not just those whose indexed values have > been actually updated. So if you have a table with many indexed fields and > you often update some obscure timestamp field, all the indices will bloat, > which will of course be corrected by VACUUM, but vacuum will have extra > work to do. The MVCC approach probably doesn't leave you with many choices here. The index entries point directly to the rows in the table, and since an update creates a new row (it's the equivalent of doing an insert then a delete), all indexes have to be updated to reflect the location of the new row. Unless my understanding of how this works is completely off... -- Kevin Brown kevin@sysexperts.com From pgsql-performance-owner@postgresql.org Fri Jan 28 20:50:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 13E583A6153 for ; Fri, 28 Jan 2005 20:50: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 02208-06 for ; Fri, 28 Jan 2005 20:50:44 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id AF8603A60D7 for ; Fri, 28 Jan 2005 20:50:44 +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 j0SKog2d025931; Fri, 28 Jan 2005 15:50:43 -0500 (EST) To: Pallav Kalva Cc: PERFORM Subject: Re: Poor Performance on Postgres 8.0 In-reply-to: <41FA992B.2090405@deg.cc> References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> <22896.1106941715@sss.pgh.pa.us> <41FA992B.2090405@deg.cc> Comments: In-reply-to Pallav Kalva message dated "Fri, 28 Jan 2005 14:57:31 -0500" Date: Fri, 28 Jan 2005 15:50:42 -0500 Message-ID: <25930.1106945442@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: 200501/598 X-Sequence-Number: 10288 I was able to duplicate this behavior with dummy data that had only a few distinct values for fknamestringid --- the planner then thinks that the index probe into attribute will match a lot of rows and hence take a long time. Could we see your pg_stats row for fknamestringid, ie select * from pg_stats where tablename = 'attribute' and attname = 'fknamestringid'; It would be interesting to see the same for your 7.4 installation too. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 28 20:58:46 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3BE3D3A60EB for ; Fri, 28 Jan 2005 20: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 03411-03 for ; Fri, 28 Jan 2005 20:58:21 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id 8F3A93A5C0F for ; Fri, 28 Jan 2005 20:58:21 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 8F0225612A; Fri, 28 Jan 2005 15:58:15 -0500 (EST) Message-ID: <41FAA76B.7070704@deg.cc> Date: Fri, 28 Jan 2005 15:58: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: PERFORM Subject: Re: Poor Performance on Postgres 8.0 References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> <22896.1106941715@sss.pgh.pa.us> <41FA992B.2090405@deg.cc> <25930.1106945442@sss.pgh.pa.us> In-Reply-To: <25930.1106945442@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: 200501/599 X-Sequence-Number: 10289 On 7.4 I get select * from pg_stats where tablename = 'attribute' and attname = 'fknamestringid'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-----------+----------------+-----------+-----------+------------+-----------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------------------------+------------- common | attribute | fknamestringid | 0 | 4 | 124 | {2524,2434,2523,2599,2595,2592,2596,2528,2586,2446} | {0.132333,0.13,0.0766667,0.0373333,0.0366667,0.0333333,0.031,0.029,0.0263333,0.019} | {2433,2441,2455,2462,2473,2479,2484,2492,2505,2574,2598} | -0.22864 (1 row) On 8 select * from pg_stats where tablename = 'attribute' and attname = 'fknamestringid'; schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation ------------+-----------+----------------+-----------+-----------+------------+-----------------------------------------------------+-----------------------------------------------------------------------------------+----------------------------------------------------------+------------- common | attribute | fknamestringid | 0 | 4 | 80 | {2524,2434,2530,2522,2525,2523,2527,2526,2574,2531} | {0.219333,0.199333,0.076,0.0643333,0.0616667,0.05,0.0453333,0.042,0.04,0.0286667} | {2437,2528,2529,2538,2539,2540,2554,2562,2575,2584,2637} | 0.0274016 Tom Lane wrote: >I was able to duplicate this behavior with dummy data that had only a >few distinct values for fknamestringid --- the planner then thinks that >the index probe into attribute will match a lot of rows and hence take a >long time. Could we see your pg_stats row for fknamestringid, ie > >select * from pg_stats >where tablename = 'attribute' and attname = 'fknamestringid'; > >It would be interesting to see the same for your 7.4 installation too. > > regards, tom lane > > > From pgsql-performance-owner@postgresql.org Fri Jan 28 21:34:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A33913A62A9 for ; Fri, 28 Jan 2005 21:34: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 07166-03 for ; Fri, 28 Jan 2005 21:34:29 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 189E53A62D5 for ; Fri, 28 Jan 2005 21:34: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 j0SLYPIQ026389; Fri, 28 Jan 2005 16:34:25 -0500 (EST) To: Pallav Kalva Cc: PERFORM Subject: Re: Poor Performance on Postgres 8.0 In-reply-to: <41FAA76B.7070704@deg.cc> References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> <22896.1106941715@sss.pgh.pa.us> <41FA992B.2090405@deg.cc> <25930.1106945442@sss.pgh.pa.us> <41FAA76B.7070704@deg.cc> Comments: In-reply-to Pallav Kalva message dated "Fri, 28 Jan 2005 15:58:19 -0500" Date: Fri, 28 Jan 2005 16:34:24 -0500 Message-ID: <26388.1106948064@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: 200501/600 X-Sequence-Number: 10290 Pallav Kalva writes: > On 8 > common | attribute | fknamestringid | 0 | 4 > | 80 | {2524,2434,2530,2522,2525,2523,2527,2526,2574,2531} | > {0.219333,0.199333,0.076,0.0643333,0.0616667,0.05,0.0453333,0.042,0.04,0.0286667} > | {2437,2528,2529,2538,2539,2540,2554,2562,2575,2584,2637} | 0.0274016 Given those stats, the planner is going to estimate that about 1/80th of the attribute table matches any particular fknamestringid, and that's what's driving it away from using the indexscan. I cannot tell whether there are indeed a couple of thousand rows joining to the 'squareFeet' string row (in which case the condition numericValue='775.0' must be really selective) or whether this is an outlier case that joins to just a few attribute rows. The slightly different stats values for 7.4 would have given it a slightly lower value for the cost of an indexscan by idx_attribute_fknamestringid, but certainly not as low as your original message shows. Perhaps you have some difference in parameter settings in your 7.4 installation --- most likely a lower random_page_cost. regards, tom lane From pgsql-performance-owner@postgresql.org Fri Jan 28 21:57:24 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3513B3A614E for ; Fri, 28 Jan 2005 21:57: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 09120-09 for ; Fri, 28 Jan 2005 21:57:08 +0000 (GMT) Received: from mail.deg.cc (mail.deg.cc [64.139.134.201]) by svr1.postgresql.org (Postfix) with ESMTP id E656D3A60B9 for ; Fri, 28 Jan 2005 21:57:09 +0000 (GMT) Received: from deg.cc (kyle.deg.cc [198.70.16.205]) by mail.deg.cc (Postfix) with ESMTP id 5386856121; Fri, 28 Jan 2005 16:57:03 -0500 (EST) Message-ID: <41FAB54C.7050506@deg.cc> Date: Fri, 28 Jan 2005 16:57:32 -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: PERFORM Subject: Re: Poor Performance on Postgres 8.0 References: <41FA5726.7040502@deg.cc> <2581.1106929396@sss.pgh.pa.us> <41FA6F29.9060009@deg.cc> <8990.1106931750@sss.pgh.pa.us> <41FA8697.1030200@deg.cc> <22896.1106941715@sss.pgh.pa.us> <41FA992B.2090405@deg.cc> <25930.1106945442@sss.pgh.pa.us> <41FAA76B.7070704@deg.cc> <26388.1106948064@sss.pgh.pa.us> In-Reply-To: <26388.1106948064@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=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/601 X-Sequence-Number: 10291 The random_page_cost value is same on both the versions, the only thing difference between 7.4 version and 8 version is that 7.4 ver has 100k less records. For, now i created index on numericvalue column on attribute table and it used that index and it is much faster that way. it came down to 24msec. Also, i tried to see the matching id for squarefeet in attribute table there are 800 some records in attribute table for 8 version and 700 something in 7.4 version. Tom Lane wrote: >Pallav Kalva writes: > > >>On 8 >> common | attribute | fknamestringid | 0 | 4 >>| 80 | {2524,2434,2530,2522,2525,2523,2527,2526,2574,2531} | >>{0.219333,0.199333,0.076,0.0643333,0.0616667,0.05,0.0453333,0.042,0.04,0.0286667} >>| {2437,2528,2529,2538,2539,2540,2554,2562,2575,2584,2637} | 0.0274016 >> >> > >Given those stats, the planner is going to estimate that about 1/80th of >the attribute table matches any particular fknamestringid, and that's >what's driving it away from using the indexscan. I cannot tell whether >there are indeed a couple of thousand rows joining to the 'squareFeet' >string row (in which case the condition numericValue='775.0' must be >really selective) or whether this is an outlier case that joins to just >a few attribute rows. > >The slightly different stats values for 7.4 would have given it a >slightly lower value for the cost of an indexscan by >idx_attribute_fknamestringid, but certainly not as low as your original >message shows. Perhaps you have some difference in parameter settings >in your 7.4 installation --- most likely a lower random_page_cost. > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > > From pgsql-performance-owner@postgresql.org Fri Jan 28 22:04:42 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CCA5D3A614A for ; Fri, 28 Jan 2005 22:04: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 09861-10 for ; Fri, 28 Jan 2005 22:04:29 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id CEDE43A609F for ; Fri, 28 Jan 2005 22:04:30 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 9FB5631DA0; Fri, 28 Jan 2005 23:04:30 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Fri, 28 Jan 2005 14:04:24 -0800 Organization: Hub.Org Networking Services Lines: 36 Message-ID: References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501201602.39568.herve@elma.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <200501201602.39568.herve@elma.fr> 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: 200501/602 X-Sequence-Number: 10292 Herv� Piedvache wrote: >>My point being is that there is no free solution. There simply isn't. >>I don't know why you insist on keeping all your data in RAM, but the >>mysql cluster requires that ALL data MUST fit in RAM all the time. > > > I don't insist about have data in RAM .... but when you use PostgreSQL with > big database you know that for quick access just for reading the index file > for example it's better to have many RAM as possible ... I just want to be > able to get a quick access with a growing and growind database ... If it's an issue of RAM and not CPU power, think about this scenario. Let's just say you *COULD* partition your DB over multiple servers. What are your plans then? Are you going to buy 4 Dual Xeon servers? Ok, let's price that out. For a full-blown rackmount server w/ RAID, 6+ SCSI drives and so on, you are looking at roughly $4000 per machine. So now you have 4 machines -- total of 16GB of RAM over the 4 machines. On the otherhand, let's say you spent that money on a Quad Opteron instead. 4x850 will cost you roughly $8000. 16GB of RAM using 1GB DIMMs is $3000. If you went with 2GB DIMMs, you could stuff 32GB of RAM onto that machine for $7500. Let's review the math: 4X server cluster, total 16GB RAM = $16K 1 beefy server w/ 16GB RAM = $11K 1 beefy server w/ 32GB RAM = $16K I know what I would choose. I'd get the mega server w/ a ton of RAM and skip all the trickyness of partitioning a DB over multiple servers. Yes your data will grow to a point where even the XXGB can't cache everything. On the otherhand, memory prices drop just as fast. By that time, you can ebay your original 16/32GB and get 64/128GB. From pgsql-performance-owner@postgresql.org Fri Jan 28 22:58:32 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B59813A6330 for ; Fri, 28 Jan 2005 22:58: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 15208-05 for ; Fri, 28 Jan 2005 22:58:10 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.195]) by svr1.postgresql.org (Postfix) with ESMTP id 9A6F23A6351 for ; Fri, 28 Jan 2005 22:58:11 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so517829wra for ; Fri, 28 Jan 2005 14:58:12 -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=mtQ46WjltjuG0PzSA+8gLg1zvQqPQaCj/vT85Ns1kVmeJPvNQ943CjgsKIP/+lgBUDd45opeWbqg/UCzCI1vMJAbD6qigT1knSOW+lDAaD4VtQEJgWQ5oEf1165CZoKc+sJl3IOhJZTbkcdYLOdphSAxWzmgA0ERr2syGAJxITE= Received: by 10.54.50.63 with SMTP id x63mr217550wrx; Fri, 28 Jan 2005 14:58:06 -0800 (PST) Received: by 10.54.18.72 with HTTP; Fri, 28 Jan 2005 14:57:11 -0800 (PST) Message-ID: <33c6269f050128145715e0e95e@mail.gmail.com> Date: Fri, 28 Jan 2005 17:57:11 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Christopher Weimann Subject: Re: PostgreSQL clustering VS MySQL clustering Cc: pgsql-performance@postgresql.org In-Reply-To: <20050128165457.GA2280@tektite.k12usa.internal> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> <20050128153138.GB9076@phlogiston.dyndns.org> <33c6269f0501280759d309de3@mail.gmail.com> <20050128165457.GA2280@tektite.k12usa.internal> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/603 X-Sequence-Number: 10293 On Fri, 28 Jan 2005 11:54:57 -0500, Christopher Weimann wrote: > On 01/28/2005-10:59AM, Alex Turner wrote: > > At this point I will interject a couple of benchmark numbers based on > > a new system we just configured as food for thought. > > > > System A (old system): > > Compaq Proliant Dual Pentium III 933 with Smart Array 5300, one RAID > > 1, one 3 Disk RAID 5 on 10k RPM drives, 2GB PC133 RAM. Original > > Price: $6500 > > > > System B (new system): > > Self Built Dual Opteron 242 with 2x3ware 9500S-8MI SATA, one RAID 1 > > (OS), one 4 drive RAID 10 (pg_xlog), one 6 drive RAID 10 (data) on 10k > > RPM Raptors, 4GB PC3200 RAM. Current price $7200 > > > > System A for our large insert job: 125 minutes > > System B for our large insert job: 10 minutes. > > > > There is no logical way there should be a 12x performance difference > > between these two systems, maybe 2x or even 4x, but not 12x > > > > Your system A has the absolute worst case Raid 5, 3 drives. The more > drives you add to Raid 5 the better it gets but it will never beat Raid > 10. On top of it being the worst case, pg_xlog is not on a separate > spindle. > True for writes, but not for reads. > Your system B has a MUCH better config. Raid 10 is faster than Raid 5 to > begin with but on top of that you have more drives involved plus pg_xlog > is on a separate spindle. I absolutely agree, it is a much better config, thats why we bought it ;).. In system A, the xlog was actualy on the RAID 1, so it was infact on a seperate spindle set. > > I'd say I am not surprised by your performance difference. > I'm not surprised at all that the new system outperformed the old, it's more the factor of improvement. 12x is a _VERY_ big performance jump. > > Bad controler cards/configuration will seriously ruin your day. 3ware > > escalade cards are very well supported on linux, and work excellently. > > Compaq smart array cards are not. Bonnie++ benchmarks show a 9MB/sec > > write, 29MB/sec read on the RAID 5, but a 172MB/sec write on the > > 6xRAID 10, and 66MB/sec write on the RAID 1 on the 3ware. > > > > What does bonnie say about the Raid 1 on the Compaq? Comparing the two > Raid 1s is really the only valid comparison that can be made between > these two machines. Other than that you are comparing apples to > snow shovels. > > My main point is that you can spend $7k on a server and believe you have a fast system. The person who bought the original system was under the delusion that it would make a good DB server. For the same $7k a different configuration can yield a vastly different performance output. This means that it's not quite apples to snow shovels. People who _believe_ they have an adequate config are often sorely mistaken, and ask misguided questions about needed 20GB of RAM because the system can't page to disk fast enough, when what they really need is a good RAID 10 with a high quality controler. A six drive RAID 10 is going to run a bit less than 20G of SSD. Alex Turner NetEconomist From pgsql-performance-owner@postgresql.org Sat Jan 29 21:43:06 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 118313A5971 for ; Sat, 29 Jan 2005 00:48: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 23791-06 for ; Sat, 29 Jan 2005 00:48:45 +0000 (GMT) Received: from tektite.k12usa.com (tektite.k12hq.com [65.112.222.24]) by svr1.postgresql.org (Postfix) with SMTP id D42023A58F0 for ; Sat, 29 Jan 2005 00:48:46 +0000 (GMT) Received: (qmail 24523 invoked by uid 1001); 29 Jan 2005 00:48:37 -0000 Date: Fri, 28 Jan 2005 19:48:37 -0500 From: Christopher Weimann To: alex@neteconomist.com Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering Message-ID: <20050129004837.GB2280@tektite.k12usa.internal> References: <330532b6050120104246597d2a@mail.gmail.com> <000001c4ff51$c0e985e0$e883f40a@br.gedasgrp> <20050128153138.GB9076@phlogiston.dyndns.org> <33c6269f0501280759d309de3@mail.gmail.com> <20050128165457.GA2280@tektite.k12usa.internal> <33c6269f050128145715e0e95e@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33c6269f050128145715e0e95e@mail.gmail.com> User-Agent: Mutt/1.4.2.1i 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: 200501/611 X-Sequence-Number: 10301 On 01/28/2005-05:57PM, Alex Turner wrote: > > > > Your system A has the absolute worst case Raid 5, 3 drives. The more > > drives you add to Raid 5 the better it gets but it will never beat Raid > > 10. On top of it being the worst case, pg_xlog is not on a separate > > spindle. > > > > True for writes, but not for reads. > Good point. > > My main point is that you can spend $7k on a server and believe you > have a fast system. The person who bought the original system was > under the delusion that it would make a good DB server. For the same > $7k a different configuration can yield a vastly different performance > output. This means that it's not quite apples to snow shovels. That point is definatly made. I primarily wanted to point out that the controlers involved were not the only difference. In my experience with SQL servers of various flavors fast disks and getting things onto a separate spindles is more important than just about anything else. Depending on the size of your 'hot' dataset RAM could be more important and CPU never is. From pgsql-performance-owner@postgresql.org Sat Jan 29 07:30:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A4C9C3A5F72 for ; Sat, 29 Jan 2005 07:30: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 54915-06 for ; Sat, 29 Jan 2005 07:30:17 +0000 (GMT) Received: from stark.xeocode.com (gsstark.mtl.istop.com [66.11.160.162]) by svr1.postgresql.org (Postfix) with ESMTP id 0E67B3A5F61 for ; Sat, 29 Jan 2005 07:30:17 +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 1Cun3f-00049f-00; Sat, 29 Jan 2005 02:30:15 -0500 To: William Yu Cc: pgsql-performance@postgresql.org Subject: Re: PostgreSQL clustering VS MySQL clustering References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501201602.39568.herve@elma.fr> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 29 Jan 2005 02:30:14 -0500 Message-ID: <874qh0u1yx.fsf@stark.xeocode.com> Lines: 34 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at 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: 200501/604 X-Sequence-Number: 10294 William Yu writes: > 1 beefy server w/ 32GB RAM = $16K > > I know what I would choose. I'd get the mega server w/ a ton of RAM and skip > all the trickyness of partitioning a DB over multiple servers. Yes your data > will grow to a point where even the XXGB can't cache everything. On the > otherhand, memory prices drop just as fast. By that time, you can ebay your > original 16/32GB and get 64/128GB. a) What do you do when your calculations show you need 256G of ram? [Yes such machines exist but you're not longer in the realm of simply "add more RAM". Administering such machines is nigh as complex as clustering] b) What do you do when you find you need multiple machines anyways to divide the CPU or I/O or network load up. Now you need n big beefy servers when n servers 1/nth as large would really have sufficed. This is a big difference when you're talking about the difference between colocating 16 1U boxen with 4G of ram vs 16 4U opterons with 64G of RAM... All that said, yes, speaking as a user I think the path of least resistance is to build n complete slaves using Slony and then just divide the workload. That's how I'm picturing going when I get to that point. Even if I just divide the workload randomly it's easier than building a machine with n times the cpu and i/o. And if I divide the workload up in a way that correlates with data in the database I can probably get close to the same performance as clustering. The actual cost of replicating the unused data is slight. And the simplicity of master-slave makes it much more appealing than full on clustering. -- greg From pgsql-performance-owner@postgresql.org Sat Jan 29 08:22:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 18AE93A5C1A for ; Sat, 29 Jan 2005 08:22: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 58011-08 for ; Sat, 29 Jan 2005 08:22:22 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id A1D093A5A8D for ; Sat, 29 Jan 2005 08:22:23 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 06FBF31DA1; Sat, 29 Jan 2005 09:22:21 +0100 (MET) From: William Yu X-Newsgroups: pgsql.performance Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Sat, 29 Jan 2005 00:22:14 -0800 Organization: Hub.Org Networking Services Lines: 44 Message-ID: <41FB47B6.3010507@talisys.com> References: <200501201503.31241.herve@elma.fr> <200501201542.06645.herve@elma.fr> <41EFC569.6030800@familyhealth.com.au> <200501201602.39568.herve@elma.fr> <874qh0u1yx.fsf@stark.xeocode.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org To: Greg Stark User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <874qh0u1yx.fsf@stark.xeocode.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: 200501/605 X-Sequence-Number: 10295 >>I know what I would choose. I'd get the mega server w/ a ton of RAM and skip >>all the trickyness of partitioning a DB over multiple servers. Yes your data >>will grow to a point where even the XXGB can't cache everything. On the >>otherhand, memory prices drop just as fast. By that time, you can ebay your >>original 16/32GB and get 64/128GB. > > > a) What do you do when your calculations show you need 256G of ram? [Yes such > machines exist but you're not longer in the realm of simply "add more RAM". > Administering such machines is nigh as complex as clustering] If you need that much memory, you've got enough customers paying you cash to pay for anything. :) Technology always increase -- 8X Opterons would double your memory capacity, higher capacity DIMMs, etc. > b) What do you do when you find you need multiple machines anyways to divide > the CPU or I/O or network load up. Now you need n big beefy servers when n > servers 1/nth as large would really have sufficed. This is a big difference > when you're talking about the difference between colocating 16 1U boxen with > 4G of ram vs 16 4U opterons with 64G of RAM... > > All that said, yes, speaking as a user I think the path of least resistance is > to build n complete slaves using Slony and then just divide the workload. > That's how I'm picturing going when I get to that point. Replication is good for uptime and high read systems. The problem is that if your system has a high volume of writes and you need near realtime data syncing, clusters don't get you anything. A write on one server means a write on every server. Spreading out the damage over multiple machines doesn't help a bit. Plus the fact that we don't have multi-master replication yet is quite a bugaboo. That requires writing quite extensive code if you can't afford to have 1 server be your single point of failure. We wrote our own multi-master replication code at the client app level and it's quite a chore making sure the replication act logically. Every table needs to have separate logic to parse situations like "voucher was posted on server 1 but voided after on server 2, what's the correct action here?" So I've got a slew of complicated if-then-else statements that not only have to take into account type of update being made but the sequence. And yes, I tried doing realtime locks over a VPN link over our servers in SF and VA. Ugh...latency was absolutely horrible and made transactions run 1000X slower. From pgsql-performance-owner@postgresql.org Sat Jan 29 14:41:59 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7EA743A63D0 for ; Sat, 29 Jan 2005 14:41: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 87062-03 for ; Sat, 29 Jan 2005 14:41:48 +0000 (GMT) Received: from rediffmail.com (unknown [203.199.83.28]) by svr1.postgresql.org (Postfix) with SMTP id 62C283A63C4 for ; Sat, 29 Jan 2005 14:41:49 +0000 (GMT) Received: (qmail 18502 invoked by uid 510); 29 Jan 2005 14:43:21 -0000 Date: 29 Jan 2005 14:43:21 -0000 Message-ID: <20050129144321.18501.qmail@webmail18.rediffmail.com> Received: from unknown (61.95.196.133) by rediffmail.com via HTTP; 29 jan 2005 14:43:16 -0000 MIME-Version: 1.0 From: "Narayanan Subramaniam Iyer" Reply-To: "Narayanan Subramaniam Iyer" To: pgsql-performance@postgresql.org Subject: Postgres server getting slow!! Content-type: multipart/alternative; boundary="Next_1107009796---0-203.199.83.28-18398" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.158 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_IMAGE_ONLY_16, HTML_MESSAGE, MSGID_FROM_MTA_HEADER X-Spam-Level: ** X-Archive-Number: 200501/607 X-Sequence-Number: 10297 This is a multipart mime message --Next_1107009796---0-203.199.83.28-18398 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =A0=0AHi=0A=0A i am running a High availability Postgresql server on redh= at=0Alinux 9. I am using NFS mount of data directory from a shared storage.= The server was running without problems for last two =0Amonths. The server= is connected to a dialin router where all my company units dialin and upda= te the database. =0AConcurrently i have some 25 to 50 connections at peak h= ours. =0A=0AFollowing are the problems i am facing =0A=0A1) When 3 or 4 cli= ents connect to this server, the pids are created and=0Athose pids are not = killed even after the client disconnects.=0Aafter sometimes some 10 to 20 p= ids gets created and postgres reject client connections. =0A=0A2) After one= or two concurrent connections, the server slows down.=0AThe postmaster occ= upies more than 90% of the memory.=0A=0A3) Even when restarting server, aft= er one or two connection from clients, the pids start increasing automatica= lly to 10 or 13. This again slows down the server.=0A=0APlease help me to s= ort out this issue=0A=0AThanks in advance .=0A=0A=0ARegards=0A=0AN S --Next_1107009796---0-203.199.83.28-18398 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0A 
=0AHi
=0A
=0A  i am running a High availability= Postgresql server on redhat
=0Alinux 9. I am using NFS mount of data di= rectory from a shared storage. The server was running without problems for = last two
=0Amonths. The server is connected to a dialin router where al= l my company units dialin and update the database.
=0AConcurrently i ha= ve some 25 to 50 connections at peak hours.
=0A
=0AFollowing are the= problems i am facing
=0A
=0A1) When 3 or 4 clients connect to this = server, the pids are created and
=0Athose pids are not killed even after= the client disconnects.
=0Aafter sometimes some 10 to 20 pids gets crea= ted and postgres reject client connections.
=0A
=0A2) After one or t= wo concurrent connections, the server slows down.
=0AThe postmaster occu= pies more than 90% of the memory.
=0A
=0A3) Even when restarting serv= er, after one or two connection from clients, the pids start increasing aut= omatically to 10 or 13. This again slows down the server.
=0A
=0APlea= se help me to sort out this issue
=0A
=0AThanks in advance .
=0A=0A
=0ARegards
=0A
=0AN S=0A

=0A

=0A=0A --Next_1107009796---0-203.199.83.28-18398-- From pgsql-performance-owner@postgresql.org Sat Jan 29 15:51:26 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A90EA3A6391 for ; Sat, 29 Jan 2005 15:51: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 94074-03 for ; Sat, 29 Jan 2005 15:51:15 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E6E5C3A5C1A for ; Sat, 29 Jan 2005 15:51:18 +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 j0TFpI1s003735; Sat, 29 Jan 2005 10:51:19 -0500 (EST) To: "Narayanan Subramaniam Iyer" Cc: pgsql-performance@postgresql.org Subject: Re: Postgres server getting slow!! In-reply-to: <20050129144321.18501.qmail@webmail18.rediffmail.com> References: <20050129144321.18501.qmail@webmail18.rediffmail.com> Comments: In-reply-to "Narayanan Subramaniam Iyer" message dated "29 Jan 2005 14:43:21 +0000" Date: Sat, 29 Jan 2005 10:51:18 -0500 Message-ID: <3734.1107013878@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: 200501/608 X-Sequence-Number: 10298 "Narayanan Subramaniam Iyer" writes: > 1) When 3 or 4 clients connect to this server, the pids are created and > those pids are not killed even after the client disconnects. In that case your clients are not really disconnecting. Take a closer look at your client-side software. regards, tom lane From pgsql-performance-owner@postgresql.org Sat Jan 29 21:52:22 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7D8A440BFB6 for ; Sat, 29 Jan 2005 21:52: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 25844-04 for ; Sat, 29 Jan 2005 21:52:19 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id D7B6740BFA3 for ; Sat, 29 Jan 2005 21:52:17 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6966190; Sat, 29 Jan 2005 13:54:01 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Performance problem with semi-large tables Date: Sat, 29 Jan 2005 13:51:10 -0800 User-Agent: KMail/1.6.2 Cc: "Ken Egervari" References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> In-Reply-To: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <200501291351.10335.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.013 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/612 X-Sequence-Number: 10302 Ken, Actually, your problem isn't that generic, and might be better solved by=20 dissecting an EXPLAIN ANALYZE. > 1. Should I just change beg to change the requirements so that I can make > more specific queries and more screens to access those?=20 This is always good. > 2. Can you=20 > recommend ways so that postgres acts on big tables more efficiently? =C2= =A0I'm > not really interested in this specific case (I just made it up). =C2=A0I'= m more > interested in general solutions to this general problem of big table sizes > with bad filters and where join orders don't seem to help much. Well, you appear to be using ORDER BY ... LIMIT. Is there a corresponding= =20 index on the order by criteria? =2D-=20 Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Sat Jan 29 22:04:43 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0B44A40A3C8 for ; Sat, 29 Jan 2005 22:04: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 26435-07 for ; Sat, 29 Jan 2005 22:04:31 +0000 (GMT) Received: from corpsrv2.tazznetworks.com (wsip-66-210-115-146.ri.ri.cox.net [66.210.115.146]) by svr1.postgresql.org (Postfix) with ESMTP id C8F0540BFD4 for ; Sat, 29 Jan 2005 22:04:28 +0000 (GMT) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5064E.7FC2EC01" Subject: Re: Performance problem with semi-large tables Date: Sat, 29 Jan 2005 17:04:26 -0500 Message-ID: <07FDEE0ED7455A48AC42AC2070EDFF7C3EE0B5@corpsrv2.tazznetworks.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PERFORM] Performance problem with semi-large tables Thread-Index: AcUGTL5A82lKwkptSjKivX4Cy4tUuwAASxig From: "David Parker" To: "Ken Egervari" , X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.093 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200501/613 X-Sequence-Number: 10303 This is a multi-part message in MIME format. ------_=_NextPart_001_01C5064E.7FC2EC01 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable You don't mention if you have run VACUUM or VACUUM ANALYZE lately. That's generally one of the first things that folks will suggest. If you have a lot of updates then VACUUM will clean up dead tuples; if you have a lot of inserts then VACUUM ANALYZE will update statistics so that the planner can make better decisions (as I understand it). =20 Another data point people will ask for in helping you will be EXPLAIN ANALYZE output from running the queries you think are slowing down. =20 - DAP ________________________________ From: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Ken Egervari Sent: Wednesday, January 26, 2005 9:17 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Performance problem with semi-large tables =09 =09 Hi everyone. =20 I'm new to this forum and was wondering if anyone would be kind enough to help me out with a pretty severe performance issue. I believe the problem to be rather generic, so I'll put it in generic terms. Since I'm at home and not a work (but this is really bugging me), I can't post any specifics. However, I think my explaination will suffice. =20 I have a 2 tables that are are getting large and will only get larger with time (expoentially as more users sign on to the system). Right the now, a table called 'shipment' contains about 16,000 rows and 'shipment_status' contains about 32,500 rows. These aren't massive rows (I keep reading about tables with millions), but they will definately get into 6 digits by next year and query performance is quite poor. =20 Now, from what I can understand about tuning, you want to specify good filters, provide good indexes on the driving filter as well as any referencial keys that are used while joining. This has helped me solve performance problems many times in the past (for example, changing a query speed from 2 seconds to 21 milliseconds). =20 =20 However, I am now tuning queries that operate on these two tables and the filters aren't very good (the best is a filter ratio of 0.125) and the number of rows returned is very large (not taking into consideration limits). =20 For example, consider something like this query that takes ~1 second to finish: =20 select s.*, ss.* from shipment s, shipment_status ss, release_code r where s.current_status_id =3D ss.id and ss.release_code_id =3D r.id and r.filtered_column =3D '5' order by ss.date desc limit 100; =20 Release code is just a very small table of 8 rows by looking at the production data, hence the 0.125 filter ratio. However, the data distribution is not normal since the filtered column actually pulls out about 54% of the rows in shipment_status when it joins. Postgres seems to be doing a sequencial scan to pull out all of these rows. Next, it joins approx 17550 rows to shipment. Since this query has a limit, it only returns the first 100, which seems like a waste. =20 Now, for this query, I know I can filter out the date instead to speed it up. For example, I can probably search for all the shipments in the last 3 days instead of limiting it to 100. But since this isn't a real production query, I only wanted to show it as an example since many times I cannot do a filter by the date (and the sort may be date or something else irrelavant). =20 I'm just stressed out how I can make queries like this more efficient since all I see is a bunch of hash joins and sequencial scans taking all kinds of time. =20 I guess here are my 2 questions: =20 1. Should I just change beg to change the requirements so that I can make more specific queries and more screens to access those? 2. Can you recommend ways so that postgres acts on big tables more efficiently? I'm not really interested in this specific case (I just made it up). I'm more interested in general solutions to this general problem of big table sizes with bad filters and where join orders don't seem to help much. =20 Thank you very much for your help. =20 Best Regards, Ken Egervari ------_=_NextPart_001_01C5064E.7FC2EC01 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
You don't mention if you have run VACUUM or = VACUUM ANALYZE=20 lately. That's generally one of the first things that folks will = suggest. If you=20 have a lot of updates then VACUUM will clean up dead tuples; if you have = a lot=20 of inserts then VACUUM ANALYZE will update statistics so that the = planner can=20 make better decisions (as I understand it).
 
Another data point people will ask for in = helping you will=20 be EXPLAIN ANALYZE output from running the queries you think are slowing = down.
 
- DAP


From: = pgsql-performance-owner@postgresql.org=20 [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of = Ken=20 Egervari
Sent: Wednesday, January 26, 2005 9:17 = PM
To:=20 pgsql-performance@postgresql.org
Subject: [PERFORM] = Performance=20 problem with semi-large tables

Hi everyone.
 
I'm new to this forum and was = wondering if anyone=20 would be kind enough to help me out with a pretty severe performance=20 issue.  I believe the problem to be rather generic, so I'll put = it in=20 generic terms.  Since I'm at home and not a work (but this is = really=20 bugging me), I can't post any specifics.  However, I think my=20 explaination will suffice.
 
I have a 2 tables that are are = getting large and=20 will only get larger with time (expoentially as more users sign on to = the=20 system).  Right the now, a table called 'shipment' contains about = 16,000=20 rows and 'shipment_status' contains about 32,500 rows.  These = aren't=20 massive rows (I keep reading about tables with millions), but they = will=20 definately get into 6 digits by next year and query performance is = quite=20 poor.
 
Now, from what I can understand about = tuning, you=20 want to specify good filters, provide good indexes on the driving = filter as=20 well as any referencial keys that are used while joining.  This = has=20 helped me solve performance problems many times in the past (for = example,=20 changing a query speed from 2 seconds to 21 milliseconds).  =
 
However, I am now tuning queries that = operate on=20 these two tables and the filters aren't very good (the best is a = filter ratio=20 of 0.125) and the number of rows returned is very large (not taking = into=20 consideration limits).
 
For example, consider something = like this=20 query that takes ~1 second to finish:
 
select s.*, ss.*
from shipment s, shipment_status ss, = release_code=20 r
where s.current_status_id =3D = ss.id
   and ss.release_code_id = =3D=20 r.id
   and r.filtered_column = =3D=20 '5'
order by ss.date desc
limit 100;
 
Release code is just a very small = table of 8 rows=20 by looking at the production data, hence the 0.125 filter ratio.  = However, the data distribution is not normal since the filtered column = actually pulls out about 54% of the rows in shipment_status when it=20 joins.  Postgres seems to be doing a sequencial scan to pull out = all of=20 these rows.  Next, it joins approx 17550 rows to shipment.  = Since=20 this query has a limit, it only returns the first 100, which seems = like a=20 waste.
 
Now, for this query, I know I can = filter out the=20 date instead to speed it up.  For example, I can probably search = for all=20 the shipments in the last 3 days instead of limiting it to 100.  = But=20 since this isn't a real production query, I only wanted to show it as = an=20 example since many times I cannot do a filter by the date (and the = sort may be=20 date or something else irrelavant).
 
I'm just stressed out how I can make = queries like=20 this more efficient since all I see is a bunch of hash joins and = sequencial=20 scans taking all kinds of time.
 
I guess here are my 2 = questions:
 
1. Should I just change beg to change = the=20 requirements so that I can make more specific queries and more screens = to=20 access those?
2. Can you recommend ways so that = postgres acts=20 on big tables more efficiently?  I'm not really interested in = this=20 specific case (I just made it up).  I'm more interested in = general=20 solutions to this general problem of big table sizes with bad filters = and=20 where join orders don't seem to help much.
 
Thank you very much for your=20 help.
 
Best Regards,
Ken=20 Egervari
------_=_NextPart_001_01C5064E.7FC2EC01-- From pgsql-performance-owner@postgresql.org Sat Jan 29 22:06:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9B58840BFB8 for ; Sat, 29 Jan 2005 22:06: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 26762-09 for ; Sat, 29 Jan 2005 22:06:37 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 116DC40BF99 for ; Sat, 29 Jan 2005 22:06:36 +0000 (GMT) Received: (qmail 28327 invoked from network); 29 Jan 2005 23:06:57 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 29 Jan 2005 23:06:57 +0100 To: "Ken Egervari" , pgsql-performance@postgresql.org Subject: Re: Performance problem with semi-large tables References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> Message-ID: Date: Sat, 29 Jan 2005 23:08:58 +0100 From: PFC 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: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/614 X-Sequence-Number: 10304 > select s.*, ss.* > from shipment s, shipment_status ss, release_code r > where s.current_status_id = ss.id > and ss.release_code_id = r.id > and r.filtered_column = '5' > order by ss.date desc > limit 100; > Release code is just a very small table of 8 rows by looking at the > production data, hence the 0.125 filter ratio. However, the data > distribution is not normal since the filtered column actually pulls out > about 54% of the rows in shipment_status when it joins. Postgres seems > to be doing a sequencial scan to pull out all of these rows. Next, it > joins approx 17550 rows to shipment. Since this query has a limit, it > only returns the first 100, which seems like a waste. Well, postgres does what you asked. It will be slow, because you have a full table join. LIMIT does not change this because the rows have to be sorted first. The date is in shipment_status so you should first get the shipment_status.id that you need and later join to shipment. This will avoid the big join : SELECT s.*, ss.* FROM (SELECT * FROM shipment_status WHERE release_code_id IN (SELECT r.id FROM release_code WHERE r.filtered_column = '5') ORDER BY date DESC LIMIT 100 ) as ss, shipment s WHERE s.current_status_id = ss.id ORDER BY date DESC LIMIT 100 Is this better ? From pgsql-performance-owner@postgresql.org Sat Jan 29 22:40:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4CB9040BFF2 for ; Sat, 29 Jan 2005 22:40: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 31301-07 for ; Sat, 29 Jan 2005 22:40:21 +0000 (GMT) Received: from fep7.cogeco.net (smtp.cogeco.net [216.221.81.25]) by svr1.postgresql.org (Postfix) with ESMTP id 735C040A3C6 for ; Sat, 29 Jan 2005 22:40:20 +0000 (GMT) Received: from windsortransportationclub.com (d57-59-156.home.cgocable.net [24.57.59.156]) by fep7.cogeco.net (Postfix) with SMTP id 1D826991 for ; Sat, 29 Jan 2005 17:40:12 -0500 (EST) Received: (qmail 26631 invoked from network); 29 Jan 2005 23:09:59 -0000 Received: from d36-66-205.home1.cgocable.net (HELO a96dfxb4kjzogw) (24.36.66.205) by 0 with SMTP; 29 Jan 2005 23:09:59 -0000 Message-ID: <001d01c50653$7e5d40a0$cd422418@a96dfxb4kjzogw> From: "Ken Egervari" To: References: <07FDEE0ED7455A48AC42AC2070EDFF7C3EE0B5@corpsrv2.tazznetworks.com> Subject: Re: Performance problem with semi-large tables Date: Sat, 29 Jan 2005 17:40:11 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001A_01C50629.953FCF60" 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=1.157 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, HTML_40_50, HTML_MESSAGE, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200501/615 X-Sequence-Number: 10305 This is a multi-part message in MIME format. ------=_NextPart_000_001A_01C50629.953FCF60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes, I'm very well aware of VACUUM and VACUUM ANALYZE. I've even = clusted the date index and so on to ensure faster performance. ----- Original Message -----=20 From: David Parker=20 To: Ken Egervari ; pgsql-performance@postgresql.org=20 Sent: Saturday, January 29, 2005 5:04 PM Subject: Re: [PERFORM] Performance problem with semi-large tables You don't mention if you have run VACUUM or VACUUM ANALYZE lately. = That's generally one of the first things that folks will suggest. If you = have a lot of updates then VACUUM will clean up dead tuples; if you have = a lot of inserts then VACUUM ANALYZE will update statistics so that the = planner can make better decisions (as I understand it). Another data point people will ask for in helping you will be EXPLAIN = ANALYZE output from running the queries you think are slowing down. - DAP -------------------------------------------------------------------------= --- From: pgsql-performance-owner@postgresql.org = [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Ken = Egervari Sent: Wednesday, January 26, 2005 9:17 PM To: pgsql-performance@postgresql.org Subject: [PERFORM] Performance problem with semi-large tables Hi everyone. I'm new to this forum and was wondering if anyone would be kind = enough to help me out with a pretty severe performance issue. I believe = the problem to be rather generic, so I'll put it in generic terms. = Since I'm at home and not a work (but this is really bugging me), I = can't post any specifics. However, I think my explaination will = suffice. I have a 2 tables that are are getting large and will only get = larger with time (expoentially as more users sign on to the system). = Right the now, a table called 'shipment' contains about 16,000 rows and = 'shipment_status' contains about 32,500 rows. These aren't massive rows = (I keep reading about tables with millions), but they will definately = get into 6 digits by next year and query performance is quite poor. Now, from what I can understand about tuning, you want to specify = good filters, provide good indexes on the driving filter as well as any = referencial keys that are used while joining. This has helped me solve = performance problems many times in the past (for example, changing a = query speed from 2 seconds to 21 milliseconds). =20 However, I am now tuning queries that operate on these two tables = and the filters aren't very good (the best is a filter ratio of 0.125) = and the number of rows returned is very large (not taking into = consideration limits). For example, consider something like this query that takes ~1 second = to finish: select s.*, ss.* from shipment s, shipment_status ss, release_code r where s.current_status_id =3D ss.id and ss.release_code_id =3D r.id and r.filtered_column =3D '5' order by ss.date desc limit 100; Release code is just a very small table of 8 rows by looking at the = production data, hence the 0.125 filter ratio. However, the data = distribution is not normal since the filtered column actually pulls out = about 54% of the rows in shipment_status when it joins. Postgres seems = to be doing a sequencial scan to pull out all of these rows. Next, it = joins approx 17550 rows to shipment. Since this query has a limit, it = only returns the first 100, which seems like a waste. Now, for this query, I know I can filter out the date instead to = speed it up. For example, I can probably search for all the shipments = in the last 3 days instead of limiting it to 100. But since this isn't = a real production query, I only wanted to show it as an example since = many times I cannot do a filter by the date (and the sort may be date or = something else irrelavant). I'm just stressed out how I can make queries like this more = efficient since all I see is a bunch of hash joins and sequencial scans = taking all kinds of time. I guess here are my 2 questions: 1. Should I just change beg to change the requirements so that I can = make more specific queries and more screens to access those? 2. Can you recommend ways so that postgres acts on big tables more = efficiently? I'm not really interested in this specific case (I just = made it up). I'm more interested in general solutions to this general = problem of big table sizes with bad filters and where join orders don't = seem to help much. Thank you very much for your help. Best Regards, Ken Egervari ------=_NextPart_000_001A_01C50629.953FCF60 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Yes, I'm very well aware of VACUUM and = VACUUM=20 ANALYZE.  I've even clusted the date index and so on to ensure = faster=20 performance.
----- Original Message -----
From:=20 David=20 Parker
To: Ken Egervari ; pgsql-performance@postgr= esql.org=20
Sent: Saturday, January 29, = 2005 5:04=20 PM
Subject: Re: [PERFORM] = Performance=20 problem with semi-large tables

You don't mention if you have run VACUUM or = VACUUM=20 ANALYZE lately. That's generally one of the first things that folks = will=20 suggest. If you have a lot of updates then VACUUM will clean up dead = tuples;=20 if you have a lot of inserts then VACUUM ANALYZE will update = statistics so=20 that the planner can make better decisions (as I understand=20 it).
 
Another data point people will ask for in = helping you=20 will be EXPLAIN ANALYZE output from running the queries you think are = slowing=20 down.
 
- DAP


From: = pgsql-performance-owner@postgresql.org=20 [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of = Ken=20 Egervari
Sent: Wednesday, January 26, 2005 9:17 = PM
To:=20 pgsql-performance@postgresql.org
Subject: [PERFORM] = Performance=20 problem with semi-large tables

Hi everyone.
 
I'm new to this forum and was = wondering if=20 anyone would be kind enough to help me out with a pretty severe = performance=20 issue.  I believe the problem to be rather generic, so I'll put = it in=20 generic terms.  Since I'm at home and not a work (but this is = really=20 bugging me), I can't post any specifics.  However, I think my=20 explaination will suffice.
 
I have a 2 tables that are are = getting large=20 and will only get larger with time (expoentially as more users sign = on to=20 the system).  Right the now, a table called 'shipment' contains = about=20 16,000 rows and 'shipment_status' contains about 32,500 rows.  = These=20 aren't massive rows (I keep reading about tables with millions), but = they=20 will definately get into 6 digits by next year and query performance = is=20 quite poor.
 
Now, from what I can understand = about tuning,=20 you want to specify good filters, provide good indexes on the = driving filter=20 as well as any referencial keys that are used while joining.  = This has=20 helped me solve performance problems many times in the past (for = example,=20 changing a query speed from 2 seconds to 21 milliseconds). =20
 
However, I am now tuning queries = that operate=20 on these two tables and the filters aren't very good (the best is a = filter=20 ratio of 0.125) and the number of rows returned is very large (not = taking=20 into consideration limits).
 
For example, consider something = like this=20 query that takes ~1 second to finish:
 
select s.*, ss.*
from shipment s, shipment_status = ss,=20 release_code r
where s.current_status_id =3D = ss.id
   and ss.release_code_id = =3D=20 r.id
   and r.filtered_column = =3D=20 '5'
order by ss.date desc
limit 100;
 
Release code is just a very small = table of 8=20 rows by looking at the production data, hence the 0.125 filter = ratio. =20 However, the data distribution is not normal since the filtered = column=20 actually pulls out about 54% of the rows in shipment_status when it=20 joins.  Postgres seems to be doing a sequencial scan to pull = out all of=20 these rows.  Next, it joins approx 17550 rows to = shipment.  Since=20 this query has a limit, it only returns the first 100, which seems = like a=20 waste.
 
Now, for this query, I know I can = filter out=20 the date instead to speed it up.  For example, I can probably = search=20 for all the shipments in the last 3 days instead of limiting it to=20 100.  But since this isn't a real production query, I only = wanted to=20 show it as an example since many times I cannot do a filter by the = date (and=20 the sort may be date or something else irrelavant).
 
I'm just stressed out how I can = make queries=20 like this more efficient since all I see is a bunch of hash joins = and=20 sequencial scans taking all kinds of time.
 
I guess here are my 2 = questions:
 
1. Should I just change beg to = change the=20 requirements so that I can make more specific queries and more = screens to=20 access those?
2. Can you recommend ways so that = postgres acts=20 on big tables more efficiently?  I'm not really interested in = this=20 specific case (I just made it up).  I'm more interested in = general=20 solutions to this general problem of big table sizes with bad = filters and=20 where join orders don't seem to help much.
 
Thank you very much for your=20 help.
 
Best Regards,
Ken=20 Egervari
------=_NextPart_000_001A_01C50629.953FCF60-- From pgsql-performance-owner@postgresql.org Sat Jan 29 22:44:40 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A07E140C005 for ; Sat, 29 Jan 2005 22: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 32566-03 for ; Sat, 29 Jan 2005 22:44:34 +0000 (GMT) Received: from fep1.cogeco.net (smtp.cogeco.net [216.221.81.25]) by svr1.postgresql.org (Postfix) with ESMTP id 2A61E40C003 for ; Sat, 29 Jan 2005 22:44:33 +0000 (GMT) Received: from windsortransportationclub.com (d57-59-156.home.cgocable.net [24.57.59.156]) by fep1.cogeco.net (Postfix) with SMTP id 3164C619E for ; Sat, 29 Jan 2005 17:44:34 -0500 (EST) Received: (qmail 26711 invoked from network); 29 Jan 2005 23:14:21 -0000 Received: from d36-66-205.home1.cgocable.net (HELO a96dfxb4kjzogw) (24.36.66.205) by 0 with SMTP; 29 Jan 2005 23:14:21 -0000 Message-ID: <002201c50654$1a8c50b0$cd422418@a96dfxb4kjzogw> From: "Ken Egervari" To: "PFC" , References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> Subject: Re: Performance problem with semi-large tables Date: Sat, 29 Jan 2005 17:44:33 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-15"; 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=1.422 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200501/616 X-Sequence-Number: 10306 > Well, postgres does what you asked. It will be slow, because you have a > full table join. LIMIT does not change this because the rows have to be > sorted first. I am aware that limit doesn't really affect the execution time all that much. It does speed up ORM though and keeps the rows to a manageable list so users don't have to look at thousands, which is good enough for me. My intention here is that the date was supposed to be a good filter. > The date is in shipment_status so you should first get the > shipment_status.id that you need and later join to shipment. This will > avoid the big join : > > > SELECT s.*, ss.* FROM > (SELECT * FROM shipment_status WHERE release_code_id IN > (SELECT r.id FROM release_code WHERE r.filtered_column = '5') > ORDER BY date DESC LIMIT 100 > ) as ss, shipment s > WHERE s.current_status_id = ss.id > ORDER BY date DESC LIMIT 100 > > Is this better ? This looks like it might be what I want. It's not that I was not aware of the correct join order. I used Dan Tow's diagram method and learned that filtering on date first is the best approach, then releae code, then finally shipment for this particular query. I just didn't know how to tell PostgreSQL how to do this. So are you suggesting as a general rule then that sub-queries are the way to force a specific join order in postgres? If that is the case, I will do this from now on. From pgsql-performance-owner@postgresql.org Sat Jan 29 23:26:53 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1296240BFC1 for ; Sat, 29 Jan 2005 23:26: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 35511-10 for ; Sat, 29 Jan 2005 23:26:40 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 4804740A3C6 for ; Sat, 29 Jan 2005 23:26:38 +0000 (GMT) Received: (qmail 31815 invoked from network); 30 Jan 2005 00:26:59 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 30 Jan 2005 00:26:59 +0100 Date: Sun, 30 Jan 2005 00:28:59 +0100 To: "Ken Egervari" , pgsql-performance@postgresql.org Subject: Re: Performance problem with semi-large tables References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> <002201c50654$1a8c50b0$cd422418@a96dfxb4kjzogw> From: PFC 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: <002201c50654$1a8c50b0$cd422418@a96dfxb4kjzogw> User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/617 X-Sequence-Number: 10307 > So are you suggesting as a general rule then that sub-queries are the > way to force a specific join order in postgres? If that is the case, I > will do this from now on. I'll try to explain a bit better... Here's your original query : > select s.*, ss.* > from shipment s, shipment_status ss, release_code r > where s.current_status_id = ss.id > and ss.release_code_id = r.id > and r.filtered_column = '5' > order by ss.date desc > limit 100; If you write something like : SELECT * FROM shipment_status WHERE release_code_id = constant ORDER BY release_code_id DESC, date DESC LIMIT 100; In this case, if you have an index on (release_code_id, date), the planner will use a limited index scan which will yield the rows in index order, which will be very fast. However, if you just have an index on date, this won't help you. In your case, moreover, you don't use release_code_id = constant, but it comes from a join. So there may be several different values for release_code_id ; thus the planner can't use the optimization, it has to find the rows with the release_code_id first. And it can't use the index on (release_code_id, date) to get the rows in sorted order precisely because there could be several different values for the release_code_id. And then it has to sort by date. I hope this makes it clearer. If you are absolutely sure there is only one row in release_code with r.filtered_column = '5', then this means release_code_id is a constant and your query could get a huge speedup by writing it differently. From pgsql-performance-owner@postgresql.org Sun Jan 30 01:26:09 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 90C7840C04F for ; Sun, 30 Jan 2005 01:25: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 58693-03 for ; Sun, 30 Jan 2005 01:25:07 +0000 (GMT) Received: from fep7.cogeco.net (smtp.cogeco.net [216.221.81.25]) by svr1.postgresql.org (Postfix) with ESMTP id B1CA940C076 for ; Sun, 30 Jan 2005 01:21:47 +0000 (GMT) Received: from windsortransportationclub.com (d57-59-156.home.cgocable.net [24.57.59.156]) by fep7.cogeco.net (Postfix) with SMTP id 8DEFE1333 for ; Sat, 29 Jan 2005 20:21:40 -0500 (EST) Received: (qmail 28968 invoked from network); 30 Jan 2005 01:51:28 -0000 Received: from d36-66-205.home1.cgocable.net (HELO a96dfxb4kjzogw) (24.36.66.205) by 0 with SMTP; 30 Jan 2005 01:51:28 -0000 Message-ID: <000a01c5066a$0d1f43e0$cd422418@a96dfxb4kjzogw> From: "Ken Egervari" To: "PFC" , References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> <002201c50654$1a8c50b0$cd422418@a96dfxb4kjzogw> Subject: Re: Performance problem with semi-large tables Date: Sat, 29 Jan 2005 20:21:40 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-15"; 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=1.542 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: * X-Archive-Number: 200501/618 X-Sequence-Number: 10308 Thanks again for your response. I'll try and clarify some metrics that I took a few days to figure out what would be the best join order. By running some count queries on the production database, I noticed there were only 8 rows in release_code. The filtered column is unique, so that means the filter ratio is 0.125. However, the data distribution is not normal. When the filtered column is the constant '5', Postgres will join to 54% of the shipment_status rows. Since shipment_status has 32,000+ rows, this join is not a very good one to make. The shipment table has 17k rows, but also due to the distribution of data, almost every shipment will join to a shipment_status with a release_code of '5'. For your information, this column indicates that a shipment has been "released", as most shipments will move to this state eventually. The actual join ratio from shipment_status to shipment is about 98.5% of the rows in the shipment table, which is still basically 17k rows. I was simply curious how to make something like this faster. You see, it's the table size and the bad filters are really destroying this query example. I would never make a query to the database like this in practice, but I have similar queries that I do make that aren't much better (and can't be due to business requirements). For example, let's add another filter to get all the shipments with release code '5' that are 7 days old or newer. ss.date >= current_date - 7 By analyzing the production data, this where clause has a filter ratio of 0.08, which is far better than the release_code filter both in ratio and in the number of rows that it can avoid joining. However, if I had this filter into the original query, Postgres will not act on it first - and I think it really should before it even touches release_code. However, the planner (using EXPLAIN ANALYZE) will actually pick this filter last and will join 17k rows prematurely to release_code. In this example, I'd like force postgres to do the date filter first, join to release_code next, then finally to shipment. Another example is filtering by the driver_id, which is a foreign key column on the shipment table itself to a driver table. This has a filter ratio of 0.000625 when analyzing the production data. However, PostgreSQL will not act on this filter first either. The sad part is that since drivers are actually distributed more evenly in the database, it would filter out the shipment table from 17k to about 10 shipments on average. In most cases, it ends up being more than 10, but not more than 60 or 70, which is very good since some drivers don't have any shipments (I question why they are even in the database, but that's another story). As you can see, joining to shipment_status at this point (using the primary key index from shipment.current_status_id to shipment_status.id) should be extremely efficient. Yet, Postgres's planner/optimizer won't make the right call until might later in the plan. > SELECT * FROM shipment_status WHERE release_code_id = constant ORDER BY > release_code_id DESC, date DESC LIMIT 100; > > In this case, if you have an index on (release_code_id, date), the > planner will use a limited index scan which will yield the rows in index > order, which will be very fast. I have done this in other queries where sorting by both release code and date were important. You are right, it is very fast and I do have this index in play. However, most of the time I retreive shipment's when their shipment_status all have the same release_code, which makes sorting kind of moot :/ I guess that answers your comment below. > However, if you just have an index on date, this won't help you. > In your case, moreover, you don't use release_code_id = constant, but it > comes from a join. So there may be several different values for > release_code_id ; thus the planner can't use the optimization, it has to > find the rows with the release_code_id first. And it can't use the index > on (release_code_id, date) to get the rows in sorted order precisely > because there could be several different values for the release_code_id. > And then it has to sort by date. Well, the filtered column is actually unique (but it's not the primary key). Should I just make it the primary key? Can't postgres be equally efficient when using other candidate keys as well? If not, then I will definately change the design of my database. I mostly use synthetic keys to make Hibernate configuration fairly straight-forward and to make it easy so all of my entities extend from the same base class. > I hope this makes it clearer. If you are absolutely sure there is only > one row in release_code with r.filtered_column = '5', then this means > release_code_id is a constant and your query could get a huge speedup by > writing it differently. You mean by avoiding the filter on number and avoiding the join? You see, I never thought joining to release_code should be so bad since the table only has 8 rows in it. Anyway, I hope my comments provide you with better insight to the problem I'm having. I really do appreciate your comments because I think you are right on target with your direction, discussing things I haven't really thought up on my own. I thank you. From pgsql-performance-owner@postgresql.org Sun Jan 30 03:21:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 83DCD40C05B for ; Sun, 30 Jan 2005 03: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 86579-06 for ; Sun, 30 Jan 2005 03:21:00 +0000 (GMT) Received: from rediffmail.com (unknown [203.199.83.37]) by svr1.postgresql.org (Postfix) with SMTP id C9D9F40C063 for ; Sun, 30 Jan 2005 03:17:59 +0000 (GMT) Received: (qmail 27719 invoked by uid 510); 30 Jan 2005 03:19:34 -0000 Date: 30 Jan 2005 03:19:34 -0000 Message-ID: <20050130031934.27718.qmail@webmail27.rediffmail.com> Received: from unknown (202.88.246.13) by rediffmail.com via HTTP; 30 jan 2005 03:19:33 -0000 MIME-Version: 1.0 From: "N S" Reply-To: "N S" To: pgsql-performance@postgresql.org Subject: Re: Postgres server getting slow!! Content-type: multipart/alternative; boundary="Next_1107055173---0-203.199.83.37-27702" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.71 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_IMAGE_ONLY_16, HTML_MESSAGE, MSGID_FROM_MTA_HEADER X-Spam-Level: * X-Archive-Number: 200501/619 X-Sequence-Number: 10309 This is a multipart mime message --Next_1107055173---0-203.199.83.37-27702 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =0A=0AThanks tom. I checked the client side software. The software closes= connection when connected locally. But when connected through dialup,=0Ath= is problem comes. I will check the ppp connection also.=0AIs there any meth= od of killing old pids. And also any performance tuning to be done on postg= resql.conf file.=0A=0AThe database now contains 20K records. Will that caus= e a problem?=0A=0ARegds=0A=0ANarayanan=0A=0AOn Sat, 29 Jan 2005 Tom Lane w= rote :=0A>"Narayanan Subramaniam Iyer" writes:=0A> >= 1) When 3 or 4 clients connect to this server, the pids are created and=0A= > > those pids are not killed even after the client disconnects.=0A>=0A>In = that case your clients are not really disconnecting. Take a closer=0A>look= at your client-side software.=0A>=0A> regards, tom lane=0A>=0A>--------= -------------------(end of broadcast)---------------------------=0A>TIP 3: = if posting/reading through Usenet, please send an appropriate=0A> sub= scribe-nomail command to majordomo@postgresql.org so that your=0A> me= ssage can get through to the mailing list cleanly=0A --Next_1107055173---0-203.199.83.37-27702 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0A 
=0A
=0AThanks tom. I checked the client side software. = The software closes connection when connected locally. But when connected t= hrough dialup,
=0Athis problem comes. I will check the ppp connection al= so.
=0AIs there any method of killing old pids. And also any performance= tuning to be done on postgresql.conf file.
=0A
=0AThe database now c= ontains 20K records. Will that cause  a problem?
=0A
=0ARegds=0A
=0ANarayanan
=0A
=0AOn Sat, 29 Jan 2005 Tom Lane wrote :
= =0A>"Narayanan Subramaniam Iyer" <bunix@rediffmail.com> = writes:
=0A> > 1) When 3 or 4 clients connect to this server, the = pids are created and
=0A> > those pids are not killed even after t= he client disconnects.
=0A>
=0A>In that case your clients are n= ot really disconnecting.  Take a closer
=0A>look at your client-= side software.
=0A>
=0A>          &nbs= p;     regards, tom lane
=0A>
=0A>--------------= -------------(end of broadcast)---------------------------
=0A>TIP 3:= if posting/reading through Usenet, please send an appropriate
=0A>&n= bsp;     subscribe-nomail command to majordomo@postgresql.org so= that your
=0A>      message can get through to the m= ailing list cleanly
=0A=0A

=0A

=0A=0A --Next_1107055173---0-203.199.83.37-27702-- From pgsql-performance-owner@postgresql.org Sun Jan 30 11:10:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5D25940BF97 for ; Sun, 30 Jan 2005 11:10: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 57635-02 for ; Sun, 30 Jan 2005 11:10:21 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 9C2FB40C08C for ; Sun, 30 Jan 2005 11:08:30 +0000 (GMT) Received: (qmail 9197 invoked from network); 30 Jan 2005 12:08:52 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 30 Jan 2005 12:08:52 +0100 Date: Sun, 30 Jan 2005 12:10:55 +0100 To: "Ken Egervari" , pgsql-performance@postgresql.org Subject: Re: Performance problem with semi-large tables References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> <002201c50654$1a8c50b0$cd422418@a96dfxb4kjzogw> <000a01c5066a$0d1f43e0$cd422418@a96dfxb4kjzogw> From: PFC 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: <000a01c5066a$0d1f43e0$cd422418@a96dfxb4kjzogw> User-Agent: Opera M2/7.54 (Linux, build 751) 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: 200501/620 X-Sequence-Number: 10310 >> SELECT * FROM shipment_status WHERE release_code_id = constant ORDER BY >> release_code_id DESC, date DESC LIMIT 100; > > I have done this in other queries where sorting by both release code and > date were important. You are right, it is very fast and I do have this > index in play. However, most of the time I retreive shipment's when > their shipment_status all have the same release_code, which makes > sorting kind of moot :/ I guess that answers your comment below. Ah, well in this case, ORDER BY release_code_id DESC seems of course useless because you only have one order_code_id, but it is in fact necessary to make the planner realize it can use the index on (release_code_id,date) for the ordering. If you just ORDER BY date, the planner will not use your index. > Thanks again for your response. I'll try and clarify some metrics that > I took a few days to figure out what would be the best join order. > > By running some count queries on the production database, I noticed > there were only 8 rows in release_code. The filtered column is unique, Let's forget the shipments table for now. So you mean there is an unique, one-to-one relation between release_code_id and filtered_column ? The planner is not able to derermine this ahead of time ; and in your case, it's important that it be unique to be able to use the index to retrieve quickly the rows in (date DESC) order. So if you'll join only to ONE release_code_id, you can do this : (SELECT * FROM shipment_status WHERE release_code_id = (SELECT r.id FROM release_code WHERE r.filtered_column = '5' LIMIT 1) ORDER BY release_code_id DESC, date DESC LIMIT 100) Which is no longer a join and will get your shipment_status_id's very quickly. > so that means the filter ratio is 0.125. However, the data distribution > is not normal. When the filtered column is the constant '5', Postgres > will join to 54% of the shipment_status rows. Since shipment_status has > 32,000+ rows, this join is not a very good one to make. Sure ! > The shipment table has 17k rows, but also due to the distribution of > data, almost every shipment will join to a shipment_status with a > release_code of '5'. For your information, this column indicates that a > shipment has been "released", as most shipments will move to this state > eventually. The actual join ratio from shipment_status to shipment is > about 98.5% of the rows in the shipment table, which is still basically > 17k rows. > > I was simply curious how to make something like this faster. You see, > it's the table size and the bad filters are really destroying this query > example. I would never make a query to the database like this in > practice, but I have similar queries that I do make that aren't much > better (and can't be due to business requirements). > > For example, let's add another filter to get all the shipments with > release code '5' that are 7 days old or newer. > > ss.date >= current_date - 7 It's the order by + limit which makes the query behaves badly, and which forces use of kludges to use the index. If you add another condition like that, it should be a breeze. > By analyzing the production data, this where clause has a filter ratio > of 0.08, which is far better than the release_code filter both in ratio > and in the number of rows that it can avoid joining. However, if I had > this filter into the original query, Postgres will not act on it first - > and I think it really should before it even touches release_code. Well I think too. What with the subqueries I wrote with the LIMIT inside the subquery ? Any better ? Normally the planner is able to deconstruct subqueries and change the order as it sees fit, but if there are LIMIT's I don't know. > However, the planner (using EXPLAIN ANALYZE) will actually pick this > filter last and will join 17k rows prematurely to release_code. In this > example, I'd like force postgres to do the date filter first, join to > release_code next, then finally to shipment. You could use the JOIN keywords to specify the join order youself. > Another example is filtering by the driver_id, which is a foreign key > column on the shipment table itself to a driver table. This has a > filter ratio of 0.000625 when analyzing the production data. However, > PostgreSQL will not act on this filter first either. The sad part is > that since drivers are actually distributed more evenly in the database, > it would filter out the shipment table from 17k to about 10 shipments on > average. In most cases, it ends up being more than 10, but not more > than 60 or 70, which is very good since some drivers don't have any > shipments (I question why they are even in the database, but that's > another story). As you can see, joining to shipment_status at this > point (using the primary key index from shipment.current_status_id to > shipment_status.id) should be extremely efficient. Yet, Postgres's > planner/optimizer won't make the right call until might later in the > plan. And if you select on shipment_status where driver_id=something, does it use the index ? > Well, the filtered column is actually unique (but it's not the primary > key). Should I just make it the primary key? Can't postgres be equally It won't change anything, so probably not. What will make it faster will be changing : WHERE release_code_id IN (SELECT r.id into : WHERE release_code_id = (SELECT r.id > efficient when using other candidate keys as well? If not, then I will > definately change the design of my database. I mostly use synthetic > keys to make Hibernate configuration fairly straight-forward and to make > it easy so all of my entities extend from the same base class. > > You mean by avoiding the filter on number and avoiding the join? You > see, I never thought joining to release_code should be so bad since the > table only has 8 rows in it. It's not the join itself that's bad, it's the order by... Wel the planner insisting on joining the two big tables before limiting, also is worrying. > Anyway, I hope my comments provide you with better insight to the > problem I'm having. I really do appreciate your comments because I > think you are right on target with your direction, discussing things I > haven't really thought up on my own. I thank you. Thanks ;) From pgsql-performance-owner@postgresql.org Sun Jan 30 17:51:36 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6F66440C0BA for ; Sun, 30 Jan 2005 17:51: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 53646-06 for ; Sun, 30 Jan 2005 17:51:31 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5DF3840C147 for ; Sun, 30 Jan 2005 17:50: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 j0UHo3nU003658; Sun, 30 Jan 2005 12:50:03 -0500 (EST) To: PFC Cc: "Ken Egervari" , pgsql-performance@postgresql.org Subject: Re: Performance problem with semi-large tables In-reply-to: References: <001601c50416$57090e10$cd422418@a96dfxb4kjzogw> <002201c50654$1a8c50b0$cd422418@a96dfxb4kjzogw> <000a01c5066a$0d1f43e0$cd422418@a96dfxb4kjzogw> Comments: In-reply-to PFC message dated "Sun, 30 Jan 2005 12:10:55 +0100" Date: Sun, 30 Jan 2005 12:50:02 -0500 Message-ID: <3657.1107107402@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: 200501/621 X-Sequence-Number: 10311 PFC writes: >> For example, let's add another filter to get all the shipments with >> release code '5' that are 7 days old or newer. >> >> ss.date >= current_date - 7 > It's the order by + limit which makes the query behaves badly, and which > forces use of kludges to use the index. If you add another condition like > that, it should be a breeze. Actually, that date condition has its own problem, namely that the compared-to value isn't a constant. The 8.0 planner is able to realize that this is a pretty selective condition, but prior releases fall back on a very pessimistic default estimate. I'm sure that has something to do with Ken not being able to get it to use an index on date. regards, tom lane From pgsql-performance-owner@postgresql.org Sun Jan 30 18:04:44 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 830FE40C1F0 for ; Sun, 30 Jan 2005 18:04: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 57134-08 for ; Sun, 30 Jan 2005 18:04:36 +0000 (GMT) Received: from rediffmail.com (unknown [203.199.83.37]) by svr1.postgresql.org (Postfix) with SMTP id 10CB440C1E3 for ; Sun, 30 Jan 2005 18:02:40 +0000 (GMT) Received: (qmail 5303 invoked by uid 510); 30 Jan 2005 18:04:10 -0000 Date: 30 Jan 2005 18:04:10 -0000 Message-ID: <20050130180410.5302.qmail@webmail27.rediffmail.com> Received: from unknown (202.88.246.214) by rediffmail.com via HTTP; 30 jan 2005 18:04:08 -0000 MIME-Version: 1.0 From: "N S" Reply-To: "N S" To: pgsql-performance@postgresql.org Subject: Re: Postgres server getting slow!! Content-type: multipart/alternative; boundary="Next_1107108248---0-203.199.83.37-5205" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.201 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE, MSGID_FROM_MTA_HEADER X-Spam-Level: * X-Archive-Number: 200501/622 X-Sequence-Number: 10312 This is a multipart mime message --Next_1107108248---0-203.199.83.37-5205 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I checked to find out the cause of the problem, ppp is disconnecting proper= ly and the user session is also closed smoothely.=0ABut when a report query= is run on the table containing 32500 records,=0Athe memory shoots up from = 50 MB to 500 MB(Total memory is 512 MB RAM).=0AAfter that the memory usage = never comes down .When some 4 or 5 user =0Aconnects, the remaining memory i= s utilised in a very little way, and finally the 6th or 7th user is denied = with database access.The server now becomes slow. =0A=0AWill running vacuum= help to solve the problem?=0A=0AThe total database dump is 50 MB and the /= var/lib/pgsql/data contains=0A700 MB of data.=0A=0A Which all paramters are= required to be increased in postgresq.conf.=0A=0A=0ARegds=0A=0AN S =0A=0AO= n Sun, 30 Jan 2005 N S wrote :=0A>=0A>=0A>Thanks tom. I checked the client = side software. The software closes connection when connected locally. But w= hen connected through dialup,=0A>this problem comes. I will check the ppp c= onnection also.=0A>Is there any method of killing old pids. And also any pe= rformance tuning to be done on postgresql.conf file.=0A>=0A>The database no= w contains 20K records. Will that cause a problem?=0A>=0A>Regds=0A>=0A>Nar= ayanan=0A>=0A>On Sat, 29 Jan 2005 Tom Lane wrote :=0A> >"Narayanan Subraman= iam Iyer" writes:=0A> > > 1) When 3 or 4 clients con= nect to this server, the pids are created and=0A> > > those pids are not ki= lled even after the client disconnects.=0A> >=0A> >In that case your client= s are not really disconnecting. Take a closer=0A> >look at your client-sid= e software.=0A> >=0A> > regards, tom lane=0A> >=0A> >-------------------= --------(end of broadcast)---------------------------=0A> >TIP 3: if postin= g/reading through Usenet, please send an appropriate=0A> > subscribe-= nomail command to majordomo@postgresql.org so that your=0A> > message= can get through to the mailing list cleanly=0A --Next_1107108248---0-203.199.83.37-5205 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0AI checked to find out the cause of the problem, ppp is disconnecting = properly and the user session is also closed smoothely.
=0ABut when a re= port query is run on the table containing 32500 records,
=0Athe memory s= hoots up from 50 MB to 500 MB(Total memory is 512 MB RAM).
=0AAfter that= the memory usage never comes down .When some 4 or 5 user
=0Aconnects, = the remaining memory is utilised in a very little way, and finally the 6th = or 7th user is denied with database access.The server now becomes slow. =0A
=0AWill running vacuum help to solve the problem?
=0A
=0AThe = total database dump is 50 MB and the /var/lib/pgsql/data contains
=0A700= MB of data.
=0A
=0A Which all paramters are required to be increased= in postgresq.conf.
=0A
=0A
=0ARegds
=0A
=0AN S
=0A
= =0AOn Sun, 30 Jan 2005 N S wrote :
=0A>
=0A>
=0A>Thanks t= om. I checked the client side software. The software closes connection when= connected locally. But when connected through dialup,
=0A>this probl= em comes. I will check the ppp connection also.
=0A>Is there any meth= od of killing old pids. And also any performance tuning to be done on postg= resql.conf file.
=0A>
=0A>The database now contains 20K records= . Will that cause  a problem?
=0A>
=0A>Regds
=0A>=0A>Narayanan
=0A>
=0A>On Sat, 29 Jan 2005 Tom Lane wrote :=
=0A> >"Narayanan Subramaniam Iyer" <bunix@rediffmail= .com> writes:
=0A> > > 1) When 3 or 4 clients connect to thi= s server, the pids are created and
=0A> > > those pids are not = killed even after the client disconnects.
=0A> >
=0A> >In= that case your clients are not really disconnecting.  Take a closer=0A> >look at your client-side software.
=0A> >
=0A>= >                regards, = tom lane
=0A> >
=0A> >---------------------------(end of = broadcast)---------------------------
=0A> >TIP 3: if posting/read= ing through Usenet, please send an appropriate
=0A> >   =   subscribe-nomail command to majordomo@postgresql.org so that your<= BR>=0A> >      message can get through to the mailing= list cleanly
=0A=0A

=0A

=0A=0A --Next_1107108248---0-203.199.83.37-5205-- From pgsql-performance-owner@postgresql.org Sun Jan 30 20:29:25 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3A83840C208 for ; Sun, 30 Jan 2005 20:29: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 97700-09 for ; Sun, 30 Jan 2005 20:29:16 +0000 (GMT) Received: from hosting.commandprompt.com (128.commandprompt.com [207.173.200.128]) by svr1.postgresql.org (Postfix) with ESMTP id D592140BFC8 for ; Sun, 30 Jan 2005 20:26: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 j0UKQSgf023877; Sun, 30 Jan 2005 12:26:29 -0800 Message-ID: <41FD4302.4040704@commandprompt.com> Date: Sun, 30 Jan 2005 12:26:42 -0800 From: "Joshua D. Drake" User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: N S Cc: pgsql-performance@postgresql.org Subject: Re: Postgres server getting slow!! References: <20050130180410.5302.qmail@webmail27.rediffmail.com> In-Reply-To: <20050130180410.5302.qmail@webmail27.rediffmail.com> Content-Type: multipart/mixed; boundary="------------080809040007080202010605" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.029 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/623 X-Sequence-Number: 10313 This is a multi-part message in MIME format. --------------080809040007080202010605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit N S wrote: > I checked to find out the cause of the problem, ppp is disconnecting > properly and the user session is also closed smoothely. > But when a report query is run on the table containing 32500 records, > the memory shoots up from 50 MB to 500 MB(Total memory is 512 MB RAM). > After that the memory usage never comes down .When some 4 or 5 user > connects, the remaining memory is utilised in a very little way, and > finally the 6th or 7th user is denied with database access.The server > now becomes slow. > > Will running vacuum help to solve the problem? > Sounds like you need to run vacuum and analyze. It also sounds like you may need to run vacuum full the first time. vacuum needs to be run regularly as does analyze. Sincerely, Joshua D. Drake > > The total database dump is 50 MB and the /var/lib/pgsql/data contains > 700 MB of data. > > Which all paramters are required to be increased in postgresq.conf. > > > Regds > > N S > > On Sun, 30 Jan 2005 N S wrote : > > > > > >Thanks tom. I checked the client side software. The software closes > connection when connected locally. But when connected through dialup, > >this problem comes. I will check the ppp connection also. > >Is there any method of killing old pids. And also any performance > tuning to be done on postgresql.conf file. > > > >The database now contains 20K records. Will that cause a problem? > > > >Regds > > > >Narayanan > > > >On Sat, 29 Jan 2005 Tom Lane wrote : > > >"Narayanan Subramaniam Iyer" writes: > > > > 1) When 3 or 4 clients connect to this server, the pids are > created and > > > > those pids are not killed even after the client disconnects. > > > > > >In that case your clients are not really disconnecting. Take a closer > > >look at your client-side software. > > > > > > 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 > > > > -- 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 --------------080809040007080202010605 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 --------------080809040007080202010605-- From pgsql-performance-owner@postgresql.org Mon Jan 31 14:54:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1CF0A8B9C01 for ; Mon, 31 Jan 2005 14:54: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 76049-05 for ; Mon, 31 Jan 2005 14:54:15 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 855F88B9CAA for ; Mon, 31 Jan 2005 14:49:14 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by www.postgresql.com (Postfix) with ESMTP id 263249A81F9 for ; Mon, 31 Jan 2005 04:17:30 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 71so713162wra for ; Sun, 30 Jan 2005 20:16:30 -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=p9pa17GNeZYPWgorzzzp+yGsPV0r/omKlbPVrtiLNHJrhOeKEPEDSQsFzmNKFtN/CnCYG0Er+InjEOmQoZ1+kUJE+/X5ClkrUlxj35+z9MmtbG1lW8jzd9gsLe3I0+aonS4EfrrOeVloPV7N8555aHWFn6OqxfK9mdZdtq7SUA0= Received: by 10.54.38.69 with SMTP id l69mr40076wrl; Sun, 30 Jan 2005 20:15:07 -0800 (PST) Received: by 10.54.18.59 with HTTP; Sun, 30 Jan 2005 20:15:07 -0800 (PST) Message-ID: <33c6269f0501302015490d9274@mail.gmail.com> Date: Sun, 30 Jan 2005 23:15:07 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Merlin Moncure Subject: Re: PostgreSQL clustering VS MySQL clustering Cc: pgsql-performance@postgresql.org In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3412A75F5@Herge.rcsinc.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <6EE64EF3AB31D5448D0007DD34EEB3412A75F5@Herge.rcsinc.local> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/627 X-Sequence-Number: 10317 fsync on. Alex Turner NetEconomist On Fri, 28 Jan 2005 11:19:44 -0500, Merlin Moncure wrote: > > With the right configuration you can get very serious throughput. The > > new system is processing over 2500 insert transactions per second. We > > don't need more RAM with this config. The disks are fast enough. > > 2500 transaction/second is pretty damn fast. > > fsync on/off? > > Merlin > > From pgsql-performance-owner@postgresql.org Mon Jan 31 12:20:29 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E78838B9CAC for ; Mon, 31 Jan 2005 12: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 38233-04 for ; Mon, 31 Jan 2005 12:20:12 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 767F48B9BC5 for ; Mon, 31 Jan 2005 12:19:01 +0000 (GMT) Received: from rediffmail.com (unknown [203.199.83.31]) by www.postgresql.com (Postfix) with SMTP id 808C79A866E for ; Mon, 31 Jan 2005 05:47:31 +0000 (GMT) Received: (qmail 21553 invoked by uid 510); 31 Jan 2005 05:47:37 -0000 Date: 31 Jan 2005 05:47:37 -0000 Message-ID: <20050131054737.21552.qmail@webmail46.rediffmail.com> Received: from unknown (202.88.231.207) by rediffmail.com via HTTP; 31 jan 2005 05:47:24 -0000 MIME-Version: 1.0 From: "N S" Reply-To: "N S" To: "Joshua D.Drake" Cc: pgsql-performance@postgresql.org Subject: Re: Postgres server getting slow!! Content-type: multipart/alternative; boundary="Next_1107150444---0-203.199.83.31-20838" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.806 tagged_above=0 required=5 tests=AWL, HTML_20_30, HTML_MESSAGE, MSGID_FROM_MTA_HEADER X-Spam-Level: X-Archive-Number: 200501/625 X-Sequence-Number: 10315 This is a multipart mime message --Next_1107150444---0-203.199.83.31-20838 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks joshua=0A=0A i tried running vacuum command, =0Avacuum database as= well as vacuum =0A=0Abut even after that querying t= he database , the memory shoots up=0Aas i mentioned in the previous mail an= d never comes down.=0AAlso the old pids of connections established remains = even after the=0Aconnection is closed.=0A=0AWill backing up the complete da= tabase, dropping and recreating can=0Amake any difference. =0A=0A=0AKindly = suggest=0A=0AThanks in advance=0A=0Aregards=0A=0AN S=0A=0A=0AOn Mon, 31 Jan= 2005 Joshua D.Drake wrote :=0A>N S wrote:=0A>=0A>>I checked to find out th= e cause of the problem, ppp is disconnecting properly and the user session = is also closed smoothely.=0A>>But when a report query is run on the table c= ontaining 32500 records,=0A>>the memory shoots up from 50 MB to 500 MB(Tota= l memory is 512 MB RAM).=0A>>After that the memory usage never comes down .= When some 4 or 5 user=0A>>connects, the remaining memory is utilised in a v= ery little way, and finally the 6th or 7th user is denied with database acc= ess.The server now becomes slow.=0A>>=0A>>Will running vacuum help to solve= the problem?=0A>>=0A>Sounds like you need to run vacuum and analyze. It al= so sounds like you=0A>may need to run vacuum full the first time.=0A>=0A>va= cuum needs to be run regularly as does analyze.=0A>=0A>Sincerely,=0A>=0A>Jo= shua D. Drake=0A>=0A>=0A>>=0A>>The total database dump is 50 MB and the /va= r/lib/pgsql/data contains=0A>>700 MB of data.=0A>>=0A>>Which all paramters = are required to be increased in postgresq.conf.=0A>>=0A>>=0A>>Regds=0A>>=0A= >>N S=0A>>=0A>>On Sun, 30 Jan 2005 N S wrote :=0A>> >=0A>> >=0A>> >Thanks t= om. I checked the client side software. The software closes connection when= connected locally. But when connected through dialup,=0A>> >this problem c= omes. I will check the ppp connection also.=0A>> >Is there any method of ki= lling old pids. And also any performance tuning to be done on postgresql.co= nf file.=0A>> >=0A>> >The database now contains 20K records. Will that caus= e a problem?=0A>> >=0A>> >Regds=0A>> >=0A>> >Narayanan=0A>> >=0A>> >On Sat= , 29 Jan 2005 Tom Lane wrote :=0A>> > >"Narayanan Subramaniam Iyer" writes:=0A>> > > > 1) When 3 or 4 clients connect to this s= erver, the pids are created and=0A>> > > > those pids are not killed even a= fter the client disconnects.=0A>> > >=0A>> > >In that case your clients are= not really disconnecting. Take a closer=0A>> > >look at your client-side = software.=0A>> > >=0A>> > > regards, tom lane=0A>> > >=0A>> = > >---------------------------(end of broadcast)---------------------------= =0A>> > >TIP 3: if posting/reading through Usenet, please send an appropria= te=0A>> > > subscribe-nomail command to majordomo@postgresql.org so th= at your=0A>> > > message can get through to the mailing list cleanly= =0A>>=0A>>=0A>>=0A>>=0A>= =0A>=0A>=0A>-- Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC an= d S/JDBC=0A>Postgresql support, programming shared hosting and dedicated ho= sting.=0A>+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt= .com=0A>PostgreSQL Replicator -- production quality replication for Postgre= SQL=0A>=0A --Next_1107150444---0-203.199.83.31-20838 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0A Thanks joshua
=0A
=0A  i tried running vacuum command, =0Avacuum database as well as vacuum <indvidual table names>
=0A=
=0Abut even after that querying the database , the memory shoots up
= =0Aas i mentioned in the previous mail and never comes down.
=0AAlso the= old pids of connections established remains even after the
=0Aconnectio= n is closed.
=0A
=0AWill backing up the complete database, dropping a= nd recreating can
=0Amake any difference.
=0A
=0A
=0AKindly su= ggest
=0A
=0AThanks in advance
=0A
=0Aregards
=0A
=0AN S<= BR>=0A
=0A
=0AOn Mon, 31 Jan 2005 Joshua D.Drake wrote :
=0A>N = S wrote:
=0A>
=0A>>I checked to find out the cause of the pr= oblem, ppp is disconnecting properly and the user session is also closed sm= oothely.
=0A>>But when a report query is run on the table containi= ng 32500 records,
=0A>>the memory shoots up from 50 MB to 500 MB(T= otal memory is 512 MB RAM).
=0A>>After that the memory usage never= comes down .When some 4 or 5 user
=0A>>connects, the remaining me= mory is utilised in a very little way, and finally the 6th or 7th user is d= enied with database access.The server now becomes slow.
=0A>>
= =0A>>Will running vacuum help to solve the problem?
=0A>>=0A>Sounds like you need to run vacuum and analyze. It also sounds like= you
=0A>may need to run vacuum full the first time.
=0A>
= =0A>vacuum needs to be run regularly as does analyze.
=0A>
=0A&= gt;Sincerely,
=0A>
=0A>Joshua D. Drake
=0A>
=0A>=0A>>
=0A>>The total database dump is 50 MB and the /var/li= b/pgsql/data contains
=0A>>700 MB of data.
=0A>>
=0A&g= t;>Which all paramters are required to be increased in postgresq.conf.=0A>>
=0A>>
=0A>>Regds
=0A>>
=0A>&= gt;N S
=0A>>
=0A>>On Sun, 30 Jan 2005 N S wrote :
=0A&= gt;> >
=0A>> >
=0A>> >Thanks tom. I checked t= he client side software. The software closes connection when connected loca= lly. But when connected through dialup,
=0A>> >this problem com= es. I will check the ppp connection also.
=0A>> >Is there any m= ethod of killing old pids. And also any performance tuning to be done on po= stgresql.conf file.
=0A>> >
=0A>> >The database now= contains 20K records. Will that cause  a problem?
=0A>> >=
=0A>> >Regds
=0A>> >
=0A>> >Narayanan<= BR>=0A>> >
=0A>> >On Sat, 29 Jan 2005 Tom Lane wrote :=
=0A>> > >"Narayanan Subramaniam Iyer" <bunix@r= ediffmail.com> writes:
=0A>> > > > 1) When 3 or 4 clie= nts connect to this server, the pids are created and
=0A>> > &g= t; > those pids are not killed even after the client disconnects.
=0A= >> > >
=0A>> > >In that case your clients are no= t really disconnecting.  Take a closer
=0A>> > >look at= your client-side software.
=0A>> > >
=0A>> > &g= t;                regards, tom lane=
=0A>> > >
=0A>> > >-------------------------= --(end of broadcast)---------------------------
=0A>> > >TIP= 3: if posting/reading through Usenet, please send an appropriate
=0A>= ;> > >      subscribe-nomail command to majordomo@p= ostgresql.org so that your
=0A>> > >      mes= sage can get through to the mailing list cleanly
=0A>>
=0A>&= gt;
=0A>>
=0A>><http://clients.rediff.com/signature/tr= ack_sig.asp>
=0A>
=0A>
=0A>
=0A>-- Command Promp= t, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
=0A>Postgresq= l support, programming shared hosting and dedicated hosting.
=0A>+1-5= 03-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
=0A>= ;PostgreSQL Replicator -- production quality replication for PostgreSQL
= =0A>
=0A=0A

=0A

=0A=0A --Next_1107150444---0-203.199.83.31-20838-- From pgsql-performance-owner@postgresql.org Mon Jan 31 12:52:33 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 158568B9B47 for ; Mon, 31 Jan 2005 12:52: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 43321-02 for ; Mon, 31 Jan 2005 12:52:16 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 72F998B9B4F for ; Mon, 31 Jan 2005 12:52:17 +0000 (GMT) Received: from rediffmail.com (unknown [203.199.83.39]) by www.postgresql.com (Postfix) with SMTP id 00AFA9A8823 for ; Mon, 31 Jan 2005 09:38:03 +0000 (GMT) Received: (qmail 26417 invoked by uid 510); 31 Jan 2005 09:38:36 -0000 Date: 31 Jan 2005 09:38:36 -0000 Message-ID: <20050131093836.26416.qmail@webmail29.rediffmail.com> Received: from unknown (202.88.231.207) by rediffmail.com via HTTP; 31 jan 2005 09:38:31 -0000 MIME-Version: 1.0 From: "N S" Reply-To: "N S" To: pgsql-performance@postgresql.org Subject: Re: Postgres server getting slow!! Content-type: multipart/alternative; boundary="Next_1107164311---0-203.199.83.39-26226" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.893 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE, MSGID_FROM_MTA_HEADER X-Spam-Level: X-Archive-Number: 200501/626 X-Sequence-Number: 10316 This is a multipart mime message --Next_1107164311---0-203.199.83.39-26226 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =0AThanks joshua=0A=0A i tried running vacuum command,=0Avacuum database= as well as vacuum =0A=0Abut even after that queryin= g the database , the memory shoots up=0Aas i mentioned in the previous mail= and never comes down.=0AAlso the old pids of connections established remai= ns even after the=0Aconnection is closed.=0A=0AWill backing up the complete= database, dropping and recreating can=0Amake any difference.=0A=0A=0AKindl= y suggest=0A=0AThanks in advance=0A=0Aregards=0A=0AN S=0A=0A=0A N S wrote:= =0A=0A> I checked to find out the cause of the problem, ppp is disconnectin= g=0A> properly and the user session is also closed smoothely.=0A> But when = a report query is run on the table containing 32500 records,=0A> the memory= shoots up from 50 MB to 500 MB(Total memory is 512 MB RAM).=0A> After that= the memory usage never comes down .When some 4 or 5 user=0A> connects, the= remaining memory is utilised in a very little way, and=0A> finally the 6th= or 7th user is denied with database access.The server=0A> now becomes slow= .=0A>=0A> Will running vacuum help to solve the problem?=0A>=0ASounds like = you need to run vacuum and analyze. It also sounds like you=0Amay need to r= un vacuum full the first time.=0A=0Avacuum needs to be run regularly as doe= s analyze.=0A=0ASincerely,=0A=0AJoshua D. Drake=0A=0A=0A>=0A> The total dat= abase dump is 50 MB and the /var/lib/pgsql/data contains=0A> 700 MB of data= .=0A>=0A> Which all paramters are required to be increased in postgresq.con= f.=0A>=0A>=0A> Regds=0A>=0A> N S=0A>=0A> On Sun, 30 Jan 2005 N S wrote :=0A= > >=0A> >=0A> >Thanks tom. I checked the client side software. The software= closes=0A> connection when connected locally. But when connected through d= ialup,=0A> >this problem comes. I will check the ppp connection also.=0A> >= Is there any method of killing old pids. And also any performance=0A> tunin= g to be done on postgresql.conf file.=0A> >=0A> >The database now contains = 20K records. Will that cause a problem?=0A> >=0A> >Regds=0A> >=0A> >Naraya= nan=0A> >=0A> >On Sat, 29 Jan 2005 Tom Lane wrote :=0A> > >"Narayanan Subra= maniam Iyer" writes:=0A> > > > 1) When 3 or 4 client= s connect to this server, the pids are=0A> created and=0A> > > > those pids= are not killed even after the client disconnects.=0A> > >=0A> > >In that c= ase your clients are not really disconnecting. Take a closer=0A> > >look a= t your client-side software.=0A> > >=0A> > > regards, tom la= ne=0A> > >=0A> > >---------------------------(end of=0A> broadcast)--------= -------------------=0A> > >TIP 3: if posting/reading through Usenet, please= send an appropriate=0A> > > subscribe-nomail command to majordomo@pos= tgresql.org so that your=0A> > > message can get through to the mailin= g list cleanly=0A>=0A>=0A>=0A> =20 --Next_1107164311---0-203.199.83.39-26226 Content-type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

=0A 
=0AThanks joshua
=0A
=0A  i tried running vacuu= m command,
=0Avacuum database as well as vacuum <indvidual table name= s>
=0A
=0Abut even after that querying the database , the memory s= hoots up
=0Aas i mentioned in the previous mail and never comes down.=0AAlso the old pids of connections established remains even after the
= =0Aconnection is closed.
=0A
=0AWill backing up the complete database= , dropping and recreating can
=0Amake any difference.
=0A
=0A
= =0AKindly suggest
=0A
=0AThanks in advance
=0A
=0Aregards
= =0A
=0AN S
=0A
=0A
=0A     N S wrote:
=0A
= =0A> I checked to find out the cause of the problem, ppp is disconnectin= g
=0A> properly and the user session is also closed smoothely.
=0A= > But when a report query is run on the table containing 32500 records,<= BR>=0A> the memory shoots up from 50 MB to 500 MB(Total memory is 512 MB= RAM).
=0A> After that the memory usage never comes down .When some 4= or 5 user
=0A> connects, the remaining memory is utilised in a very = little way, and
=0A> finally the 6th or 7th user is denied with datab= ase access.The server
=0A> now becomes slow.
=0A>
=0A> Wi= ll running vacuum help to solve the problem?
=0A>
=0ASounds like y= ou need to run vacuum and analyze. It also sounds like you
=0Amay need t= o run vacuum full the first time.
=0A
=0Avacuum needs to be run regul= arly as does analyze.
=0A
=0ASincerely,
=0A
=0AJoshua D. Drake<= BR>=0A
=0A
=0A>
=0A> The total database dump is 50 MB and th= e /var/lib/pgsql/data contains
=0A> 700 MB of data.
=0A>
=0A= > Which all paramters are required to be increased in postgresq.conf.=0A>
=0A>
=0A> Regds
=0A>
=0A> N S
=0A>=0A> On Sun, 30 Jan 2005 N S wrote :
=0A> >
=0A> >=0A> >Thanks tom. I checked the client side software. The software = closes
=0A> connection when connected locally. But when connected thr= ough dialup,
=0A> >this problem comes. I will check the ppp connec= tion also.
=0A> >Is there any method of killing old pids. And also= any performance
=0A> tuning to be done on postgresql.conf file.
= =0A> >
=0A> >The database now contains 20K records. Will tha= t cause  a problem?
=0A> >
=0A> >Regds
=0A> &g= t;
=0A> >Narayanan
=0A> >
=0A> >On Sat, 29 Jan 2= 005 Tom Lane wrote :
=0A> > >"Narayanan Subramaniam Iyer&q= uot; <bunix@rediffmail.com> writes:
=0A> > > > 1) When= 3 or 4 clients connect to this server, the pids are
=0A> created and=
=0A> > > > those pids are not killed even after the client = disconnects.
=0A> > >
=0A> > >In that case your cli= ents are not really disconnecting.  Take a closer
=0A> > >= look at your client-side software.
=0A> > >
=0A> > >= ;                regards, tom lane<= BR>=0A> > >
=0A> > >---------------------------(end of=
=0A> broadcast)---------------------------
=0A> > >TIP 3= : if posting/reading through Usenet, please send an appropriate
=0A> = > >      subscribe-nomail command to majordomo@postgre= sql.org so that your
=0A> > >      message can g= et through to the mailing list cleanly
=0A>
=0A>
=0A>
= =0A> <http://clients.rediff.com/signature/track_sig.asp> =0A

= =0A

=0A=0A --Next_1107164311---0-203.199.83.39-26226-- From pgsql-performance-owner@postgresql.org Mon Jan 31 11:04:37 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 730258B9D0D for ; Mon, 31 Jan 2005 11:04: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 26550-07 for ; Mon, 31 Jan 2005 11:04:29 +0000 (GMT) Received: from email07.aon.at (warsl404pip8.highway.telekom.at [195.3.96.102]) by svr1.postgresql.org (Postfix) with SMTP id 57F898B9D09 for ; Mon, 31 Jan 2005 11:04:29 +0000 (GMT) Received: (qmail 263654 invoked from network); 31 Jan 2005 11:04:23 -0000 Received: from m148p024.dipool.highway.telekom.at (HELO PASCAL) ([62.46.8.120]) (envelope-sender ) by email07.aon.at (qmail-ldap-1.03) with SMTP for ; 31 Jan 2005 11:04:23 -0000 From: Manfred Koizar To: "Peter Darley" Cc: "Richard Huxton" , "Pgsql-Performance" Subject: Re: Possibly slow query Date: Mon, 31 Jan 2005 12:06:01 +0100 Message-ID: References: <41F76482.7080001@archonet.com> In-Reply-To: X-Mailer: Forte Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.377 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/624 X-Sequence-Number: 10314 On Wed, 26 Jan 2005 07:16:25 -0800, "Peter Darley" wrote: >SELECT User_ID >FROM Assignments A NATURAL LEFT JOIN (SELECT * FROM Assignment_Settings >WHERE Setting='Status') ASet >WHERE A.User_ID IS NOT NULL > AND ASet.Assignment_ID IS NULL >GROUP BY User_ID; "ASet.Assignment_ID IS NULL" and "value IS NULL" as you had in your original post don't necessarily result in the same set of rows. SELECT DISTINCT a.User_ID FROM Assignments a LEFT JOIN Assignment_Settings s ON (a.Assignment_ID=s.Assignment_ID AND s.Setting='Status') WHERE a.User_ID IS NOT NULL AND s.Value IS NULL; Note how the join condition can contain subexpressions that only depend on columns from one table. BTW, |neo=# \d assignment_settings | [...] | setting | character varying(250) | not null | [...] |Indexes: | [...] | "assignment_settings_assignment_id_setting" unique, btree (assignment_id, setting) storing the setting names in their own table and referencing them by id might speed up some queries (and slow down others). Certainly worth a try ... Servus Manfred From pgsql-performance-owner@postgresql.org Mon Jan 31 15:16:51 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 703D58B9B86 for ; Mon, 31 Jan 2005 15:15: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 81416-08 for ; Mon, 31 Jan 2005 15:14:59 +0000 (GMT) Received: from mail.logi-track.com (burro.logi-track.com [213.239.193.212]) by svr1.postgresql.org (Postfix) with ESMTP id 6C6B18B9BE3 for ; Mon, 31 Jan 2005 14:54:19 +0000 (GMT) Received: from kingfisher.intern.logi-track.com (J0f7b.j.pppool.de [85.74.15.123]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logi-track.com (Postfix) with ESMTP id 9E126303D4; Mon, 31 Jan 2005 15:54:21 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logi-track.com (Postfix) with ESMTP id 0B14FAB3D2; Mon, 31 Jan 2005 15:54:14 +0100 (CET) Message-ID: <41FE4692.6080104@logi-track.com> Date: Mon, 31 Jan 2005 15:54:10 +0100 From: Markus Schaber User-Agent: Mozilla Thunderbird 1.0 (X11/20041218) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Christopher Kings-Lynne Cc: PostgreSQL Performance List Subject: Re: Automagic tuning References: <20040727151531.4f60b5b0@kingfisher.intern.logi-track.com> <41066485.7080502@familyhealth.com.au> In-Reply-To: <41066485.7080502@familyhealth.com.au> X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigF1B13BB5E45DE17BEE30DF02" 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: 200501/628 X-Sequence-Number: 10318 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF1B13BB5E45DE17BEE30DF02 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Hi, Cristopher, Christopher Kings-Lynne schrieb: >> Are there any tools that help with postgres/postgis performance tuning? >> >> So they measure the acutal tuple costs and cpu power, or suggest optimal >> values for the index sample counts? > > Have you turned on the stat_* settings in postgresql.conf and then > examined the pg_stat_* system views? As far as I examined, those views only count several things like fetched rows and pages, and cache hits. I would like something that really measures values like random_page_cost or cpu_tuple_cost that are hardware dependent. I assume such thing does not exist? Markus -- markus schaber | dipl. informatiker logi-track ag | rennweg 14-16 | ch 8001 z�rich phone +41-43-888 62 52 | fax +41-43-888 62 53 mailto:schabios@logi-track.com | www.logi-track.com --------------enigF1B13BB5E45DE17BEE30DF02 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 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB/kaTOVWsnapT9i0RAgvVAJ4gtEETn89bOZyix6DBSk9ZM1kI9ACghU2n BtGZLksqRxiubzDl2FpAIrs= =7RIX -----END PGP SIGNATURE----- --------------enigF1B13BB5E45DE17BEE30DF02-- From pgsql-performance-owner@postgresql.org Mon Jan 31 15:24:27 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 888268B9ED6 for ; Mon, 31 Jan 2005 15:24: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 83457-07 for ; Mon, 31 Jan 2005 15:24:13 +0000 (GMT) Received: from mail23.sea5.speakeasy.net (mail23.sea5.speakeasy.net [69.17.117.25]) by svr1.postgresql.org (Postfix) with ESMTP id 1AACE8BA1A1 for ; Mon, 31 Jan 2005 15:06:50 +0000 (GMT) Received: (qmail 17796 invoked from network); 31 Jan 2005 15:06:49 -0000 Received: from mail.kinesis-cem.com (HELO pdarley) ([64.81.9.230]) (envelope-sender ) by mail23.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 31 Jan 2005 15:06:48 -0000 From: "Peter Darley" To: "Manfred Koizar" Cc: "Richard Huxton" , "Pgsql-Performance" Subject: Re: Possibly slow query Date: Mon, 31 Jan 2005 07:06:50 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) 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: 200501/629 X-Sequence-Number: 10319 Manfred, Yeah, that was a typo. It should have been ASet.Value IS NULL. I have considered storing the setting names by key, since I do have a separate table with the names and a key as you suggest, but since my application is only ~75% finished, it's still pretty important to have human readable/editable tables. Thanks, Peter Darley -----Original Message----- From: Manfred Koizar [mailto:mkoi-pg@aon.at] Sent: Monday, January 31, 2005 3:06 AM To: Peter Darley Cc: Richard Huxton; Pgsql-Performance Subject: Re: [PERFORM] Possibly slow query On Wed, 26 Jan 2005 07:16:25 -0800, "Peter Darley" wrote: >SELECT User_ID >FROM Assignments A NATURAL LEFT JOIN (SELECT * FROM Assignment_Settings >WHERE Setting='Status') ASet >WHERE A.User_ID IS NOT NULL > AND ASet.Assignment_ID IS NULL >GROUP BY User_ID; "ASet.Assignment_ID IS NULL" and "value IS NULL" as you had in your original post don't necessarily result in the same set of rows. SELECT DISTINCT a.User_ID FROM Assignments a LEFT JOIN Assignment_Settings s ON (a.Assignment_ID=s.Assignment_ID AND s.Setting='Status') WHERE a.User_ID IS NOT NULL AND s.Value IS NULL; Note how the join condition can contain subexpressions that only depend on columns from one table. BTW, |neo=# \d assignment_settings | [...] | setting | character varying(250) | not null | [...] |Indexes: | [...] | "assignment_settings_assignment_id_setting" unique, btree (assignment_id, setting) storing the setting names in their own table and referencing them by id might speed up some queries (and slow down others). Certainly worth a try ... Servus Manfred From pgsql-performance-owner@postgresql.org Mon Jan 31 15:31:07 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EF81C8B9B83 for ; Mon, 31 Jan 2005 15:31: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 84941-08 for ; Mon, 31 Jan 2005 15:30:42 +0000 (GMT) Received: from mailer.elma.loc (mail.elma.fr [213.41.14.138]) by svr1.postgresql.org (Postfix) with ESMTP id 8B4D08B9BD1 for ; Mon, 31 Jan 2005 15:16:10 +0000 (GMT) Received: from mailer.elma.loc (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id D0E2EEC574; Mon, 31 Jan 2005 16:16:28 +0100 (CET) Received: from bigoo (nike.elma.fr [10.0.1.10]) by mailer.elma.loc (Postfix) with ESMTP id AAD34EC561; Mon, 31 Jan 2005 16:16:28 +0100 (CET) From: Olivier Sirven To: Marty Scholes Subject: Re: PostgreSQL clustering VS MySQL clustering Date: Mon, 31 Jan 2005 16:16:07 +0100 User-Agent: KMail/1.7.2 Cc: herve@elma.fr, pgsql-performance@postgresql.org References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> In-Reply-To: <41F14758.4030602@outputservices.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200501311616.07955.osirven@elma.fr> X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200501/630 X-Sequence-Number: 10320 Le Vendredi 21 Janvier 2005 19:18, Marty Scholes a =E9crit : > The indexes can be put on a RAM disk tablespace and that's the end of > index problems -- just make sure you have enough memory available. Also > make sure that the machine can restart correctly after a crash: the > tablespace is dropped and recreated, along with the indexes. This will > cause a machine restart to take some time. Tell me if I am wrong but it sounds to me like like an endless problem....T= his=20 solution may work with small indexes (less than 4GB) but what appends when= =20 the indexes grow ? You would add more memory to your server ? But there wil= l=20 be a moment were you can not add more so what's next ? From pgsql-performance-owner@postgresql.org Mon Jan 31 15:36:08 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 477198B9C54 for ; Mon, 31 Jan 2005 15:36: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 86225-06 for ; Mon, 31 Jan 2005 15:35:51 +0000 (GMT) Received: from outputservices.com (outputt1130.customer.frii.net [216.17.159.130]) by svr1.postgresql.org (Postfix) with ESMTP id 576158B9C47 for ; Mon, 31 Jan 2005 15:25:02 +0000 (GMT) Received: from outputservices.com (outputservices.com [137.106.76.15]) by outputservices.com (8.10.2+Sun/8.11.3) with ESMTP id j0VFOuJ07698; Mon, 31 Jan 2005 08:24:56 -0700 (MST) Message-ID: <41FE4DC7.7060903@outputservices.com> Date: Mon, 31 Jan 2005 08:24:55 -0700 From: Marty Scholes User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:0.9.9) Gecko/20020517 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Olivier Sirven Cc: herve@elma.fr, pgsql-performance@postgresql.org, Marty Scholes Subject: Re: PostgreSQL clustering VS MySQL clustering References: <41F144FE.30902@outputservices.com> <41F14758.4030602@outputservices.com> <200501311616.07955.osirven@elma.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable 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: 200501/631 X-Sequence-Number: 10321 > Tell me if I am wrong but it sounds to me like like > an endless problem.... Agreed. Such it is with caching. After doing some informal=20 benchmarking with 8.0 under Solaris, I am convinced that our major choke = point is WAL synchronization, at least for applications with a high=20 commit rate. We have noticed a substantial improvement in performance with 8.0 vs=20 7.4.6. All of the update/insert problems seem to have gone away, save=20 WAL syncing. I may have to take back what I said about indexes. Olivier Sirven wrote: > Le Vendredi 21 Janvier 2005 19:18, Marty Scholes a =E9crit : >=20 >>The indexes can be put on a RAM disk tablespace and that's the end of >>index problems -- just make sure you have enough memory available. Als= o >>make sure that the machine can restart correctly after a crash: the >>tablespace is dropped and recreated, along with the indexes. This will= >>cause a machine restart to take some time. >=20 > Tell me if I am wrong but it sounds to me like like an endless problem.= =2E..This=20 > solution may work with small indexes (less than 4GB) but what appends w= hen=20 > the indexes grow ? You would add more memory to your server ? But there= will=20 > be a moment were you can not add more so what's next ? From pgsql-performance-owner@postgresql.org Mon Jan 31 17:20:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E7EC58B9B5F for ; Mon, 31 Jan 2005 17:20: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 12365-02 for ; Mon, 31 Jan 2005 17:20:13 +0000 (GMT) Received: from web51410.mail.yahoo.com (web51410.mail.yahoo.com [206.190.38.189]) by svr1.postgresql.org (Postfix) with SMTP id 4B0A98B9BA9 for ; Mon, 31 Jan 2005 17:19:21 +0000 (GMT) Received: (qmail 20667 invoked by uid 60001); 31 Jan 2005 17:19:18 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=QgLExJqpTBpA3IO6MzB3DNhzIJdV2XGPM6kPuK7vY7c0ShJxO9jhBEgn3KXskmGEJXaAmlr2QE5OitivWZiRrdN9gWTBIST3+YKgMSb59lHHSMrdCF9VuHtephcwYq5HG5X7IzLw9ZI7mauOYYhktFv0/2h5DhZ0lKbZBYDhUmA= ; Message-ID: <20050131171918.20665.qmail@web51410.mail.yahoo.com> Received: from [192.88.67.254] by web51410.mail.yahoo.com via HTTP; Mon, 31 Jan 2005 09:19:18 PST Date: Mon, 31 Jan 2005 09:19:18 -0800 (PST) From: Bill Chandler Subject: Performance degredation at client site 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.89 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS X-Spam-Level: X-Archive-Number: 200501/632 X-Sequence-Number: 10322 Hello, Client is seeing continual performance degradation on updates and queries from a large database. Any help appreciated. Client is using PostgreSQL 7.4.2 on Sparcv9 650MHZ cpu, 2GB Ram, running Solaris. We have the following tables: EVENT_TBL evt_id bigserial, unique d1 numeric(13) obj_id numeric(6) d2 numeric(13) val varchar(22) correction numeric(1) delta numeric(13) CONTROL_TBL obj_id numeric(6), unique name varchar(22), unique dtype numeric(2) dfreq numeric(2) Indexes: EVENT_TBL.d1 (non-clustered) EVENT_TBL.obj_id (non-clustered) CONTROL_TBL.obj_id (non-clustered) CONTROL_TBL.name (clustered) Update processes run continually throughout the day in which rows are inserted but none deleted. The EVENT_TBL is currently very big, w/ over 5 million rows. The CONTROL_TBL is fairly small w/ around 4000 rows. We're doing a "VACUUM ANALYZE" on each table after each update has been completed and changes committed. Each night we drop all the indexes and recreate them. Do I understand correctly, however, that when you create a unique SERIAL column an index is automatically created on that column? If so, does that sound like a possible culprit? We are not doing any reindexing on that index at all. Could it be suffering from index bloat? Do we need to periodically explicity run the command: reindex index event_tbl_evt_id_key; ??? Even seemingly simple commands are taking forever. For example: select evt_id from event_tbl where evt_id=1; takes over a minute to complete. Here is a slightly more complicated example along with its explain output: select events.evt_id, ctrl.name, events.d1, events.val, events.d2, events.correction, ctrl.type, ctrl.freq from event_tbl events, control_tbl ctrl where events.obj_id = ctrl.obj_id and events.evt_id > 3690000 order by events.evt_id limit 2000; QUERY PLAN ----------------------------------------------------------------- Limit (cost=0.00..6248.56 rows=2000 width=118) -> Nested Loop (cost=0.00..7540780.32 rows=2413606 width=118) -> Index Scan using event_tbl_evt_id_key on event_tbl events (cost=0.00..237208.57 rows=2413606 width=63) Filter: (evt_id > 3690000) -> Index Scan using control_tbl_obj_id_idx on control_tbl ctrl (cost=0.00..3.01 rows=1 width=75) Index Cond: ("outer".obj_id = ctrl.obj_id) (6 rows) This takes minutes to return 2000 rows. Thank you in advance. Bill __________________________________ Do you Yahoo!? All your favorites on one personal page � Try My Yahoo! http://my.yahoo.com From pgsql-performance-owner@postgresql.org Mon Jan 31 17:48:20 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 380348B9E44 for ; Mon, 31 Jan 2005 17:48: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 19307-02 for ; Mon, 31 Jan 2005 17:48: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 2551C8B9D1C for ; Mon, 31 Jan 2005 17:46:20 +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 j0VHkJjb020888; Mon, 31 Jan 2005 12:46:19 -0500 (EST) To: Bill Chandler Cc: pgsql-performance@postgresql.org Subject: Re: Performance degredation at client site In-reply-to: <20050131171918.20665.qmail@web51410.mail.yahoo.com> References: <20050131171918.20665.qmail@web51410.mail.yahoo.com> Comments: In-reply-to Bill Chandler message dated "Mon, 31 Jan 2005 09:19:18 -0800" Date: Mon, 31 Jan 2005 12:46:19 -0500 Message-ID: <20887.1107193579@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: 200501/633 X-Sequence-Number: 10323 Bill Chandler writes: > Update processes run continually throughout the day in > which rows are inserted but none deleted. What about row updates? > Even seemingly simple commands are taking forever. > For example: > select evt_id from event_tbl where evt_id=1; > takes over a minute to complete. Since evt_id is a bigint, you need to write that as select evt_id from event_tbl where evt_id=1::bigint; or various other locutions that have the same effect. What you have is a bigint-vs-int comparison, which is not indexable in releases before 8.0. The same problem is occurring in your other example. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jan 31 18:13:57 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C63378B9CFB for ; Mon, 31 Jan 2005 18:13: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 25408-04 for ; Mon, 31 Jan 2005 18:13:52 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 5519F8B9BF6 for ; Mon, 31 Jan 2005 18:12:24 +0000 (GMT) Received: (qmail 3599 invoked from network); 31 Jan 2005 19:12:40 +0100 Received: from unknown (HELO musicbox) (boutiquenumerique-lists@192.168.0.2) by boutiquenumerique.com with SMTP; 31 Jan 2005 19:12:40 +0100 To: "Bill Chandler" , pgsql-performance@postgresql.org Subject: Re: Performance degredation at client site References: <20050131171918.20665.qmail@web51410.mail.yahoo.com> Message-ID: From: PFC 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, 31 Jan 2005 19:14:48 +0100 In-Reply-To: <20050131171918.20665.qmail@web51410.mail.yahoo.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.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/634 X-Sequence-Number: 10324 > Do I understand correctly, however, that when you > create a unique SERIAL column an index is > automatically created on that column? If so, does > that sound like a possible culprit? We are not doing > any reindexing on that index at all. Could it be > suffering from index bloat? Do we need to > periodically explicity run the command: SERIAL creates a sequence, not an index. UNIQUE and PRIMARY KEY do create indexes. Regards. From pgsql-performance-owner@postgresql.org Mon Jan 31 18:34:17 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 844788B9B26 for ; Mon, 31 Jan 2005 18:34: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 30542-01 for ; Mon, 31 Jan 2005 18:34:04 +0000 (GMT) Received: from web51404.mail.yahoo.com (web51404.mail.yahoo.com [206.190.38.183]) by svr1.postgresql.org (Postfix) with SMTP id 1F6B08BA0AC for ; Mon, 31 Jan 2005 18:32:02 +0000 (GMT) Received: (qmail 59939 invoked by uid 60001); 31 Jan 2005 18:32:00 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=LaPC7+uhv2mRWpLjtTZYDF7C8eESB9LtHIO+BpDuOtn50UBUK8p8rADxKJBZLZio7ePM/u4KGj50h47MlWknZqRPXOY9bHQ5wFb+8mGTZKJdzSzHIqtplnfaeMvNAzUPKQDurFAicHAyE+Pnw2kPVV3KcGv1f/RgwILRnkbCm58= ; Message-ID: <20050131183200.59937.qmail@web51404.mail.yahoo.com> Received: from [192.88.67.254] by web51404.mail.yahoo.com via HTTP; Mon, 31 Jan 2005 10:32:00 PST Date: Mon, 31 Jan 2005 10:32:00 -0800 (PST) From: Bill Chandler Subject: Re: Performance degredation at client site To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <20887.1107193579@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.796 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, FROM_ENDS_IN_NUMS X-Spam-Level: X-Archive-Number: 200501/635 X-Sequence-Number: 10325 Tom, Thank you! I will have the client try that. What about the event_tbl_evt_id_key index question. Could that also be causing me difficulties? Should I periodically reindex it? thanks, Bill --- Tom Lane wrote: > Bill Chandler writes: > > Update processes run continually throughout the > day in > > which rows are inserted but none deleted. > > What about row updates? > > > Even seemingly simple commands are taking forever. > > > For example: > > select evt_id from event_tbl where evt_id=1; > > takes over a minute to complete. > > Since evt_id is a bigint, you need to write that as > > select evt_id from event_tbl where evt_id=1::bigint; > > or various other locutions that have the same > effect. What you have is > a bigint-vs-int comparison, which is not indexable > in releases before 8.0. > > The same problem is occurring in your other example. > > regards, tom lane > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From pgsql-performance-owner@postgresql.org Mon Jan 31 20:05:48 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id E59478BA01D for ; Mon, 31 Jan 2005 20:05: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 51054-05 for ; Mon, 31 Jan 2005 20:05:38 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id BDAC68BA015 for ; Mon, 31 Jan 2005 20:05:34 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found 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 6972677; Mon, 31 Jan 2005 12:07:16 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Markus Schaber Subject: Re: Automagic tuning Date: Mon, 31 Jan 2005 12:09:31 -0800 User-Agent: KMail/1.7.1 Cc: Christopher Kings-Lynne , PostgreSQL Performance List References: <20040727151531.4f60b5b0@kingfisher.intern.logi-track.com> <41066485.7080502@familyhealth.com.au> <41FE4692.6080104@logi-track.com> In-Reply-To: <41FE4692.6080104@logi-track.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501311209.31827.josh@agliodbs.com> 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: 200501/636 X-Sequence-Number: 10326 Markus, > As far as I examined, those views only count several things like fetched > rows and pages, and cache hits. > > I would like something that really measures values like random_page_cost > or cpu_tuple_cost that are hardware dependent. > > I assume such thing does not exist? Nope. You gotta whip out your calculator and run some queries. -- --Josh Josh Berkus Aglio Database Solutions San Francisco From pgsql-performance-owner@postgresql.org Mon Jan 31 20:26:34 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3EFC38B9B36 for ; Mon, 31 Jan 2005 20:26: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 53041-04 for ; Mon, 31 Jan 2005 20:26:29 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8D9688B9B27 for ; Mon, 31 Jan 2005 20:26:30 +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 j0VKQCxH003901; Mon, 31 Jan 2005 15:26:12 -0500 (EST) To: josh@agliodbs.com Cc: Markus Schaber , Christopher Kings-Lynne , PostgreSQL Performance List Subject: Re: Automagic tuning In-reply-to: <200501311209.31827.josh@agliodbs.com> References: <20040727151531.4f60b5b0@kingfisher.intern.logi-track.com> <41066485.7080502@familyhealth.com.au> <41FE4692.6080104@logi-track.com> <200501311209.31827.josh@agliodbs.com> Comments: In-reply-to Josh Berkus message dated "Mon, 31 Jan 2005 12:09:31 -0800" Date: Mon, 31 Jan 2005 15:26:12 -0500 Message-ID: <3900.1107203172@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: 200501/637 X-Sequence-Number: 10327 Josh Berkus writes: >> I would like something that really measures values like random_page_cost >> or cpu_tuple_cost that are hardware dependent. >> >> I assume such thing does not exist? > Nope. You gotta whip out your calculator and run some queries. Preferably a whole lot of queries. All the measurement techniques I can think of are going to have a great deal of noise, so you shouldn't twiddle these cost settings based on just a few examples. regards, tom lane From pgsql-performance-owner@postgresql.org Mon Jan 31 20:42:18 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A546A8B9CD9 for ; Mon, 31 Jan 2005 20:42: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 54271-10 for ; Mon, 31 Jan 2005 20:41:59 +0000 (GMT) Received: from smtp20.libero.it (smtp20.libero.it [193.70.192.147]) by svr1.postgresql.org (Postfix) with ESMTP id 5DD0F8B9CA5 for ; Mon, 31 Jan 2005 20:41:47 +0000 (GMT) Received: from localhost (172.16.1.84) by smtp20.libero.it (7.0.027-DD01) id 41D02C980070AF3E for pgsql-performance@postgresql.org; Mon, 31 Jan 2005 21:41:46 +0100 Received: from [62.98.119.56] (62.98.119.56) by smtp1.libero.it (7.0.027-DD01) (authenticated as tdezotti@inwind.it) id 41BF654A0367664B for pgsql-performance@postgresql.org; Mon, 31 Jan 2005 21:41:42 +0100 Message-ID: <41FE97FC.3060106@streppone.it> Date: Mon, 31 Jan 2005 21:41:32 +0100 From: Cosimo Streppone User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgresql Performance list Subject: High end server and storage for a PostgreSQL OLTP system Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at libero.it serv5 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: 200501/638 X-Sequence-Number: 10328 Hi all, I've been following this list for nearly a year now. I've always managed to get PostgreSQL 7.1.x right for the job, which in my case is a large and complex oltp system, run under Pg for 6 years now. We were already planning the switch from 7.1 to 7.4 (or even 8.0). The last project we're facing with has a transaction volume that is something we've never dealt with. By "transaction" I mean something involving 10 to 10,000 (and more) sql queries (a complex mix of insert/ update/ delete/ select). I'd like to ask: 1) What kind of performance gain can I expect switching from 7.1 to 7.4 (or 8.0)? Obviously I'm doing my own testing, but I'm not very impressed by 8.0 speed, may be I'm doing testing on a low end server... 2) The goal is to make the db handle 100 tps (something like 100 users). What kind of server and storage should I provide? The actual servers our application runs on normally have 2 Intel Xeon processors, 2-4 Gb RAM, RAID 0/1/5 SCSI disk storage with hard drives @ 10,000 rpm 3) Highest I/O throughput SCSI adapters? Adaptec? 4) Is it correct to suppose that multiple RAID 1 arrays can provide the fastest I/O ? I usually reserve one RAID1 array to db data directory, one RAID1 array to pg_xlog directory and one RAID1 array for os and application needs. 5) OS and Pg specific tuning? Usually I modify shared memory settings and most of postgresql.conf available settings for 7.1, like `effective_cache', `shared_buffers', `wal_buffers', `wal_files', and so on. -- Cosimo From pgsql-performance-owner@postgresql.org Tue Feb 1 03:43:30 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 140B78B9D0A for ; Mon, 31 Jan 2005 21:14: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 57690-09 for ; Mon, 31 Jan 2005 21:14:40 +0000 (GMT) Received: from mink.eppcon.com (unknown [67.71.195.166]) by svr1.postgresql.org (Postfix) with ESMTP id 74D708B9D0F for ; Mon, 31 Jan 2005 21:14:40 +0000 (GMT) Subject: Index Slowing Insert >50x Date: Mon, 31 Jan 2005 16:14:39 -0500 Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C507D9.DFDAD7F5" X-MS-Has-Attach: X-MS-TNEF-Correlator: content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Thread-Topic: Index Slowing Insert >50x Thread-Index: AcUH2dqDUtweQoh5TX+aIfnKBBYmrA== From: "Trevor Ball" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.57 tagged_above=0 required=5 tests=HTML_BACKHAIR_8, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/1 X-Sequence-Number: 10330 This is a multi-part message in MIME format. ------_=_NextPart_001_01C507D9.DFDAD7F5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I have a data collector function in a PostGreSQL 7.4 DB running on Linux that inserts approximately 10000 records into a table every fifteen minutes. The table has two macaddr columns, one varchar(50) column, two timestamptz columns, five interval columns, one float8 column, and one int4 column. I have one multi-column B-tree index on the two macaddr columns, the varchar(50), and one of the timestamptz columns, in that order. The 10000-record insert takes approximately 2 minutes, which I thought seemed awfully slow, so I tried removing the index, and sure enough, without the index the insert took less than two seconds. I repeated the inserts many times (with and without the index) and there's very little other activity on this server, so I'm confident of these results. There are approximately 10000 fixed combinations of the first three indexed columns, and the fourth is the current time, so essentially what the function is doing is inserting a set of values for each of those 10000 fixed combinations for every fifteen minute period. I can see how this might be a worst-case scenario for an index, because the inserted rows are alone and evenly spaced through the index. Even so, it doesn't seem reasonable to me that an index would slow an insert more than 50-fold, regardless of hardware or the nature of the index. Am I wrong? Can anybody suggest why this would be happening and what I might be able to do about it? In production the table will have several million records, and the index is necessary for data retrieval from this table to be feasible, so leaving the index off is not an option. Thanks in advance, Trevor Ball ------_=_NextPart_001_01C507D9.DFDAD7F5 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Index Slowing Insert >50x

I = have a data collector function = in a PostGreSQL 7.4 DB running on = Linux that inserts approximately 10000 records = into a table = every fifteen minutes. The table has two macaddr = columns, one varchar(50) column, two timestamptz columns, five = interval columns, one float8 column, and = one int4 = column. I have one multi-column = B-tree = index on the two macaddr columns, the = varchar(50), and one of the timestamptz columns, in that = order.

The = 10000-record insert takes approximately 2 minutes, = which I thought seemed awfully slow, so I tried removing the = index, and sure enough, without the index = the insert took less than two seconds. I = repeated the inserts many times (with and without the = index) and theres very little other activity on this server, so = Im confident = of these = results.

There are approximately 10000 fixed = combinations of the first = three indexed columns, and the fourth is the current = time, so = essentially what the function = is doing is = inserting a set of values for each = of those 10000 fixed combinations for every fifteen minute = period. I can see how this might be a worst-case scenario for an = index, because the inserted rows are = alone and = evenly spaced through the = index. Even so, it = doesnt seem = reasonable to me that an index would slow an insert more than = 50-fold, regardless of hardware or the nature of the = index. Am I wrong? Can anybody suggest why = this would be happening and what I might be able to do about = it? In production the table will have several = million records, and the index is = necessary for data retrieval from this = table to be feasible, so leaving the index off is not an = option.

Thanks in advance,

Trevor Ball

------_=_NextPart_001_01C507D9.DFDAD7F5-- From pgsql-performance-owner@postgresql.org Mon Jan 31 21:35:21 2005 X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4B7848B9C27 for ; Mon, 31 Jan 2005 21:35: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 60631-03 for ; Mon, 31 Jan 2005 21:35: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 9F5008B9C02 for ; Mon, 31 Jan 2005 21:35:08 +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 j0VLZ8rN004430; Mon, 31 Jan 2005 16:35:08 -0500 (EST) To: Cosimo Streppone Cc: Postgresql Performance list Subject: Re: High end server and storage for a PostgreSQL OLTP system In-reply-to: <41FE97FC.3060106@streppone.it> References: <41FE97FC.3060106@streppone.it> Comments: In-reply-to Cosimo Streppone message dated "Mon, 31 Jan 2005 21:41:32 +0100" Date: Mon, 31 Jan 2005 16:35:08 -0500 Message-ID: <4429.1107207308@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: 200501/639 X-Sequence-Number: 10329 Cosimo Streppone writes: > 1) What kind of performance gain can I expect switching from > 7.1 to 7.4 (or 8.0)? Obviously I'm doing my own testing, > but I'm not very impressed by 8.0 speed, may be I'm doing > testing on a low end server... Most people report a noticeable speedup in each new release; we hit different things in different releases, but usually at least one performance gain is useful to any one person. For a jump as far as from 7.1 to 8.0 I'm surprised that you're not seeing any gain at all. What was your test case exactly? Have you perhaps tuned your app so specifically to 7.1 that you need to detune it? regards, tom lane