diff --git "a/pgsql-performance.200607" "b/pgsql-performance.200607" new file mode 100644--- /dev/null +++ "b/pgsql-performance.200607" @@ -0,0 +1,33365 @@ +From pgsql-performance-owner@postgresql.org Sun Jul 2 03:26:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4F6959FA4E4 + for ; + Sun, 2 Jul 2006 03:26:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66955-03 for + ; + Sun, 2 Jul 2006 03:26:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz + [203.96.152.181]) + by postgresql.org (Postfix) with ESMTP id 170DD9FA250 + for ; + Sun, 2 Jul 2006 03:26:04 -0300 (ADT) +Received: from smtp-1.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J1R000O9J7EHL@linda-2.paradise.net.nz> for + pgsql-performance@postgresql.org; Sun, 02 Jul 2006 18:26:03 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-28-133.dsl.clear.net.nz [218.101.28.133]) by + smtp-1.paradise.net.nz (Postfix) with ESMTP id 52F2711B41DC; + Sun, 02 Jul 2006 18:26:02 +1200 (NZST) +Date: Sun, 02 Jul 2006 18:25:56 +1200 +From: Mark Kirkwood +Subject: Re: [pgadmin-support] 100% CPU +In-reply-to: <20060630175834.GH17241@pervasive.com> +To: Peter Newman +Cc: "Jim C. Nasby" , pgsql-performance@postgresql.org +Message-id: <44A766F4.8040606@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5 (X11/20060417) +References: + + <20060630175834.GH17241@pervasive.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/1 +X-Sequence-Number: 19861 + +Jim C. Nasby wrote: +> moving to -performance +> +> On Fri, Jun 30, 2006 at 08:32:39AM +0100, Peter Newman wrote: +>> Good Morning +>> +>> I am new to postgres and have been asked to look at a server where we +>> truncate a table then load data. +>> +>> The CPU has started to hit 100% usage during this process. +>> + +This could be a good sign! - if you are using COPY into a table with no +indexes and your machine has a good IO subsystem, then typically cpu +becomes the limiting factor. However as Jim suggested, more details +would be good, otherwise we are just guessing! + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Sun Jul 2 11:36:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 14EDC9FA605 + for ; + Sun, 2 Jul 2006 11:36:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74798-04 for + ; + Sun, 2 Jul 2006 11:36:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.179]) + by postgresql.org (Postfix) with ESMTP id 663029FA50D + for ; + Sun, 2 Jul 2006 11:36:22 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id 39so687158pyu + for ; + Sun, 02 Jul 2006 07:36:20 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=JXKXYkDqYU3KBEPcgnqoa6bVRhqPHPoYyq3+me9knLkhoMEB+yP6Sk/3fxuHWAPaebPTP0AEGAw9VomyNgdDA3eGhghAhcrso2Cxs0BQk7czrJaXyQAaXN5pAHM8zuxzOvpFulygTzPhD6ZFE1jJGXyCnMbzldBEgBujtk+4uRw= +Received: by 10.35.70.17 with SMTP id x17mr2062846pyk; + Sun, 02 Jul 2006 07:36:20 -0700 (PDT) +Received: by 10.35.48.20 with HTTP; Sun, 2 Jul 2006 07:36:20 -0700 (PDT) +Message-ID: +Date: Sun, 2 Jul 2006 09:36:20 -0500 +From: "Jaime Casanova" +To: "Jozsef Szalay" +Subject: Re: FWD: Update touches unrelated indexes? +Cc: "Tom Lane" , pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/2 +X-Sequence-Number: 19862 + +> >This surprises you why? +> +> I don't know anything about how PG stores keys along with their +> references to the actual rows but my assumption was that that reference +> is some sort of an index into a table that maps the reference to an +> actual disk/file address. So even if the row or the page with the row on +> it is physically moved to a different location in the disk file, the +> unrelated indexes would not have to be changed because only the +> disk/file address changes but the reference does not. If PG does not +> work in a similar fashion then I understand the locks. +> + +When you update a table postgres makes a copy of the row being updated +so it has to create new index entries pointing to the new version of +the row... but it keeps old index entries pointing to the prior +version of the row because if there are concurrent queries to those +tables that looks for that particular row and you haven't committed +yet we still want the old version (old index entry)... + +-- +regards, +Jaime Casanova + +"Programming today is a race between software engineers striving to +build bigger and better idiot-proof programs and the universe trying +to produce bigger and better idiots. +So far, the universe is winning." + Richard Cook + +From pgsql-performance-owner@postgresql.org Sun Jul 2 18:50:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DB7639FA5FC + for ; + Sun, 2 Jul 2006 18:50:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 70572-01 for + ; + Sun, 2 Jul 2006 18:50:39 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wr-out-0506.google.com (wr-out-0506.google.com + [64.233.184.227]) + by postgresql.org (Postfix) with ESMTP id 113159FA163 + for ; + Sun, 2 Jul 2006 18:50:38 -0300 (ADT) +Received: by wr-out-0506.google.com with SMTP id 37so920199wra + for ; + Sun, 02 Jul 2006 14:50:37 -0700 (PDT) +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:content-disposition; + b=AYOSXd0siu9kzwH+L0H9hViJJt3BWU7XnFNOsDvSDEq2qZx9QRLUokCTWlP0WFowVwNs2SjUzOAVwkeHB05YAYhjy1spTV60Bguzm3Neu66HqondxpqiU++fOAxAWQiKJjURkkhRRIvCsslJk/REeuyn2m3L0Ih7zJfKbz6YHQo= +Received: by 10.64.48.20 with SMTP id v20mr2555984qbv; + Sun, 02 Jul 2006 14:50:37 -0700 (PDT) +Received: by 10.65.114.11 with HTTP; Sun, 2 Jul 2006 14:50:37 -0700 (PDT) +Message-ID: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> +Date: Sun, 2 Jul 2006 17:50:37 -0400 +From: Gene +Reply-To: genekhart@gmail.com +To: pgsql-performance@postgresql.org +Subject: optimizing LIKE '%2345' queries +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/3 +X-Sequence-Number: 19863 + +Is there any way to create a reverse index on string columns so that +queries of the form: + +where column like '%2345'; + +can use an index and perform as fast as searching with like '2345%'? + +Is the only way to create a reverse function and create an index using +the reverse function and modify queries to use: + +where reverse(column) like reverse('%2345') ? + +thanks + +-- +Eugene Hart +Cell: 443-604-2679 + +From pgsql-performance-owner@postgresql.org Mon Jul 3 04:34:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CE5579FA5C3 + for ; + Mon, 3 Jul 2006 04:34:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50969-04 for + ; + Mon, 3 Jul 2006 04:33:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 168559FA2F3 + for ; + Mon, 3 Jul 2006 04:33:58 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from relay.icomedias.com (relay.icomedias.com [62.99.232.66]) + by svr4.postgresql.org (Postfix) with ESMTP id A6E755AF04A + for ; + Mon, 3 Jul 2006 07:33:57 +0000 (GMT) +Received: from loki.icomedias.com ([10.192.17.128]) + by relay.icomedias.com (8.13.6/8.13.6) with ESMTP id k637XrnR026808; + Mon, 3 Jul 2006 09:33:53 +0200 +From: Mario Weilguni +To: pgsql-performance@postgresql.org, genekhart@gmail.com +Subject: Re: optimizing LIKE '%2345' queries +Date: Mon, 3 Jul 2006 09:33:53 +0200 +User-Agent: KMail/1.9.3 +References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> +In-Reply-To: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200607030933.53373.mweilguni@sime.com> +X-Scanned-By: MIMEDefang 2.54 on 10.192.64.200 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/6 +X-Sequence-Number: 19866 + +Am Sonntag, 2. Juli 2006 23:50 schrieb Gene: +> Is there any way to create a reverse index on string columns so that +> queries of the form: +> +> where column like '%2345'; +> +> can use an index and perform as fast as searching with like '2345%'? +> +> Is the only way to create a reverse function and create an index using +> the reverse function and modify queries to use: +> +> where reverse(column) like reverse('%2345') ? +> +> thanks + +create a trigger that computes this at insert/update time, index this fix, and +rewrite the query this way: +where inverted_column like '5432%'; + + +From pgsql-performance-owner@postgresql.org Mon Jul 3 09:39:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 598039FA357 + for ; + Mon, 3 Jul 2006 09:39:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88998-02 for + ; + Mon, 3 Jul 2006 09:38:50 -0300 (ADT) +X-Greylist: delayed 00:59:59.596434 by SQLgrey- +Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) + by postgresql.org (Postfix) with ESMTP id 4DF129FA232 + for ; + Mon, 3 Jul 2006 09:38:50 -0300 (ADT) +Received: from [127.0.0.1] ([24.202.239.251]) by VL-MO-MR002.ip.videotron.ca + (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) + with ESMTP id <0J1T00LWRSCNWV90@VL-MO-MR002.ip.videotron.ca> for + pgsql-performance@postgresql.org; Mon, 03 Jul 2006 07:38:48 -0400 (EDT) +Date: Mon, 03 Jul 2006 07:41:33 -0400 +From: David Gagnon +Subject: Is postgresql ca do the job for software deployed in ASP ou SaaS + mode? +In-reply-to: <200607030933.53373.mweilguni@sime.com> +To: pgsql-performance@postgresql.org +Message-id: <44A9026D.7090903@siunik.com> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> + <200607030933.53373.mweilguni@sime.com> +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/7 +X-Sequence-Number: 19867 + +Hi all, + + I've been working on my personal project for 3.5 years now. I +developed an ERP system in web/java. Now the people I will work with +suggest to offers it in Saas mode. Which means my customer will connect +to my website and found they ERP software and data there. It's not the +deployment I planned initially so if you can just validate some +technicals points to be sure it's not crazy using Postgresl here and not +a big $$$ db to do the job. + +Typically I will have 1db per client and around 150 tables per db. So +since I hope I didn`t work all those year for nothing .. I expect to +have bunch of clients witch means the same amount of db since I have 1 +db/client. + +Can I hope having several hundred of db on 1 db server? Like 250 dbs = +250 client = 360 000 tables !!! +So is there a limit for the number of db in the db server ?(this spec is +not on the website) +What about the performance? Can I expect to have the same performance? + +Since I put everything on the web I do needs an High Availability +infrastructure. I looked into SlonyI and Mammoth to replicate the db +but since SlonyI use triggers can I expect it to do the job? Is Mammoth +is the only available solution? + +Last question and not the least I'm reading this performance list for +several years now and know suggestion about hardware to run postgresl is +discussed. Since I wrote software there severals points about hardware +that I don`t understand. Do you have any suggestion of platform to run +into my Saas configuration? I do need the WISE one! I'm pretty sure +that if I was a big company I would be able throw bunch of $$$$ but it's +not my case. I'm pretty sure it exists out there some piece of Hardware +that would do the job perfectly with a fair price. + +So far I did understand that Postgresql loves Opteron and I have looked +into the dl145 series of HP. I did understand that Dell Hardware it`s +not reliable. But it's still not clear what should be my requirement +for memory, disk, nb cpu, cpu power, etc. + +I'm pretty sure it`s better to have more slower CPUs that having the +latest Opteron available on the market, or more slower servers that +having the fastest one... am I right? But agains what it`s the optimal +choice? + +Thanks you to share your knowledge on those point. I do consider using +Postgresql is the Smart choice in my project since the beginning but +before putting all the money (That I don`t have ..:-)) to buy some +hardware I just want to be sure I'm not crazy! + +Thanks for your help I really appreciate it!! + +Best Regards +/David + + + + + + + +From pgsql-performance-owner@postgresql.org Mon Jul 3 14:00:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C16639FA621 + for ; + Mon, 3 Jul 2006 14:00:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27022-10 for + ; + Mon, 3 Jul 2006 14:00:31 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web31809.mail.mud.yahoo.com (web31809.mail.mud.yahoo.com + [68.142.207.72]) by postgresql.org (Postfix) with SMTP id 4E5DF9FA232 + for ; + Mon, 3 Jul 2006 14:00:28 -0300 (ADT) +Received: (qmail 37008 invoked by uid 60001); 3 Jul 2006 17:00:27 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=m4kxP/9i8Qk7TE9p5NKnZgcbovOQ4o/PdW1+nKE9zHMS8H2h447Pus/L6F3Mi+p6NQW2WIitCBKLM8aYqHwcy7ji70c/Sj1Q2GWJq0NUBEYIgcVAQWrTldR/yc80lF16T9BhMJriElquSwFWkJWipA2HdXbfloXbdI9rYWkug4Q= + ; +Message-ID: <20060703170027.37006.qmail@web31809.mail.mud.yahoo.com> +Received: from [65.211.203.26] by web31809.mail.mud.yahoo.com via HTTP; + Mon, 03 Jul 2006 10:00:27 PDT +Date: Mon, 3 Jul 2006 10:00:27 -0700 (PDT) +From: Richard Broersma Jr +Subject: Re: Is postgresql ca do the job for software deployed in ASP ou SaaS + mode? +To: David Gagnon , pgsql-performance@postgresql.org +In-Reply-To: <44A9026D.7090903@siunik.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/8 +X-Sequence-Number: 19868 + +> Typically I will have 1db per client and around 150 tables per db. So +> since I hope I didn`t work all those year for nothing .. I expect to +> have bunch of clients witch means the same amount of db since I have 1 +> db/client. +> +> Can I hope having several hundred of db on 1 db server? Like 250 dbs = +> 250 client = 360 000 tables !!! +> So is there a limit for the number of db in the db server ?(this spec is +> not on the website) + +I'll take a stab at this question. + +Each table and database are referenced by an OID. + +So the sum(tables) + sum(database) << max-size(OID). +In my case max-size of OID (I believe) is 9223372036854775807. +So if you limited yourself to 1% of the OIDs for use as tables and databases then you could +potentially have 92233720368547758 table or database. + +Each database create produces a directory with the database OID: +./data/base/10792 +./data/base/10793 +./data/base/16814 +... +... + +since the creation of a new db produces a directory, one limitation would come from your +file-systems limitation on the number of sub-directories that are allowed. + +Each table with-in the database is assigned an OID and is located inside the DB directory. So if +there is a file-system limitation on the number of files with-in a given directory it would also +be a limit to the number of tables that could be created for each database. + +The only other limitation that I am aware of is the storage capacity of you DB server. + +If there are additional limitations beyond these I would be interested in knowing about them and +adding them to the http://www.postgresql.org/about/ we be helpful also. + +Regards, + +Richard Broersma Jr. + +From pgsql-performance-owner@postgresql.org Mon Jul 3 14:20:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 576FE9FA232 + for ; + Mon, 3 Jul 2006 14:20:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32158-03 for + ; + Mon, 3 Jul 2006 14:20:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.192]) + by postgresql.org (Postfix) with ESMTP id 5718E9FA192 + for ; + Mon, 3 Jul 2006 14:20:22 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id s13so183233wxc + for ; + Mon, 03 Jul 2006 10:20:21 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=Yk4/U68nNJJvXQn4D5jCIwRR7MXh9opjfn4yIrPOVSf9Y6ybZxDrGgtUNxZa35KNiiPqNJTVl8ey2ojKfCUXjk1TJ5BO1TVkYkL3xlfKdBPmzwQO5KOgyOdwbV0CmJLv9Kr976CPdVOrHHjX8Cm4fNlOJOPdbYxTiY20VT2sXX8= +Received: by 10.70.90.18 with SMTP id n18mr6167638wxb; + Mon, 03 Jul 2006 10:20:21 -0700 (PDT) +Received: by 10.70.73.15 with HTTP; Mon, 3 Jul 2006 10:20:20 -0700 (PDT) +Message-ID: <1d219a6f0607031020w4c578c54x89877b8055dac756@mail.gmail.com> +Date: Mon, 3 Jul 2006 13:20:20 -0400 +From: "Chris Hoover" +To: "David Gagnon" +Subject: Re: Is postgresql ca do the job for software deployed in ASP ou SaaS + mode? +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44A9026D.7090903@siunik.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_46496_21554929.1151947220749" +References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> + <200607030933.53373.mweilguni@sime.com> <44A9026D.7090903@siunik.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/9 +X-Sequence-Number: 19869 + +------=_Part_46496_21554929.1151947220749 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 7/3/06, David Gagnon wrote: +> +> +> Can I hope having several hundred of db on 1 db server? Like 250 dbs = +> 250 client = 360 000 tables !!! +> So is there a limit for the number of db in the db server ?(this spec is +> not on the website) +> What about the performance? Can I expect to have the same performance? + + + +I am running a similar environment. Each of our customers has a seperate +database with serveral hundred tables per database. One of our servers is +running over 200 customer databases with absolutely no problems. + +HTH, + +chris + +------=_Part_46496_21554929.1151947220749 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 7/3/06, David Gagnon <dgagnon@siunik.com> wrote:
+
Can I hope having several hundred of db on 1 db server?  Like 250 dbs =
250 client = 360 000 tables !!!
So is there a limit for the number of db in the db server ?(this spec is
not on the website)
What about the performance? Can I expect to have the same performance? +


I am running a similar environment.  Each of our customers has a seperate database with serveral hundred tables per database.  One of our servers is running over 200 customer databases with absolutely no problems. +

HTH,

chris

+ +------=_Part_46496_21554929.1151947220749-- + +From pgsql-performance-owner@postgresql.org Mon Jul 3 15:37:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A5D209FA250 + for ; + Mon, 3 Jul 2006 15:37:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40830-03 for + ; + Mon, 3 Jul 2006 15:37:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 4987B9FA232 + for ; + Mon, 3 Jul 2006 15:37:27 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k63Ipo24030280; Mon, 3 Jul 2006 11:51:50 -0700 +Message-ID: <44A9557B.20603@modgraph-usa.com> +Date: Mon, 03 Jul 2006 10:35:55 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: David Gagnon +CC: pgsql-performance@postgresql.org +Subject: Re: Is postgresql ca do the job for software deployed in +References: <20060703170027.37006.qmail@web31809.mail.mud.yahoo.com> +In-Reply-To: <20060703170027.37006.qmail@web31809.mail.mud.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/10 +X-Sequence-Number: 19870 + +Richard Broersma Jr wrote: +> Each table with-in the database is assigned an OID and is located inside the DB directory. So if +> there is a file-system limitation on the number of files with-in a given directory it would also +> be a limit to the number of tables that could be created for each database. + +You could handle this with tablespaces. For example, create ten tablespaces, and then assign customer databases to them in round-robin fashion. This also lets you assign databases to different disks to balance the I/O load. + +Craig + +From pgsql-bugs-owner@postgresql.org Mon Jul 3 18:03:03 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8BB859FA250 + for ; + Mon, 3 Jul 2006 18:03:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57182-04 for ; + Mon, 3 Jul 2006 18:02:49 -0300 (ADT) +X-Greylist: delayed 00:32:50.790414 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 9893B9FA232 + for ; Mon, 3 Jul 2006 18:02:46 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from szalupa.batory.org.pl (pompka.batory.org.pl [62.89.72.236]) + by svr4.postgresql.org (Postfix) with ESMTP id 324025AF038 + for ; Mon, 3 Jul 2006 20:29:54 +0000 (GMT) +Received: from opal.localdomain (ntwklan-62-233-204-42.devs.futuro.pl + [62.233.204.42]) (authenticated bits=0) + by szalupa.batory.org.pl (8.13.6/8.13.6) with ESMTP id k63KTnN6023870 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Mon, 3 Jul 2006 22:29:50 +0200 +Received: from opal.localdomain (localhost.localdomain [127.0.0.1]) + by opal.localdomain (8.13.6/8.13.4) with ESMTP id k63KV826007022 + for ; Mon, 3 Jul 2006 22:31:08 +0200 +Received: (from tometzky@localhost) + by opal.localdomain (8.13.6/8.13.6/Submit) id k63KV79W007019 + for pgsql-bugs@postgresql.org; Mon, 3 Jul 2006 22:31:07 +0200 +X-Authentication-Warning: opal.localdomain: tometzky set sender to + using -f +Date: Mon, 3 Jul 2006 22:31:07 +0200 +From: Tomasz Ostrowski +To: pgsql-bugs@postgresql.org +Subject: query very slow when enable_seqscan=on +Message-ID: <20060703203105.GA2801@batory.org.pl> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.2.1i +X-Scanned-By: MIMEDefang 2.57 on 62.89.72.236 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/11 +X-Sequence-Number: 15356 + +I have a very slow query when enable_seqscan=on and very fast when +enable_seqscan=off. My schema looks like this (relevant columns +only): + +create table organizations ( + organization_id serial primary key, + organization varchar(200) not null, + organization_location varchar(55) not null + -- and several irrelevant columns +); -- about 9000 records +create table persons ( + person_id serial primary key, + surname varchar(50) not null, + forename varchar(35) not null, + organization_id int references organizations, + -- and several irrelevant columns +); -- about 6500 records +create index persons_surname_forename_person_id on persons ( + surname, + forename, + lpad(person_id,10,'0') +); -- I was hoping this would speed up array comparisions + + +The query looking for a position of a person of given person_id in a +list sorted by surname, forename and person_id and filtered by some +criteria. In this example person_id=1, forename~*'to' (about 400 +people) and organization_location~*'warszawa' (about 2000 +organizations): + +select count(*) as position from (select + person_id, surname, forename + from persons + natural left join organizations + where forename~*'to' and organization_location~*'warszawa' + ) as person_filter + where array[surname, forename, lpad(person_id,10,'0')] + < + (select array[surname, forename, lpad(person_id,10,'0')] + from persons where person_id=1); + +This query take about 30 seconds when enable_seqscan=on and 65 +milliseconds when off. + +When enable_seqscan=on: + Aggregate (cost=785.72..785.73 rows=1 width=0) (actual time=27948.955..27948.956 rows=1 loops=1) + InitPlan + -> Index Scan using persons_pkey on persons (cost=0.00..3.11 rows=1 width=26) (actual time=0.019..0.019 rows=0 loops=1) + Index Cond: (person_id = 1) + -> Nested Loop (cost=0.00..782.60 rows=1 width=0) (actual time=27948.939..27948.939 rows=0 loops=1) + Join Filter: ("inner".organization_id = "outer".organization_id) + -> Seq Scan on organization (cost=0.00..480.95 rows=1 width=4) (actual time=0.071..69.702 rows=1892 loops=1) + Filter: ((organization_location)::text ~* 'warszawa'::text) + -> Seq Scan on persons (cost=0.00..296.10 rows=444 width=4) (actual time=14.720..14.720 rows=0 loops=1892) + Filter: (((forename)::text ~* 'to'::text) AND (ARRAY[surname, forename, (lpad((person_id)::text, 10, '0'::text))::character varying] < $0)) + Total runtime: 27949.106 ms + +When enable_seqscan=off: + Aggregate (cost=100001710.26..100001710.27 rows=1 width=0) (actual time=66.788..66.789 rows=1 loops=1) + InitPlan + -> Index Scan using persons_pkey on persons (cost=0.00..3.11 rows=1 width=26) (actual time=0.019..0.019 rows=0 loops=1) + Index Cond: (person_id = 1) + -> Hash Join (cost=100001408.81..100001707.14 rows=1 width=0) (actual time=66.756..66.756 rows=0 loops=1) + Hash Cond: ("outer".organization_id = "inner".organization_id) + -> Seq Scan on persons (cost=100000000.00..100000296.10 rows=444 width=4) (actual time=14.972..14.972 rows=0 loops=1) + Filter: (((forename)::text ~* 'to'::text) AND (ARRAY[surname, forename, (lpad((person_id)::text, 10, '0'::text))::character varying] < $0)) + -> Hash (cost=1408.81..1408.81 rows=1 width=4) (actual time=51.763..51.763 rows=1892 loops=1) + -> Index Scan using organizations_pkey on organizations (cost=0.00..1408.81 rows=1 width=4) (actual time=0.049..48.233 rows=1892 loops=1) + Filter: ((organization_location)::text ~* 'warszawa'::text) + Total runtime: 66.933 ms + + +Database is properly analyzed. postgresql-8.1.4 on Fedora Core 4. + +Regards +Tometzky + +PS. Actual table and column names are different (they're in Polish) +but I've translated them for better readability for english-speaking. + +PS. I wonder if it makes sense to "enable_seqscan=off" for every client +if a database is small enough to fit in OS cache. +-- +...although Eating Honey was a very good thing to do, there was a +moment just before you began to eat it which was better than when you +were... + Winnie the Pooh + +From pgsql-bugs-owner@postgresql.org Mon Jul 3 20:06:03 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 88A279FA605; + Mon, 3 Jul 2006 20:06:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 87415-04; Mon, 3 Jul 2006 20:05:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.171]) + by postgresql.org (Postfix) with ESMTP id 77DB89FA60B; + Mon, 3 Jul 2006 20:05:56 -0300 (ADT) +Received: from [84.12.170.54] (helo=[192.168.0.2]) + by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), + id 0MKwpI-1FxXUG16Ni-0002OL; Tue, 04 Jul 2006 01:05:52 +0200 +Subject: Re: query very slow when enable_seqscan=on +From: Simon Riggs +To: Tomasz Ostrowski +Cc: pgsql-bugs@postgresql.org, pgsql-performance@postgresql.org +In-Reply-To: <20060703203105.GA2801@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> +Content-Type: text/plain +Date: Tue, 04 Jul 2006 00:05:42 +0100 +Message-Id: <1151967943.2479.330.camel@localhost.localdomain> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 (2.6.1-1.fc5.2) +Content-Transfer-Encoding: 7bit +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:726643fe08f41a451f0fe7fa43bce239 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/14 +X-Sequence-Number: 15359 + +On Mon, 2006-07-03 at 22:31 +0200, Tomasz Ostrowski wrote: +> I have a very slow query when enable_seqscan=on and very fast when +> enable_seqscan=off. My schema looks like this (relevant columns +> only): +> PS. Actual table and column names are different (they're in Polish) +> but I've translated them for better readability for english-speaking. + +Thanks + +> PS. I wonder if it makes sense to "enable_seqscan=off" for every client +> if a database is small enough to fit in OS cache. + +You can set this for individual statements if you choose to. + +> -> Seq Scan on organization (cost=0.00..480.95 rows=1 +> width=4) (actual time=0.071..69.702 rows=1892 loops=1) +> Filter: ((organization_location)::text ~* +> 'warszawa'::text) + +The issue is caused by the under-estimation of the number of rows in the +table as a result of the regular expression comparison. As a result the +planner thinks it can choose a nested loops scan, though ends up doing +1892 seq scans of persons, when it thought it would do only one. + +The under estimation is a known issue. Posting to -perform for the +record. + +-- + Simon Riggs + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-bugs-owner@postgresql.org Mon Jul 3 20:06:01 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 34EB89FA66C + for ; + Mon, 3 Jul 2006 20:06:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85458-09 for ; + Mon, 3 Jul 2006 20:05:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 9B1309FA605 + for ; Mon, 3 Jul 2006 20:05:50 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k63N5kWr007354; + Mon, 3 Jul 2006 19:05:46 -0400 (EDT) +To: Tomasz Ostrowski +cc: pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +In-reply-to: <20060703203105.GA2801@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> +Comments: In-reply-to Tomasz Ostrowski + message dated "Mon, 03 Jul 2006 22:31:07 +0200" +Date: Mon, 03 Jul 2006 19:05:46 -0400 +Message-ID: <7353.1151967946@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/13 +X-Sequence-Number: 15358 + +Tomasz Ostrowski writes: +> I have a very slow query when enable_seqscan=on and very fast when +> enable_seqscan=off. + +Here's your problem: + +> -> Seq Scan on organization (cost=0.00..480.95 rows=1 width=4) (actual time=0.071..69.702 rows=1892 loops=1) +> Filter: ((organization_location)::text ~* 'warszawa'::text) + +If it were estimating something like the actual number of rows matching +that filter, it'd never have chosen a nestloop plan like that. + +How many rows are there in the organization table? + +This is probably the fault of the pattern-selectivity heuristic: it's +far too optimistic about long match strings eliminating a lot of rows. +I think there's been some discussion of modifying that logic but no +one's really stepped up with a better idea. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 4 02:06:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A41559FA5FE + for ; + Tue, 4 Jul 2006 02:06:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34796-10 for + ; + Tue, 4 Jul 2006 02:06:08 -0300 (ADT) +X-Greylist: delayed 00:30:18.285687 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 10C639FB1B9 + for ; + Tue, 4 Jul 2006 02:06:06 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from ns2.nec.com.au (ns2.nec.com.au [147.76.180.2]) + by svr4.postgresql.org (Postfix) with ESMTP id 1477F5AF025 + for ; + Tue, 4 Jul 2006 04:35:46 +0000 (GMT) +Received: from smtp1.nec.com.au (unknown [172.31.8.18]) + by ns2.nec.com.au (Postfix) with ESMTP id 68FAF3B6B9 + for ; + Tue, 4 Jul 2006 14:35:41 +1000 (EST) +Received: from eddy (eddy.ssd.neca.nec.com.au [147.76.48.116]) + by warp.ssd.neca.nec.com.au (8.12.10+Sun/8.12.10) with SMTP id + k644ZduP004662; Tue, 4 Jul 2006 14:35:39 +1000 (EST) +Reply-To: +From: "Guoping Zhang" +To: "'Chris Hoover'" , + "'David Gagnon'" +Cc: +Subject: Re: Is postgresql ca do the job for software deployed in ASP ou SaaS + mode? +Date: Tue, 4 Jul 2006 14:35:37 +1000 +Message-ID: <007801c69f23$4ce97d80$74304c93@eddy> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0079_01C69F77.1E958D80" +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: <1d219a6f0607031020w4c578c54x89877b8055dac756@mail.gmail.com> +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +Importance: Normal +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/12 +X-Sequence-Number: 19872 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0079_01C69F77.1E958D80 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 8bit + +Hi, Chris, + +In your deployment, can you put a bit more detail if available? Many thanks! + +My questions are: + a) How do you resolve the connection pool issue? + b) If each client application has many threads of connections to the +remote server, what is the likely performance penalty with compare to the +DBMS hosted at the same host as the client? + +Indeed, the application requirements may be quite different for us, but +above two are my main concerns prior to doing a porting work for a large +application (from other vendor DBMS). + +We have several idential applications on different servers, each has 250+ +database connections, currently they are having a DBMS on each server but we +want them to share one DBMS at a dedicate DBMS server (in the same LAN) if +performance penalty is little. I wonder if anyone there can provide your +comments and experience on this. Many thanks. + +Regards, +Guoping + + -----Original Message----- + From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Chris Hoover + Sent: 2006��7��4�� 3:20 + To: David Gagnon + Cc: pgsql-performance@postgresql.org + Subject: Re: [PERFORM] Is postgresql ca do the job for software deployed +in ASP ou SaaS mode? + + + On 7/3/06, David Gagnon wrote: + + Can I hope having several hundred of db on 1 db server? Like 250 dbs = + 250 client = 360 000 tables !!! + So is there a limit for the number of db in the db server ?(this spec is + not on the website) + What about the performance? Can I expect to have the same performance? + + + I am running a similar environment. Each of our customers has a seperate +database with serveral hundred tables per database. One of our servers is +running over 200 customer databases with absolutely no problems. + + + HTH, + + chris + + + +------=_NextPart_000_0079_01C69F77.1E958D80 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
Hi,=20 +Chris,
+
 
+
In=20 +your deployment, can you put a bit more detail if available? = +Many=20 +thanks!
+
 
+
My=20 +questions are: 
+
 =20 +a)  How do you resolve the connection=20 +pool issue?
+
 =20 +b)  If each client application has many threads of connections = +to the=20 +remote server, what is the likely performance penalty with compare to = +the DBMS=20 +hosted at the same host as the client?
+
 
+
Indeed, the application requirements may be quite = +different for us,=20 +but above two are my main concerns prior to doing a porting = +work for=20 +a large application (from other vendor DBMS). = +
+
 
+
We=20 +have several idential applications on different servers, each has 250+ = +database=20 +connections, currently they are having a DBMS on each server but we=20 +want them to share one DBMS at a dedicate DBMS server (in the = +same=20 +LAN) if performance penalty is little. I wonder if anyone = +there can=20 +provide your comments and experience on this. Many=20 +thanks.  
+
 
+
Regards,
+
Guoping
+
 
+
+
-----Original Message-----
From:=20 + pgsql-performance-owner@postgresql.org=20 + [mailto:pgsql-performance-owner@postgresql.org]On Behalf Of = +Chris=20 + Hoover
Sent: 2006=C4=EA7=D4=C24=C8=D5 3:20
To: = +David=20 + Gagnon
Cc: = +pgsql-performance@postgresql.org
Subject: Re:=20 + [PERFORM] Is postgresql ca do the job for software deployed in ASP ou = +SaaS=20 + mode?

On 7/3/06, David = + + Gagnon <dgagnon@siunik.com>=20 + wrote: +
+

Can=20 + I hope having several hundred of db on 1 db server?  Like = +250 dbs=20 + =3D
250 client =3D 360 000 tables !!!
So is there a limit for = +the number=20 + of db in the db server ?(this spec is
not on the website)
What = +about=20 + the performance? Can I expect to have the same performance? = +
+


I am running a similar environment.  Each of our = +customers=20 + has a seperate database with serveral hundred tables per = +database.  One=20 + of our servers is running over 200 customer databases with absolutely = +no=20 + problems.=20 +

HTH,

chris

+ +------=_NextPart_000_0079_01C69F77.1E958D80-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 4 05:02:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 31D5B9FADD1 + for ; + Tue, 4 Jul 2006 05:02:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61591-03 for + ; + Tue, 4 Jul 2006 05:02:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 256259FA5FE + for ; + Tue, 4 Jul 2006 05:02:25 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Tue, 04 Jul 2006 10:02:19 +0200 +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: Is postgresql ca do the job for software deployed in ASP ou SaaS + mode? +Date: Tue, 4 Jul 2006 10:03:45 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Is postgresql ca do the job for software deployed in + ASP ou SaaS mode? +Thread-Index: Acaenhvdm7Aw7rNNQmGz1aHZLUJGDgAngTEg +From: "Mikael Carneholm" +To: "David Gagnon" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/13 +X-Sequence-Number: 19873 + +Do you really need to create one *DB* per client - that is, is one +schema (in the same DB) per client out of the question? If not, I would +look into moving all reference tables (read-only data, constants and +such) into a common schema (with read permission granted to each +client/role), that way reducing the amount of objects needed to be +created/maintained and at the same time reducing the memory requirements +(lots of shared objects =3D=3D lots of reused shared buffers). Set the +default_tablespace variable per client (login role) also so that the I/O +load can be balanced. A system based on Opterons such as the HP DL385 or +DL585 with two CPUs (or four if you go for the 585), 8-16Gb of RAM and a +decent storage system with 14-28 disks could be worth evaluating. + +/Mikael + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of David +Gagnon +Sent: den 3 juli 2006 13:42 +To: pgsql-performance@postgresql.org +Subject: [PERFORM] Is postgresql ca do the job for software deployed in +ASP ou SaaS mode? + +Hi all, + + I've been working on my personal project for 3.5 years now. I +developed an ERP system in web/java. Now the people I will work with +suggest to offers it in Saas mode. Which means my customer will connect +to my website and found they ERP software and data there. It's not the +deployment I planned initially so if you can just validate some +technicals points to be sure it's not crazy using Postgresl here and not +a big $$$ db to do the job. + +Typically I will have 1db per client and around 150 tables per db. So +since I hope I didn`t work all those year for nothing .. I expect to +have bunch of clients witch means the same amount of db since I have 1 +db/client.=20 + +Can I hope having several hundred of db on 1 db server? Like 250 dbs = +=3D +250 client =3D 360 000 tables !!! +So is there a limit for the number of db in the db server ?(this spec is +not on the website) What about the performance? Can I expect to have the +same performance?=20 + +Since I put everything on the web I do needs an High Availability +infrastructure. I looked into SlonyI and Mammoth to replicate the db +but since SlonyI use triggers can I expect it to do the job? Is Mammoth +is the only available solution? + +Last question and not the least I'm reading this performance list for +several years now and know suggestion about hardware to run postgresl is +discussed. Since I wrote software there severals points about hardware +that I don`t understand. Do you have any suggestion of platform to run +into my Saas configuration? I do need the WISE one! I'm pretty sure +that if I was a big company I would be able throw bunch of $$$$ but it's +not my case. I'm pretty sure it exists out there some piece of Hardware +that would do the job perfectly with a fair price. + +So far I did understand that Postgresql loves Opteron and I have looked +into the dl145 series of HP. I did understand that Dell Hardware it`s +not reliable. But it's still not clear what should be my requirement +for memory, disk, nb cpu, cpu power, etc. + +I'm pretty sure it`s better to have more slower CPUs that having the +latest Opteron available on the market, or more slower servers that +having the fastest one... am I right? But agains what it`s the optimal +choice? + +Thanks you to share your knowledge on those point. I do consider using +Postgresql is the Smart choice in my project since the beginning but +before putting all the money (That I don`t have ..:-)) to buy some +hardware I just want to be sure I'm not crazy! + +Thanks for your help I really appreciate it!! + +Best Regards +/David + + + + + + + +---------------------------(end of broadcast)--------------------------- +TIP 4: Have you searched our list archives? + + http://archives.postgresql.org + + +From pgsql-bugs-owner@postgresql.org Tue Jul 4 05:59:37 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D015D9FA322 + for ; + Tue, 4 Jul 2006 05:59:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65860-08 for ; + Tue, 4 Jul 2006 05:59:27 -0300 (ADT) +X-Greylist: delayed 00:21:48.380731 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 287099FB1BA + for ; Tue, 4 Jul 2006 05:59:27 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from pancernik.batory.org.pl (pancernik.batory.org.pl + [62.89.72.210]) + by svr4.postgresql.org (Postfix) with ESMTP id 62A165AF04E + for ; Tue, 4 Jul 2006 08:37:37 +0000 (GMT) +Received: from pancernik.batory.org.pl (localhost.localdomain [127.0.0.1]) + by pancernik.batory.org.pl (8.13.6/8.13.6) with ESMTP id k648bYba020295; + Tue, 4 Jul 2006 10:37:34 +0200 +Received: (from tometzky@localhost) + by pancernik.batory.org.pl (8.13.6/8.13.6/Submit) id k648bXbp020294; + Tue, 4 Jul 2006 10:37:33 +0200 +Date: Tue, 4 Jul 2006 10:37:33 +0200 +From: Tomasz Ostrowski +To: Tom Lane +Cc: pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +Message-ID: <20060704083733.GA20102@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> + <7353.1151967946@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <7353.1151967946@sss.pgh.pa.us> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/15 +X-Sequence-Number: 15360 + +On Mon, 03 Jul 2006, Tom Lane wrote: + +> > -> Seq Scan on organization (cost=0.00..480.95 rows=1 width=4) (actual time=0.071..69.702 rows=1892 loops=1) +> > Filter: ((organization_location)::text ~* 'warszawa'::text) +> +> How many rows are there in the organization table? + +About 9000. And about 6500 persons. "Warszawa" is a biggest city in +Poland and a capital - many organizations are located there. + +> This is probably the fault of the pattern-selectivity heuristic: +> it's far too optimistic about long match strings eliminating a lot +> of rows. I think there's been some discussion of modifying that +> logic but no one's really stepped up with a better idea. + +I think because there is no good solution to this - no statistical +information is going to predict how much data will match a regular +expression. Maybe in this situation an algorithm should be +pessimistic - that it will return all rows, or all non-null rows or +all rows no shorter than matching string (if it's a string and not +for example regex like [abcdefghijklmnopqrstuvwxyz] which is long but +will match basicaly everything). In my opinion it is better to +overestimate most of the time than to risk underestimation by a +factor of 1000 and more. + +For now I'm turning off seqscans. This is a second time I got +terrible permormance with seqscans turned on because of bad +estimation. And my database will probably fit in cache. + +Regards +Tometzky +-- +...although Eating Honey was a very good thing to do, there was a +moment just before you began to eat it which was better than when you +were... + Winnie the Pooh + +From pgsql-performance-owner@postgresql.org Tue Jul 4 08:46:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F13D79FA5C3 + for ; + Tue, 4 Jul 2006 08:46:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88401-01 for + ; + Tue, 4 Jul 2006 08:46:06 -0300 (ADT) +X-Greylist: delayed 00:31:34.351018 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 4D24D9FA350 + for ; + Tue, 4 Jul 2006 08:46:06 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from blackblue.iasi.activemediatech.com (unknown [86.105.148.53]) + by svr4.postgresql.org (Postfix) with ESMTP id 3E39E5AF02A + for ; + Tue, 4 Jul 2006 11:14:29 +0000 (GMT) +Received: from blackblue.iasi.activemediatech.com (localhost.localdomain + [127.0.0.1]) + by blackblue.iasi.activemediatech.com (8.13.6/8.13.6) with ESMTP id + k64BEOD9020537; Tue, 4 Jul 2006 14:14:24 +0300 +Received: from localhost (Mituc@localhost) + by blackblue.iasi.activemediatech.com (8.13.6/8.13.6/Submit) with ESMTP + id k64BEN2Z020532; Tue, 4 Jul 2006 14:14:24 +0300 +X-Authentication-Warning: blackblue.iasi.activemediatech.com: Mituc owned + process doing -bs +Date: Tue, 4 Jul 2006 14:14:23 +0300 (EEST) +From: Tarhon-Onu Victor +To: pgsql-performance@postgresql.org +Cc: Gene +Subject: Re: optimizing LIKE '%2345' queries +In-Reply-To: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> +Message-ID: + +References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/14 +X-Sequence-Number: 19874 + +On Sun, 2 Jul 2006, Gene wrote: + +> can use an index and perform as fast as searching with like '2345%'? +> +> Is the only way to create a reverse function and create an index using +> the reverse function and modify queries to use: +> +> where reverse(column) like reverse('%2345') ? + + Hmm.. interesting. + If (and only if) the records stored in "column" column have fixed +length (say, all are 50 characters in length) you could create and index +on, say, substring(column,45,50), and use this in the WHERE clauses in +your queries. + Or if the length of those records is not the same maybe it is +feasible to create an ondex on substring(column, length(column)-5, +length(column)). + +-- +Any views or opinions presented within this e-mail are solely those of +the author and do not necessarily represent those of any company, unless +otherwise expressly stated. + +From pgsql-performance-owner@postgresql.org Tue Jul 4 08:53:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A4F879FA350 + for ; + Tue, 4 Jul 2006 08:53:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88897-01 for + ; + Tue, 4 Jul 2006 08:53:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) + by postgresql.org (Postfix) with ESMTP id C68C69FA2F3 + for ; + Tue, 4 Jul 2006 08:53:14 -0300 (ADT) +Received: from [127.0.0.1] ([24.202.239.251]) by VL-MO-MR001.ip.videotron.ca + (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) + with ESMTP id <0J1V008U2NONCK20@VL-MO-MR001.ip.videotron.ca> for + pgsql-performance@postgresql.org; Tue, 04 Jul 2006 07:53:13 -0400 (EDT) +Date: Tue, 04 Jul 2006 07:55:58 -0400 +From: David Gagnon +Subject: Re: Is postgresql ca do the job for software deployed in ASP +In-reply-to: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> +To: Mikael Carneholm +Cc: pgsql-performance@postgresql.org +Message-id: <44AA574E.1080404@siunik.com> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/15 +X-Sequence-Number: 19875 + +Hi All, + + First thanks for your help everyone! + + + + +Mikael Carneholm wrote: +> Do you really need to create one *DB* per client - that is, is one +> schema (in the same DB) per client out of the question? If not, I would +> look into moving all reference tables (read-only data, constants and +> such) into a common schema (with read permission granted to each +> client/role), that way reducing the amount of objects needed to be +> created/maintained and at the same time reducing the memory requirements +> (lots of shared objects == lots of reused shared buffers). +For my application there is very little info I can share. Maybe less +than 10 on 100 actually so I not sure it worth it ... + + + +> Set the +> default_tablespace variable per client (login role) also so that the I/O +> load can be balanced. A system based on Opterons such as the HP DL385 or +> DL585 with two CPUs (or four if you go for the 585), 8-16Gb of RAM and a +> decent storage system with 14-28 disks could be worth evaluating. +> +> /Mikael +> +I look into the HP DL385 and DL585 on HP site and they are price between +3000 and 15000$$ (base price). Thats quite a difference? So is the HP +DL385 with 2 cpus will do the job ? + +http://h71016.www7.hp.com/dstore/ctoBases.asp?jumpid=re_NSS_dl585storageserver&oi=E9CED&BEID=19701&SBLID=&ProductLineId=450&FamilyId=2230&LowBaseId=&LowPrice=&familyviewgroup=405&viewtype=Matrix +http://h71016.www7.hp.com/dstore/ctoBases.asp?ProductLineId=431&FamilyId=2048&jumpid=re_hphqiss/Ovw_Buy/DL385 + +I will look more deeply into them in detail trying to understand +something ... + +Thanks for your help! +Best Regards +/David + + + + + + + + + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of David +> Gagnon +> Sent: den 3 juli 2006 13:42 +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Is postgresql ca do the job for software deployed in +> ASP ou SaaS mode? +> +> Hi all, +> +> I've been working on my personal project for 3.5 years now. I +> developed an ERP system in web/java. Now the people I will work with +> suggest to offers it in Saas mode. Which means my customer will connect +> to my website and found they ERP software and data there. It's not the +> deployment I planned initially so if you can just validate some +> technicals points to be sure it's not crazy using Postgresl here and not +> a big $$$ db to do the job. +> +> Typically I will have 1db per client and around 150 tables per db. So +> since I hope I didn`t work all those year for nothing .. I expect to +> have bunch of clients witch means the same amount of db since I have 1 +> db/client. +> +> Can I hope having several hundred of db on 1 db server? Like 250 dbs = +> 250 client = 360 000 tables !!! +> So is there a limit for the number of db in the db server ?(this spec is +> not on the website) What about the performance? Can I expect to have the +> same performance? +> +> Since I put everything on the web I do needs an High Availability +> infrastructure. I looked into SlonyI and Mammoth to replicate the db +> but since SlonyI use triggers can I expect it to do the job? Is Mammoth +> is the only available solution? +> +> Last question and not the least I'm reading this performance list for +> several years now and know suggestion about hardware to run postgresl is +> discussed. Since I wrote software there severals points about hardware +> that I don`t understand. Do you have any suggestion of platform to run +> into my Saas configuration? I do need the WISE one! I'm pretty sure +> that if I was a big company I would be able throw bunch of $$$$ but it's +> not my case. I'm pretty sure it exists out there some piece of Hardware +> that would do the job perfectly with a fair price. +> +> So far I did understand that Postgresql loves Opteron and I have looked +> into the dl145 series of HP. I did understand that Dell Hardware it`s +> not reliable. But it's still not clear what should be my requirement +> for memory, disk, nb cpu, cpu power, etc. +> +> I'm pretty sure it`s better to have more slower CPUs that having the +> latest Opteron available on the market, or more slower servers that +> having the fastest one... am I right? But agains what it`s the optimal +> choice? +> +> Thanks you to share your knowledge on those point. I do consider using +> Postgresql is the Smart choice in my project since the beginning but +> before putting all the money (That I don`t have ..:-)) to buy some +> hardware I just want to be sure I'm not crazy! +> +> Thanks for your help I really appreciate it!! +> +> Best Regards +> /David +> +> +> +> +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org +> +> +> +> +> + + + +From pgsql-performance-owner@postgresql.org Tue Jul 4 10:04:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 660A69FA350 + for ; + Tue, 4 Jul 2006 10:04:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 95367-06 for + ; + Tue, 4 Jul 2006 10:04:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 98D549FA2F3 + for ; + Tue, 4 Jul 2006 10:04:24 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Tue, 04 Jul 2006 15:04:16 +0200 +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: Is postgresql ca do the job for software deployed in ASP ou SaaS + mode? +Date: Tue, 4 Jul 2006 15:05:42 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47DE@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Is postgresql ca do the job for software deployed in + ASP ou SaaS mode? +Thread-Index: AcafYKQ2e8WzltGQTuaj/50MlUIWsgAAGWKg +From: "Mikael Carneholm" +To: "David Gagnon" +Cc: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/16 +X-Sequence-Number: 19876 + +> For my application there is very little info I can share. Maybe less +than 10 on 100 actually so I not sure it worth it ... + +Ok, so 90% of the tables are being written to - this either means that +your application uses very little constants, or that it has access to +constans that are stored somewhere else (eg, a JMX Mbean that's +initialized from property files on application startup). Would it be too +much work to redesign the DB model to support more than one client?=20 + +>I look into the HP DL385 and DL585 on HP site and they are price +between=20 +>3000 and 15000$$ (base price). Thats quite a difference? So is the HP + +>DL385 with 2 cpus will do the job ? + +Yeah, there's quite a difference on the price tags between those two. +I'd vote for the DL385 since the sockets for the two extra CPU's won't +give you linear scalability per $ in the end. A single machine may be +cheaper to administrate, but if administration costs are +irrelevant/negligible I'd go for several 2-socket machines instead of +one 4-socket machine. + +/Mikael + +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of David +> Gagnon +> Sent: den 3 juli 2006 13:42 +> To: pgsql-performance@postgresql.org +> Subject: [PERFORM] Is postgresql ca do the job for software deployed +in +> ASP ou SaaS mode? +> +> Hi all, +> +> I've been working on my personal project for 3.5 years now. I +> developed an ERP system in web/java. Now the people I will work with +> suggest to offers it in Saas mode. Which means my customer will +connect +> to my website and found they ERP software and data there. It's not +the +> deployment I planned initially so if you can just validate some +> technicals points to be sure it's not crazy using Postgresl here and +not +> a big $$$ db to do the job. +> +> Typically I will have 1db per client and around 150 tables per db. So +> since I hope I didn`t work all those year for nothing .. I expect to +> have bunch of clients witch means the same amount of db since I have 1 +> db/client.=20 +> +> Can I hope having several hundred of db on 1 db server? Like 250 dbs +=3D +> 250 client =3D 360 000 tables !!! +> So is there a limit for the number of db in the db server ?(this spec +is +> not on the website) What about the performance? Can I expect to have +the +> same performance?=20 +> +> Since I put everything on the web I do needs an High Availability +> infrastructure. I looked into SlonyI and Mammoth to replicate the db +> but since SlonyI use triggers can I expect it to do the job? Is +Mammoth +> is the only available solution? +> +> Last question and not the least I'm reading this performance list for +> several years now and know suggestion about hardware to run postgresl +is +> discussed. Since I wrote software there severals points about +hardware +> that I don`t understand. Do you have any suggestion of platform to +run +> into my Saas configuration? I do need the WISE one! I'm pretty sure +> that if I was a big company I would be able throw bunch of $$$$ but +it's +> not my case. I'm pretty sure it exists out there some piece of +Hardware +> that would do the job perfectly with a fair price. +> +> So far I did understand that Postgresql loves Opteron and I have +looked +> into the dl145 series of HP. I did understand that Dell Hardware it`s +> not reliable. But it's still not clear what should be my requirement +> for memory, disk, nb cpu, cpu power, etc. +> +> I'm pretty sure it`s better to have more slower CPUs that having the +> latest Opteron available on the market, or more slower servers that +> having the fastest one... am I right? But agains what it`s the +optimal +> choice? +> +> Thanks you to share your knowledge on those point. I do consider +using +> Postgresql is the Smart choice in my project since the beginning but +> before putting all the money (That I don`t have ..:-)) to buy some +> hardware I just want to be sure I'm not crazy! +> +> Thanks for your help I really appreciate it!! +> +> Best Regards +> /David +> +> +> +> +> +> +> +> ---------------------------(end of +broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org +> +> +> +> +> =20 + + + + +From pgsql-performance-owner@postgresql.org Tue Jul 4 10:30:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 329989FA350 + for ; + Tue, 4 Jul 2006 10:30:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 01578-01 for + ; + Tue, 4 Jul 2006 10:30:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) + by postgresql.org (Postfix) with ESMTP id 3BCA99FA2F3 + for ; + Tue, 4 Jul 2006 10:30:36 -0300 (ADT) +Received: from [127.0.0.1] ([24.202.239.251]) by VL-MH-MR002.ip.videotron.ca + (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) + with ESMTP id <0J1V00AEDS6XED60@VL-MH-MR002.ip.videotron.ca> for + pgsql-performance@postgresql.org; Tue, 04 Jul 2006 09:30:34 -0400 (EDT) +Date: Tue, 04 Jul 2006 09:33:20 -0400 +From: David Gagnon +Subject: Re: Is postgresql ca do the job for software deployed in ASP +In-reply-to: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47DE@sesrv12.wirelesscar.com> +To: Mikael Carneholm +Cc: pgsql-performance@postgresql.org +Message-id: <44AA6E20.60205@siunik.com> +MIME-version: 1.0 +Content-type: text/plain; charset=ISO-8859-1; format=flowed +Content-transfer-encoding: 7BIT +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47DE@sesrv12.wirelesscar.com> +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/17 +X-Sequence-Number: 19877 + +Mikael Carneholm wrote: +>> For my application there is very little info I can share. Maybe less +>> +> than 10 on 100 actually so I not sure it worth it ... +> +> Ok, so 90% of the tables are being written to - this either means that +> your application uses very little constants, or that it has access to +> constans that are stored somewhere else (eg, a JMX Mbean that's +> initialized from property files on application startup). Would it be too +> much work to redesign the DB model to support more than one client? +> +Yes configuration are in property files or somewhere else. I will keep +this solution in mind but for now I really think that would really +complicated for what it will give in return... + + + +> +>> I look into the HP DL385 and DL585 on HP site and they are price +>> +> between +> +>> 3000 and 15000$$ (base price). Thats quite a difference? So is the HP +>> +> +> +>> DL385 with 2 cpus will do the job ? +>> +> +> Yeah, there's quite a difference on the price tags between those two. +> I'd vote for the DL385 since the sockets for the two extra CPU's won't +> give you linear scalability per $ in the end. A single machine may be +> cheaper to administrate, but if administration costs are +> irrelevant/negligible I'd go for several 2-socket machines instead of +> one 4-socket machine. +> +I do need 2 machines since I need an HA solution. So on top of those +question I try to figure out if Slony-I can do the job in my scenario or +do I need the Mammoth solution. I'm searching the list right now and +there is not a lot of info... :-( Any Idea? + +So thanks for the info about the DL385 I will look deeply into it ! + +Best Regards +/David + + +> /Mikael +> +> +>> -----Original Message----- +>> From: pgsql-performance-owner@postgresql.org +>> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of David +>> Gagnon +>> Sent: den 3 juli 2006 13:42 +>> To: pgsql-performance@postgresql.org +>> Subject: [PERFORM] Is postgresql ca do the job for software deployed +>> +> in +> +>> ASP ou SaaS mode? +>> +>> Hi all, +>> +>> I've been working on my personal project for 3.5 years now. I +>> developed an ERP system in web/java. Now the people I will work with +>> suggest to offers it in Saas mode. Which means my customer will +>> +> connect +> +>> to my website and found they ERP software and data there. It's not +>> +> the +> +>> deployment I planned initially so if you can just validate some +>> technicals points to be sure it's not crazy using Postgresl here and +>> +> not +> +>> a big $$$ db to do the job. +>> +>> Typically I will have 1db per client and around 150 tables per db. So +>> since I hope I didn`t work all those year for nothing .. I expect to +>> have bunch of clients witch means the same amount of db since I have 1 +>> db/client. +>> +>> Can I hope having several hundred of db on 1 db server? Like 250 dbs +>> +> = +> +>> 250 client = 360 000 tables !!! +>> So is there a limit for the number of db in the db server ?(this spec +>> +> is +> +>> not on the website) What about the performance? Can I expect to have +>> +> the +> +>> same performance? +>> +>> Since I put everything on the web I do needs an High Availability +>> infrastructure. I looked into SlonyI and Mammoth to replicate the db +>> but since SlonyI use triggers can I expect it to do the job? Is +>> +> Mammoth +> +>> is the only available solution? +>> +>> Last question and not the least I'm reading this performance list for +>> several years now and know suggestion about hardware to run postgresl +>> +> is +> +>> discussed. Since I wrote software there severals points about +>> +> hardware +> +>> that I don`t understand. Do you have any suggestion of platform to +>> +> run +> +>> into my Saas configuration? I do need the WISE one! I'm pretty sure +>> that if I was a big company I would be able throw bunch of $$$$ but +>> +> it's +> +>> not my case. I'm pretty sure it exists out there some piece of +>> +> Hardware +> +>> that would do the job perfectly with a fair price. +>> +>> So far I did understand that Postgresql loves Opteron and I have +>> +> looked +> +>> into the dl145 series of HP. I did understand that Dell Hardware it`s +>> not reliable. But it's still not clear what should be my requirement +>> for memory, disk, nb cpu, cpu power, etc. +>> +>> I'm pretty sure it`s better to have more slower CPUs that having the +>> latest Opteron available on the market, or more slower servers that +>> having the fastest one... am I right? But agains what it`s the +>> +> optimal +> +>> choice? +>> +>> Thanks you to share your knowledge on those point. I do consider +>> +> using +> +>> Postgresql is the Smart choice in my project since the beginning but +>> before putting all the money (That I don`t have ..:-)) to buy some +>> hardware I just want to be sure I'm not crazy! +>> +>> Thanks for your help I really appreciate it!! +>> +>> Best Regards +>> /David +>> +>> +>> +>> +>> +>> +>> +>> ---------------------------(end of +>> +> broadcast)--------------------------- +> +>> TIP 4: Have you searched our list archives? +>> +>> http://archives.postgresql.org +>> +>> +>> +>> +>> +>> +> +> +> +> +> +> +> + + + +From pgsql-bugs-owner@postgresql.org Tue Jul 4 10:56:39 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C98919FA350 + for ; + Tue, 4 Jul 2006 10:56:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03112-04 for ; + Tue, 4 Jul 2006 10:56:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 4B61E9FA2F3 + for ; Tue, 4 Jul 2006 10:56:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k64DuTCi013854; + Tue, 4 Jul 2006 09:56:29 -0400 (EDT) +To: Tomasz Ostrowski +cc: pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +In-reply-to: <20060704083733.GA20102@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> + <7353.1151967946@sss.pgh.pa.us> + <20060704083733.GA20102@batory.org.pl> +Comments: In-reply-to Tomasz Ostrowski + message dated "Tue, 04 Jul 2006 10:37:33 +0200" +Date: Tue, 04 Jul 2006 09:56:29 -0400 +Message-ID: <13853.1152021389@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/17 +X-Sequence-Number: 15362 + +Tomasz Ostrowski writes: +> I think because there is no good solution to this - no statistical +> information is going to predict how much data will match a regular +> expression. + +Well, it's certainly hard to imagine simple stats that would let the +code guess that, say, "warsa" and "warsaw" match nearly the same +(large) number of rows while "warsawq" matches nothing. + +I think the real problem here is that regex matching is the wrong tool +for the job. Have you looked into a full-text index (tsearch2)? +With something like that, the index operator has at least got the +correct conceptual model, ie, looking for indexed words. I'm not sure +if they have any decent statistical support for it :-( but in theory +that seems doable, whereas regex estimation will always be a crapshoot. + + regards, tom lane + +From pgsql-bugs-owner@postgresql.org Tue Jul 4 11:44:24 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5E29B9FA350 + for ; + Tue, 4 Jul 2006 11:44:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08986-06 for ; + Tue, 4 Jul 2006 11:44:11 -0300 (ADT) +X-Greylist: delayed 06:06:29.890639 by SQLgrey- +Received: from pancernik.batory.org.pl (pancernik.batory.org.pl + [62.89.72.210]) + by postgresql.org (Postfix) with ESMTP id 15D899FA2F3 + for ; Tue, 4 Jul 2006 11:44:10 -0300 (ADT) +Received: from pancernik.batory.org.pl (localhost.localdomain [127.0.0.1]) + by pancernik.batory.org.pl (8.13.6/8.13.6) with ESMTP id k64Ei84F022433; + Tue, 4 Jul 2006 16:44:08 +0200 +Received: (from tometzky@localhost) + by pancernik.batory.org.pl (8.13.6/8.13.6/Submit) id k64Ei8cR022432; + Tue, 4 Jul 2006 16:44:08 +0200 +Date: Tue, 4 Jul 2006 16:44:08 +0200 +From: Tomasz Ostrowski +To: Tom Lane +Cc: pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +Message-ID: <20060704144406.GA21511@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> + <7353.1151967946@sss.pgh.pa.us> + <20060704083733.GA20102@batory.org.pl> + <13853.1152021389@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-2 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <13853.1152021389@sss.pgh.pa.us> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/19 +X-Sequence-Number: 15364 + +On Tue, 04 Jul 2006, Tom Lane wrote: + +> I think the real problem here is that regex matching is the wrong +> tool for the job. Have you looked into a full-text index +> (tsearch2)? + +So much to do with so little time... + +I've briefly looked into it but: + +- it's complicated; + +- it is not needed - basic scan is good enough for the amount of data + we have (if a sane query plan is chosen by a database); + +- we have data in many languages (including based on cyryllic + alphabet) - languages which use different forms of the same word + based on context, for example: + Warszawa + Warszawy + Warszawie + Warszaw� + Warszaw� + Warszawo + All of the above could be translated to "Warsaw". So we need to + support matching parts of words ("warszaw"), which I haven't seen + in tsearch2 (maybe I've overlooked). We also have words, which + different forms look like this: "st�" "stole" "sto�u" (Polish for + "table") - when we need to find it we'd need to list every possible + form (about 10) or use a regex like: 'st[o�][l�]'. + +> With something like that, the index operator has at least got the +> correct conceptual model, ie, looking for indexed words. I'm not sure +> if they have any decent statistical support for it :-( but in theory +> that seems doable, whereas regex estimation will always be a crapshoot. + +So why estimate regex expressions if there is no estimation possible? +Let's set this estimate to be pessimistic (match everything or +everything not null) and it will choose better plans. At least until +somebody will figure out better approach. + +Pozdrawiam +Tometzky +-- +Best of prhn - najzabawniejsze teksty polskiego UseNet-u +http://prhn.dnsalias.org/ + Chaos zawsze pokonuje porz�dek, gdy� jest lepiej zorganizowany. + [ Terry Pratchett ] + +From pgsql-performance-owner@postgresql.org Tue Jul 4 13:00:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC7F69FA5C3 + for ; + Tue, 4 Jul 2006 13:00:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 83993-01 for + ; + Tue, 4 Jul 2006 13:00:08 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) + by postgresql.org (Postfix) with ESMTP id A645B9FA4A8 + for ; + Tue, 4 Jul 2006 13:00:07 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so1890488ugf + for ; + Tue, 04 Jul 2006 09:00:03 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=HKl4Wx9NDCiTVSSMiqPLsBPNdhI03FgBlK725vWtBs4BjnIrL436BjWpiwi6I26S8sBoEANQiVE14FfMg1mo9wdG917MZLPUZ+eeCtNdvojukUJADYUmZbB8CYUtUmNumADbt36Lo1gVyL1Xl/t/5oGvdUkW3r81S27hkEWrso4= +Received: by 10.67.101.10 with SMTP id d10mr6733519ugm; + Tue, 04 Jul 2006 09:00:03 -0700 (PDT) +Received: by 10.66.251.18 with HTTP; Tue, 4 Jul 2006 09:00:02 -0700 (PDT) +Message-ID: +Date: Tue, 4 Jul 2006 20:00:02 +0400 +From: Luckys +To: pgsql-performance@postgresql.org +Subject: how to tune this query. +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_72450_1574529.1152028802875" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.462 tagged_above=0 required=5 tests=BAYES_00, + DNS_FROM_RFC_ABUSE, FROM_LOCAL_NOVOWEL, HTML_MESSAGE, SPF_PASS, + UPPERCASE_25_50 +X-Spam-Level: +X-Archive-Number: 200607/18 +X-Sequence-Number: 19878 + +------=_Part_72450_1574529.1152028802875 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi all, +I got this query, I'm having indexes for PropertyId and Dates columns across +all the tables, but still it takes ages to get me the result. What indexes +would be proposed on this, or I'm helpless? + +FROM STG_Property a + + FULL OUTER JOIN + STG_PropConfirmedLogs b + ON (a.PropertyId = b.PropertyId AND a.p_LastModified = b.p_Modified_Date +) + + FULL OUTER JOIN + STG_PropConnectionFeesLogs c + ON ((a.PropertyId = c.PropertyId AND a.p_LastModified = c.p_ChangedOn) + OR (b.PropertyId = c.PropertyId AND b.p_Modified_Date = c.p_ChangedOn)) + + FULL OUTER JOIN + STG_PropDeletedLogs d + ON ((a.PropertyId = d.PropertyId AND a.p_LastModified = d.p_DeletedOn) + OR (b.PropertyId = d.PropertyId AND b.p_Modified_Date = d.p_DeletedOn) + OR (c.PropertyId = d.PropertyId AND c.p_ChangedOn = d.p_DeletedOn)) + + FULL OUTER JOIN + STG_PropFEWALogs e + ON ((a.PropertyId = e.PropertyId AND a.p_LastModified = +e.p_Modified_Date) + OR (b.PropertyId = e.PropertyId AND b.p_Modified_Date = +e.p_Modified_Date) OR (c.PropertyId = e.PropertyId AND c.p_ChangedOn = +e.p_Modified_Date) + OR (d.PropertyId = e.PropertyId AND d.p_DeletedOn = e.p_Modified_Date)) + + FULL OUTER JOIN + STG_PropInSewerNetworkLogs f + ON ((a.PropertyId = f.PropertyId AND a.p_LastModified = +f.p_Modified_Date) + OR (b.PropertyId = f.PropertyId AND b.p_Modified_Date = +f.p_Modified_Date) + OR (c.PropertyId = f.PropertyId AND c.p_ChangedOn = f.p_Modified_Date) + OR (d.PropertyId = f.PropertyId AND d.p_DeletedOn = f.p_Modified_Date) + OR (e.PropertyId = f.PropertyId AND e.p_Modified_Date = +f.p_Modified_Date)) FULL OUTER JOIN + STG_PropTypeLogs g + ON ((a.PropertyId = g.PropertyId AND a.p_LastModified = g +.p_LastModified) + OR (b.PropertyId = g.PropertyId AND b.p_Modified_Date = g +.p_LastModified) + OR (c.PropertyId = g.PropertyId AND c.p_ChangedOn = g.p_LastModified) + OR (d.PropertyId = g.PropertyId AND d.p_DeletedOn = g.p_LastModified) + OR (e.PropertyId = g.PropertyId AND e.p_Modified_Date = g +.p_LastModified) + OR (f.PropertyId = g.PropertyId AND f.p_Modified_Date = g +.p_LastModified)) + +-- Luckys + +------=_Part_72450_1574529.1152028802875 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
Hi all,
+
I got this query, I'm having indexes for PropertyId and Dates columns across all the tables, but still it takes ages to get me the result. What indexes would be proposed on this, or I'm helpless?
+
 
+
FROM  STG_Property a
 
  FULL OUTER JOIN
    STG_PropConfirmedLogs b
    +ON (a.PropertyId = b.PropertyId AND a.p_LastModified = b.p_Modified_Date)
 
  FULL OUTER JOIN +
    STG_PropConnectionFeesLogs c
    ON ((a.PropertyId = c.PropertyId AND a.p_LastModified = +c.p_ChangedOn)
    OR  (b.PropertyId = c.PropertyId AND b.p_Modified_Date = c.p_ChangedOn))

  FULL OUTER JOIN
    STG_PropDeletedLogs d
    ON ((a.PropertyId = d.PropertyId +AND a.p_LastModified = d.p_DeletedOn)
    OR  (b.PropertyId = d.PropertyId AND b.p_Modified_Date = d.p_DeletedOn)
    OR  ( +c.PropertyId = d.PropertyId AND c.p_ChangedOn = d.p_DeletedOn))
 
  FULL OUTER + JOIN
    STG_PropFEWALogs e
    ON ((a.PropertyId = e.PropertyId AND a.p_LastModified = e.p_Modified_Date)
    +OR  (b.PropertyId = e.PropertyId AND b.p_Modified_Date = e.p_Modified_Date) OR  (c.PropertyId = e.PropertyId +AND c.p_ChangedOn = e.p_Modified_Date)
    OR  (d.PropertyId = e.PropertyId AND d.p_DeletedOn = e.p_Modified_Date))
 
FULL OUTER JOIN
    STG_PropInSewerNetworkLogs f
    ON ((a.PropertyId = f.PropertyId +AND a.p_LastModified = f.p_Modified_Date)
    OR  (b.PropertyId = f.PropertyId AND b.p_Modified_Date = f.p_Modified_Date)
    OR +  (c.PropertyId = f.PropertyId AND c.p_ChangedOn = f.p_Modified_Date)
    OR  (d.PropertyId = f.PropertyId + AND d.p_DeletedOn = f.p_Modified_Date)
    OR  (e.PropertyId = f.PropertyId AND e.p_Modified_Date = f.p_Modified_Date))   +FULL OUTER JOIN
    STG_PropTypeLogs g
    ON ((a.PropertyId = g +.PropertyId AND a.p_LastModified = g.p_LastModified)
    OR  (b.PropertyId = g.PropertyId +AND b.p_Modified_Date = g.p_LastModified)
    OR  (c.PropertyId = g.PropertyId +AND c.p_ChangedOn = g.p_LastModified)
    OR  (d.PropertyId = g.PropertyId +AND d.p_DeletedOn = g.p_LastModified)
    OR  (e.PropertyId = g.PropertyId AND e.p_Modified_Date + = g.p_LastModified)
    OR  (f.PropertyId = g.PropertyId AND f.p_Modified_Date = +g.p_LastModified))
+
 
+
-- Luckys
+ +------=_Part_72450_1574529.1152028802875-- + +From pgsql-performance-owner@postgresql.org Tue Jul 4 13:25:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 193149FA5DD + for ; + Tue, 4 Jul 2006 13:25:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04227-01 for + ; + Tue, 4 Jul 2006 13:25:26 -0300 (ADT) +X-Greylist: delayed 00:06:40.346015 by SQLgrey- +Received: from mail.89glass.com (mail.89glass.com [72.10.2.250]) + by postgresql.org (Postfix) with SMTP id 920B49FA4A5 + for ; + Tue, 4 Jul 2006 13:25:25 -0300 (ADT) +Received: (qmail 13652 invoked by uid 1006); 4 Jul 2006 16:18:44 -0000 +Received: from 192.168.254.111 by lumberjack (envelope-from + , + uid 201) with qmail-scanner-1.25 (clamdscan: 0.67. + Clear:RC:1(192.168.254.111):. + Processed in 0.035349 secs); 04 Jul 2006 16:18:44 -0000 +Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; + s=domkey; d=rbsinteractive.com; + b=PdaWc4/8r3pxP/NaEYpuOA+pM64F/skZqTvFuhUVF5kOoGcpmQ5vrJY6I0w3x6Ch6qv8FKARrXjQkkM3S+ZYGlgumtZLZ2LZWmGpWeB6ts0WtUDZBLd8r9LA8CH80gBp9I66cboK09cZN3CpWNrqJN47wRwh8wNAVjLFDV+sDio= + ; +Received: from unknown (HELO ?192.168.254.111?) (192.168.254.111) + by mail.89glass.com with SMTP; 4 Jul 2006 16:18:44 -0000 +Message-ID: <44AA94E3.9040301@rbsinteractive.com> +Date: Tue, 04 Jul 2006 09:18:43 -0700 +From: Nolan Cafferky +User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Luckys +CC: pgsql-performance@postgresql.org +Subject: Re: how to tune this query. +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/19 +X-Sequence-Number: 19879 + +I don't think indexes are going to help you here - with the FULL OUTER +JOINs, the query will have to look at and include each row from each +table you query from anyway, so it's going to choose sequential scans. +In addition, some of the lower join conditions are going to take forever. + +What's is your goal? The volume of data that I imagine this query would +produce can't possibly be useful. I'm guessing at the very least you'll +want to LEFT OUTER JOIN everything back against STG_Property, and leave +the other join conditions out of each ON statement. + +Luckys wrote: + +> Hi all, +> I got this query, I'm having indexes for PropertyId and Dates columns +> across all the tables, but still it takes ages to get me the result. +> What indexes would be proposed on this, or I'm helpless? +> +> FROM STG_Property a +> +> FULL OUTER JOIN +> STG_PropConfirmedLogs b +> ON (a.PropertyId = b.PropertyId AND a.p_LastModified = +> b.p_Modified_Date) +> +> FULL OUTER JOIN +> STG_PropConnectionFeesLogs c +> ON ((a.PropertyId = c.PropertyId AND a.p_LastModified = c.p_ChangedOn) +> OR (b.PropertyId = c.PropertyId AND b.p_Modified_Date = +> c.p_ChangedOn)) +> +> FULL OUTER JOIN +> STG_PropDeletedLogs d +> ON ((a.PropertyId = d.PropertyId AND a.p_LastModified = d.p_DeletedOn) +> OR (b.PropertyId = d.PropertyId AND b.p_Modified_Date = +> d.p_DeletedOn) +> OR ( c.PropertyId = d.PropertyId AND c.p_ChangedOn = d.p_DeletedOn)) +> +> FULL OUTER JOIN +> STG_PropFEWALogs e +> ON ((a.PropertyId = e.PropertyId AND a.p_LastModified = +> e.p_Modified_Date) +> OR (b.PropertyId = e.PropertyId AND b.p_Modified_Date = +> e.p_Modified_Date) OR (c.PropertyId = e.PropertyId AND c.p_ChangedOn +> = e.p_Modified_Date) +> OR (d.PropertyId = e.PropertyId AND d.p_DeletedOn = +> e.p_Modified_Date)) +> +> FULL OUTER JOIN +> STG_PropInSewerNetworkLogs f +> ON ((a.PropertyId = f.PropertyId AND a.p_LastModified = +> f.p_Modified_Date) +> OR (b.PropertyId = f.PropertyId AND b.p_Modified_Date = +> f.p_Modified_Date) +> OR (c.PropertyId = f.PropertyId AND c.p_ChangedOn = +> f.p_Modified_Date) +> OR (d.PropertyId = f.PropertyId AND d.p_DeletedOn = +> f.p_Modified_Date) +> OR (e.PropertyId = f.PropertyId AND e.p_Modified_Date = +> f.p_Modified_Date)) FULL OUTER JOIN +> STG_PropTypeLogs g +> ON ((a.PropertyId = g .PropertyId AND a.p_LastModified = +> g.p_LastModified) +> OR (b.PropertyId = g.PropertyId AND b.p_Modified_Date = +> g.p_LastModified) +> OR (c.PropertyId = g.PropertyId AND c.p_ChangedOn = g.p_LastModified) +> OR (d.PropertyId = g.PropertyId AND d.p_DeletedOn = g.p_LastModified) +> OR (e.PropertyId = g.PropertyId AND e.p_Modified_Date = +> g.p_LastModified) +> OR (f.PropertyId = g.PropertyId AND f.p_Modified_Date = +> g.p_LastModified)) +> +> -- Luckys + +-- + +Nolan Cafferky +Software Developer +IT Department +RBS Interactive +nolan.cafferky@rbsinteractive.com + + +From pgsql-bugs-owner@postgresql.org Tue Jul 4 13:27:44 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BF9249FA5DD + for ; + Tue, 4 Jul 2006 13:27:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92935-05 for ; + Tue, 4 Jul 2006 13:27:39 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id B02F19FA4A5 + for ; Tue, 4 Jul 2006 13:27:39 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from www.elogos.de (alextrapp1.equinoxe.de [217.22.192.104]) + by svr4.postgresql.org (Postfix) with ESMTP id E033B5AF06C + for ; Tue, 4 Jul 2006 16:27:38 +0000 (GMT) +Received: from www.elogos.de (localhost [127.0.0.1]) + by www.elogos.de (Postfix) with ESMTP id C91654BB05; + Tue, 4 Jul 2006 16:24:34 +0000 (UTC) +Received: by www.elogos.de (Postfix, from userid 4000) + id C50B64BB0A; Tue, 4 Jul 2006 16:24:34 +0000 (UTC) +Date: Tue, 4 Jul 2006 16:24:34 +0000 +To: Tomasz Ostrowski +Cc: Tom Lane , pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +Message-ID: <20060704162434.GD20619@www.trapp.net> +References: <20060703203105.GA2801@batory.org.pl> + <7353.1151967946@sss.pgh.pa.us> + <20060704083733.GA20102@batory.org.pl> + <13853.1152021389@sss.pgh.pa.us> + <20060704144406.GA21511@batory.org.pl> +Mime-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="fXStkuK2IQBfcDe+" +Content-Disposition: inline +In-Reply-To: <20060704144406.GA21511@batory.org.pl> +User-Agent: Mutt/1.5.9i +From: tomas@tuxteam.de +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/20 +X-Sequence-Number: 15365 + + +--fXStkuK2IQBfcDe+ +Content-Type: text/plain; charset=iso-8859-1 +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +On Tue, Jul 04, 2006 at 04:44:08PM +0200, Tomasz Ostrowski wrote: +> On Tue, 04 Jul 2006, Tom Lane wrote: +>=20 +> > I think the real problem here is that regex matching is the wrong +> > tool for the job. Have you looked into a full-text index +> > (tsearch2)? +>=20 +> So much to do with so little time... + +For what it's worth, I've got pretty good results (at least taking the +little amount of work I put into it) with trigram indexes, courtesy of +$PGCONTRIB/pg_trgm.sql, just another amazing little piece by Bartunov +and Sigaev. + +Let me know if you'd like to hear more. + +Regards +-- tom=E1s + +--fXStkuK2IQBfcDe+ +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.1 (GNU/Linux) + +iD8DBQFEqpZCBcgs9XrR2kYRAuqEAJ9dIwhl+rKvztYyn8PSBI5gnoaspQCdGTMh +n/b9OwcGPMh+LN50K2YL63c= +=XWfB +-----END PGP SIGNATURE----- + +--fXStkuK2IQBfcDe+-- + + +From pgsql-bugs-owner@postgresql.org Tue Jul 4 15:16:06 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3E8789FA7B6 + for ; + Tue, 4 Jul 2006 15:16:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66169-07 for ; + Tue, 4 Jul 2006 15:15:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8D7129FA4A5 + for ; Tue, 4 Jul 2006 15:15:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k64IFsC7025495; + Tue, 4 Jul 2006 14:15:55 -0400 (EDT) +To: Tomasz Ostrowski +cc: pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +In-reply-to: <20060704144406.GA21511@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> + <7353.1151967946@sss.pgh.pa.us> + <20060704083733.GA20102@batory.org.pl> + <13853.1152021389@sss.pgh.pa.us> + <20060704144406.GA21511@batory.org.pl> +Comments: In-reply-to Tomasz Ostrowski + message dated "Tue, 04 Jul 2006 16:44:08 +0200" +Date: Tue, 04 Jul 2006 14:15:54 -0400 +Message-ID: <25494.1152036954@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/21 +X-Sequence-Number: 15366 + +Tomasz Ostrowski writes: +> So why estimate regex expressions if there is no estimation possible? +> Let's set this estimate to be pessimistic (match everything or +> everything not null) and it will choose better plans. + +Better plans for this specific example, worse plans for other cases. +Life is not that simple. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Tue Jul 4 17:27:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 629879FA4A5 + for ; + Tue, 4 Jul 2006 17:27:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78491-03 for + ; + Tue, 4 Jul 2006 17:27:46 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wr-out-0506.google.com (wr-out-0506.google.com + [64.233.184.225]) + by postgresql.org (Postfix) with ESMTP id 211069FA0EC + for ; + Tue, 4 Jul 2006 17:27:46 -0300 (ADT) +Received: by wr-out-0506.google.com with SMTP id i7so833952wra + for ; + Tue, 04 Jul 2006 13:27:45 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=IYw+skfUeyxnGdCYfTVeTxUpOMEoN4TKlr+9+4++oHjx+5z4xNCL4OHeivRLSaBUqGrwJvAl/gYkKXI6lgKPXnJ2wLvKpVg7wH8LnCtY3S4aO9IM2bVBaViV/qr2w1gxmSaHzX/6rVgmstq+/VaX+6NHnVBEyAuPJ7dHOkOGHjY= +Received: by 10.65.176.17 with SMTP id d17mr4538854qbp; + Tue, 04 Jul 2006 13:27:44 -0700 (PDT) +Received: by 10.65.114.11 with HTTP; Tue, 4 Jul 2006 13:27:44 -0700 (PDT) +Message-ID: <430d92a20607041327r4bcd6306ofec4adec6856c037@mail.gmail.com> +Date: Tue, 4 Jul 2006 16:27:44 -0400 +From: Gene +Reply-To: genekhart@gmail.com +To: "Tarhon-Onu Victor" +Subject: Re: optimizing LIKE '%2345' queries +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/20 +X-Sequence-Number: 19880 + +Thanks for the suggestion. Actually I went ahead and created a reverse +function using plpgsql, created an index using reverse column and now +my queries use "where reverse(column) like reverse('%2345') and it's +using the index like i hoped it would! Now if I could figure out how +to optimize like '%2345%' queries. I don't want to create many +indexes though the table is very write heavy. + +> > Is the only way to create a reverse function and create an index using +> > the reverse function and modify queries to use: +> > +> > where reverse(column) like reverse('%2345') ? +> +> Hmm.. interesting. +> If (and only if) the records stored in "column" column have fixed +> length (say, all are 50 characters in length) you could create and index +> on, say, substring(column,45,50), and use this in the WHERE clauses in +> your queries. +> Or if the length of those records is not the same maybe it is +> feasible to create an ondex on substring(column, length(column)-5, +> length(column)). +> +> -- +> Any views or opinions presented within this e-mail are solely those of +> the author and do not necessarily represent those of any company, unless +> otherwise expressly stated. +> + +From pgsql-performance-owner@postgresql.org Tue Jul 4 21:22:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 838EA9FA60C + for ; + Tue, 4 Jul 2006 21:22:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 52960-04 for + ; + Tue, 4 Jul 2006 21:22:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.192]) + by postgresql.org (Postfix) with ESMTP id 2D6D29FA45F + for ; + Tue, 4 Jul 2006 21:22:48 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id l1so1219315nzf + for ; + Tue, 04 Jul 2006 17:22:47 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; + b=YbC2iiRQnFKZ1Ms2viP4cLOSFXU7BZ2DbjXlwhRKbiuZKtPikNpBrU/Fzw3SLrECi0XNy4m7+JO9Yxd48GtrhzSZlLa+VYuLN1JrrNuH7VoGiJyFtHBqFpxUUulCYG3ir+rg28CstBkPjfwMR6F+M8UlIJOywgWGTMP3KxCIvBE= +Received: by 10.36.138.15 with SMTP id l15mr4588597nzd; + Tue, 04 Jul 2006 17:22:47 -0700 (PDT) +Received: from ?10.1.1.20? ( [203.217.18.65]) + by mx.gmail.com with ESMTP id 15sm11781460nzp.2006.07.04.17.22.45; + Tue, 04 Jul 2006 17:22:47 -0700 (PDT) +Message-ID: <44AB0652.2080606@gmail.com> +Date: Wed, 05 Jul 2006 10:22:42 +1000 +From: Chris +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: genekhart@gmail.com +CC: pgsql-performance@postgresql.org +Subject: Re: optimizing LIKE '%2345' queries +References: <430d92a20607021450i1d228350j292d68e987ed58de@mail.gmail.com> + + <430d92a20607041327r4bcd6306ofec4adec6856c037@mail.gmail.com> +In-Reply-To: <430d92a20607041327r4bcd6306ofec4adec6856c037@mail.gmail.com> +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/21 +X-Sequence-Number: 19881 + +Gene wrote: +> Thanks for the suggestion. Actually I went ahead and created a reverse +> function using plpgsql, created an index using reverse column and now +> my queries use "where reverse(column) like reverse('%2345') and it's +> using the index like i hoped it would! Now if I could figure out how +> to optimize like '%2345%' queries. I don't want to create many +> indexes though the table is very write heavy. + +You can't because that text can be anywhere inside the database field, +so the whole field basically has to be checked to see if it's there. + +You could check out full text indexing (tsearch2). + + +http://www.designmagick.com/article/27/PostgreSQL/Introduction-to-Full-Text-Indexing + +-- +Postgresql & php tutorials +http://www.designmagick.com/ + +From pgsql-performance-owner@postgresql.org Wed Jul 5 03:56:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 083B79FA0EC + for ; + Wed, 5 Jul 2006 03:56:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18554-04-2 + for ; + Wed, 5 Jul 2006 03:56:13 -0300 (ADT) +X-Greylist: delayed 00:28:01.463307 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 8929A9FA634 + for ; + Wed, 5 Jul 2006 03:56:13 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from tenar.csd.uoc.gr (tenar.csd.uoc.gr [147.52.16.3]) + by svr4.postgresql.org (Postfix) with ESMTP id 61AF95AF07D + for ; + Wed, 5 Jul 2006 06:28:10 +0000 (GMT) +Received: from localhost (ermis.edu.uoc.gr [147.52.78.6]) + by tenar.csd.uoc.gr (8.12.11.20060308/8.12.10) with ESMTP id + k656QHG5002506 for ; + Wed, 5 Jul 2006 09:26:17 +0300 (EEST) +Organization: +Received: from hera530-a101.otenet.gr (hera530-a101.otenet.gr + [212.205.208.101]) by ermis.edu.uoc.gr (IMP) with HTTP + for ; Wed, 5 Jul 2006 08:54:44 +0300 +Message-ID: <1152078884.44ab542441450@ermis.edu.uoc.gr> +Date: Wed, 5 Jul 2006 08:54:44 +0300 +From: jkapad@csd.uoc.gr +To: pgsql-performance@postgresql.org +Subject: Problem with bitmap-index-scan plan +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-7 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.2 +X-Originating-IP: 212.205.208.101 +X-Scanned-By: MIMEDefang 2.56 on 147.52.16.3 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/22 +X-Sequence-Number: 19882 + +Hi, + +If I run the query + +explain analyze select * from ind_uni_100 where a=1 and b=1 and c=1 + +I get the following plan: + +Bitmap Heap Scan on ind_uni_100 (cost=942.50..1411.12 rows=125 width=104) +(actual time=72.556..72.934 rows=116 loops=1) + Recheck Cond: ((c = 1) AND (a = 1) AND (b = 1)) + -> BitmapAnd (cost=942.50..942.50 rows=125 width=0) (actual +time=72.421..72.421 rows=0 loops=1) + -> Bitmap Index Scan on index_c_ind_uni_100 (cost=0.00..314.00 +rows=50000 width=0) (actual time=21.854..21.854 rows=49832 loops=1) + Index Cond: (c = 1) + -> Bitmap Index Scan on index_a_ind_uni_100 (cost=0.00..314.00 +rows=50000 width=0) (actual time=22.371..22.371 rows=50319 loops=1) + Index Cond: (a = 1) + -> Bitmap Index Scan on index_b_ind_uni_100 (cost=0.00..314.00 +rows=50000 width=0) (actual time=14.226..14.226 rows=49758 loops=1) + Index Cond: (b = 1) +Total runtime: 73.395 ms + +Which is quite reasonable.The table has 1.000.000 rows (17.242 pages). From +pg_stat_get_blocks_fetched I can see that there were 102 page requests for +table. So all things seem to work great here! + +But if I multiply the size of the table ten-times (10.000.000 rows - 172.414 +pages) and run the same query I get: + +explain analyze select * from ind_uni_1000 where a=1 and b=1 and c=1 + +Bitmap Heap Scan on ind_uni_1000 (cost=9369.50..14055.74 rows=1250 width=104) +(actual time=18111.415..176747.937 rows=1251 loops=1) + Recheck Cond: ((c = 1) AND (a = 1) AND (b = 1)) + -> BitmapAnd (cost=9369.50..9369.50 rows=1250 width=0) (actual +time=17684.587..17684.587 rows=0 loops=1) + -> Bitmap Index Scan on index_c_ind_uni_1000 (cost=0.00..3123.00 +rows=500000 width=0) (actual time=5704.624..5704.624 rows=500910 loops=1) + Index Cond: (c = 1) + -> Bitmap Index Scan on index_a_ind_uni_1000 (cost=0.00..3123.00 +rows=500000 width=0) (actual time=6147.962..6147.962 rows=500080 loops=1) + Index Cond: (a = 1) + -> Bitmap Index Scan on index_b_ind_uni_1000 (cost=0.00..3123.00 +rows=500000 width=0) (actual time=5767.754..5767.754 rows=500329 loops=1) + Index Cond: (b = 1) +Total runtime: 176753.200 ms + +which is slower even than a seq scan. Now I get that there were 131.398 page +requests for table in order to retrieve almost 1250 tuples!Can someone explain +why this is happening? All memory parameters are set to default. + +Thanks! + + + +From pgsql-bugs-owner@postgresql.org Wed Jul 5 05:34:09 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D00559FA66C + for ; + Wed, 5 Jul 2006 05:34:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71582-05 for ; + Wed, 5 Jul 2006 05:34:03 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from pancernik.batory.org.pl (pancernik.batory.org.pl + [62.89.72.210]) + by postgresql.org (Postfix) with ESMTP id 79FF29FA0EC + for ; Wed, 5 Jul 2006 05:34:02 -0300 (ADT) +Received: from pancernik.batory.org.pl (localhost.localdomain [127.0.0.1]) + by pancernik.batory.org.pl (8.13.6/8.13.6) with ESMTP id k658Y0Oa000743; + Wed, 5 Jul 2006 10:34:00 +0200 +Received: (from tometzky@localhost) + by pancernik.batory.org.pl (8.13.6/8.13.6/Submit) id k658XxEw000742; + Wed, 5 Jul 2006 10:33:59 +0200 +Date: Wed, 5 Jul 2006 10:33:59 +0200 +From: Tomasz Ostrowski +To: Tom Lane +Cc: pgsql-bugs@postgresql.org +Subject: Re: query very slow when enable_seqscan=on +Message-ID: <20060705083358.GA570@batory.org.pl> +References: <20060703203105.GA2801@batory.org.pl> + <7353.1151967946@sss.pgh.pa.us> + <20060704083733.GA20102@batory.org.pl> + <13853.1152021389@sss.pgh.pa.us> + <20060704144406.GA21511@batory.org.pl> + <25494.1152036954@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <25494.1152036954@sss.pgh.pa.us> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/25 +X-Sequence-Number: 15370 + +On Tue, 04 Jul 2006, Tom Lane wrote: + +> Tomasz Ostrowski writes: +> > So why estimate regex expressions if there is no estimation possible? +> > Let's set this estimate to be pessimistic (match everything or +> > everything not null) and it will choose better plans. +> +> Better plans for this specific example, worse plans for other cases. +> Life is not that simple. + +It isn't. This worse plans will be choosen only when pattern/regex +matching is used and will be, say, 2 times worse. + +What I'm trying to point out is that some people use regular +expressions for filtering rows. When the program is written it is +often impossible to know what data will be put into it. And when a +program is unexpectedly 2000 times slower than normal it is much +worse than if it is 2 times slower, but predictable. + +I know Postgres uses probabilistic approach so there's always a +probability that the planner chooses very wrong. But this probability +is so small that it can be ignored. With pattern/regex matching it is +not. + +Regards +Tometzky +-- +...although Eating Honey was a very good thing to do, there was a +moment just before you began to eat it which was better than when you +were... + Winnie the Pooh + +From pgsql-performance-owner@postgresql.org Wed Jul 5 07:38:21 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0804F9FA64B + for ; + Wed, 5 Jul 2006 07:38:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 00901-03 for + ; + Wed, 5 Jul 2006 07:38:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id BC4CC9FA0EC + for ; + Wed, 5 Jul 2006 07:38:13 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tc87b.t.pppool.de + [89.55.200.123]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 41EB6656C1 + for ; + Wed, 5 Jul 2006 12:39:48 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id B82D3181B2EC1 + for ; + Wed, 5 Jul 2006 12:38:20 +0200 (CEST) +Message-ID: <44AB969C.6090604@logix-tt.com> +Date: Wed, 05 Jul 2006 12:38:20 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Is postgresql ca do the job for software deployed in +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/23 +X-Sequence-Number: 19883 + +Hi, Mikael, + +Just my 2 cents: + +Mikael Carneholm wrote: +> Do you really need to create one *DB* per client - that is, is one +> schema (in the same DB) per client out of the question? + +Sometimes, schemas would work _technically_, but not politically, as a +postgresql user cannot be prevented from listing all schemas (or even +all databases in the same user), regardless whether he/she has access +rights. + +But it is not always acceptable that a customer knows which other +customers one has. + +This forces the use of the "one cluster per customer" paradigm. + + +Thanks, +Markus +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Wed Jul 5 08:05:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 86ED99FA64B + for ; + Wed, 5 Jul 2006 08:05:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26038-02 for + ; + Wed, 5 Jul 2006 08:05:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from loki.globexplorer.com (loki.globexplorer.com [12.25.176.46]) + by postgresql.org (Postfix) with ESMTP id 2BE599FA646 + for ; + Wed, 5 Jul 2006 08:05:46 -0300 (ADT) +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="Windows-1252" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Is postgresql ca do the job for software deployed in +Date: Wed, 5 Jul 2006 04:06:23 -0700 +Message-ID: + <71E37EF6B7DCC1499CEA0316A256832802B3E203@loki.wc.globexplorer.net> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Is postgresql ca do the job for software deployed in +thread-index: AcagH3RCHacG9ULQQVqRwUHMJKLrlQAAxWN2 +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> + <44AB969C.6090604@logix-tt.com> +From: "Gregory S. Williamson" +To: "Markus Schaber" , +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/24 +X-Sequence-Number: 19884 + +A sodden late night idea ... schemas don't need to have names that are = +meaningful to outsiders. + +Still, the point about "political" aspects is an important one. OTH, = +schemas provide an elegant way of segregating data. + +My $0.02 (not worth what it was) + +Greg Williamson +DBA +GlobeXplorer LLC + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org on behalf of Markus Schaber +Sent: Wed 7/5/2006 3:38 AM +To: pgsql-performance@postgresql.org +Cc:=09 +Subject: Re: [PERFORM] Is postgresql ca do the job for software deployed = +in + +Hi, Mikael, + +Just my 2 cents: + +Mikael Carneholm wrote: +> Do you really need to create one *DB* per client - that is, is one +> schema (in the same DB) per client out of the question? + +Sometimes, schemas would work _technically_, but not politically, as a +postgresql user cannot be prevented from listing all schemas (or even +all databases in the same user), regardless whether he/she has access +rights. + +But it is not always acceptable that a customer knows which other +customers one has. + +This forces the use of the "one cluster per customer" paradigm. + + +Thanks, +Markus +--=20 +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org = +www.nosoftwarepatents.org + +---------------------------(end of broadcast)--------------------------- +TIP 4: Have you searched our list archives? + + http://archives.postgresql.org + +!DSPAM:44ab96fb98231804284693! + + + + + +From pgsql-performance-owner@postgresql.org Wed Jul 5 10:07:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 821069FA646 + for ; + Wed, 5 Jul 2006 10:07:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06354-08 for + ; + Wed, 5 Jul 2006 10:07:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 1306C9FA0EC + for ; + Wed, 5 Jul 2006 10:07:06 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from office.redwerk.com (office.redwerk.com [85.90.206.104]) + by svr4.postgresql.org (Postfix) with ESMTP id F244B5AF05D + for ; + Wed, 5 Jul 2006 13:07:04 +0000 (GMT) +Received: from bofh by office.redwerk.com with local (Exim 4.62 (FreeBSD)) + (envelope-from ) id 1Fy75r-0000e3-0q + for pgsql-performance@postgresql.org; Wed, 05 Jul 2006 16:07:03 +0300 +Date: Wed, 5 Jul 2006 16:07:03 +0300 +From: Eugeny N Dzhurinsky +To: pgsql-performance@postgresql.org +Subject: managing database with thousands of tables +Message-ID: <20060705130703.GA2428@office.redwerk.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=koi8-r +Content-Disposition: inline +User-Agent: Mutt/1.5.11 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/25 +X-Sequence-Number: 19885 + +Hello! + +I facing some strange problems with PostgreSQL 8.0 performance. +I have application which handles a lot of tasks, each task is keps in separate +table. Those tables are dropped and created again periodically (precisely - +when new task results came back from remote server). Also each table can have +hundreds of thousands records inside (but mostly they do have just few +thousands). + +Sometimes I facing performance loss when working with database, and aafter I +performed vacuuming on entire database, i saw some tables and indexes in pg_* +schemas were optimized and hundreds of thousands records were deleted. Could +that be the reason of performance loss, and if so - how can I fix that? + +I have pg_autovacuum up and running all the time + +pg_autovacuum -d 3 -D -L /dev/null + +but it seems pg_autovacuum does not do vacuuming on system tables. + +-- +Eugene Dzhurinsky + +From pgsql-performance-owner@postgresql.org Wed Jul 5 10:39:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6C0F79FA646 + for ; + Wed, 5 Jul 2006 10:39:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18683-05 for + ; + Wed, 5 Jul 2006 10:39:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 7176F9FA0EC + for ; + Wed, 5 Jul 2006 10:39:33 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k65DdVYD002956; + Wed, 5 Jul 2006 09:39:31 -0400 (EDT) +To: Eugeny N Dzhurinsky +cc: pgsql-performance@postgresql.org +Subject: Re: managing database with thousands of tables +In-reply-to: <20060705130703.GA2428@office.redwerk.com> +References: <20060705130703.GA2428@office.redwerk.com> +Comments: In-reply-to Eugeny N Dzhurinsky + message dated "Wed, 05 Jul 2006 16:07:03 +0300" +Date: Wed, 05 Jul 2006 09:39:31 -0400 +Message-ID: <2955.1152106771@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/26 +X-Sequence-Number: 19886 + +Eugeny N Dzhurinsky writes: +> but it seems pg_autovacuum does not do vacuuming on system tables. + +There was a bug awhile back whereby autovac failed to notice temp table +cleanup at connection end --- maybe you need to update? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jul 5 12:07:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A07C99FA64B + for ; + Wed, 5 Jul 2006 12:07:54 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49620-03 for + ; + Wed, 5 Jul 2006 12:07:39 -0300 (ADT) +X-Greylist: delayed 00:24:41.725825 by SQLgrey- +Received: from home.nohrsc.nws.gov (home.nohrsc.nws.gov [192.46.108.2]) + by postgresql.org (Postfix) with ESMTP id 32F5C9FA0EC + for ; + Wed, 5 Jul 2006 12:07:38 -0300 (ADT) +Received: from noaa.gov (opps-gw.nohrsc.nws.gov [192.46.108.142]) + by home.nohrsc.nws.gov (Postfix) with ESMTP + id 24C69A570; Wed, 5 Jul 2006 09:43:01 -0500 (CDT) +Message-ID: <44ABCFF4.3010007@noaa.gov> +Date: Wed, 05 Jul 2006 09:43:00 -0500 +From: andy rost +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.4) Gecko/20030624 Netscape/7.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: bill.sites@noaa.gov +Subject: Opteron/FreeBSD/PostgreSQL performance poor +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/27 +X-Sequence-Number: 19887 + +We're in the process of porting from Informix 9.4 to PostgreSQL 8.1.3. +Our PostgreSQL server is an AMD Opteron Dual Core 275 with two 2.2 Ghz +64-bit processors. There are two internal drives and an external +enclosure containing 14 drives (configured as 7 pairs of mirrored drives +- four pairs for table spaces, one pair for dbcluster, two pairs for +point in time recovery). The operating system is FreeBSD 6.0-RELEASE #10 + +The output from ulimit -a is: + +ulimit -a +core file size (blocks, -c) unlimited +data seg size (kbytes, -d) 33554432 +file size (blocks, -f) unlimited +max locked memory (kbytes, -l) unlimited +max memory size (kbytes, -m) unlimited +open files (-n) 11095 +pipe size (512 bytes, -p) 1 +stack size (kbytes, -s) 524288 +cpu time (seconds, -t) unlimited +max user processes (-u) 5547 +virtual memory (kbytes, -v) unlimited + +Shared memory kernel parameters are set to: + +shmmax 1073741000 +shmmin 1 +shmall 262144 +shmseg 128 +shmmni 192 +semmni 256 +semmns 512 +semmsl 256 +semmap 256 +semvmx 32767 +shm_use_phys 1 + +The postgresql.conf file contains: + +#--------------------------------------------------------------------------- +# FILE LOCATIONS +#--------------------------------------------------------------------------- + +# The default values of these variables are driven from the -D command line +# switch or PGDATA environment variable, represented here as ConfigDir. + +#data_directory = 'ConfigDir' # use data in another directory +#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file +#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file + +# If external_pid_file is not explicitly set, no extra pid file is written. + +#external_pid_file = '(none)' # write an extra pid file + + +#--------------------------------------------------------------------------- +# CONNECTIONS AND AUTHENTICATION +#--------------------------------------------------------------------------- + +# - Connection Settings - + +listen_addresses = '*' # what IP address(es) to listen on; + # comma-separated list of +addresses; + # defaults to 'localhost', '*' += all +port = 5432 +max_connections = 102 +# note: increasing max_connections costs ~400 bytes of shared memory per +# connection slot, plus lock space (see max_locks_per_transaction). You +# might also need to raise shared_buffers to support more connections. +superuser_reserved_connections = 2 +unix_socket_directory = '' +unix_socket_group = '' +unix_socket_permissions = 0777 # octal +bonjour_name = '' # defaults to the computer name + +# - Security & Authentication - + +authentication_timeout = 60 # 1-600, in seconds +ssl = off +password_encryption = on +db_user_namespace = off + +# Kerberos + +krb_server_keyfile = '' +krb_srvname = 'postgres' +krb_server_hostname = '' # empty string matches any +keytab entry +krb_caseins_users = off + +# - TCP Keepalives - +# see 'man 7 tcp' for details + +tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; + # 0 selects the system default +tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; + # 0 selects the system default +tcp_keepalives_count = 0 # TCP_KEEPCNT; + # 0 selects the system default + + +#--------------------------------------------------------------------------- +# RESOURCE USAGE (except WAL) +#--------------------------------------------------------------------------- + +# - Memory - + +shared_buffers = 125000 # min 16 or max_connections*2, +8KB each +temp_buffers = 1000 # min 100, 8KB each +max_prepared_transactions = 0 # can be 0 or more +# note: increasing max_prepared_transactions costs ~600 bytes of shared +memory +# per transaction slot, plus lock space (see max_locks_per_transaction). +work_mem = 10000 # min 64, size in KB +maintenance_work_mem = 50000 # min 1024, size in KB +max_stack_depth = 500000 # in 100, size in KB + # ulimit -a or ulimit -s + +# - Free Space Map - + +max_fsm_pages = 600000 # min max_fsm_relations*16, 6 +bytes each +max_fsm_relations = 1000 # min 100, ~70 bytes each + +# - Kernel Resource Usage - + +max_files_per_process = 1000 # min 25 +preload_libraries = '' + +# - Cost-Based Vacuum Delay - + +vacuum_cost_delay = 0 # 0-1000 milliseconds +vacuum_cost_page_hit = 1 # 0-10000 credits +vacuum_cost_page_miss = 10 # 0-10000 credits +vacuum_cost_page_dirty = 20 # 0-10000 credits +vacuum_cost_limit = 200 # 0-10000 credits + +# - Background writer - + +bgwriter_delay = 200 # 10-10000 milliseconds between +rounds +bgwriter_lru_percent = 1.0 # 0-100% of LRU buffers +scanned/round +bgwriter_lru_maxpages = 1000 # 0-1000 buffers max written/round +bgwriter_all_percent = 0.333 # 0-100% of all buffers +scanned/round +bgwriter_all_maxpages = 1000 # 0-1000 buffers max written/round + + +#--------------------------------------------------------------------------- +# WRITE AHEAD LOG +#--------------------------------------------------------------------------- + +# - Settings - + +fsync = on # turns forced synchronization +on or off +wal_sync_method = fsync # the default is the first option + # supported by the operating +system: + # open_datasync + # fdatasync + # fsync + # fsync_writethrough + # open_sync +full_page_writes = on # recover from partial page writes +wal_buffers = 64 # min 4, 8KB each +commit_delay = 0 # range 0-100000, in microseconds +commit_siblings = 5 # range 1-1000 + +# - Checkpoints - + +checkpoint_segments = 120 # in logfile segments, min 1, +16MB each +checkpoint_timeout = 900 # range 30-3600, in seconds +checkpoint_warning = 900 # in seconds, 0 is off + +# - Archiving - + +archive_command = 'archive_wal -email -txtmsg "%p" "%f"' # +command to use + # to archive a logfile segment + + +#--------------------------------------------------------------------------- +# QUERY TUNING +#--------------------------------------------------------------------------- + +# - Planner Method Configuration - + +enable_bitmapscan = on +enable_hashagg = on +enable_hashjoin = on +enable_indexscan = on +enable_mergejoin = on +enable_nestloop = on +enable_seqscan = on +enable_sort = on +enable_tidscan = on + +# - Planner Cost Constants - + +effective_cache_size = 27462 # typically 8KB each + # On TRU64 do /sbin/sysconfig +-q advfs + # to get the size o +AdvfsCacheMaxPercent + # (default is 7% of RAM). On +FreeBSD set + # to sysctl -n vfs.hibufspace / +8192 +random_page_cost = 2 # units are one sequential page +fetch + # cost +cpu_tuple_cost = 0.01 # (same) +cpu_index_tuple_cost = 0.001 # (same) +cpu_operator_cost = 0.0025 # (same) + +# - Genetic Query Optimizer - + +geqo = on +geqo_threshold = 12 +geqo_effort = 5 # range 1-10 +geqo_pool_size = 0 # selects default based on effort +geqo_generations = 0 # selects default based on effort +geqo_selection_bias = 2.0 # range 1.5-2.0 + +# - Other Planner Options - + +default_statistics_target = 100 # range 1-1000 +constraint_exclusion = off +from_collapse_limit = 8 +join_collapse_limit = 8 # 1 disables collapsing of explicit + # JOINs + + +#--------------------------------------------------------------------------- +# ERROR REPORTING AND LOGGING +#--------------------------------------------------------------------------- + +# - Where to Log - + +log_destination = 'stderr' # Valid values are combinations of + # stderr, syslog and eventlog, + # depending on platform. + +# This is used when logging to stderr: +redirect_stderr = on # Enable capturing of stderr +into log + # files + +# These are only used if redirect_stderr is on: +log_directory = 'pg_log' # Directory where log files are +written + # Can be absolute or relative +to PGDATA +log_filename = 'postgresql_log.%a' # Log file name pattern. + # Can include strftime() escapes +log_truncate_on_rotation = on # If on, any existing log file +of the + # same name as the new log file +will be + # truncated rather than +appended to. But + # such truncation only occurs on + # time-driven rotation, not on +restarts + # or size-driven rotation. +Default is + # off, meaning append to +existing files + # in all cases. +log_rotation_age = 1440 # Automatic rotation of logfiles +will + # happen after so many minutes. + 0 to + # disable. +log_rotation_size = 10240 # Automatic rotation of logfiles +will + # happen after so many +kilobytes of log + # output. 0 to disable. + +# These are relevant when logging to syslog: +syslog_facility = 'LOCAL0' +syslog_ident = 'postgres' + + +# - When to Log - + +client_min_messages = log # Values, in order of decreasing +detail: + # debug5 + # debug4 + # debug3 + # debug2 + # debug1 + # log + # notice + # warning + # error + +log_min_messages = notice # Values, in order of decreasing +detail: + # debug5 + # debug4 + # debug3 + # debug2 + # debug1 + # info + # notice + # warning + # error + # log + # fatal + # panic + +log_error_verbosity = default # terse, default, or verbose +messages + +log_error_verbosity = default # terse, default, or verbose +messages + +#log_min_error_statement = notice # Values in order of increasing +severity: + # debug5 + # debug4 + # debug3 + # debug2 + # debug1 + # info + # notice + # warning + # error + # panic(off) + +log_min_duration_statement = 1000 # -1 is disabled, 0 logs all +statements + # and their durations, in +milliseconds. + +silent_mode = off # DO NOT USE without syslog or + # redirect_stderr + +# - What to Log - + +debug_print_parse = off +debug_print_rewritten = off +debug_print_plan = off +debug_pretty_print = off +log_connections = off +log_disconnections = off +log_duration = off +log_line_prefix = '%t' # Special values: + # %u = user name + # %d = database name + # %r = remote host and port + # %h = remote host + # %p = PID + # %t = timestamp (no +milliseconds) + # %m = timestamp with +milliseconds + # %i = command tag + # %c = session id + # %l = session line number + # %s = session start timestamp + # %x = transaction id + # %q = stop here in non-session + # processes + # %% = '%' + # e.g. '<%u%%%d> ' +log_statement = 'none' # none, mod, ddl, all +log_hostname = off + + +#--------------------------------------------------------------------------- +# RUNTIME STATISTICS +#--------------------------------------------------------------------------- + +# - Statistics Monitoring - + +log_parser_stats = off +log_planner_stats = off +log_executor_stats = off +log_statement_stats = off + +# - Query/Index Statistics Collector - + +stats_start_collector = on +stats_command_string = on +stats_block_level = on +stats_row_level = on +stats_reset_on_server_start = off + + +#--------------------------------------------------------------------------- +# AUTOVACUUM PARAMETERS +#--------------------------------------------------------------------------- + +autovacuum = off # enable autovacuum subprocess? +autovacuum_naptime = 60 # time between autovacuum runs, +in secs +autovacuum_vacuum_threshold = 1000 # min # of tuple updates before + # vacuum +autovacuum_analyze_threshold = 500 # min # of tuple updates before + # analyze +autovacuum_vacuum_scale_factor = 0.4 # fraction of rel size before + # vacuum +autovacuum_analyze_scale_factor = 0.2 # fraction of rel size before + # analyze +autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for + # autovac, -1 means use + # vacuum_cost_delay +autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for + # autovac, -1 means use + # vacuum_cost_limit + + +#--------------------------------------------------------------------------- +# CLIENT CONNECTION DEFAULTS +#--------------------------------------------------------------------------- + +# - Statement Behavior - + +search_path = '$user' # schema names +default_tablespace = '' # a tablespace name, '' uses + # the default +check_function_bodies = on +default_transaction_isolation = 'read committed' +default_transaction_read_only = off +statement_timeout = 7200000 # 0 is disabled, in milliseconds + +# - Locale and Formatting - + +datestyle = 'iso, mdy' +timezone = unknown # actually, defaults to TZ + # environment setting +australian_timezones = off +extra_float_digits = 0 # min -15, max 2 +client_encoding = sql_ascii # actually, defaults to database + # encoding + +# These settings are initialized by initdb -- they might be changed +lc_messages = 'C' # locale for system error message + # strings +lc_monetary = 'C' # locale for monetary formatting +lc_numeric = 'C' # locale for number formatting +lc_time = 'C' # locale for time formatting + +# - Other Defaults - + +explain_pretty_print = on +dynamic_library_path = '$libdir' + + +#--------------------------------------------------------------------------- +# LOCK MANAGEMENT +#--------------------------------------------------------------------------- + +deadlock_timeout = 7200000 # in milliseconds +max_locks_per_transaction = 500 # min 10 +# note: each lock table slot uses ~220 bytes of shared memory, and there are +# max_locks_per_transaction * (max_connections + max_prepared_transactions) +# lock table slots. + + +#--------------------------------------------------------------------------- +# VERSION/PLATFORM COMPATIBILITY +#--------------------------------------------------------------------------- + +# - Previous Postgres Versions - + +add_missing_from = off +regex_flavor = advanced # advanced, extended, or basic +sql_inheritance = on +default_with_oids = off +escape_string_warning = off + +# - Other Platforms & Clients - + +transform_null_equals = off + + +#--------------------------------------------------------------------------- +# CUSTOMIZED OPTIONS +#--------------------------------------------------------------------------- + +#custom_variable_classes = '' # list of custom variable class +names + +NOTE - raising shared_buffers had no effect +NOTE - changing stats_command_string had no effect + +The pg_hba.conf file contains: + +# TYPE DATABASE USER CIDR-ADDRESS METHOD + +# "local" is for Unix domain socket connections only +local all postgre trust +# IPv4 local connections: +host all postgre 127.0.0.1/32 trust +hostnossl operations opps,opps_adm 10.1.10.0/8 trust +hostnossl development,work all 10.1.10.0/8 trust +# IPv6 local connections: +host all postgre ::1/128 trust + +The pg_ident.conf file, other than comments, is empty. + +We're running an OLTP database with a small number of connections (<50) +performing mostly reads and inserts on modest sized tables (largest is < +2,000,000 records). + +The symptoms are: + +a) All 4 CPUs are nearly always 0% idle; +b) The system load level is nearly always in excess of 20; +c) the output from vmstat -w 10 looks like: + procs memory page disks faults cpu + r b w avm fre flt re pi po fr sr aa0 aa1 in sy cs us +sy id +21 0 3 1242976 327936 2766 0 0 0 2264 0 2 2 17397 140332 +104846 18 82 1 +21 0 3 1242932 313312 2761 0 0 0 1223 0 1 1 15989 128666 +107019 13 86 1 +19 3 0 1245908 275356 3762 0 0 0 1962 0 3 3 16397 131584 +105792 14 85 1 +21 0 2 1243968 262616 2006 0 0 0 2036 0 1 1 15260 122801 +107406 14 85 1 + 4 19 0 1240996 247004 1589 0 0 0 984 0 1 0 15403 121323 +108331 12 87 2 +17 1 2 1230744 252888 2440 0 0 0 1807 0 1 0 17977 142618 +105600 15 84 2 +NOTE - small user demands and high system demands +d) Running top indicates a significant number or sblock states and +occasional smwai states; +e) ps auxww | grep postgres doesn't show anything abnormal; +f) ESQL applications are very slow. + +We VACUUM ANALYZE user databases every four hours. We VACUUM template1 +every 4 hours. We make a copy of the current WAL every minute. We create +a PIT recovery archive daily daily. None of these, individually seem to +place much strain on the server. + +Hopefully I've supplied enough information to start diagnosing the +problem. Any ideas, thoughts, suggestions are greatly appreciated ... + + +Andy + +-- +-------------------------------------------------------------------------------- +Andrew Rost +National Operational Hydrologic Remote Sensing Center (NOHRSC) +National Weather Service, NOAA +1735 Lake Dr. West, Chanhassen, MN 55317-8582 +Voice: (952)361-6610 x 234 +Fax: (952)361-6634 +andy.rost@noaa.gov +http://www.nohrsc.noaa.gov +-------------------------------------------------------------------------------- + + + +From pgsql-performance-owner@postgresql.org Wed Jul 5 12:47:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 30CCF9FA0EC + for ; + Wed, 5 Jul 2006 12:47:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38085-06 for + ; + Wed, 5 Jul 2006 12:46:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id 53A389FA646 + for ; + Wed, 5 Jul 2006 12:46:57 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id 9FCFF58059; Wed, 5 Jul 2006 10:46:56 -0500 (CDT) +Date: Wed, 5 Jul 2006 11:46:56 -0400 +From: Stephen Frost +To: andy rost +Cc: pgsql-performance@postgresql.org, bill.sites@noaa.gov +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +Message-ID: <20060705154656.GS22057@kenobi.snowman.net> +Mail-Followup-To: andy rost , + pgsql-performance@postgresql.org, bill.sites@noaa.gov +References: <44ABCFF4.3010007@noaa.gov> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="TegBI+r9roYdcP94" +Content-Disposition: inline +In-Reply-To: <44ABCFF4.3010007@noaa.gov> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-2-vserver-686 (i686) +X-Uptime: 11:27:39 up 10 days, 5:24, 22 users, load average: 1.43, 0.80, 0.69 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/28 +X-Sequence-Number: 19888 + + +--TegBI+r9roYdcP94 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +* andy rost (andy.rost@noaa.gov) wrote: +> We're in the process of porting from Informix 9.4 to PostgreSQL 8.1.3.=20 +> Our PostgreSQL server is an AMD Opteron Dual Core 275 with two 2.2 Ghz=20 +> 64-bit processors. There are two internal drives and an external=20 +> enclosure containing 14 drives (configured as 7 pairs of mirrored drives= +=20 +> - four pairs for table spaces, one pair for dbcluster, two pairs for=20 +> point in time recovery). The operating system is FreeBSD 6.0-RELEASE #10 + +Not sure it matters, but is the mirroring done with a hardware +controller or in software? + +> shared_buffers =3D 125000 # min 16 or max_connections*2,= +=20 +> 8KB each +> temp_buffers =3D 1000 # min 100, 8KB each +> max_prepared_transactions =3D 0 # can be 0 or more +> # note: increasing max_prepared_transactions costs ~600 bytes of shared= +=20 +> memory +> # per transaction slot, plus lock space (see max_locks_per_transaction). +> work_mem =3D 10000 # min 64, size in KB +> maintenance_work_mem =3D 50000 # min 1024, size in KB +> max_stack_depth =3D 500000 # in 100, size in KB +> # ulimit -a or ulimit -s + +These seem kind of.. backwards... Just an example of one system I've +got shows: + +shared_buffers =3D 10000 +work_mem =3D 32768 +maintenance_work_mem =3D 65535 + +Defaults for the rest. This is more of a data-warehouse than an OLTP, +so I'm sure these aren't perfect for you, but you might try playing with +them some. + +> # - Free Space Map - +> max_fsm_pages =3D 600000 # min max_fsm_relations*16, 6= +=20 +> bytes each + +This seems somewhat hgih from the default of 20,000, but for a very +frequently changing database it may make sense. + +> archive_command =3D 'archive_wal -email -txtmsg "%p" "%f"' #=20 +> command to use + +Are WALs being archived very frequently? Any idea if this takes much +time? I wouldn't really think it'd be an issue, but might be useful to +know. + +> effective_cache_size =3D 27462 # typically 8KB each + +This seems like it might be a little low... How much memory do you have +in the system? Then again, with your shared_mem set so high, perhaps +it's not that bad, but it might make sense to swap those two settings, +or at least that'd be a more common PG setup. + +> random_page_cost =3D 2 # units are one sequential page= +=20 + +That's quite a bit lower than the default of 4... May make sense for +you but it's certainly something to look at. + +> We're running an OLTP database with a small number of connections (<50)= +=20 +> performing mostly reads and inserts on modest sized tables (largest is <= +=20 +> 2,000,000 records). +>=20 +> The symptoms are: +>=20 +> a) All 4 CPUs are nearly always 0% idle; +> b) The system load level is nearly always in excess of 20; + +At a guess I'd say that the system is doing lots of sequential scans +rather than using indexes, and that's why the processes are ending up in +a disk-wait state, which makes the load go up. Have you looked at the +plans which are being generated for the most common queries to see what +they're doing? + +I'd also wonder if the shared_mem setting isn't set *too* high and +causing problems with the IPC or something... Not something I've heard +of (generally, going up with shared_mem doesn't degrade performance, +just doesn't improve it) but might be possible. + +> We VACUUM ANALYZE user databases every four hours. We VACUUM template1=20 +> every 4 hours. We make a copy of the current WAL every minute. We create= +=20 +> a PIT recovery archive daily daily. None of these, individually seem to= +=20 +> place much strain on the server. + +This doesn't sound too bad at all. How long do the vacuum's run for? +If it's 3 hours, then that might start to be an issue with disk I/O +contention... + +> Hopefully I've supplied enough information to start diagnosing the=20 +> problem. Any ideas, thoughts, suggestions are greatly appreciated ... + +Just my 2c, hopefully you'll get some better answers too. :) + + Thanks, + + Stephen + +--TegBI+r9roYdcP94 +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFEq97wrzgMPqB3kigRAuLWAJ9fnjgf3kNU3qUPUO7F7HIULweBQwCfQseF ++CTDICWnBiC2RFepgAHzJAM= +=ixPR +-----END PGP SIGNATURE----- + +--TegBI+r9roYdcP94-- + +From pgsql-performance-owner@postgresql.org Wed Jul 5 12:57:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 953479FA646 + for ; + Wed, 5 Jul 2006 12:57:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 81195-02 for + ; + Wed, 5 Jul 2006 12:57:28 -0300 (ADT) +X-Greylist: delayed 02:50:31.053161 by SQLgrey- +Received: from office.redwerk.com (office.redwerk.com [85.90.206.104]) + by postgresql.org (Postfix) with ESMTP id 5F3149FA0EC + for ; + Wed, 5 Jul 2006 12:57:28 -0300 (ADT) +Received: from bofh by office.redwerk.com with local (Exim 4.62 (FreeBSD)) + (envelope-from ) id 1Fy9kl-00040P-BZ + for pgsql-performance@postgresql.org; Wed, 05 Jul 2006 18:57:27 +0300 +Date: Wed, 5 Jul 2006 18:57:27 +0300 +From: Eugeny N Dzhurinsky +To: pgsql-performance@postgresql.org +Subject: Re: managing database with thousands of tables +Message-ID: <20060705155727.GC15232@office.redwerk.com> +References: <20060705130703.GA2428@office.redwerk.com> + <2955.1152106771@sss.pgh.pa.us> +Mime-Version: 1.0 +Content-Type: text/plain; charset=koi8-r +Content-Disposition: inline +In-Reply-To: <2955.1152106771@sss.pgh.pa.us> +User-Agent: Mutt/1.5.11 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/29 +X-Sequence-Number: 19889 + +On Wed, Jul 05, 2006 at 09:39:31AM -0400, Tom Lane wrote: +> Eugeny N Dzhurinsky writes: +> > but it seems pg_autovacuum does not do vacuuming on system tables. +> +> There was a bug awhile back whereby autovac failed to notice temp table +> cleanup at connection end --- maybe you need to update? + +May be. So should I update to newer postgres 8.1 or just upgrade +pg_autovacuum somehow (I don't know how btw ;) )? + +-- +Eugene N Dzhurinsky + +From pgsql-performance-owner@postgresql.org Wed Jul 5 14:55:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D45819FA61D + for ; + Wed, 5 Jul 2006 14:55:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05806-05 for + ; + Wed, 5 Jul 2006 14:55:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by postgresql.org (Postfix) with ESMTP id 002F89FA4A8 + for ; + Wed, 5 Jul 2006 14:55:30 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id 9CE6AB826; + Wed, 5 Jul 2006 13:55:29 -0400 (EDT) +In-Reply-To: <44ABCFF4.3010007@noaa.gov> +References: <44ABCFF4.3010007@noaa.gov> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <41D25DC5-6499-4C80-A7DE-A0D4FA86916D@khera.org> +Cc: pgsql-performance@postgresql.org, + bill.sites@noaa.gov +Content-Transfer-Encoding: 7bit +From: Vivek Khera +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +Date: Wed, 5 Jul 2006 13:55:28 -0400 +To: andy rost +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/30 +X-Sequence-Number: 19890 + + +On Jul 5, 2006, at 10:43 AM, andy rost wrote: + +> We're in the process of porting from Informix 9.4 to PostgreSQL +> 8.1.3. Our PostgreSQL server is an AMD Opteron Dual Core 275 with +> two 2.2 Ghz 64-bit processors. There are two internal drives and an +> external enclosure containing 14 drives (configured as 7 pairs of +> mirrored drives - four pairs for table spaces, one pair for +> dbcluster, two pairs for point in time recovery). The operating +> system is FreeBSD 6.0-RELEASE #10 + +What RAID card are you hooked up to? My best machines have LSI +MegaRAID 320-2X cards in them, with the pairs of each mirrored set on +opposing channels. My second best machine (into which the above card +will not fit) uses an Adaptec 2230SLP card similarly configured. + +The database is mirrored from one box to the other, and a vacuum +analyze takes ~10 hours. + +You seem to have done the right things in your postgresql.conf file. + +Things I'd like to know before offering advice: how big is your +database? Ie, what is the "df" output for your various partitions +holding Pg data? also, how much RAM is in this box? And finally, +can you show the output of "iostsat -w3" for a few rows during times +when you're having poor performance. + + + +From pgsql-performance-owner@postgresql.org Wed Jul 5 15:11:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E49269FA4A8 + for ; + Wed, 5 Jul 2006 15:11:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29304-09 for + ; + Wed, 5 Jul 2006 15:11:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from home.nohrsc.nws.gov (home.nohrsc.nws.gov [192.46.108.2]) + by postgresql.org (Postfix) with ESMTP id 1E9819FA61D + for ; + Wed, 5 Jul 2006 15:11:02 -0300 (ADT) +Received: from noaa.gov (opps-gw.nohrsc.nws.gov [192.46.108.142]) + by home.nohrsc.nws.gov (Postfix) with ESMTP + id 5EC85A571; Wed, 5 Jul 2006 13:11:01 -0500 (CDT) +Message-ID: <44AC00B5.6030207@noaa.gov> +Date: Wed, 05 Jul 2006 13:11:01 -0500 +From: andy rost +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.4) Gecko/20030624 Netscape/7.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Stephen Frost +Cc: pgsql-performance@postgresql.org, Bill.Sites@noaa.gov +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +References: <44ABCFF4.3010007@noaa.gov> + <20060705154656.GS22057@kenobi.snowman.net> +In-Reply-To: <20060705154656.GS22057@kenobi.snowman.net> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/31 +X-Sequence-Number: 19891 + + +Hi Stephen, + +Thanks for your input. My follow ups are interleaved below ... + +Stephen Frost wrote: +> * andy rost (andy.rost@noaa.gov) wrote: +> +>>We're in the process of porting from Informix 9.4 to PostgreSQL 8.1.3. +>>Our PostgreSQL server is an AMD Opteron Dual Core 275 with two 2.2 Ghz +>>64-bit processors. There are two internal drives and an external +>>enclosure containing 14 drives (configured as 7 pairs of mirrored drives +>>- four pairs for table spaces, one pair for dbcluster, two pairs for +>>point in time recovery). The operating system is FreeBSD 6.0-RELEASE #10 +> +> +> Not sure it matters, but is the mirroring done with a hardware +> controller or in software? +> + +I'll have to check on this when our system administrator returns +tomorrow. I performed a quick test while the server was under load by +moving a couple of Gigs of data while running iostat.I was getting disk +I/O rates of about 125 KB per transaction, 250 transactions per second, +and 35 Mg per second on all drives. + +> +>>shared_buffers = 125000 # min 16 or max_connections*2, +>>8KB each +>>temp_buffers = 1000 # min 100, 8KB each +>>max_prepared_transactions = 0 # can be 0 or more +>># note: increasing max_prepared_transactions costs ~600 bytes of shared +>>memory +>># per transaction slot, plus lock space (see max_locks_per_transaction). +>>work_mem = 10000 # min 64, size in KB +>>maintenance_work_mem = 50000 # min 1024, size in KB +>>max_stack_depth = 500000 # in 100, size in KB +>> # ulimit -a or ulimit -s +> +> +> These seem kind of.. backwards... Just an example of one system I've +> got shows: +> +> shared_buffers = 10000 +> work_mem = 32768 +> maintenance_work_mem = 65535 +> +> Defaults for the rest. This is more of a data-warehouse than an OLTP, +> so I'm sure these aren't perfect for you, but you might try playing with +> them some. + +Originally shared_buffers was set to 32768. I set it to its current +value out of desperations (newby response). + +> +> +>># - Free Space Map - +>>max_fsm_pages = 600000 # min max_fsm_relations*16, 6 +>>bytes each +> +> +> This seems somewhat hgih from the default of 20,000, but for a very +> frequently changing database it may make sense. +> + +This value is based on the output from VACUUM ANALYZE + +> +>>archive_command = 'archive_wal -email -txtmsg "%p" "%f"' # +>>command to use +> +> +> Are WALs being archived very frequently? Any idea if this takes much +> time? I wouldn't really think it'd be an issue, but might be useful to +> know. +> + +Yes, about 100 times per hour. No, I don't think it takes much time + +> +>>effective_cache_size = 27462 # typically 8KB each +> +> +> This seems like it might be a little low... How much memory do you have +> in the system? Then again, with your shared_mem set so high, perhaps +> it's not that bad, but it might make sense to swap those two settings, +> or at least that'd be a more common PG setup. + +Oops, forgot to mention that we have 6 Gigs of memory. This value was +set based on sysctl -n vfs.hibufspace / 8192 + +> +> +>>random_page_cost = 2 # units are one sequential page +> +> +> That's quite a bit lower than the default of 4... May make sense for +> you but it's certainly something to look at. +> + +This value set per web page entitiled "Annotated POSTGRESQL.CONF Guide +for PostgreSQL" + +> +>>We're running an OLTP database with a small number of connections (<50) +>>performing mostly reads and inserts on modest sized tables (largest is < +>>2,000,000 records). +>> +>>The symptoms are: +>> +>>a) All 4 CPUs are nearly always 0% idle; +>>b) The system load level is nearly always in excess of 20; +> +> +> At a guess I'd say that the system is doing lots of sequential scans +> rather than using indexes, and that's why the processes are ending up in +> a disk-wait state, which makes the load go up. Have you looked at the +> plans which are being generated for the most common queries to see what +> they're doing? + +We thought of that too. However, executing: +select * from pg_stat_user_tables +suggests that we are using indexes where needed. We confirmed this by +checking and running manually queries reported by +select * from pg_stat_activity +while the server is suffering + +> +> I'd also wonder if the shared_mem setting isn't set *too* high and +> causing problems with the IPC or something... Not something I've heard +> of (generally, going up with shared_mem doesn't degrade performance, +> just doesn't improve it) but might be possible. +> + +Possible I suppose but we had the same trouble while the server was +configured with 32768 buffers + +> +>>We VACUUM ANALYZE user databases every four hours. We VACUUM template1 +>>every 4 hours. We make a copy of the current WAL every minute. We create +>>a PIT recovery archive daily daily. None of these, individually seem to +>>place much strain on the server. +> +> +> This doesn't sound too bad at all. How long do the vacuum's run for? +> If it's 3 hours, then that might start to be an issue with disk I/O +> contention... +> + +VACUUM ANALYZE lasts about an hour and fifteen minutes + +> +>>Hopefully I've supplied enough information to start diagnosing the +>>problem. Any ideas, thoughts, suggestions are greatly appreciated ... +> +> +> Just my 2c, hopefully you'll get some better answers too. :) +> + +Again, many thanks. Is this the proper mail list for this problem or +should I also be addressing the administation mail list as well? + +> Thanks, +> +> Stephen + +-- +-------------------------------------------------------------------------------- +Andrew Rost +National Operational Hydrologic Remote Sensing Center (NOHRSC) +National Weather Service, NOAA +1735 Lake Dr. West, Chanhassen, MN 55317-8582 +Voice: (952)361-6610 x 234 +Fax: (952)361-6634 +andy.rost@noaa.gov +http://www.nohrsc.noaa.gov +-------------------------------------------------------------------------------- + + + +From pgsql-performance-owner@postgresql.org Wed Jul 5 16:18:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C10B29FA61D + for ; + Wed, 5 Jul 2006 16:18:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 91067-07 for + ; + Wed, 5 Jul 2006 16:17:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 1C3699FA4A8 + for ; + Wed, 5 Jul 2006 16:17:58 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D1F05.dip0.t-ipconnect.de + [84.157.31.5]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 760E2656C1 + for ; + Wed, 5 Jul 2006 21:19:37 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 88B8B184C7A8D + for ; + Wed, 5 Jul 2006 21:18:08 +0200 (CEST) +Message-ID: <44AC106F.1040304@logix-tt.com> +Date: Wed, 05 Jul 2006 21:18:07 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Is postgresql ca do the job for software deployed in +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E47B2@sesrv12.wirelesscar.com> + <44AB969C.6090604@logix-tt.com> + <71E37EF6B7DCC1499CEA0316A256832802B3E203@loki.wc.globexplorer.net> +In-Reply-To: + <71E37EF6B7DCC1499CEA0316A256832802B3E203@loki.wc.globexplorer.net> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/32 +X-Sequence-Number: 19892 + +Hi, Gregory, + +Gregory S. Williamson wrote: +> A sodden late night idea ... schemas don't need to have names that +> are meaningful to outsiders. + +Yes, but having schema names like A34FZ37 not only qualifies for +thedailywtf.com, but also tends to produce maintainance nightmares. + +And it still allows the customer to estimate the amount of customers. + +> Still, the point about "political" aspects is an important one. OTH, +> schemas provide an elegant way of segregating data. + +Yes, they do, and in the ASP case (where we have control over all +software that connects to PostgreSQL) we use the one schema per customer +paradigm quite successfully. + +> My $0.02 (not worth what it was) + +Oh, I think the're at least $0.03 cents worth. :-) + +Markus +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Wed Jul 5 20:59:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7A7A19FA605 + for ; + Wed, 5 Jul 2006 20:59:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 91820-08 for + ; + Wed, 5 Jul 2006 20:59:29 -0300 (ADT) +X-Greylist: delayed 00:13:04.815632 by SQLgrey- +Received: from colo-dns-ext1.juniper.net (colo-dns-ext1.juniper.net + [207.17.137.57]) + by postgresql.org (Postfix) with ESMTP id BDCBC9FA147 + for ; + Wed, 5 Jul 2006 20:59:29 -0300 (ADT) +Received: from merlot.juniper.net (merlot.juniper.net [172.17.27.10]) + by colo-dns-ext1.juniper.net (8.11.3/8.9.3) with ESMTP id k65NkNX60556 + for ; + Wed, 5 Jul 2006 16:46:23 -0700 (PDT) + (envelope-from kenjim@juniper.net) +Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [172.17.58.60]) + by merlot.juniper.net (8.11.3/8.11.3) with ESMTP id k65NkH572817; + Wed, 5 Jul 2006 16:46:17 -0700 (PDT) + (envelope-from kenjim@juniper.net) +Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [127.0.0.1]) + by kenjim-lnx.juniper.net (8.13.4/8.13.4) with ESMTP id k65NkH4Q003090; + Wed, 5 Jul 2006 16:46:17 -0700 +Received: (from kenjim@localhost) + by kenjim-lnx.juniper.net (8.13.4/8.13.4/Submit) id k65NkHDW003089; + Wed, 5 Jul 2006 16:46:17 -0700 +Date: Wed, 5 Jul 2006 16:46:17 -0700 +From: Kenji Morishige +To: pgsql-performance@postgresql.org +Cc: kenjim@juniper.net +Subject: suggested RAID controller for FreeBSD 6.1 + PostgreSQL 8.1 +Message-ID: <20060705234617.GB2367@juniper.net> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/34 +X-Sequence-Number: 19894 + +I am currently running FreeBSD 4.11 (due to IT requirements for now) and +Adaptec's 2200S RAID controller running in RAID5. I was advised in the past +that the 2200S is actually a poor performing controller and obviously the +RAID5 is less than ideal for databases. I chose to run the controller in +RAID5 as the tech I talked to suggested that the 2200S was primarily designed +for RAID5 and it would operate the best that way. My server is a dual Xeon + 3.06Ghz box running on a motherboard approximately 2-3 years old now. I'd +like to know what an ideal RAID controller that would be compatible with +FreeBSD 6.1 would be these days. + +Thanks in advance, +Kenji + +From pgsql-performance-owner@postgresql.org Wed Jul 5 20:50:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 297569FA147 + for ; + Wed, 5 Jul 2006 20:50:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32365-10 for + ; + Wed, 5 Jul 2006 20:49:50 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-3.paradise.net.nz (bm-3a.paradise.net.nz + [203.96.152.182]) + by postgresql.org (Postfix) with ESMTP id 215159FA605 + for ; + Wed, 5 Jul 2006 20:49:49 -0300 (ADT) +Received: from smtp-2.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-3.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J1Y00076FIZZY@linda-3.paradise.net.nz> for + pgsql-performance@postgresql.org; Thu, 06 Jul 2006 11:49:47 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-28-133.dsl.clear.net.nz [218.101.28.133]) by + smtp-2.paradise.net.nz (Postfix) with ESMTP id DD71AAC2CA; + Thu, 06 Jul 2006 11:49:46 +1200 (NZST) +Date: Thu, 06 Jul 2006 11:49:40 +1200 +From: Mark Kirkwood +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +In-reply-to: <44AC00B5.6030207@noaa.gov> +To: andy rost +Cc: Stephen Frost , pgsql-performance@postgresql.org, + Bill.Sites@noaa.gov +Message-id: <44AC5014.1070605@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=us-ascii +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: <44ABCFF4.3010007@noaa.gov> + <20060705154656.GS22057@kenobi.snowman.net> <44AC00B5.6030207@noaa.gov> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/33 +X-Sequence-Number: 19893 + +andy rost wrote: +> + +>>> effective_cache_size = 27462 # typically 8KB each +>> +>> +>> This seems like it might be a little low... How much memory do you have +>> in the system? Then again, with your shared_mem set so high, perhaps +>> it's not that bad, but it might make sense to swap those two settings, +>> or at least that'd be a more common PG setup. +> +> Oops, forgot to mention that we have 6 Gigs of memory. This value was +> set based on sysctl -n vfs.hibufspace / 8192 +> + +That vfs.hibufspace sysctl is a little deceptive IMHO - e.g on my +FreeBSD 6.1 system with 2G of ram it says 117276672 (i.e. about 112M), +but I have a 1G file cached entirely in ram at the moment... In FreeBSD +file pages are actually kept in the 'Inactive' section of memory, the +'Buffer' section is used as a 'window' to read 'em. For instance on my +system I see: + +Mem: 4192K Active, 1303M Inact, 205M Wired, 12K Cache, 112M Buf, 491M Free + +So my 1G file is cached in the 1303M of 'Inactive', but I have 112M of +buffer window for accessing this (and other) cached files. Now, I may +not have explained this that well, and it is quite confusing... but +hopefully you get the idea! + +Now on the basis of the figures provided: +- max_connections=102 , each with work_mem=10000 (approx 1G in total) +- shared buffers=125000 (1G total) + +it looks like you are only using about 2G of your 6G, so there is a lot +left for caching file pages (lets say 3-4G or so). + +I would think you can happily set effective_cache_size=393216 (i.e. +3G/8192). This will have the side effect of encouraging more index scans +(probably what you want I think). + +Best wishes + +Mark + +From pgsql-performance-owner@postgresql.org Wed Jul 5 21:33:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5FC4C9FA605 + for ; + Wed, 5 Jul 2006 21:33:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82574-06 for + ; + Wed, 5 Jul 2006 21:33:26 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.192]) + by postgresql.org (Postfix) with ESMTP id 7BD779FA147 + for ; + Wed, 5 Jul 2006 21:33:26 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id 13so1537496nzp + for ; + Wed, 05 Jul 2006 17:33:25 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; + b=Jiu9bKKlDWlVkfxopKaewvRvda9kVc0RtFqTCHQJffVefMQRn3gyYNY7KZXtnWh6CudXSh9lcxLXQAxPInFHhAKLk3QazYRBpRPapJbyNxvTs6Pmi/F9OLuD4iojQBhUQQ1+i0fh2eE79v+t4aTNet89efpikBZoyqH3O/haNq8= +Received: by 10.36.47.14 with SMTP id u14mr33083nzu; + Wed, 05 Jul 2006 17:33:25 -0700 (PDT) +Received: from ?10.1.1.20? ( [203.217.18.65]) + by mx.gmail.com with ESMTP id 12sm163906nzn.2006.07.05.17.33.22; + Wed, 05 Jul 2006 17:33:24 -0700 (PDT) +Message-ID: <44AC5A50.9000503@gmail.com> +Date: Thu, 06 Jul 2006 10:33:20 +1000 +From: Chris +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Eugeny N Dzhurinsky +CC: pgsql-performance@postgresql.org +Subject: Re: managing database with thousands of tables +References: <20060705130703.GA2428@office.redwerk.com> + <2955.1152106771@sss.pgh.pa.us> + <20060705155727.GC15232@office.redwerk.com> +In-Reply-To: <20060705155727.GC15232@office.redwerk.com> +Content-Type: text/plain; charset=KOI8-R; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/35 +X-Sequence-Number: 19895 + +Eugeny N Dzhurinsky wrote: +> On Wed, Jul 05, 2006 at 09:39:31AM -0400, Tom Lane wrote: +>> Eugeny N Dzhurinsky writes: +>>> but it seems pg_autovacuum does not do vacuuming on system tables. +>> There was a bug awhile back whereby autovac failed to notice temp table +>> cleanup at connection end --- maybe you need to update? +> +> May be. So should I update to newer postgres 8.1 or just upgrade +> pg_autovacuum somehow (I don't know how btw ;) )? + +Update the whole lot. You should be able to do the upgrade "in place" +but take a backup "just in case". + +http://www.postgresql.org/docs/8.1/interactive/release.html + +will list all changes between versions. + +-- +Postgresql & php tutorials +http://www.designmagick.com/ + +From pgsql-performance-owner@postgresql.org Wed Jul 5 21:52:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 66E349FA605 + for ; + Wed, 5 Jul 2006 21:52:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77378-07 for + ; + Wed, 5 Jul 2006 21:52:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz + [203.96.152.183]) + by postgresql.org (Postfix) with ESMTP id BFC119FA147 + for ; + Wed, 5 Jul 2006 21:52:18 -0300 (ADT) +Received: from smtp-2.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J1Y00FMLIF430@linda-4.paradise.net.nz> for + pgsql-performance@postgresql.org; Thu, 06 Jul 2006 12:52:16 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-28-133.dsl.clear.net.nz [218.101.28.133]) by + smtp-2.paradise.net.nz (Postfix) with ESMTP id 09E0315D941D; + Thu, 06 Jul 2006 12:52:15 +1200 (NZST) +Date: Thu, 06 Jul 2006 12:52:09 +1200 +From: Mark Kirkwood +Subject: Re: suggested RAID controller for FreeBSD 6.1 + PostgreSQL +In-reply-to: <20060705234617.GB2367@juniper.net> +To: Kenji Morishige +Cc: pgsql-performance@postgresql.org +Message-id: <44AC5EB9.8060707@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: <20060705234617.GB2367@juniper.net> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/36 +X-Sequence-Number: 19896 + +Kenji Morishige wrote: +> I am currently running FreeBSD 4.11 (due to IT requirements for now) and +> Adaptec's 2200S RAID controller running in RAID5. I was advised in the past +> that the 2200S is actually a poor performing controller and obviously the +> RAID5 is less than ideal for databases. I chose to run the controller in +> RAID5 as the tech I talked to suggested that the 2200S was primarily designed +> for RAID5 and it would operate the best that way. My server is a dual Xeon +> 3.06Ghz box running on a motherboard approximately 2-3 years old now. I'd +> like to know what an ideal RAID controller that would be compatible with +> FreeBSD 6.1 would be these days. +> +> + +I've had good experience with 3Ware on FreeBSD - painless installs and +excellent performance! (in my case the older 7506 models for (P)ATA on +4.10, 5.4, 6.0 and 6.1). + +It looks like the new 9550 series is supported in 6.1 onwards. Given +that this has been added recently I would suggest mailing +freebsd-hardware to see what experiences folks are having (I don't +recall seeing any postings about issues with the 9000 or 9550 series). + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Thu Jul 6 03:40:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0CC889FB1C0 + for ; + Thu, 6 Jul 2006 03:40:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25034-06 for + ; + Thu, 6 Jul 2006 03:40:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from office.redwerk.com (office.redwerk.com [85.90.206.104]) + by postgresql.org (Postfix) with ESMTP id 142C69FA603 + for ; + Thu, 6 Jul 2006 03:40:16 -0300 (ADT) +Received: from bofh by office.redwerk.com with local (Exim 4.62 (FreeBSD)) + (envelope-from ) id 1FyNX6-0000Qf-2U + for pgsql-performance@postgresql.org; Thu, 06 Jul 2006 09:40:16 +0300 +Date: Thu, 6 Jul 2006 09:40:16 +0300 +From: Eugeny N Dzhurinsky +To: pgsql-performance@postgresql.org +Subject: getting better performance +Message-ID: <20060706064016.GC1091@office.redwerk.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=koi8-r +Content-Disposition: inline +User-Agent: Mutt/1.5.11 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/37 +X-Sequence-Number: 19897 + +Hello! + +I have a postgresql server serving thousands of tables. Sometime there are +queries which involves several tables. + +In postgresql.conf I have these settings: + +shared_buffers = 40000 +work_mem = 8192 +maintenance_work_mem = 16384 +max_stack_depth = 2048 + +all other settings are left by default (except ones needed for pg_autovacuum). + +Is there anything I can tune to get better performance? + +-- +Eugene N Dzhurinsky + +From pgsql-performance-owner@postgresql.org Thu Jul 6 03:48:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 14E0A9FB1C0 + for ; + Thu, 6 Jul 2006 03:48:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32764-01 for + ; + Thu, 6 Jul 2006 03:48:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moutng.kundenserver.de (moutng.kundenserver.de + [212.227.126.188]) + by postgresql.org (Postfix) with ESMTP id D55249FA603 + for ; + Thu, 6 Jul 2006 03:48:09 -0300 (ADT) +Received: from [194.25.154.138] (helo=webserv.wug.de) + by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis), + id 0ML29c-1FyNei1Uwb-0003Nl; Thu, 06 Jul 2006 08:48:08 +0200 +Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) + id 1FyNeh-0007nc-00 + for pgsql-performance@postgresql.org; Thu, 06 Jul 2006 08:48:07 +0200 +Date: Thu, 6 Jul 2006 08:48:07 +0200 +From: "A. Kretschmer" +To: pgsql-performance@postgresql.org +Subject: Re: getting better performance +Message-ID: <20060706064807.GD27611@webserv.wug-glas.de> +References: <20060706064016.GC1091@office.redwerk.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <20060706064016.GC1091@office.redwerk.com> +X-DEST: 208 +X-OS: Linux - weil ich es mir Wert bin! +X-Info: registrierter Linux-User 97922 http://counter.li.org +User-Agent: mutt-ng 1.5.9i (Linux) +X-Provags-ID: kundenserver.de abuse@kundenserver.de + login:51ea9561fc3f6d9539a2acd743e4748c +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/38 +X-Sequence-Number: 19898 + +am 06.07.2006, um 9:40:16 +0300 mailte Eugeny N Dzhurinsky folgendes: +> In postgresql.conf I have these settings: +> +> shared_buffers = 40000 +> work_mem = 8192 +> maintenance_work_mem = 16384 +> max_stack_depth = 2048 +> +> all other settings are left by default (except ones needed for pg_autovacuum). +> +> Is there anything I can tune to get better performance? + +You can set "log_min_duration_statement" to log slow querys and then +analyse this querys. + + +HTH, Andreas +-- +Andreas Kretschmer (Kontakt: siehe Header) +Heynitz: 035242/47215, D1: 0160/7141639 +GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net + === Schollglas Unternehmensgruppe === + +From pgsql-performance-owner@postgresql.org Thu Jul 6 05:46:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2E6FD9FB1C4 + for ; + Thu, 6 Jul 2006 05:46:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32412-04 for + ; + Thu, 6 Jul 2006 05:46:09 -0300 (ADT) +X-Greylist: delayed 00:30:56.936089 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 536FB9FB1C0 + for ; + Thu, 6 Jul 2006 05:46:09 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from az18cn848.global.ds.honeywell.com (tmpnat1.honeywell.com + [199.64.0.252]) + by svr4.postgresql.org (Postfix) with ESMTP id 2914D5AF05B + for ; + Thu, 6 Jul 2006 08:15:10 +0000 (GMT) +Received: from AZ18EV808.global.ds.honeywell.com ([131.127.167.102]) by + az18cn848.global.ds.honeywell.com with Microsoft + SMTPSVC(6.0.3790.1830); Thu, 6 Jul 2006 01:15:07 -0700 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C6A0D4.4AB0301C" +Subject: Re: unsubscribe +Date: Thu, 6 Jul 2006 01:15:07 -0700 +Message-ID: + +In-Reply-To: +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] unsubscribe +Thread-Index: AcaZcmqfp4/5L54AR8q4vsCyEO+oRgHYa6SQ +From: "Chethana, Rao (IE10)" +To: +X-OriginalArrivalTime: 06 Jul 2006 08:15:07.0649 (UTC) + FILETIME=[4AE23F10:01C6A0D4] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/39 +X-Sequence-Number: 19899 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C6A0D4.4AB0301C +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +=20 + +Unsubscribe + +=20 + +________________________________ + +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Diego +Gaviola +Sent: Tuesday, June 27, 2006 4:15 AM +To: pgsql-performance@postgresql.org +Subject: [PERFORM] unsubscribe + +=20 + +unsubscribe=20 + + +------_=_NextPart_001_01C6A0D4.4AB0301C +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + + +
+ +

  + +

Unsubscribe

+ +
+ +

  + +

+ +
+ +
+ +
+ +
+ +

From: +pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Diego Gaviola
+Sent: Tuesday, June 27, = +2006 4:15 +AM
+To: +pgsql-performance@postgresql.org
+Subject: [PERFORM] = +unsubscribe

+ +
+ +

 

+ +

unsubscribe

+ +
+ + + + + +------_=_NextPart_001_01C6A0D4.4AB0301C-- + +From pgsql-performance-owner@postgresql.org Thu Jul 6 05:48:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DEB939FB1C3 + for ; + Thu, 6 Jul 2006 05:48:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40768-03 for + ; + Thu, 6 Jul 2006 05:48:11 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.185]) + by postgresql.org (Postfix) with ESMTP id 181D29FA603 + for ; + Thu, 6 Jul 2006 05:48:10 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id m19so26048nfc + for ; + Thu, 06 Jul 2006 01:48:09 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=sQboxooAkqxkb3ZNlseI/Rxhcm5qGOIKN+3Tiw8iyhYbk3xF7PIAIC65yJ0uxi7zA4kHCDwvt5FYqDnD9hbMbtoBQJzlkq9BIZVv/xxkMzvPk9reyZA3FANxzPu1ISlo3cqb+OQYeqZSiM3FFlMYr3AbDE8O8vpGGGpvwllssOA= +Received: by 10.49.21.7 with SMTP id y7mr242006nfi; + Thu, 06 Jul 2006 01:48:09 -0700 (PDT) +Received: by 10.48.47.19 with HTTP; Thu, 6 Jul 2006 01:48:09 -0700 (PDT) +Message-ID: <751e56400607060148vc8186ffpe580c4741ce942fd@mail.gmail.com> +Date: Thu, 6 Jul 2006 12:48:09 +0400 +From: "Ivan Zolotukhin" +Reply-To: iz@sai.msu.ru +To: "A. Kretschmer" +Subject: Re: getting better performance +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060706064807.GD27611@webserv.wug-glas.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <20060706064016.GC1091@office.redwerk.com> + <20060706064807.GD27611@webserv.wug-glas.de> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/40 +X-Sequence-Number: 19900 + +On 7/6/06, A. Kretschmer wrote: +> am 06.07.2006, um 9:40:16 +0300 mailte Eugeny N Dzhurinsky folgendes: +> > In postgresql.conf I have these settings: +> > +> > shared_buffers = 40000 +> > work_mem = 8192 +> > maintenance_work_mem = 16384 +> > max_stack_depth = 2048 +> > +> > all other settings are left by default (except ones needed for pg_autovacuum). +> > +> > Is there anything I can tune to get better performance? +> +> You can set "log_min_duration_statement" to log slow querys and then +> analyse this querys. + +When you collect your logs try PgFouine +http://pgfouine.projects.postgresql.org/ +to understand what queries should be optimized and what's the reason +of poor performance. + +From pgsql-performance-owner@postgresql.org Thu Jul 6 05:49:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F2E7D9FB1C3 + for ; + Thu, 6 Jul 2006 05:49:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 98320-08 for + ; + Thu, 6 Jul 2006 05:49:37 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id DD38B9FA603 + for ; + Thu, 6 Jul 2006 05:49:37 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smail3.alcatel.fr (smail3.alcatel.fr [64.208.49.56]) + by svr4.postgresql.org (Postfix) with ESMTP id 9A0E05AF07B + for ; + Thu, 6 Jul 2006 08:49:36 +0000 (GMT) +Received: from frmail33.netfr.alcatel.fr (frmail33.netfr.alcatel.fr + [155.132.182.174]) + by smail3.alcatel.fr (ALCANET/NETFR) with ESMTP id k668nWqo028412 + for ; Thu, 6 Jul 2006 10:49:32 +0200 +Received: from [172.26.118.199] ([172.26.118.199]) + by frmail33.netfr.alcatel.fr (Lotus Domino Release 5.0.9a) + with ESMTP id 2006070610493178:3062 ; Thu, 6 Jul 2006 10:49:31 +0200 +Message-ID: <44ACCE9D.5050204@alcatel.fr> +Date: Thu, 06 Jul 2006 10:49:33 +0200 +From: Monique.Lu@alcatel.fr +User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; + rv:1.7.3) Gecko/20040910 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: unsubscribe +X-MIMETrack: Itemize by SMTP Server on FRMAIL33/FR/ALCATEL(Release 5.0.9a + |January 7, 2002) at 07/06/2006 10:49:31, + Serialize by Router on FRMAIL33/FR/ALCATEL(Release 5.0.9a |January 7, + 2002) at 07/06/2006 10:49:32, + Serialize complete at 07/06/2006 10:49:32 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset=us-ascii; format=flowed +X-Alcanet-MTA-scanned-and-authorized: yes +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.221 tagged_above=0 required=5 tests=BAYES_20, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200607/41 +X-Sequence-Number: 19901 + + + +From pgsql-performance-owner@postgresql.org Thu Jul 6 06:36:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 546599FB1CA; + Thu, 6 Jul 2006 06:36:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36840-05; Thu, 6 Jul 2006 06:36:10 -0300 (ADT) +X-Greylist: delayed 00:30:50.354611 by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 37E479FB1C5; + Thu, 6 Jul 2006 06:36:08 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from denali.trilogy.com (denali.trilogy.com [149.74.1.3]) + by svr4.postgresql.org (Postfix) with ESMTP id 8AD6D5AF024; + Thu, 6 Jul 2006 09:05:17 +0000 (GMT) +Received: from sunrise.trilogy.com (sunset.trilogy.com [149.74.1.10] (may be + forged)) + by denali.trilogy.com (8.12.9/8.12.8) with ESMTP id k66959TV002463; + Thu, 6 Jul 2006 04:05:09 -0500 +In-Reply-To: <44ACCE9D.5050204@alcatel.fr> +To: pgsql-performance@postgresql.org +Cc: pgsql-performance-owner@postgresql.org +Subject: unsubscribe +MIME-Version: 1.0 +X-Mailer: Lotus Notes Release 7.0.1 January 17, 2006 +From: Vipul.Gupta@trilogy.com +Message-ID: + +Date: Thu, 6 Jul 2006 14:35:12 +0530 +X-MIMETrack: Serialize by Router on Sunrise/Trilogy(Release 7.0.1 HF250|June + 15, 2006) at 07/06/2006 04:05:13 AM, + Serialize complete at 07/06/2006 04:05:13 AM +Content-Type: multipart/alternative; + boundary="=_alternative 00322226652571A3_=" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.462 tagged_above=0 required=5 tests=BAYES_50, + NO_REAL_NAME, RAZOR2_CF_RANGE_51_100, RAZOR2_CF_RANGE_E4_51_100, + RAZOR2_CHECK +X-Spam-Level: *** +X-Archive-Number: 200607/42 +X-Sequence-Number: 19902 + +This is a multipart message in MIME format. +--=_alternative 00322226652571A3_= +Content-Type: text/plain; charset="US-ASCII" + + +--=_alternative 00322226652571A3_= +Content-Type: text/html; charset="US-ASCII" + + +--=_alternative 00322226652571A3_=-- + +From pgsql-performance-owner@postgresql.org Thu Jul 6 11:28:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0AE399FA147 + for ; + Thu, 6 Jul 2006 11:28:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19100-07 for + ; + Thu, 6 Jul 2006 11:28:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id CC97D9FA0EC + for ; + Thu, 6 Jul 2006 11:28:45 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 6 Jul 2006 14:28:39 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 06 Jul 2006 09:28:39 -0500 +Subject: Re: getting better performance +From: Scott Marlowe +To: Eugeny N Dzhurinsky +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060706064016.GC1091@office.redwerk.com> +References: <20060706064016.GC1091@office.redwerk.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1152196118.13851.110.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Thu, 06 Jul 2006 09:28:39 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/43 +X-Sequence-Number: 19903 + +On Thu, 2006-07-06 at 01:40, Eugeny N Dzhurinsky wrote: +> Hello! +> +> I have a postgresql server serving thousands of tables. Sometime there are +> queries which involves several tables. + +Do you add / remove tables a lot? Could be you've got system catalog +bloat. + +do you have autovacuum running? + +What version of pgsql are you running? + +What OS? + +What file system? + +What kind of machine are you using? + +How much memory does it have? + +How many disk drives? + +Are you using RAID? hardware / software? battery backed cache or no? + +Do you have one or two, or thousands of connections at a time? + +Do you use connection pooling if you have lots of connections to handle? + +There's a lot of info needed to make a decision on how to performance +tune a system. + +From pgsql-performance-owner@postgresql.org Thu Jul 6 11:44:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1370B9FA147 + for ; + Thu, 6 Jul 2006 11:44:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76955-02 for + ; + Thu, 6 Jul 2006 11:44:29 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.202]) + by postgresql.org (Postfix) with ESMTP id 51AB59FA0EC + for ; + Thu, 6 Jul 2006 11:44:28 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id z3so874428nzf + for ; + Thu, 06 Jul 2006 07:44:26 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=jqQiM+AOyyp7eniVOlAXvZXvfPkE6TGdlx3HPUcETk7hlQYd5S0Nd2Ow662WuS+tLp6UhCkXBQAt2aOrwbOX0z3/m43ZwcR2gRhezRCTsFBNZeU5B95xHQ6o9i9UpnmH+x+m4e2tKpqtzzKGx9h/Q11RNDTgKGBhPQtrODA7r5Q= +Received: by 10.65.219.7 with SMTP id w7mr634908qbq; + Thu, 06 Jul 2006 07:44:26 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Thu, 6 Jul 2006 07:44:26 -0700 (PDT) +Message-ID: +Date: Thu, 6 Jul 2006 10:44:26 -0400 +From: "Merlin Moncure" +To: "andy rost" +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +Cc: pgsql-performance@postgresql.org, bill.sites@noaa.gov +In-Reply-To: <44ABCFF4.3010007@noaa.gov> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <44ABCFF4.3010007@noaa.gov> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/44 +X-Sequence-Number: 19904 + +On 7/5/06, andy rost wrote: + +> fsync = on # turns forced synchronization + +have you tried turning this off and measuring performance? + +> stats_command_string = on + +I would turn this off unless you absoltely require it. It is +expensive for what it does. + +> a) All 4 CPUs are nearly always 0% idle; +> b) The system load level is nearly always in excess of 20; + +I am guessing your system is spending all it's time syncing. If so, +it's solvable (again, just run fsync=off for a bit and compare). + +> c) the output from vmstat -w 10 looks like: +> procs memory page disks faults cpu +> r b w avm fre flt re pi po fr sr aa0 aa1 in sy cs us +> sy id +> 21 0 3 1242976 327936 2766 0 0 0 2264 0 2 2 17397 140332 +> 104846 18 82 1 + +is that 100k context switches over 10 seconds or one second? that +might be something to check out. pg 8.1 is regarded as the solution +to any cs problem, though. + +> NOTE - small user demands and high system demands +> d) Running top indicates a significant number or sblock states and +> occasional smwai states; +> e) ps auxww | grep postgres doesn't show anything abnormal; +> f) ESQL applications are very slow. +> +> We VACUUM ANALYZE user databases every four hours. We VACUUM template1 +> every 4 hours. We make a copy of the current WAL every minute. We create +> a PIT recovery archive daily daily. None of these, individually seem to +> place much strain on the server. + +your server should be able to handle this easily. + +> Hopefully I've supplied enough information to start diagnosing the +> problem. Any ideas, thoughts, suggestions are greatly appreciated ... +> + +can you please approximate roughly how many transactions per second +your server is handling while you are getting the 20 load condition +(and, if possible, broken down into read and write transactions)? + +merlin + +From pgsql-performance-owner@postgresql.org Thu Jul 6 12:11:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 595E39FA147 + for ; + Thu, 6 Jul 2006 12:11:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02274-05 for + ; + Thu, 6 Jul 2006 12:11:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from office.redwerk.com (office.redwerk.com [85.90.206.104]) + by postgresql.org (Postfix) with ESMTP id F3C7A9FA0EC + for ; + Thu, 6 Jul 2006 12:11:27 -0300 (ADT) +Received: from bofh by office.redwerk.com with local (Exim 4.62 (FreeBSD)) + (envelope-from ) id 1FyVVm-0002Pe-Oo + for pgsql-performance@postgresql.org; Thu, 06 Jul 2006 18:11:26 +0300 +Date: Thu, 6 Jul 2006 18:11:26 +0300 +From: Eugeny N Dzhurinsky +To: pgsql-performance@postgresql.org +Subject: Re: getting better performance +Message-ID: <20060706151126.GA9239@office.redwerk.com> +References: <20060706064016.GC1091@office.redwerk.com> + <1152196118.13851.110.camel@state.g2switchworks.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=koi8-r +Content-Disposition: inline +In-Reply-To: <1152196118.13851.110.camel@state.g2switchworks.com> +User-Agent: Mutt/1.5.11 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/45 +X-Sequence-Number: 19905 + +On Thu, Jul 06, 2006 at 09:28:39AM -0500, Scott Marlowe wrote: +> On Thu, 2006-07-06 at 01:40, Eugeny N Dzhurinsky wrote: +> Do you add / remove tables a lot? Could be you've got system catalog +> bloat. + +Yes, almost each table is dropped and re-created in 3-5 days. + +> do you have autovacuum running? + +Yes. + +> What version of pgsql are you running? + +psql -V +psql (PostgreSQL) 8.0.0 + +> What OS? + +CentOS release 3.7 (Final) + +> What file system? + +ext3 + +> What kind of machine are you using? + +Pentium IV, 1.8 GHz + +> How much memory does it have? + +512 Mb RAM + +> How many disk drives? + +single + +> Are you using RAID? hardware / software? battery backed cache or no? + +no + +> Do you have one or two, or thousands of connections at a time? + +something like 20 connections (peak). + +> Do you use connection pooling if you have lots of connections to handle? + +My application uses Jakarta Commons DBCP module. + +-- +Eugene Dzhurinsky + +From pgsql-performance-owner@postgresql.org Thu Jul 6 12:27:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 039B19FA147 + for ; + Thu, 6 Jul 2006 12:27:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82411-03 for + ; + Thu, 6 Jul 2006 12:26:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.203]) + by postgresql.org (Postfix) with ESMTP id ECB2E9FA0EC + for ; + Thu, 6 Jul 2006 12:26:55 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id z3so883186nzf + for ; + Thu, 06 Jul 2006 08:26:55 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=oyaEwpEa5OJKXn1OUPhk5Q1+mdH/lhkn3GIiPrA9N6ejHV3xfI5os1oVXdWjmxSL6/8OKyub7MZjVkIhn4cCvbf5V2XDlxhem4tLS3mnHzwIED53LdJDPM31dkDUGQQcUe2ImoJrQVtLDE078yIdVzZpTpXZ8By1sloOl9rnNFE= +Received: by 10.65.185.17 with SMTP id m17mr667209qbp; + Thu, 06 Jul 2006 08:26:54 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Thu, 6 Jul 2006 08:26:54 -0700 (PDT) +Message-ID: +Date: Thu, 6 Jul 2006 11:26:54 -0400 +From: "Merlin Moncure" +To: "Eugeny N Dzhurinsky" +Subject: Re: getting better performance +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060706064016.GC1091@office.redwerk.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <20060706064016.GC1091@office.redwerk.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/46 +X-Sequence-Number: 19906 + +On 7/6/06, Eugeny N Dzhurinsky wrote: +> Hello! +> +> I have a postgresql server serving thousands of tables. Sometime there are +> queries which involves several tables. + +> In postgresql.conf I have these settings: +> +> shared_buffers = 40000 +> work_mem = 8192 +> maintenance_work_mem = 16384 +> max_stack_depth = 2048 +> +> all other settings are left by default (except ones needed for pg_autovacuum). +> +> Is there anything I can tune to get better performance? + +you may want to explore upping your FSM settings with that many tables. + +Merlin + +From pgsql-performance-owner@postgresql.org Thu Jul 6 12:32:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 93FE69FA147 + for ; + Thu, 6 Jul 2006 12:32:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29602-08 for + ; + Thu, 6 Jul 2006 12:32:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 3AFAD9FA0EC + for ; + Thu, 6 Jul 2006 12:32:28 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 6 Jul 2006 15:32:28 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 06 Jul 2006 10:32:28 -0500 +Subject: Re: getting better performance +From: Scott Marlowe +To: Eugeny N Dzhurinsky +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060706151126.GA9239@office.redwerk.com> +References: <20060706064016.GC1091@office.redwerk.com> + <1152196118.13851.110.camel@state.g2switchworks.com> + <20060706151126.GA9239@office.redwerk.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1152199947.13851.140.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Thu, 06 Jul 2006 10:32:28 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/47 +X-Sequence-Number: 19907 + +On Thu, 2006-07-06 at 10:11, Eugeny N Dzhurinsky wrote: +> On Thu, Jul 06, 2006 at 09:28:39AM -0500, Scott Marlowe wrote: +> > On Thu, 2006-07-06 at 01:40, Eugeny N Dzhurinsky wrote: +> > Do you add / remove tables a lot? Could be you've got system catalog +> > bloat. +> +> Yes, almost each table is dropped and re-created in 3-5 days. + +> > do you have autovacuum running? +> +> Yes. + +Hopefully, that will keep the system catalogs from getting overly fat. +You still need to check their size every so often to make sure they're +not getting out of line. + +you might wanna run a vacuum verbose and see what it has to say. + +> > What version of pgsql are you running? +> +> psql -V +> psql (PostgreSQL) 8.0.0 + +You should update. x.0.0 versions often have the nastiest of the data +loss bugs of any release versions of postgresql. 8.0 is up to 8.0.8 +now. The upgrades are generally painless (backup anyway, just in case) +and can be done in place. just down postgres, rpm -Uvh the packages and +restart postgres + +> > What OS? +> +> CentOS release 3.7 (Final) +> +> > What file system? +> +> ext3 +> +> > What kind of machine are you using? +> +> Pentium IV, 1.8 GHz +> +> > How much memory does it have? +> +> 512 Mb RAM + +That's kind of small for a database server. If your data set is fairly +small it's alright, but if you're working on gigs of data in your +database, the more memory the better. + +> > How many disk drives? +> +> single + +OTOH, if you're doing a lot of committing / writing to the hard drives, +a single disk drive is suboptimal + +Is this SCSI, PATA or SATA? If it's [SP]ATA, then you've likely got no +real fsyncing, and while performance won't be a problem, reliability +should the machine crash would be. If it's SCSI, then it could be a +bottle neck for writes. + +> > Are you using RAID? hardware / software? battery backed cache or no? +> +> no + +I'd recommend looking into it, unless you're CPU bound. A decent RAID +controller with battery backed cache and a pair of drives in a mirror +setup can be a marked improved to start with, and you can add more +drives as time goes by if needs be. + +My guess is that you've got sys catalog bloat. You might have to down +the database to single user mode and run a vacuum on the system catalogs +from there. That's how it was in the old days of 7.x databases anyway. + +If you don't have sys cat bloat, then you're probably CPU / memory bound +right now. unless you're writing a lot, then you're likely disk i/o +bound, but I kinda doubt it. + +From pgsql-performance-owner@postgresql.org Thu Jul 6 12:35:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9C6019FA147 + for ; + Thu, 6 Jul 2006 12:35:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23536-01 for + ; + Thu, 6 Jul 2006 12:35:21 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) + by postgresql.org (Postfix) with ESMTP id 95C2F9FA0EC + for ; + Thu, 6 Jul 2006 12:35:21 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id a2so2716026ugf + for ; + Thu, 06 Jul 2006 08:35:19 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=Agh2GnSCtAMZOmLUYlcPl+r9AFomB0947VCY5ha513LjqDwVakijyyXq+s+G9HTx62soiEfUbF4aZjU5DrKoVCX73+HmrHrWt3SiqppwK2tsxbEfSd7dml6DgcXmMt1Iai0asSdvxhxjqQjuG/WZesyhFX2vzVwabVzEV8wpfcM= +Received: by 10.67.93.7 with SMTP id v7mr187658ugl; + Thu, 06 Jul 2006 08:35:19 -0700 (PDT) +Received: by 10.66.244.1 with HTTP; Thu, 6 Jul 2006 08:35:18 -0700 (PDT) +Message-ID: +Date: Thu, 6 Jul 2006 17:35:18 +0200 +From: "Lorenzo Pasquinelli" +To: pgsql-performance@postgresql.org +Subject: unsubscribe +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_19618_14098679.1152200118845" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/48 +X-Sequence-Number: 19908 + +------=_Part_19618_14098679.1152200118845 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +** + +-- +Lorenzo Pasquinelli +Software Developer + +-------------------------------------------------------- +"My grandfather once told me that there are two kinds of people: those +who work and those who take the credit. He told me to try to be in the +first group; there was less competition there." +- Indira Gandhi + +------=_Part_19618_14098679.1152200118845 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +


--
Lorenzo Pasquinelli
Software Developer

--------------------------------------------------------
+"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi + +------=_Part_19618_14098679.1152200118845-- + +From pgsql-performance-owner@postgresql.org Thu Jul 6 14:53:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ED69E9FA0EC + for ; + Thu, 6 Jul 2006 14:53:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22490-08 for + ; + Thu, 6 Jul 2006 14:53:44 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.176]) + by postgresql.org (Postfix) with ESMTP id C66149F94F3 + for ; + Thu, 6 Jul 2006 14:53:44 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id d80so2735462pyd + for ; + Thu, 06 Jul 2006 10:53:43 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=ulD50fn15+HZW1Xm90GV/soVtCbzNGXSMf2wxLRiu8CKq4y4yYY9ZnKeY09WgmXtahCDPGI5zA5W0t0XHSzw+uTs9W5rgi/cvcJnyqAchC94D+pVwAteMm8LXDaYkFolhb2xUN773MmcQ+N6UtZJNSyJz6qPhU1TWbbE/sM+HUA= +Received: by 10.35.84.16 with SMTP id m16mr1185769pyl; + Thu, 06 Jul 2006 10:53:42 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Thu, 6 Jul 2006 10:53:42 -0700 (PDT) +Message-ID: +Date: Thu, 6 Jul 2006 13:53:42 -0400 +From: "Merlin Moncure" +To: "PGSQL Performance" +Subject: victory! +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/49 +X-Sequence-Number: 19909 + +with all these unsubscribe requests, we can only extrapolate that the +server has no serious performance issues left to solve. good work! +:-) + +merlin + +From pgsql-performance-owner@postgresql.org Thu Jul 6 15:01:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5C4599FA0EC + for ; + Thu, 6 Jul 2006 15:01:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65526-05 for + ; + Thu, 6 Jul 2006 15:01:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from hs5.cfa.cmu.edu (HS5.CFA.cmu.edu [128.2.103.215]) + by postgresql.org (Postfix) with ESMTP id 3AEDF9F94F3 + for ; + Thu, 6 Jul 2006 15:01:25 -0300 (ADT) +Received: from webmail.webopticon.org (hs5.cfa.cmu.edu [127.0.0.1]) + by hs5.cfa.cmu.edu (8.12.11.20060308/8.12.11) with ESMTP id + k66I1OFf002368 + for ; Thu, 6 Jul 2006 14:01:24 -0400 +Received: from 216.41.12.254 (SquirrelMail authenticated user agentm) + by webmail.webopticon.org with HTTP; + Thu, 6 Jul 2006 14:01:24 -0400 (EDT) +Message-ID: <36266.216.41.12.254.1152208884.squirrel@webmail.webopticon.org> +In-Reply-To: +References: +Date: Thu, 6 Jul 2006 14:01:24 -0400 (EDT) +Subject: Re: victory! +From: "A.M." +To: "PGSQL Performance" +User-Agent: SquirrelMail/1.5.1 [CVS] +MIME-Version: 1.0 +Content-Type: text/plain;charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/50 +X-Sequence-Number: 19910 + +On Thu, July 6, 2006 1:53 pm, Merlin Moncure wrote: +> with all these unsubscribe requests, we can only extrapolate that the +> server has no serious performance issues left to solve. good work! :-) + +Well, either that or the performance issues are so severe that users are +dropping like flies... + +-M + + + +From pgsql-performance-owner@postgresql.org Thu Jul 6 15:10:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8B7049FA0EC + for ; + Thu, 6 Jul 2006 15:10:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68938-09 for + ; + Thu, 6 Jul 2006 15:10:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from colo-dns-ext2.juniper.net (colo-dns-ext2.juniper.net + [207.17.137.64]) + by postgresql.org (Postfix) with ESMTP id B690B9F94F3 + for ; + Thu, 6 Jul 2006 15:10:32 -0300 (ADT) +Received: from merlot.juniper.net (merlot.juniper.net [172.17.27.10]) + by colo-dns-ext2.juniper.net (8.12.3/8.12.3) with ESMTP id + k66IAT1Z017358; Thu, 6 Jul 2006 11:10:29 -0700 (PDT) + (envelope-from kenjim@juniper.net) +Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [172.17.58.60]) + by merlot.juniper.net (8.11.3/8.11.3) with ESMTP id k66IAT555281; + Thu, 6 Jul 2006 11:10:29 -0700 (PDT) + (envelope-from kenjim@juniper.net) +Received: from kenjim-lnx.juniper.net (kenjim-lnx.juniper.net [127.0.0.1]) + by kenjim-lnx.juniper.net (8.13.4/8.13.4) with ESMTP id k66IAOPm016297; + Thu, 6 Jul 2006 11:10:24 -0700 +Received: (from kenjim@localhost) + by kenjim-lnx.juniper.net (8.13.4/8.13.4/Submit) id k66IAJH5016296; + Thu, 6 Jul 2006 11:10:19 -0700 +Date: Thu, 6 Jul 2006 11:10:19 -0700 +From: Kenji Morishige +To: Mark Kirkwood +Cc: pgsql-performance@postgresql.org, kenjim@juniper.net +Subject: Re: suggested RAID controller for FreeBSD 6.1 + PostgreSQL 8.1 +Message-ID: <20060706181019.GA15855@juniper.net> +References: <20060705234617.GB2367@juniper.net> + <44AC5EB9.8060707@paradise.net.nz> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44AC5EB9.8060707@paradise.net.nz> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/51 +X-Sequence-Number: 19911 + +Thanks for the suggestion Mark, though the server chassis I am trying to +utilize already has 4 10,000 RPM SCSI drives with SCA interfaces. Ideally I +would like to use the existing drives and chassis and find another SCSI RAID +controller. It looks like 3Ware only makes ATA controllers. +-Kenji + +On Thu, Jul 06, 2006 at 12:52:09PM +1200, Mark Kirkwood wrote: +> Kenji Morishige wrote: +> >I am currently running FreeBSD 4.11 (due to IT requirements for now) and +> >Adaptec's 2200S RAID controller running in RAID5. I was advised in the +> >past +> >that the 2200S is actually a poor performing controller and obviously the +> >RAID5 is less than ideal for databases. I chose to run the controller in +> >RAID5 as the tech I talked to suggested that the 2200S was primarily +> >designed +> >for RAID5 and it would operate the best that way. My server is a dual Xeon +> > 3.06Ghz box running on a motherboard approximately 2-3 years old now. +> > I'd +> >like to know what an ideal RAID controller that would be compatible with +> >FreeBSD 6.1 would be these days. +> > +> > +> +> I've had good experience with 3Ware on FreeBSD - painless installs and +> excellent performance! (in my case the older 7506 models for (P)ATA on +> 4.10, 5.4, 6.0 and 6.1). +> +> It looks like the new 9550 series is supported in 6.1 onwards. Given +> that this has been added recently I would suggest mailing +> freebsd-hardware to see what experiences folks are having (I don't +> recall seeing any postings about issues with the 9000 or 9550 series). +> +> Cheers +> +> Mark + +From pgsql-performance-owner@postgresql.org Thu Jul 6 15:18:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D1CD49FA0EC + for ; + Thu, 6 Jul 2006 15:18:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03861-08 for + ; + Thu, 6 Jul 2006 15:17:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id F2D699F94F3 + for ; + Thu, 6 Jul 2006 15:17:56 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 6 Jul 2006 18:17:55 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 06 Jul 2006 13:17:55 -0500 +Subject: Re: suggested RAID controller for FreeBSD 6.1 + +From: Scott Marlowe +To: Kenji Morishige +Cc: Mark Kirkwood , pgsql-performance@postgresql.org +In-Reply-To: <20060706181019.GA15855@juniper.net> +References: <20060705234617.GB2367@juniper.net> + <44AC5EB9.8060707@paradise.net.nz> <20060706181019.GA15855@juniper.net> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1152209875.13851.159.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Thu, 06 Jul 2006 13:17:55 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/52 +X-Sequence-Number: 19912 + +On Thu, 2006-07-06 at 13:10, Kenji Morishige wrote: +> Thanks for the suggestion Mark, though the server chassis I am trying to +> utilize already has 4 10,000 RPM SCSI drives with SCA interfaces. Ideally I +> would like to use the existing drives and chassis and find another SCSI RAID +> controller. It looks like 3Ware only makes ATA controllers. + +Take a look at LSI. They make solid and reliable SCSI RAID +controllers. be sure and get the BBU cache. + +From pgsql-performance-owner@postgresql.org Thu Jul 6 15:46:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A5ACE9FA0EC + for ; + Thu, 6 Jul 2006 15:46:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29805-02-2 + for ; + Thu, 6 Jul 2006 15:46:14 -0300 (ADT) +X-Greylist: delayed 00:28:07.408771 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 62C899FA65C + for ; + Thu, 6 Jul 2006 15:46:10 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from ottexbe01.corp.distributel.ca (ottexbe01.corp.distributel.ca + [206.80.252.36]) + by svr4.postgresql.org (Postfix) with ESMTP id C15505AF090 + for ; + Thu, 6 Jul 2006 18:18:01 +0000 (GMT) +Received: from 10.14.61.42 ([10.14.61.42]) by ottexbe01.corp.distributel.ca + ([192.168.16.70]) via Exchange Front-End Server 10.14.61.70 + ([10.14.61.70]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 6 Jul 2006 18:17:59 +0000 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-BokUYyNyMoUbvGnmSTVz"; + micalg=pgp-sha1; protocol="application/pgp-signature" +Received: from paul.mtl.distributel.net by 10.14.61.70; + 06 Jul 2006 14:21:15 -0400 +In-Reply-To: <20060706181019.GA15855@juniper.net> +Content-class: urn:content-classes:message +Subject: Re: suggested RAID controller for FreeBSD 6.1 +PostgreSQL 8.1 +Date: Thu, 6 Jul 2006 14:21:15 -0400 +Message-ID: <1152210075.3852.5.camel@paul> +X-MS-Has-Attach: yes +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] suggested RAID controller for FreeBSD 6.1 +PostgreSQL + 8.1 +Thread-Index: AcahKINGLoc+LjbDTVWd05kMy2YBsw== +References: <20060705234617.GB2367@juniper.net> + <44AC5EB9.8060707@paradise.net.nz> + <20060706181019.GA15855@juniper.net> +From: "Paul Khavkine" +To: "Kenji Morishige" +Cc: "Mark Kirkwood" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/53 +X-Sequence-Number: 19913 + + +--=-BokUYyNyMoUbvGnmSTVz +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + + + +Take a look at: http://www.icp-vortex.com/english/index_e.htm + +They have always made good RAID controllers. + + + +Cheers +Paul + +On Thu, 2006-07-06 at 11:10 -0700, Kenji Morishige wrote: +> Thanks for the suggestion Mark, though the server chassis I am trying to +> utilize already has 4 10,000 RPM SCSI drives with SCA interfaces. Ideall= +y I +> would like to use the existing drives and chassis and find another SCSI R= +AID +> controller. It looks like 3Ware only makes ATA controllers. +> -Kenji +>=20 +> On Thu, Jul 06, 2006 at 12:52:09PM +1200, Mark Kirkwood wrote: +> > Kenji Morishige wrote: +> > >I am currently running FreeBSD 4.11 (due to IT requirements for now) a= +nd +> > >Adaptec's 2200S RAID controller running in RAID5. I was advised in th= +e=20 +> > >past +> > >that the 2200S is actually a poor performing controller and obviously = +the +> > >RAID5 is less than ideal for databases. I chose to run the controller= + in +> > >RAID5 as the tech I talked to suggested that the 2200S was primarily=20 +> > >designed +> > >for RAID5 and it would operate the best that way. My server is a dual= + Xeon +> > > 3.06Ghz box running on a motherboard approximately 2-3 years old now= +. =20 +> > > I'd +> > >like to know what an ideal RAID controller that would be compatible wi= +th +> > >FreeBSD 6.1 would be these days. +> > > +> > > +> >=20 +> > I've had good experience with 3Ware on FreeBSD - painless installs and=20 +> > excellent performance! (in my case the older 7506 models for (P)ATA on=20 +> > 4.10, 5.4, 6.0 and 6.1). +> >=20 +> > It looks like the new 9550 series is supported in 6.1 onwards. Given=20 +> > that this has been added recently I would suggest mailing=20 +> > freebsd-hardware to see what experiences folks are having (I don't=20 +> > recall seeing any postings about issues with the 9000 or 9550 series). +> >=20 +> > Cheers +> >=20 +> > Mark +>=20 +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +>=20 +> http://archives.postgresql.org + +--=-BokUYyNyMoUbvGnmSTVz +Content-Type: application/pgp-signature; name=signature.asc +Content-Description: This is a digitally signed message part + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.2 (FreeBSD) + +iQCVAwUARK1Um/kjFY05CfyYAQK8PwP/am2kjEK3/zNs/u76am0xpAS53YVNCjKV +ZAfYHhrJA5s2bCxa73RtI9HoE5GCIyWepTE7ZpkmTJNCJ+1uZtIkeMrS0qMnDgHH +0R1Pcm6sDL27T2O1bKTb/BPQ3rFePQ9XZkXN9n6MosheN6TwWk+DP9VSHcJmCCNT +g4/5bz8tQP0= +=YyeJ +-----END PGP SIGNATURE----- + +--=-BokUYyNyMoUbvGnmSTVz-- + +From pgsql-performance-owner@postgresql.org Thu Jul 6 22:38:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 55F499F97C2 + for ; + Thu, 6 Jul 2006 22:38:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 45075-02 for + ; + Thu, 6 Jul 2006 22:38:04 -0300 (ADT) +X-Greylist: delayed 01:48:18.017311 by SQLgrey- +Received: from web55911.mail.re3.yahoo.com (web55911.mail.re3.yahoo.com + [216.252.110.72]) + by postgresql.org (Postfix) with SMTP id 0F6A59F94F3 + for ; + Thu, 6 Jul 2006 22:38:03 -0300 (ADT) +Received: (qmail 50297 invoked by uid 60001); 6 Jul 2006 20:06:52 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=KCxhyhzAOisyfpLVXHGsdp8aFPiCG5Kdhz2IE/HZM5viNK8KWCAPfR6J40hvodjDIvsmpK9rXgG3Sn7OjYDD3FciRIKvtL15KvJBU5wn26rtAg/E5zsTTeQM/NAczToCi+0WXtnw6IGVfHDJhPeL5knTflOkU3EuFtvyLNr7oRM= + ; +Message-ID: <20060706200652.50294.qmail@web55911.mail.re3.yahoo.com> +Received: from [207.164.182.8] by web55911.mail.re3.yahoo.com via HTTP; + Thu, 06 Jul 2006 16:06:52 EDT +Date: Thu, 6 Jul 2006 16:06:52 -0400 (EDT) +From: Ioana Danes +Subject: Query plan issue when upgrading to postgres 8.14 (from postgres 8.12 + or 7.4) +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1703118205-1152216412=:42800" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/55 +X-Sequence-Number: 19915 + +--0-1703118205-1152216412=:42800 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + + I have a problem with a query that in postgres 7.4 and 8.12 has an acceptable response time but in postgres 8.14 is very slow. + + + This is the table I use: + + create table TEST ( + TESTID INT8 not null, + TESTTYPE INT4 null, + constraint PK_TESTID primary key (TESTID)); + create index IX_TEST_TESTTYPE on TEST (TESTTYPE); + + And this is the query with the problem: + + explain select max(TESTID) from TEST where TESTTYPE = 1577; + + The query plan in postgres 7.4 and 8.12 is using the index by TESTTYPE field, which is what I want in this case. + + QUERY PLAN + Aggregate (cost=25.97..25.97 rows=1 width=8) + -> Index Scan using ix_test_testtype on test (cost=0.00..25.95 rows=9 width=8) + Index Cond: (testtype = 1577) + + + With postgres 8.14 the query plan uses the primary key PK_TESTID with filter by TESTTYPE, which it takes almost 10 minutes to execute: + + QUERY PLAN + Limit (cost=0.00..41.46 rows=1 width=8) + -> Index Scan Backward using pk_testid on test (cost=�) + Filter: ((testid IS NOT NULL) and (testtype = 1577)) + + When replacing the index + create index IX_TEST_TESTTYPE on TEST (TESTTYPE); + with + create index IX_TEST_TESTTYPE on TEST (TESTTYPE, TESTID); + the query plan uses this index and the execution of this select is extremely fast. + + From what I can see, the query plan for 8.14 is using a index scan by the field used with max() function with a filter by the field in where condition. + Should not the query plan use an index scan by the field in where condition (which in my case is a small range) and come up with the max value in that range? + + Is this a bug, am I missing a configuration step or this is how it is supposed to work? + + Thank you very much, + Ioana + + +--------------------------------- +Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice +--0-1703118205-1152216412=:42800 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +
I have a problem with a query that in postgres 7.4 and 8.12 has an acceptable response time but in postgres 8.14 is very slow.

This is the table I use:

create
table TEST (
TESTID    INT8 not null,
TESTTYPE  INT4     null,
constraint PK_TESTID primary key (TESTID));
create index IX_TEST_TESTTYPE on TEST (TESTTYPE);
 
And this is the query with the problem:
 
explain select max(TESTID) + from TEST where TESTTYPE = 1577;
 
The query plan in postgres 7.4 and 8.12 is using the index by TESTTYPE field, which is what I want in this case.
 
QUERY PLAN 
Aggregate  (cost=25.97..25.97 rows=1 width=8)   
+
  ->  Index Scan using ix_test_testtype on test  (cost=0.00..25.95 rows=9 width=8)   
        Index Cond: (testtype = 1577)
 
 
With postgres 8.14 the query plan uses the primary key PK_TESTID with filter by TESTTYPE, which it takes almost 10 minutes to execute:
 
QUERY PLAN 
Limit  (cost=0.00..41.46 rows=1 width=8)   
  ->  Index Scan Backward using pk_testid on test  (cost=�)   
        Filter: ((testid IS NOT NULL) and (testtype = 1577))
 
When replacing the index
create index IX_TEST_TESTTYPE on TEST (TESTTYPE);
with
create index + IX_TEST_TESTTYPE on TEST (TESTTYPE, TESTID);
the query plan uses this index and the execution of this select is extremely fast.
 
From what I can see, the query plan for 8.14 is using a index scan by the field used with max() function with a filter by the field in where condition.
Should not the query plan use an index scan by the field in where condition (which in my case is a small range) and come up with the max value in that range?
 
Is this a bug, am I missing a + configuration step or this is how it is supposed to work?
 
Thank you very much,
Ioana

+ + + +


Make free worldwide PC-to-PC calls. Try the new Yahoo! Canada Messenger with Voice +--0-1703118205-1152216412=:42800-- + +From pgsql-performance-owner@postgresql.org Fri Jul 7 02:31:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 274779FA6BB + for ; + Fri, 7 Jul 2006 02:31:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93464-05 for + ; + Fri, 7 Jul 2006 02:31:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from web55908.mail.re3.yahoo.com (web55908.mail.re3.yahoo.com + [216.252.110.69]) + by postgresql.org (Postfix) with SMTP id 56BDD9FA6A2 + for ; + Fri, 7 Jul 2006 02:31:24 -0300 (ADT) +Received: (qmail 99719 invoked by uid 60001); 6 Jul 2006 21:34:46 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=XBGT534s5Dx/9TiCPK4rjoEpuzHIhCOIXzgh0FhYjUBoIheaMakQddGvanf4FjPnwQv0tDWKSO5RywdaBfnz3DQMjYDZZsR4rYxsttY0VLsaqKbc/ePj3q+L8iNdChj6PiamWw48lrmN5GoN8dDwI0+tLrzXQs95ADgQylbkmz0= + ; +Message-ID: <20060706213446.99717.qmail@web55908.mail.re3.yahoo.com> +Received: from [70.29.94.218] by web55908.mail.re3.yahoo.com via HTTP; + Thu, 06 Jul 2006 17:34:46 EDT +Date: Thu, 6 Jul 2006 17:34:46 -0400 (EDT) +From: Ioana Danes +Subject: Query plan issue when upgrading to postgres 8.14 (from postgres 8.12 + or 7.4) +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-878230187-1152221686=:95484" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/59 +X-Sequence-Number: 19919 + +--0-878230187-1152221686=:95484 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +I have a problem with a query that in postgres 7.4 and 8.12 has an acceptable response time but in postgres 8.14 is very slow. + +This is the table I use: + + create table TEST ( + TESTID INT8 not null, + TESTTYPE INT4 null, + constraint PK_TESTID primary key (TESTID)); + create index IX_TEST_TESTTYPE on TEST (TESTTYPE); + +And this is the query with the problem: + explain select max(TESTID) from TEST where TESTTYPE = 1577; + +The query plan in postgres 7.4 and 8.12 is using the index by TESTTYPE field, which is what I want in this case. + QUERY PLAN + Aggregate (cost=25.97..25.97 rows=1 width=8) + -> Index Scan using ix_test_testtype on test (cost=0.00..25.95 rows=9 width=8) + Index Cond: (testtype = 1577) + With postgres 8.14 the query plan uses the primary key PK_TESTID with filter by TESTTYPE, which it takes almost 10 minutes to execute: + QUERY PLAN + Limit (cost=0.00..41.46 rows=1 width=8) + -> Index Scan Backward using pk_testid on test (cost=�) + Filter: ((testid IS NOT NULL) and (testtype = 1577)) + +When replacing the index + create index IX_TEST_TESTTYPE on TEST (TESTTYPE); +with + create index IX_TEST_TESTTYPE on TEST (TESTTYPE, TESTID); +the query plan uses this index and the execution of this select is extremely fast. + +>From what I can see, the query plan for 8.14 is using a index scan by the field used with max() function with a filter by the field in the where condition. +Should not the query plan use an index scan by the field in where condition (which in my case is a small range) and come up with the max value in that range? + +Is this a bug, am I missing a configuration step or this is how it is supposed to work? + +Thank you very much, +Ioana + + + +--------------------------------- + All new Yahoo! Mail - +--------------------------------- +Get a sneak peak at messages with a handy reading pane. +--0-878230187-1152221686=:95484 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +
I have a problem with a query that in postgres 7.4  and 8.12 has an acceptable response time but in postgres 8.14 is very slow.
     
This is the table I use:
      
      create table  TEST (
      TESTID    INT8 not null,
      TESTTYPE  INT4     null,
      constraint  PK_TESTID primary key (TESTID));
      create index  IX_TEST_TESTTYPE on TEST (TESTTYPE);
      
And this is the query with the problem:
      explain select max(TESTID) from TEST where TESTTYPE = 1577;
      
The query plan in postgres 7.4 and 8.12 is using the  index by TESTTYPE field, which is what I want in this + case.
      QUERY PLAN 
      Aggregate   (cost=25.97..25.97 rows=1 width=8)   
        ->  Index Scan using ix_test_testtype on  test  (cost=0.00..25.95 rows=9 width=8)   
              Index Cond:  (testtype = 1577)       
With postgres 8.14 the query plan uses the primary  key PK_TESTID with filter by TESTTYPE, which  it takes almost 10 minutes to execute:
      QUERY PLAN 
      Limit  (cost=0.00..41.46  rows=1 width=8)   
        ->  Index Scan Backward using pk_testid on  test  (cost=�)    +
              Filter: ((testid IS  NOT NULL) and (testtype = 1577))
      
When replacing the index
     create index IX_TEST_TESTTYPE on TEST (TESTTYPE);
with
     create index IX_TEST_TESTTYPE on TEST (TESTTYPE, TESTID);
the query plan uses this index and the execution of this select is  extremely fast.
      
From what I can see, the query plan for 8.14 is using a index scan  by the field used with max() function with a filter by the field in the where  condition.
Should not the query plan use an index scan by the field in where  condition (which in my case is a small range) and come up with the max value in that range?
      
Is this a bug, am I missing a configuration step or this is how it  is supposed + to work?
      
Thank you very much,
Ioana

+


All new Yahoo! Mail - +
Get a sneak peak at messages with a handy reading pane. +--0-878230187-1152221686=:95484-- + +From pgsql-performance-owner@postgresql.org Thu Jul 6 19:52:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 55C859F97C2 + for ; + Thu, 6 Jul 2006 19:52:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38617-02 for + ; + Thu, 6 Jul 2006 19:52:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz + [203.96.152.183]) + by postgresql.org (Postfix) with ESMTP id 41CC59F94F3 + for ; + Thu, 6 Jul 2006 19:52:10 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J2000E6M7IVYM@linda-4.paradise.net.nz> for + pgsql-performance@postgresql.org; Fri, 07 Jul 2006 10:52:08 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-28-133.dsl.clear.net.nz [218.101.28.133]) by + smtp-3.paradise.net.nz (Postfix) with ESMTP id A9C29746ADD; + Fri, 07 Jul 2006 10:52:06 +1200 (NZST) +Date: Fri, 07 Jul 2006 10:51:54 +1200 +From: Mark Kirkwood +Subject: Re: suggested RAID controller for FreeBSD 6.1 + PostgreSQL +In-reply-to: <20060706181019.GA15855@juniper.net> +To: Kenji Morishige +Cc: pgsql-performance@postgresql.org +Message-id: <44AD940A.7070501@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: <20060705234617.GB2367@juniper.net> + <44AC5EB9.8060707@paradise.net.nz> <20060706181019.GA15855@juniper.net> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/54 +X-Sequence-Number: 19914 + +Kenji Morishige wrote: +> Thanks for the suggestion Mark, though the server chassis I am trying to +> utilize already has 4 10,000 RPM SCSI drives with SCA interfaces. Ideally I +> would like to use the existing drives and chassis and find another SCSI RAID +> controller. It looks like 3Ware only makes ATA controllers. +> + +I should have checked that the 2200S was a *SCSI* RAID controller, sorry! + + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Thu Jul 6 23:50:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E3B149F97C2 + for ; + Thu, 6 Jul 2006 23:50:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08333-05 for + ; + Thu, 6 Jul 2006 23:50:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 995269F94F3 + for ; + Thu, 6 Jul 2006 23:50:21 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k67357uq006379 + for ; Thu, 6 Jul 2006 20:05:08 -0700 +Message-ID: <44ADBDB8.5010008@modgraph-usa.com> +Date: Thu, 06 Jul 2006 18:49:44 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: need vacuum after insert/truncate/insert? +References: <20060706200652.50294.qmail@web55911.mail.re3.yahoo.com> +In-Reply-To: <20060706200652.50294.qmail@web55911.mail.re3.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/57 +X-Sequence-Number: 19917 + +If I insert a bunch of rows, then truncate, then insert a bunch more rows, do I need to vacuum? I've been assuming that TRUNCATE TABLE is a brute-force technique that more-or-less tosses the old table and starts fresh so that no vacuum is necessary. + +Second question: Same scenario as above, but now the table has indexes. Is a reindex needed, or are the indexes they "truncated" too? + +Thanks, +Craig + + +From pgsql-performance-owner@postgresql.org Thu Jul 6 22:51:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 51E559FA441 + for ; + Thu, 6 Jul 2006 22:51:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25445-03 for + ; + Thu, 6 Jul 2006 22:51:06 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.198]) + by postgresql.org (Postfix) with ESMTP id 7DE1A9F94F3 + for ; + Thu, 6 Jul 2006 22:51:06 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id 8so1411986nzo + for ; + Thu, 06 Jul 2006 18:51:04 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; + b=LPp1RmH9/hoE9OPhHPdEbd+9+91UlQaHOah7cIMYQwgIBvjemKKhqG4pon+w1ulpz3FXi/7KhDx7qTdqo4sEvBMAoaENeZHA5zTvCb4P6MTr9THkhe+FIEXlLzmnOiM3IVVLtLnpHnQ+MmhVERiqv96HxRMr2G3KmGGuTapyTAY= +Received: by 10.36.118.8 with SMTP id q8mr1807850nzc; + Thu, 06 Jul 2006 18:51:04 -0700 (PDT) +Received: from ?10.1.1.20? ( [203.217.18.65]) + by mx.gmail.com with ESMTP id 14sm3819638nzp.2006.07.06.18.51.02; + Thu, 06 Jul 2006 18:51:03 -0700 (PDT) +Message-ID: <44ADBE04.9010605@gmail.com> +Date: Fri, 07 Jul 2006 11:51:00 +1000 +From: Chris +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Ioana Danes +CC: pgsql-performance@postgresql.org +Subject: Re: Query plan issue when upgrading to postgres 8.14 (from +References: <20060706200652.50294.qmail@web55911.mail.re3.yahoo.com> +In-Reply-To: <20060706200652.50294.qmail@web55911.mail.re3.yahoo.com> +Content-Type: text/plain; charset=windows-1252; format=flowed +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/56 +X-Sequence-Number: 19916 + +Ioana Danes wrote: +> I have a problem with a query that in postgres 7.4 and 8.12 has an +> acceptable response time but in postgres 8.14 is very slow. +> +> This is the table I use: +> * +> create* *table* TEST ( +> TESTID INT8 *not* *null*, +> TESTTYPE INT4 *null*, +> *constraint* PK_TESTID *primary* *key* (TESTID)); +> *create* *index* IX_TEST_TESTTYPE *on* TEST (TESTTYPE); +> +> And this is the query with the problem: +> +> *explain select* *max*(TESTID) *from* TEST *where* TESTTYPE = 1577; +> +> The query plan in postgres 7.4 and 8.12 is using the index by TESTTYPE +> field, which is what I want in this case. +> +> QUERY PLAN +> Aggregate (cost=25.97..25.97 rows=1 width=8) +> -> Index Scan using ix_test_testtype on test (cost=0.00..25.95 +> rows=9 width=8) +> Index Cond: (testtype = 1577) +> +> +> With postgres 8.14 the query plan uses the primary key PK_TESTID with +> filter by TESTTYPE, which it takes almost 10 minutes to execute: +> +> QUERY PLAN +> Limit (cost=0.00..41.46 rows=1 width=8) +> -> Index Scan Backward using pk_testid on test (cost=�) +> Filter: ((testid IS NOT NULL) and (testtype = 1577)) +> +> When replacing the index +> *create* *index* IX_TEST_TESTTYPE *on* TEST (TESTTYPE); +> with +> *create* *index* IX_TEST_TESTTYPE *on* TEST (TESTTYPE, TESTID); +> the query plan uses this index and the execution of this select is +> extremely fast. +> +> From what I can see, the query plan for 8.14 is using a index scan by +> the field used with max() function with a filter by the field in where +> condition. +> Should not the query plan use an index scan by the field in where +> condition (which in my case is a small range) and come up with the max +> value in that range? +> +> Is this a bug, am I missing a configuration step or this is how it is +> supposed to work? + +You've left out the best details. Post an 'explain analyze' from both +versions, and don't cut anything out :) + +I'm guessing postgres is seeing an index on the table is faster because +it doesn't think you have many rows in the table. How many are there, +and have you done an analyze of the table after loading the data in? + +-- +Postgresql & php tutorials +http://www.designmagick.com/ + +From pgsql-performance-owner@postgresql.org Fri Jul 7 02:08:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6F0089FAA6E + for ; + Fri, 7 Jul 2006 02:08:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92105-09 for + ; + Fri, 7 Jul 2006 02:08:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id A1A2F9FA68D + for ; + Fri, 7 Jul 2006 02:08:33 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from shell.wgops.com (free.wgops.com [69.51.116.66]) + by svr4.postgresql.org (Postfix) with ESMTP id CE7C65AF036 + for ; + Fri, 7 Jul 2006 05:08:32 +0000 (GMT) +Received: from [10.1.2.206] (localhost [127.0.0.1]) + by shell.wgops.com (Postfix) with ESMTP id 40A4E24FB0 + for ; + Thu, 6 Jul 2006 23:08:12 -0600 (MDT) +Date: Thu, 06 Jul 2006 23:08:11 -0600 +From: Michael Loftis +To: pgsql-performance@postgresql.org +Subject: Re: suggested RAID controller for FreeBSD 6.1 +PostgreSQL +Message-ID: +In-Reply-To: <1152210075.3852.5.camel@paul> +References: <20060705234617.GB2367@juniper.net> + <44AC5EB9.8060707@paradise.net.nz> <20060706181019.GA15855@juniper.net> + <1152210075.3852.5.camel@paul> +X-Mailer: Mulberry/4.0.4 (Mac OS X) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-MailScanner-Information: Please contact support@wgops.com +X-MailScanner: WGOPS clean +X-MailScanner-From: mloftis@wgops.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/58 +X-Sequence-Number: 19918 + + + +--On July 6, 2006 2:21:15 PM -0400 Paul Khavkine + wrote: + +> +> +> Take a look at: http://www.icp-vortex.com/english/index_e.htm +> +> They have always made good RAID controllers. + + +I'll give a huge thumbs up for the ICPs, and also make sure you get the BBU +cache as well (batter back-up) otherwise TURN OFF YOUR WRITE CACHE ON THE +CARD. You will hose your database severely if you don't the one time hte +machine acidentally loses power. + +I'm getting ready to put together a pretty beefy server with either an LSI +or ICP card (we're discussing options at this point) -- I've had really +good experience with the all of the ICP cards we've used. LSI used to be +worthless, couldn't do anything online at all in any form of *nix, but +atleast in Linux you can now, I don't know about FreeBSD, look into that, +drives fail, and it bites to have to take your server down, and leave it +down for a rebuild. + +From pgsql-performance-owner@postgresql.org Fri Jul 7 04:51:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5D5A79FA65C + for ; + Fri, 7 Jul 2006 04:51:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60841-04 for + ; + Fri, 7 Jul 2006 04:51:40 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.195]) + by postgresql.org (Postfix) with ESMTP id AD2A29FA634 + for ; + Fri, 7 Jul 2006 04:51:40 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id z3so1006669nzf + for ; + Fri, 07 Jul 2006 00:51:38 -0700 (PDT) +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; + b=P/X2hgqh1rjmUfQGbOCsq+p5aDuuT1896ZDblpkdeCw1gtA9j77a+E3BFumAczcT2QoOSHqbfTAIAp7S9YWIh4WfGmDy2IzKAUyojOtDE1WYtuKjPK4yFk+UNYXUf+uQSPUlxOKTdtcboyd74+CNXsbQv/NpOuqjS1V7BEJ01oE= +Received: by 10.65.249.3 with SMTP id b3mr1768899qbs; + Fri, 07 Jul 2006 00:51:38 -0700 (PDT) +Received: by 10.65.114.11 with HTTP; Fri, 7 Jul 2006 00:51:38 -0700 (PDT) +Message-ID: <430d92a20607070051k514e5325q87f434ccc666c01d@mail.gmail.com> +Date: Fri, 7 Jul 2006 03:51:38 -0400 +From: Gene +Reply-To: genekhart@gmail.com +To: pgsql-performance@postgresql.org +Subject: Update INSERT RULE while running for Partitioning +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_44462_22743121.1152258698188" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/60 +X-Sequence-Number: 19920 + +------=_Part_44462_22743121.1152258698188 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I'm using PostgreSQL 8.1.4 in a Hibernate Application and I am attempting to +use partitioning via Inherited tables. At first I was going to create a rule +per sub-table based on a date range, but found out with multiple rules +postgres will only return the affected-row count on the last rule which +gives Hibernate problems. So now I'm thinking the way to do it is just have +one rule at a time and when I want to start appending data to a new +partition, just change the rule on the parent table and also update the +constraint on the last table to reflect the date ranges contained so that +constraint_exclusion will work. this should perform better also. For +instance + +Starting off with: + +Parent (Rule on insert instead insert into Child2) + Child1 (Constraint date <= somedate1) + Child2 (Constraint date > somedate1) + +Now I want to create another Partition: + + Create Table Child3 +BEGIN +Update Parent Rule( instead insert into Child3) +somedate2 = max(date) from Child2 +Update Child2 Constraint( date > somedate1 AND date <= somedate2 ) +Set Constraint Child3 (date > somedate2) +END + +Which ends up with: + +Parent (Rule on insert instead insert into Child2) + Child1 (Constraint date <= somedate1) + Child2 (Constraint date > somedate1 AND date <= somedate2) + Child3 (Constraint date > somedate2) + +Anyone else tried this or expect it to work consistently (without stopping +db)? Is it possible that there could be a race condition for the insertion +and constraints or will the transaction prevent that from occurring? I've +done some testing and it seems to work but I could just get lucky so far and +not lose any data :) + +Thanks for any help, +Gene + +------=_Part_44462_22743121.1152258698188 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +I'm using PostgreSQL 8.1.4 in a Hibernate Application and I am +attempting to use partitioning via Inherited tables. At first I was +going to create a rule per sub-table based on a date range, but found +out with multiple rules postgres will only return the affected-row +count on the last rule which gives Hibernate problems. So now I'm +thinking the way to do it is just have one rule at a time and when I +want to start appending data to a new partition, just change the rule +on the parent table and also update the constraint on the last table to +reflect the date ranges contained so that constraint_exclusion will +work. this should perform better also. For instance
+
Starting off with:

+Parent (Rule on insert instead insert into Child2)
+  Child1 (Constraint date <= somedate1)
+  Child2 (Constraint date > somedate1)
+
+Now I want to create another Partition:
+
+
+
Create Table Child3
+BEGIN
+Update Parent Rule( instead insert into Child3)
+somedate2 = max(date) from Child2
+Update Child2 Constraint( date > somedate1 AND date <= somedate2 )
+Set Constraint Child3 (date > somedate2)
+END
+
+
Which ends up with:

+Parent (Rule on insert instead insert into Child2)
+ +  Child1 (Constraint date <= somedate1)
+ +  Child2 (Constraint date > somedate1 AND date <= somedate2)
  Child3 (Constraint date > somedate2)

Anyone else tried this or expect it to work consistently (without stopping db)? Is it possible that there could be a race condition for the insertion and constraints or will the transaction prevent that from occurring? I've done some testing and it seems to work but I could just get lucky so far and not lose any data :) +

Thanks for any help,
Gene
+ + + +------=_Part_44462_22743121.1152258698188-- + +From pgsql-performance-owner@postgresql.org Fri Jul 7 05:28:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5AE0B9FA65C + for ; + Fri, 7 Jul 2006 05:28:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20991-04 for + ; + Fri, 7 Jul 2006 05:28:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id E78359FA634 + for ; + Fri, 7 Jul 2006 05:28:42 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D142A.dip0.t-ipconnect.de + [84.157.20.42]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 9D0CC656C1; + Fri, 7 Jul 2006 10:30:18 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id E28901852EF8A; + Fri, 7 Jul 2006 10:28:54 +0200 (CEST) +Message-ID: <44AE1B46.6090908@logix-tt.com> +Date: Fri, 07 Jul 2006 10:28:54 +0200 +From: Markus Schaber +Reply-To: pgsql-performance@postgresql.org +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Eugeny N Dzhurinsky +Cc: pgsql-performance@postgresql.org +Subject: Re: getting better performance +References: <20060706064016.GC1091@office.redwerk.com> + <1152196118.13851.110.camel@state.g2switchworks.com> + <20060706151126.GA9239@office.redwerk.com> +In-Reply-To: <20060706151126.GA9239@office.redwerk.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/61 +X-Sequence-Number: 19921 + +Hi, Eugeny, + +Eugeny N Dzhurinsky wrote: + +>> Do you add / remove tables a lot? Could be you've got system catalog +>> bloat. +> +> Yes, almost each table is dropped and re-created in 3-5 days. + +If your really recreate the same table, TRUNCATE may be a better +solution than dropping and recreation. + +HTH, +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jul 7 05:32:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E9BAF9FA65C + for ; + Fri, 7 Jul 2006 05:31:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27660-05 for + ; + Fri, 7 Jul 2006 05:31:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 584AB9FA66C + for ; + Fri, 7 Jul 2006 05:31:51 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D142A.dip0.t-ipconnect.de + [84.157.20.42]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id E23A0656C1; + Fri, 7 Jul 2006 10:33:31 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 3BEF61852EF8A; + Fri, 7 Jul 2006 10:32:08 +0200 (CEST) +Message-ID: <44AE1C07.60009@logix-tt.com> +Date: Fri, 07 Jul 2006 10:32:07 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: "Craig A. James" +Cc: pgsql-performance@postgresql.org +Subject: Re: need vacuum after insert/truncate/insert? +References: <20060706200652.50294.qmail@web55911.mail.re3.yahoo.com> + <44ADBDB8.5010008@modgraph-usa.com> +In-Reply-To: <44ADBDB8.5010008@modgraph-usa.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/62 +X-Sequence-Number: 19922 + +Hi, Craig, + +Craig A. James wrote: +> If I insert a bunch of rows, then truncate, then insert a bunch more +> rows, do I need to vacuum? I've been assuming that TRUNCATE TABLE is a +> brute-force technique that more-or-less tosses the old table and starts +> fresh so that no vacuum is necessary. +> +> Second question: Same scenario as above, but now the table has indexes. +> Is a reindex needed, or are the indexes they "truncated" too? + +AFAIK, both table and indices are "cut down" nicely. + +But you will need an ANALYZE after refilling of the table, to have +current statistics. + + +HTH, +Markus + + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jul 7 05:33:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8E3609FA6B2 + for ; + Fri, 7 Jul 2006 05:33:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44895-04 for + ; + Fri, 7 Jul 2006 05:33:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id D955E9FA66C + for ; + Fri, 7 Jul 2006 05:33:14 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D142A.dip0.t-ipconnect.de + [84.157.20.42]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 6516A656C1; + Fri, 7 Jul 2006 10:34:55 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id DACB21852EF8A; + Fri, 7 Jul 2006 10:33:31 +0200 (CEST) +Message-ID: <44AE1C5B.3000300@logix-tt.com> +Date: Fri, 07 Jul 2006 10:33:31 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: genekhart@gmail.com +Cc: pgsql-performance@postgresql.org +Subject: Re: Update INSERT RULE while running for Partitioning +References: <430d92a20607070051k514e5325q87f434ccc666c01d@mail.gmail.com> +In-Reply-To: <430d92a20607070051k514e5325q87f434ccc666c01d@mail.gmail.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/63 +X-Sequence-Number: 19923 + +Hi, Gene, + +Gene wrote: +> I'm using PostgreSQL 8.1.4 in a Hibernate Application and I am +> attempting to use partitioning via Inherited tables. At first I was +> going to create a rule per sub-table based on a date range, but found +> out with multiple rules postgres will only return the affected-row count +> on the last rule which gives Hibernate problems. + +This could be considered a PostgreSQL bug - maybe you should discuss +this on the appropriate list (general, hackers)? + + +HTH, +Markus +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jul 7 06:13:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 922249FA6B5 + for ; + Fri, 7 Jul 2006 06:13:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13901-05-2 + for ; + Fri, 7 Jul 2006 06:12:59 -0300 (ADT) +X-Greylist: delayed 00:23:55.852531 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id B58E99FA999 + for ; + Fri, 7 Jul 2006 06:12:55 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from mx3.stroyinvest.com (mx3.stroyinvest.com [85.249.97.36]) + by svr4.postgresql.org (Postfix) with ESMTP id 9BD675AF094 + for ; + Fri, 7 Jul 2006 08:48:58 +0000 (GMT) +Received: from mail.linkey.ru (mail.linkey.ru [213.159.102.206]) + by mx3.stroyinvest.com (Postfix) with ESMTP id AC75842AD33 + for ; + Fri, 7 Jul 2006 12:55:46 +0400 (MSD) +Received: by mail.linkey.ru (Postfix, from userid 106) + id A406113C97B; Fri, 7 Jul 2006 12:55:46 +0400 (MSD) +Received: from skripatch.linkey.ru (skripatch.linkey.ru [213.159.100.14]) + by mail.linkey.ru (Postfix) with ESMTP id 3B66313C96A + for ; + Fri, 7 Jul 2006 12:55:46 +0400 (MSD) +Date: Fri, 7 Jul 2006 12:48:49 +0400 +From: Hripchenko Sergey +X-Mailer: The Bat! (v3.0.1.33) Professional +Reply-To: Hripchenko Sergey +Organization: ITSP "Linkey" +X-Priority: 3 (Normal) +Message-ID: <848789310.20060707124849@linkey.ru> +To: pgsql-performance@postgresql.org +Subject: longest prefix match querries +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/64 +X-Sequence-Number: 19924 + +Hi, all. + +i'm trying to tune application which makes alots of queries +with semantics(find LONGEST PREFIX MATCH in a string) like: + +SELECT cost +FROM tarif +WHERE $1 LIKE prefix +ORDER BY length(prefix) DESC +LIMIT 1 + +from table like: + +CREATE TABLE tarif ( + id bigint NOT NULL, + prefix varchar(55) NOT NULL, + cost numeric(x, x) not null +) WITHOUT OIDS; + +where $1 is the phone numbers.. for example. +it's common task for voice billing applications. + + +so, generally i can do it that ways: + +WHERE $1 LIKE prefix +WHERE $1 SIMILAR TO prefix +WHERE $1 ~ prefix +WHERE position(prefix in $1) = 0 + +( +surely i must adopt prefix for matching rules, +e.g. LIKE prefix || '%' +and the best is to create trigger which modifies prefix on +insert/update time +) + +BUT! this methods doesn't use indexes!! +this is the main disadvantage. + +voip3a=# EXPLAIN ANALYZE SELECT cost FROM tarif WHERE '78123319060' like prefix ORDER BY length(prefix) LIMIT 1; + QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------- + Limit (cost=3028.90..3028.90 rows=1 width=22) (actual time=162.189..162.192 rows=1 loops=1) + -> Sort (cost=3028.90..3030.43 rows=612 width=22) (actual time=162.181..162.181 rows=1 loops=1) + Sort Key: length((prefix)::text) + -> Seq Scan on tarif (cost=0.00..3000.57 rows=612 width=22) (actual time=4.132..161.715 rows=39 loops=1) + Filter: ('78123319060'::text ~~ (prefix)::text) + Total runtime: 162.340 ms +(6 rows) + +voip3a=# SELECT count(*) from tarif; + count +-------- + 122323 +(1 row) + + + + +AND there are many more effective algorithms for searching LONGEST PREFIX +MATCH in a string.. like +http://search.cpan.org/~avif/Tree-Trie-1.1/Trie.pm +for example + + + + +Is there any ways to improve perfomance? +May be implement indexes using Tire algoritm ? +(if so can you please show me some url's to start...) + + +Thanks, Sergey + + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 10:21:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7DD179FB1B7 + for ; + Fri, 7 Jul 2006 10:21:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05213-06 for + ; + Fri, 7 Jul 2006 10:21:17 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.201]) + by postgresql.org (Postfix) with ESMTP id C8F2D9FAC76 + for ; + Fri, 7 Jul 2006 10:21:16 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id 8so1478732nzo + for ; + Fri, 07 Jul 2006 06:21:15 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=oLILjnoqHpkMueDyKVExx2Osuzw5bGvOu63QUykyln1q/3AOqMK01K/aJP9SFFG6PKcOcRw/egzZLiLadLGZJzytvoFF0fE1bfZnCC7lqXUCqdCz16l0rzAMSsyJR9+5oU9i1HzaAV1XnsYI83XN4ehdqV7LSo2g6yTKP6RKJ7s= +Received: by 10.65.235.15 with SMTP id m15mr2120727qbr; + Fri, 07 Jul 2006 06:21:14 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Fri, 7 Jul 2006 06:21:14 -0700 (PDT) +Message-ID: +Date: Fri, 7 Jul 2006 09:21:14 -0400 +From: "Merlin Moncure" +To: "PGSQL Performance" +Subject: Re: Calling a SP from Curosor loop +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <1151600435.709010.253120@j72g2000cwa.googlegroups.com> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/65 +X-Sequence-Number: 19925 + +On 29 Jun 2006 10:00:35 -0700, satishchandra999@gmail.com + wrote: +> I have SP, which has a cursor iterations. Need to call another SP for +> every loop iteration of the cursor. The pseudo code is as follows.. + +i would suggest converting your code to pl/pgsql and reposting. that +look awfully like t-sql stored procedure, you may as well be saying, +'gobble de gook bak wakka bakka bak!', got it? :-) + +(aside: pg/pgsql functions support nested calls, recursion, etc and +should provide no problems when properly written). + +merlin + +From pgsql-performance-owner@postgresql.org Fri Jul 7 10:57:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 425B09FB1C2 + for ; + Fri, 7 Jul 2006 10:57:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60449-08 for + ; + Fri, 7 Jul 2006 10:57:55 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 116D69FB1B9 + for ; + Fri, 7 Jul 2006 10:57:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from elasmtp-mealy.atl.sa.earthlink.net + (elasmtp-mealy.atl.sa.earthlink.net [209.86.89.69]) + by svr4.postgresql.org (Postfix) with ESMTP id 1CDDC5AF06D + for ; + Fri, 7 Jul 2006 13:57:55 +0000 (GMT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; + d=earthlink.net; + b=dx4jPI7Wum/l2H1R2BdvRmJPc9ZbZu3In5VW33QQsOgqV9iG+eM/QCRpD/hLq+55; + h=Message-ID:Date:From:Reply-To:To:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; +Received: from [209.86.224.42] (helo=elwamui-muscovy.atl.sa.earthlink.net) + by elasmtp-mealy.atl.sa.earthlink.net with asmtp (Exim 4.34) + id 1Fyqq9-0003qU-VW + for pgsql-performance@postgresql.org; Fri, 07 Jul 2006 09:57:54 -0400 +Received: from 71.243.53.95 by webmail.pas.earthlink.net with HTTP; + Fri, 7 Jul 2006 09:57:53 -0400 +Message-ID: + <10119704.1152280673965.JavaMail.root@elwamui-muscovy.atl.sa.earthlink.net> +Date: Fri, 7 Jul 2006 09:57:53 -0400 (EDT) +From: Ron Peacetree +Reply-To: Ron Peacetree +To: pgsql-performance@postgresql.org +Subject: Re: suggested RAID controller for FreeBSD 6.1 + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: EarthLink Zoo Mail 1.0 +X-ELNK-Trace: + acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcefa875c36c6f036cd72932127e40f68f350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c +X-Originating-IP: 209.86.224.42 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/66 +X-Sequence-Number: 19926 + +Adaptecs RAID controllers as all underwhelming. + +The best commodity RAID controllers in terms of performance, size of available BBC, connectivity technologies (all of IDE, SCSI, SATA and FC are supported), etc are made by Areca. + +Get one of Areca's RAID controllers that hold up to 2 GB of BBC. +ARC-11xx are the PCI-X based products. +ARC-12xx are the PCI-E based products. + +Reviews at places like tweakers.net +Areca is based in Taiwan, but has European and US offices as well + +Ron Peacetree + +-----Original Message----- +>From: Kenji Morishige +>Sent: Jul 5, 2006 7:46 PM +>To: pgsql-performance@postgresql.org +>Cc: kenjim@juniper.net +>Subject: [PERFORM] suggested RAID controller for FreeBSD 6.1 + PostgreSQL 8.1 +> +>I am currently running FreeBSD 4.11 (due to IT requirements for now) and +>Adaptec's 2200S RAID controller running in RAID5. I was advised in the past +>that the 2200S is actually a poor performing controller and obviously the +>RAID5 is less than ideal for databases. I chose to run the controller in +>RAID5 as the tech I talked to suggested that the 2200S was primarily designed +>for RAID5 and it would operate the best that way. My server is a dual Xeon +> 3.06Ghz box running on a motherboard approximately 2-3 years old now. I'd +>like to know what an ideal RAID controller that would be compatible with +>FreeBSD 6.1 would be these days. +> +>Thanks in advance, +>Kenji +> +>---------------------------(end of broadcast)--------------------------- +>TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 13:27:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D21D79FB205 + for ; + Fri, 7 Jul 2006 13:26:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93951-04-7 + for ; + Fri, 7 Jul 2006 13:26:12 -0300 (ADT) +X-Greylist: delayed 00:20:09.496385 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id E8E489FB213 + for ; + Fri, 7 Jul 2006 13:26:11 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from gw.sandvine.com (sandvine.com [199.243.201.138]) + by svr4.postgresql.org (Postfix) with ESMTP id E86FF5AF07C + for ; + Fri, 7 Jul 2006 16:06:00 +0000 (GMT) +Received: from mailserver.sandvine.com ([192.168.1.10]) by gw.sandvine.com + with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 7 Jul 2006 12:05:57 -0400 +Received: from labgw2.phaedrus.sandvine.com ([192.168.3.11]) by + mailserver.sandvine.com with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 7 Jul 2006 12:05:56 -0400 +Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 12671) + id CA8E111657; Fri, 7 Jul 2006 12:05:56 -0400 (EDT) +Date: Fri, 7 Jul 2006 12:05:56 -0400 +From: Dave Chapeskie +To: pgsql-performance@postgresql.org +Cc: Gene +Subject: Re: Update INSERT RULE while running for Partitioning +Message-ID: <20060707160556.GA40235@ddm.wox.org> +Mail-Followup-To: Dave Chapeskie , + pgsql-performance@postgresql.org, Gene +References: <430d92a20607070051k514e5325q87f434ccc666c01d@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <430d92a20607070051k514e5325q87f434ccc666c01d@mail.gmail.com> +User-Agent: Mutt/1.4.2.1i +X-OriginalArrivalTime: 07 Jul 2006 16:05:57.0023 (UTC) + FILETIME=[3B3C62F0:01C6A1DF] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/67 +X-Sequence-Number: 19927 + +On Fri, Jul 07, 2006 at 03:51:38AM -0400, Gene wrote: +> Starting off with: +> +> Parent (Rule on insert instead insert into Child2) +> Child1 (Constraint date <= somedate1) +> Child2 (Constraint date > somedate1) +> +> Now I want to create another Partition: +> +> Create Table Child3 +> BEGIN +> Update Parent Rule( instead insert into Child3) +> somedate2 = max(date) from Child2 +> Update Child2 Constraint( date > somedate1 AND date <= somedate2 ) +> Set Constraint Child3 (date > somedate2) +> END + +Be aware that adding a constraint with ALTER TABLE will involve a whole +table scan (at least in 8.1.2 or earlier). This is true even if if you +have an index such that "EXPLAIN SELECT EXISTS (SELECT date > somedate1 +AND date <= somedate2 FROM Child2)" claims it will run fast. ALTER +TABLE is coded to always do a heap scan for constraint changes. + + +To avoid this, this I've made a minor modification to my local +PostgreSQL to give a construct similar to Oracle's NOVALIDATE. I allow +"ALTER TABLE ... ADD CONSTRAINT ... [CHECK EXISTING | IGNORE EXISTING]". +To use this safely without any race conditions I setup my last partition +with an explicit end time and possible extend it if needed. + +E.g. + child1 CHECK(ts >= '-infinity' and ts < t1) + child2 CHECK(ts >= t1 and ts < t2) + child3 CHECK(ts >= t2 and ts < t3) + +Here doing: + ALTER TABLE child3 ADD CONSTRAINT new_cstr + CHECK(ts >= t2 and ts < t4) IGNORE EXISTING; + ALTER TABLE child3 DROP CONSTRAINT old_cstr; +is safe if t4 >= t3. + +I have a regular cron job that makes sure if CURRENT_TIMESTAMP +approaches tn (the highest constraint time) it either makes a new +partition (actually, in my case, recycles an old partition) or extends +the last partition. My data is such that inserts with a timestamp in +the future make no sense. + + +> Anyone else tried this or expect it to work consistently (without stopping +> db)? + +Note that using ALTER TABLE to add a constraint as well as using DROP +TABLE or TRUNCATE to remove/recycle partitions are DDL commands that +require exclusive locks. This will block both readers and writers to +the table(s) and can also cause readers and writers to now interfere +with each other. + +For example, my work load is a lot of continuous small inserts with +some long running queries (reports). MVCC allows these to not block +each other at all. However, if my cron job comes along and naively +attempts to do DROP TABLE, TRUNCATE, or ALTER TABLE it will block on the +long running queries. This in turn will cause new INSERT transactions +to queue up behind my waiting exclusive lock and now I effectively have +reports blocking inserts. + +Always think twice about running DDL commands on a live database; +especially in an automated fashion. + +There are methods to alleviate or work around some of the issues of +getting an exclusive lock but I haven't found a true solution yet. +I'd imagine that implementing true partitioning within the PostgreSQL +back-end would solve this. Presumably because it would know that adding +a new partition, etc can be done without locking out readers at all +and it would use something other than an exclusive lock to do the DDL +changes. + +> Is it possible that there could be a race condition for the insertion +> and constraints or will the transaction prevent that from occurring? + +The required exclusive locks will prevent race conditions. (If you were +to use something like my IGNORE EXISTING you'd need to make sure you +manually got an exclusive lock before looking up the maximum value to +set as the new constraint.) + +-- +Dave Chapeskie + +From pgsql-performance-owner@postgresql.org Fri Jul 7 14:42:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E4CC59FB0D1 + for ; + Fri, 7 Jul 2006 14:42:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13321-06 for + ; + Fri, 7 Jul 2006 14:42:17 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.195]) + by postgresql.org (Postfix) with ESMTP id D15079FA603 + for ; + Fri, 7 Jul 2006 14:42:17 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id z3so1085542nzf + for ; + Fri, 07 Jul 2006 10:42:16 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=VdSqv/cpyahapbchE5jtg91RKhaq59U2GSn4NXKrX3OTxKdTBH22WgEDjxrlEb16T21wC5Ehv/HC1022wpj6LEqMDwiNa809gCJQ7b1dHbJSyImNOB+PdneNgYZ5MBvsqNCwn/xxKm8FsXKzhN1ujDUX4ecnlZBAlc05K7wcJKo= +Received: by 10.65.249.3 with SMTP id b3mr2526612qbs; + Fri, 07 Jul 2006 10:42:16 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Fri, 7 Jul 2006 10:42:16 -0700 (PDT) +Message-ID: +Date: Fri, 7 Jul 2006 13:42:16 -0400 +From: "Merlin Moncure" +To: Luckys +Subject: Re: how to tune this query. +Cc: pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/68 +X-Sequence-Number: 19928 + +On 7/4/06, Luckys wrote: +> +> Hi all, +> I got this query, I'm having indexes for PropertyId and Dates columns across +> all the tables, but still it takes ages to get me the result. What indexes +> would be proposed on this, or I'm helpless? +> + +I would suggest posting your table schemas and describe what you want +the results to look like. After years of following this list, I +regard your query as something of a classic. There simply has to be +an easier way of writing it. + +merlin + +From pgsql-performance-owner@postgresql.org Fri Jul 7 17:38:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6EA9B9FB1EC + for ; + Fri, 7 Jul 2006 17:38:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93756-06 for + ; + Fri, 7 Jul 2006 17:38:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from home.nohrsc.nws.gov (home.nohrsc.nws.gov [192.46.108.2]) + by postgresql.org (Postfix) with ESMTP id 242719FB1E9 + for ; + Fri, 7 Jul 2006 17:38:29 -0300 (ADT) +Received: from noaa.gov (opps-gw.nohrsc.nws.gov [192.46.108.142]) + by home.nohrsc.nws.gov (Postfix) with ESMTP + id 38C83A5AC; Fri, 7 Jul 2006 15:38:27 -0500 (CDT) +Message-ID: <44AEC642.9060401@noaa.gov> +Date: Fri, 07 Jul 2006 15:38:26 -0500 +From: andy rost +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.4) Gecko/20030624 Netscape/7.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Mark Kirkwood +Cc: Stephen Frost , + pgsql-performance@postgresql.org, Bill.Sites@noaa.gov +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +References: <44ABCFF4.3010007@noaa.gov> + <20060705154656.GS22057@kenobi.snowman.net> + <44AC00B5.6030207@noaa.gov> <44AC5014.1070605@paradise.net.nz> +In-Reply-To: <44AC5014.1070605@paradise.net.nz> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/69 +X-Sequence-Number: 19929 + +Mark, + +Thanks for the insight. I increased the value of effective_cache_size to +3 Gigs and will monitor the performance over the weekend. Prior to this +change we discovered that we are filling up WALs to the tune of 2400 per +day. Moving the pg_xlog subdirectory to its own drive seemed to boost +the performance significantly. We're taking this one step at a time. On +Monday we plan to drop the number of shared memory buffers down to 50000 +from its current value of 125000 (per the large number of +recommendations that this value should be held fairly low and +suggestions that vales in excess of 50000 may hamper performance). + +Thanks again ... + +Andy + +Mark Kirkwood wrote: +> andy rost wrote: +> +>> +> +>>>> effective_cache_size = 27462 # typically 8KB each +>>> +>>> +>>> +>>> This seems like it might be a little low... How much memory do you have +>>> in the system? Then again, with your shared_mem set so high, perhaps +>>> it's not that bad, but it might make sense to swap those two settings, +>>> or at least that'd be a more common PG setup. +>> +>> +>> Oops, forgot to mention that we have 6 Gigs of memory. This value was +>> set based on sysctl -n vfs.hibufspace / 8192 +>> +> +> That vfs.hibufspace sysctl is a little deceptive IMHO - e.g on my +> FreeBSD 6.1 system with 2G of ram it says 117276672 (i.e. about 112M), +> but I have a 1G file cached entirely in ram at the moment... In FreeBSD +> file pages are actually kept in the 'Inactive' section of memory, the +> 'Buffer' section is used as a 'window' to read 'em. For instance on my +> system I see: +> +> Mem: 4192K Active, 1303M Inact, 205M Wired, 12K Cache, 112M Buf, 491M Free +> +> So my 1G file is cached in the 1303M of 'Inactive', but I have 112M of +> buffer window for accessing this (and other) cached files. Now, I may +> not have explained this that well, and it is quite confusing... but +> hopefully you get the idea! +> +> Now on the basis of the figures provided: +> - max_connections=102 , each with work_mem=10000 (approx 1G in total) +> - shared buffers=125000 (1G total) +> +> it looks like you are only using about 2G of your 6G, so there is a lot +> left for caching file pages (lets say 3-4G or so). +> +> I would think you can happily set effective_cache_size=393216 (i.e. +> 3G/8192). This will have the side effect of encouraging more index scans +> (probably what you want I think). +> +> Best wishes +> +> Mark + +-- +-------------------------------------------------------------------------------- +Andrew Rost +National Operational Hydrologic Remote Sensing Center (NOHRSC) +National Weather Service, NOAA +1735 Lake Dr. West, Chanhassen, MN 55317-8582 +Voice: (952)361-6610 x 234 +Fax: (952)361-6634 +andy.rost@noaa.gov +http://www.nohrsc.noaa.gov +-------------------------------------------------------------------------------- + + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 18:11:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0E4679FB21C + for ; + Fri, 7 Jul 2006 18:11:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88333-09 for + ; + Fri, 7 Jul 2006 18:11:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from home.nohrsc.nws.gov (home.nohrsc.nws.gov [192.46.108.2]) + by postgresql.org (Postfix) with ESMTP id 59A7C9FB1F5 + for ; + Fri, 7 Jul 2006 18:11:27 -0300 (ADT) +Received: from noaa.gov (opps-gw.nohrsc.nws.gov [192.46.108.142]) + by home.nohrsc.nws.gov (Postfix) with ESMTP + id ED2EAA5AC; Fri, 7 Jul 2006 16:11:25 -0500 (CDT) +Message-ID: <44AECDFD.4030502@noaa.gov> +Date: Fri, 07 Jul 2006 16:11:25 -0500 +From: andy rost +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.4) Gecko/20030624 Netscape/7.1 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Merlin Moncure +Cc: pgsql-performance@postgresql.org, Bill.Sites@noaa.gov +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +References: <44ABCFF4.3010007@noaa.gov> + +In-Reply-To: +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/70 +X-Sequence-Number: 19930 + +Hi Merlin, + +Thanks for the input. Please see below ... + +Merlin Moncure wrote: +> On 7/5/06, andy rost wrote: +> +>> fsync = on # turns forced synchronization +> +> +> have you tried turning this off and measuring performance? + +No, not yet. We're trying a couple of outher avenues before manipulating +this parameter. + +> +>> stats_command_string = on +> +> +> I would turn this off unless you absoltely require it. It is +> expensive for what it does. + +We've turned this off + +> +>> a) All 4 CPUs are nearly always 0% idle; +>> b) The system load level is nearly always in excess of 20; +> +> +> I am guessing your system is spending all it's time syncing. If so, +> it's solvable (again, just run fsync=off for a bit and compare). +> + +We've reduced the load significantly primarily by moving pg_xlog to its +own drive and by increasing the effective cache size. While we still see + high load levels, they don't last very long. We're trying improve +performance from several angles but are taking it one step at a time. +Eventually we'll experiment with fsynch + +>> c) the output from vmstat -w 10 looks like: +>> procs memory page disks faults +>> cpu +>> r b w avm fre flt re pi po fr sr aa0 aa1 in sy cs us +>> sy id +>> 21 0 3 1242976 327936 2766 0 0 0 2264 0 2 2 17397 140332 +>> 104846 18 82 1 +> +> +> is that 100k context switches over 10 seconds or one second? that +> might be something to check out. pg 8.1 is regarded as the solution +> to any cs problem, though. + +According to man top, that's 100K per second. I'm interested in your +recommendation but am not sure what "pg 8.1" references + +> +>> NOTE - small user demands and high system demands +>> d) Running top indicates a significant number or sblock states and +>> occasional smwai states; +>> e) ps auxww | grep postgres doesn't show anything abnormal; +>> f) ESQL applications are very slow. +>> +>> We VACUUM ANALYZE user databases every four hours. We VACUUM template1 +>> every 4 hours. We make a copy of the current WAL every minute. We create +>> a PIT recovery archive daily daily. None of these, individually seem to +>> place much strain on the server. +> +> +> your server should be able to handle this easily. +> +>> Hopefully I've supplied enough information to start diagnosing the +>> problem. Any ideas, thoughts, suggestions are greatly appreciated ... +>> +> +> can you please approximate roughly how many transactions per second +> your server is handling while you are getting the 20 load condition +> (and, if possible, broken down into read and write transactions)? + +Do you have any suggestions on how I might obtain these metrics? + +> +> merlin + +Thanks again Merlin ... + +Andy + +-- +-------------------------------------------------------------------------------- +Andrew Rost +National Operational Hydrologic Remote Sensing Center (NOHRSC) +National Weather Service, NOAA +1735 Lake Dr. West, Chanhassen, MN 55317-8582 +Voice: (952)361-6610 x 234 +Fax: (952)361-6634 +andy.rost@noaa.gov +http://www.nohrsc.noaa.gov +-------------------------------------------------------------------------------- + + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 18:59:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 747989FA31F + for ; + Fri, 7 Jul 2006 18:59:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90152-03 for + ; + Fri, 7 Jul 2006 18:59:11 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from bay0-omc2-s12.bay0.hotmail.com (bay0-omc2-s12.bay0.hotmail.com + [65.54.246.148]) + by postgresql.org (Postfix) with ESMTP id A46EA9FA6B2 + for ; + Fri, 7 Jul 2006 18:59:11 -0300 (ADT) +Received: from hotmail.com ([65.54.229.32]) by bay0-omc2-s12.bay0.hotmail.com + with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 7 Jul 2006 14:59:09 -0700 +Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; + Fri, 7 Jul 2006 14:59:09 -0700 +Message-ID: +Received: from 65.54.229.220 by by110fd.bay110.hotmail.msn.com with HTTP; + Fri, 07 Jul 2006 21:59:07 GMT +X-Originating-IP: [69.236.161.187] +X-Originating-Email: [xgoober99@hotmail.com] +X-Sender: xgoober99@hotmail.com +From: "K-Bob body" +To: pgsql-performance@postgresql.org +Subject: Delete is very slow; + PG not using existing index to check foreign keys +Date: Fri, 07 Jul 2006 16:59:07 -0500 +Mime-Version: 1.0 +Content-Type: text/plain; format=flowed +X-OriginalArrivalTime: 07 Jul 2006 21:59:09.0456 (UTC) + FILETIME=[92E90900:01C6A210] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/71 +X-Sequence-Number: 19931 + +I've got a problem where Deletes on a certain table are taking very long (>5 +sec) (PG 8.1.3, linux). Explain Analyze on the delete shows that two +(automatically created) triggers caused by foreign keys are responsible for +99% of the time. +* The two tables are large (>1.5mm and >400k rows), so sequential scans do +take a long time. +* I've got indices on these tables, but PG doesn't appear to be using them +during the delete. +* If I run the same SELECT in psql, it does use the index and responds very +quickly. + +For example, I interrupted the Delete, and it appears that it was executing +a select from an FK table: + SELECT 1 FROM ONLY "public"."party_aliases" x WHERE "owner_party_id" = $1 +FOR SHARE OF x; + +OK, that's fine. There's an index on that column: + CREATE INDEX party_aliases_owner_party_idx ON party_aliases USING btree +(owner_party_id, id); + +I've run ANALYZE, and that doesn't appear to make any difference. Why would +PG use the index when I run the select myself, but do a sequential scan when +the same statement is run by the delete trigger? + +I looked through the mailing lists, but most suggestions appeared to be 1) +create an index, or 2) run analyze. Any ideas? + +Thanks in advance, +Kian Wright + +_________________________________________________________________ +Express yourself instantly with MSN Messenger! Download today - it's FREE! +http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 19:08:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 24ECE9FB25A + for ; + Fri, 7 Jul 2006 19:05:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72580-01 for + ; + Fri, 7 Jul 2006 19:05:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from glacier.frostconsultingllc.com (glacier.frostconsultingllc.com + [64.127.99.90]) by postgresql.org (Postfix) with ESMTP id E3FAB9FA430 + for ; + Fri, 7 Jul 2006 19:05:33 -0300 (ADT) +Received: from localhost ([127.0.0.1]:43443) + by glacier.frostconsultingllc.com with esmtp (Exim 4.62) + (envelope-from ) + id 1FyyS3-00025l-Ay; Fri, 07 Jul 2006 15:05:31 -0700 +Date: Fri, 7 Jul 2006 15:05:31 -0700 (PDT) +From: Jeff Frost +To: andy rost +cc: Merlin Moncure , pgsql-performance@postgresql.org, + Bill.Sites@noaa.gov +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +In-Reply-To: <44AECDFD.4030502@noaa.gov> +Message-ID: +References: <44ABCFF4.3010007@noaa.gov> + + <44AECDFD.4030502@noaa.gov> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-SA-Exim-Connect-IP: 127.0.0.1 +X-SA-Exim-Mail-From: jeff@frostconsultingllc.com +X-SA-Exim-Scanned: No (on glacier.frostconsultingllc.com); + SAEximRunCond expanded to false +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/72 +X-Sequence-Number: 19932 + +On Fri, 7 Jul 2006, andy rost wrote: + +>> is that 100k context switches over 10 seconds or one second? that +>> might be something to check out. pg 8.1 is regarded as the solution +>> to any cs problem, though. +> +> According to man top, that's 100K per second. I'm interested in your +> recommendation but am not sure what "pg 8.1" references + +pg 8.1 means PostgreSQL 8.1.x (preferably 8.1.4) which is said to resolve many +context switch issues. + +>> +>> can you please approximate roughly how many transactions per second +>> your server is handling while you are getting the 20 load condition +>> (and, if possible, broken down into read and write transactions)? +> +> Do you have any suggestions on how I might obtain these metrics? +> + +Every five minutes do: + +select sum(xact_commit) + sum(xact_rollback) as transactions from pg_stat_database; + +and then divide the difference by 300 and that's your transactions per second: + +select sum(xact_commit) + sum(xact_rollback) as transactions from +pg_stat_database; + + transactions +-------------- + 231894522 +(1 row) + + + + +select sum(xact_commit) + sum(xact_rollback) as transactions from +pg_stat_database; + + transactions +-------------- + 231907346 +(1 row) + +(231907346-231894522)/300 = 42.74666666666666666666 TPS + + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Fri Jul 7 19:49:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C5A419FB1DA + for ; + Fri, 7 Jul 2006 19:49:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77341-07 for + ; + Fri, 7 Jul 2006 19:49:35 -0300 (ADT) +X-Greylist: delayed 00:20:21.541028 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id A5A3A9FB215 + for ; + Fri, 7 Jul 2006 19:49:31 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from mail.brownpapertickets.com (mail.brownpapertickets.com + [66.235.70.236]) + by svr4.postgresql.org (Postfix) with ESMTP id BA74E5AF07B + for ; + Fri, 7 Jul 2006 22:29:08 +0000 (GMT) +Received: from flashheart.brownpapertickets.com + (dsl254-061-182.sea1.dsl.speakeasy.net [216.254.61.182]) + by mail.brownpapertickets.com (8.13.6/8.12.8) with ESMTP id + k67MNs60006517 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) + for ; Fri, 7 Jul 2006 15:23:55 -0700 +Message-Id: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.0 +Date: Fri, 07 Jul 2006 15:29:19 -0700 +To: pgsql-performance@postgresql.org +From: William Scott Jordan +Subject: VACUUM vs. REINDEX +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/73 +X-Sequence-Number: 19933 + +Hi all! + +Can anyone explain to me what VACUUM does that REINDEX doesn't? We +have a frequently updated table on Postgres 7.4 on FC3 with about +35000 rows which we VACUUM hourly and VACUUM FULL once per day. It +seem like the table still slows to a crawl every few weeks. Running +a REINDEX by itself or a VACUUM FULL by itself doesn't seem to help, +but running a REINDEX followed immediately by a VACUUM FULL seems to +solve the problem. + +I'm trying to decide now if we need to include a daily REINDEX along +with our daily VACUUM FULL, and more importantly I'm just curious to +know why we should or shouldn't do that. + +Any information on this subject would be appreciated. + +-Scott + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 20:15:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8EBDC9FB217 + for ; + Fri, 7 Jul 2006 20:15:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79137-01 for + ; + Fri, 7 Jul 2006 20:15:28 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web31814.mail.mud.yahoo.com (web31814.mail.mud.yahoo.com + [68.142.206.167]) + by postgresql.org (Postfix) with SMTP id A602B9FB20A + for ; + Fri, 7 Jul 2006 20:15:28 -0300 (ADT) +Received: (qmail 92788 invoked by uid 60001); 7 Jul 2006 23:15:27 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=w8WvLkueqfMM6vHWq0TnLu/IycefJAuZUQ53Fl+BPDz4Z2/9fwEOrPqOO8b01UHC+ShyZlrytmEJk8TQiUJtihtpdzjxEAhZCtLRzadJ2SMmMIhWEiULStqJjxbapFBPIZGSK3f1R5HSN7ZlHRZV8kxWZaTfQcG1fNKnOU46RQw= + ; +Message-ID: <20060707231527.92786.qmail@web31814.mail.mud.yahoo.com> +Received: from [65.211.203.44] by web31814.mail.mud.yahoo.com via HTTP; + Fri, 07 Jul 2006 16:15:27 PDT +Date: Fri, 7 Jul 2006 16:15:27 -0700 (PDT) +From: Richard Broersma Jr +Subject: Re: VACUUM vs. REINDEX +To: William Scott Jordan , + pgsql-performance@postgresql.org +In-Reply-To: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/74 +X-Sequence-Number: 19934 + +> I'm trying to decide now if we need to include a daily REINDEX along +> with our daily VACUUM FULL, and more importantly I'm just curious to +> know why we should or shouldn't do that. +> +> Any information on this subject would be appreciated. + +My understanding is that vaccum full frees all of the unused space from deprecated tuples in the +table. This effective reduces that amount of tuples that will be sequencially scanned which +deceases sequencial scan times. + +reindex rebuilds the index to removed all of the deprecated tuple references. This free memory +and reduces that time it takes to scan the index. + +Thats how I understand it. + +Regards, + +Richard Broersma Jr. + +From pgsql-performance-owner@postgresql.org Fri Jul 7 20:18:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 175399FB20A + for ; + Fri, 7 Jul 2006 20:18:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 13858-05 for + ; + Fri, 7 Jul 2006 20:18:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from glacier.frostconsultingllc.com (glacier.frostconsultingllc.com + [64.127.99.90]) by postgresql.org (Postfix) with ESMTP id 284099FB217 + for ; + Fri, 7 Jul 2006 20:18:42 -0300 (ADT) +Received: from localhost ([127.0.0.1]:47555) + by glacier.frostconsultingllc.com with esmtp (Exim 4.62) + (envelope-from ) + id 1Fyzaq-0002OX-Jx; Fri, 07 Jul 2006 16:18:40 -0700 +Date: Fri, 7 Jul 2006 16:18:40 -0700 (PDT) +From: Jeff Frost +To: William Scott Jordan +cc: pgsql-performance@postgresql.org +Subject: Re: VACUUM vs. REINDEX +In-Reply-To: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> +Message-ID: +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-SA-Exim-Connect-IP: 127.0.0.1 +X-SA-Exim-Mail-From: jeff@frostconsultingllc.com +X-SA-Exim-Scanned: No (on glacier.frostconsultingllc.com); + SAEximRunCond expanded to false +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/75 +X-Sequence-Number: 19935 + +On Fri, 7 Jul 2006, William Scott Jordan wrote: + +> Hi all! +> +> Can anyone explain to me what VACUUM does that REINDEX doesn't? We have a +> frequently updated table on Postgres 7.4 on FC3 with about 35000 rows which +> we VACUUM hourly and VACUUM FULL once per day. It seem like the table still +> slows to a crawl every few weeks. Running a REINDEX by itself or a VACUUM +> FULL by itself doesn't seem to help, but running a REINDEX followed +> immediately by a VACUUM FULL seems to solve the problem. +> +> I'm trying to decide now if we need to include a daily REINDEX along with our +> daily VACUUM FULL, and more importantly I'm just curious to know why we +> should or shouldn't do that. +> +> Any information on this subject would be appreciated. + +William, + +If you're having to VACUUM FULL that often, then it's likely your FSM settings +are too low. What does the last few lines of VACUUM VERBOSE say? Also, are +you running ANALYZE with the vacuums or just running VACUUM? You still need +to run ANALYZE to update the planner statistics, otherwise things might slowly +grind to a halt. Also, you should probably consider setting up autovacuum and +upgrading to 8.0 or 8.1 for better performance overall. + + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Fri Jul 7 21:03:04 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0FE619FB1FF + for ; + Fri, 7 Jul 2006 21:03:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 28110-05 for + ; + Fri, 7 Jul 2006 21:02:52 -0300 (ADT) +X-Greylist: delayed 01:33:42.581291 by SQLgrey- +Received: from mail.brownpapertickets.com (mail.brownpapertickets.com + [66.235.70.236]) + by postgresql.org (Postfix) with ESMTP id 497CC9FB1DE + for ; + Fri, 7 Jul 2006 21:02:51 -0300 (ADT) +Received: from flashheart.brownpapertickets.com + (dsl254-061-182.sea1.dsl.speakeasy.net [216.254.61.182]) + by mail.brownpapertickets.com (8.13.6/8.12.8) with ESMTP id + k67NvUQ5007811 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Fri, 7 Jul 2006 16:57:30 -0700 +Message-Id: <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.0 +Date: Fri, 07 Jul 2006 17:02:53 -0700 +To: Jeff Frost +From: William Scott Jordan +Subject: Re: VACUUM vs. REINDEX +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/76 +X-Sequence-Number: 19936 + +Hi Jeff, + +We are running ANALYZE with the hourly VACUUMs. Most of the time the +VACUUM for this table looks like this: + +---------------------------- +INFO: vacuuming "public.event_sums" +INFO: index "event_sums_event_available" now contains 35669 row +versions in 1524 pages +DETAIL: 22736 index row versions were removed. +1171 index pages have been deleted, 1142 are currently reusable. +CPU 0.03s/0.04u sec elapsed 0.06 sec. +INFO: index "event_sums_date_available" now contains 35669 row +versions in 3260 pages +DETAIL: 22736 index row versions were removed. +1106 index pages have been deleted, 1086 are currently reusable. +CPU 0.06s/0.14u sec elapsed 0.20 sec. +INFO: index "event_sums_price_available" now contains 35669 row +versions in 2399 pages +DETAIL: 22736 index row versions were removed. +16 index pages have been deleted, 16 are currently reusable. +CPU 0.05s/0.13u sec elapsed 0.17 sec. +INFO: "event_sums": removed 22736 row versions in 1175 pages +DETAIL: CPU 0.03s/0.05u sec elapsed 0.08 sec. +INFO: "event_sums": found 22736 removable, 35669 nonremovable row +versions in 27866 pages +DETAIL: 0 dead row versions cannot be removed yet. +There were 767199 unused item pointers. +0 pages are entirely empty. +CPU 0.49s/0.45u sec elapsed 0.93 sec. +---------------------------- + +Without any increase in table traffic, every few weeks, things start +to look like this: + +---------------------------- +INFO: vacuuming "public.event_sums" +INFO: index "event_sums_event_available" now contains 56121 row +versions in 2256 pages +DETAIL: 102936 index row versions were removed. +1777 index pages have been deleted, 1635 are currently reusable. +CPU 0.03s/0.16u sec elapsed 1.04 sec. +INFO: index "event_sums_date_available" now contains 56121 row +versions in 5504 pages +DETAIL: 102936 index row versions were removed. +2267 index pages have been deleted, 2202 are currently reusable. +CPU 0.15s/0.25u sec elapsed 13.91 sec. +INFO: index "event_sums_price_available" now contains 56121 row +versions in 4929 pages +DETAIL: 102936 index row versions were removed. +149 index pages have been deleted, 149 are currently reusable. +CPU 0.13s/0.33u sec elapsed 0.51 sec. +INFO: "event_sums": removed 102936 row versions in 3796 pages +DETAIL: CPU 0.31s/0.26u sec elapsed 0.92 sec. +INFO: "event_sums": found 102936 removable, 35972 nonremovable row +versions in 170937 pages +DETAIL: 8008 dead row versions cannot be removed yet. +There were 4840134 unused item pointers. +0 pages are entirely empty. +CPU 5.13s/1.68u sec elapsed 209.38 sec. +INFO: analyzing "public.event_sums" +INFO: "event_sums": 171629 pages, 3000 rows sampled, 7328 estimated total rows +---------------------------- + +There are a few things in the second vacuum results that catch my +eye, but I don't have the skill set to diagnose the problem. I do +know, however, that a REINDEX followed by a VACUUM FULL seems to make +the symptoms go away for a while. + +And I agree that we should upgrade to an 8.x version of PG, but as +with many things in life time, money, and risk conspire against me. + +-William + + + + +At 04:18 PM 7/7/2006, you wrote: +>On Fri, 7 Jul 2006, William Scott Jordan wrote: +> +>>Hi all! +>> +>>Can anyone explain to me what VACUUM does that REINDEX doesn't? We +>>have a frequently updated table on Postgres 7.4 on FC3 with about +>>35000 rows which we VACUUM hourly and VACUUM FULL once per day. It +>>seem like the table still slows to a crawl every few +>>weeks. Running a REINDEX by itself or a VACUUM FULL by itself +>>doesn't seem to help, but running a REINDEX followed immediately by +>>a VACUUM FULL seems to solve the problem. +>> +>>I'm trying to decide now if we need to include a daily REINDEX +>>along with our daily VACUUM FULL, and more importantly I'm just +>>curious to know why we should or shouldn't do that. +>> +>>Any information on this subject would be appreciated. +> +>William, +> +>If you're having to VACUUM FULL that often, then it's likely your +>FSM settings are too low. What does the last few lines of VACUUM +>VERBOSE say? Also, are you running ANALYZE with the vacuums or just +>running VACUUM? You still need to run ANALYZE to update the planner +>statistics, otherwise things might slowly grind to a halt. Also, +>you should probably consider setting up autovacuum and upgrading to +>8.0 or 8.1 for better performance overall. +> +> +>-- +>Jeff Frost, Owner +>Frost Consulting, LLC http://www.frostconsultingllc.com/ +>Phone: 650-780-7908 FAX: 650-649-1954 + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 21:22:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 894A09FB1D8 + for ; + Fri, 7 Jul 2006 21:22:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77505-02 for + ; + Fri, 7 Jul 2006 21:22:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from glacier.frostconsultingllc.com (glacier.frostconsultingllc.com + [64.127.99.90]) by postgresql.org (Postfix) with ESMTP id 300A79FA45F + for ; + Fri, 7 Jul 2006 21:22:10 -0300 (ADT) +Received: from localhost ([127.0.0.1]:34992) + by glacier.frostconsultingllc.com with esmtp (Exim 4.62) + (envelope-from ) + id 1Fz0aG-0002aG-Kv; Fri, 07 Jul 2006 17:22:08 -0700 +Date: Fri, 7 Jul 2006 17:22:08 -0700 (PDT) +From: Jeff Frost +To: William Scott Jordan +cc: pgsql-performance@postgresql.org +Subject: Re: VACUUM vs. REINDEX +In-Reply-To: <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> +Message-ID: +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + + <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-SA-Exim-Connect-IP: 127.0.0.1 +X-SA-Exim-Mail-From: jeff@frostconsultingllc.com +X-SA-Exim-Scanned: No (on glacier.frostconsultingllc.com); + SAEximRunCond expanded to false +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/77 +X-Sequence-Number: 19937 + +On Fri, 7 Jul 2006, William Scott Jordan wrote: + +> Hi Jeff, +> +> We are running ANALYZE with the hourly VACUUMs. Most of the time the VACUUM +> for this table looks like this: + +> INFO: vacuuming "public.event_sums" +> INFO: index "event_sums_event_available" now contains 56121 row versions in +> 2256 pages +> DETAIL: 102936 index row versions were removed. +> 1777 index pages have been deleted, 1635 are currently reusable. +> CPU 0.03s/0.16u sec elapsed 1.04 sec. +> INFO: index "event_sums_date_available" now contains 56121 row versions in +> 5504 pages +> DETAIL: 102936 index row versions were removed. +> 2267 index pages have been deleted, 2202 are currently reusable. +> CPU 0.15s/0.25u sec elapsed 13.91 sec. +> INFO: index "event_sums_price_available" now contains 56121 row versions in +> 4929 pages +> DETAIL: 102936 index row versions were removed. +> 149 index pages have been deleted, 149 are currently reusable. +> CPU 0.13s/0.33u sec elapsed 0.51 sec. +> INFO: "event_sums": removed 102936 row versions in 3796 pages +> DETAIL: CPU 0.31s/0.26u sec elapsed 0.92 sec. +> INFO: "event_sums": found 102936 removable, 35972 nonremovable row versions +> in 170937 pages +> DETAIL: 8008 dead row versions cannot be removed yet. +> There were 4840134 unused item pointers. +> 0 pages are entirely empty. +> CPU 5.13s/1.68u sec elapsed 209.38 sec. +> INFO: analyzing "public.event_sums" +> INFO: "event_sums": 171629 pages, 3000 rows sampled, 7328 estimated total +> rows + +Hmmm..I was looking for something that looks like this: + +INFO: free space map: 109 relations, 204 pages stored; 1792 total pages +needed +DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared +memory. +VACUUM + +Maybe 7.4 doesn't give this? Or maybe you need to run vacuumdb -a -v to get +it? + + + +> ---------------------------- +> +> There are a few things in the second vacuum results that catch my eye, but I +> don't have the skill set to diagnose the problem. I do know, however, that a +> REINDEX followed by a VACUUM FULL seems to make the symptoms go away for a +> while. +> +> And I agree that we should upgrade to an 8.x version of PG, but as with many +> things in life time, money, and risk conspire against me. + +You should still be able to use autovacuum, which might make you a little +happier. Which 7.4 version are you using? + + +> +> -William +> +> +> +> +> At 04:18 PM 7/7/2006, you wrote: +>> On Fri, 7 Jul 2006, William Scott Jordan wrote: +>> +>>> Hi all! +>>> +>>> Can anyone explain to me what VACUUM does that REINDEX doesn't? We have a +>>> frequently updated table on Postgres 7.4 on FC3 with about 35000 rows +>>> which we VACUUM hourly and VACUUM FULL once per day. It seem like the +>>> table still slows to a crawl every few weeks. Running a REINDEX by itself +>>> or a VACUUM FULL by itself doesn't seem to help, but running a REINDEX +>>> followed immediately by a VACUUM FULL seems to solve the problem. +>>> +>>> I'm trying to decide now if we need to include a daily REINDEX along with +>>> our daily VACUUM FULL, and more importantly I'm just curious to know why +>>> we should or shouldn't do that. +>>> +>>> Any information on this subject would be appreciated. +>> +>> William, +>> +>> If you're having to VACUUM FULL that often, then it's likely your FSM +>> settings are too low. What does the last few lines of VACUUM VERBOSE say? +>> Also, are you running ANALYZE with the vacuums or just running VACUUM? You +>> still need to run ANALYZE to update the planner statistics, otherwise +>> things might slowly grind to a halt. Also, you should probably consider +>> setting up autovacuum and upgrading to 8.0 or 8.1 for better performance +>> overall. +>> +>> +>> -- +>> Jeff Frost, Owner +>> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>> Phone: 650-780-7908 FAX: 650-649-1954 +> +> +> + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Fri Jul 7 21:48:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 52C4F9FB1B8 + for ; + Fri, 7 Jul 2006 21:48:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76660-06 for + ; + Fri, 7 Jul 2006 21:47:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.brownpapertickets.com (mail.brownpapertickets.com + [66.235.70.236]) + by postgresql.org (Postfix) with ESMTP id EAE6C9FA612 + for ; + Fri, 7 Jul 2006 21:47:59 -0300 (ADT) +Received: from flashheart.brownpapertickets.com + (dsl254-061-182.sea1.dsl.speakeasy.net [216.254.61.182]) + by mail.brownpapertickets.com (8.13.6/8.12.8) with ESMTP id + k680ggbP008484 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Fri, 7 Jul 2006 17:42:42 -0700 +Message-Id: <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> +X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.0 +Date: Fri, 07 Jul 2006 17:48:09 -0700 +To: Jeff Frost +From: William Scott Jordan +Subject: Re: VACUUM vs. REINDEX +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + + <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> + +Mime-Version: 1.0 +Content-Type: text/plain; charset="us-ascii"; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/78 +X-Sequence-Number: 19938 + +Hi Jeff, + +Ah, okay. I see what information you were looking for. Doing a +VACUUM on the full DB, we get the following results: + +---------------------------- +INFO: free space map: 885 relations, 8315 pages stored; 177632 total +pages needed +DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 178 kB +shared memory. +---------------------------- + +-William + + +At 05:22 PM 7/7/2006, you wrote: +>On Fri, 7 Jul 2006, William Scott Jordan wrote: +> +>>Hi Jeff, +>> +>>We are running ANALYZE with the hourly VACUUMs. Most of the time +>>the VACUUM for this table looks like this: +> +>>INFO: vacuuming "public.event_sums" +>>INFO: index "event_sums_event_available" now contains 56121 row +>>versions in 2256 pages +>>DETAIL: 102936 index row versions were removed. +>>1777 index pages have been deleted, 1635 are currently reusable. +>>CPU 0.03s/0.16u sec elapsed 1.04 sec. +>>INFO: index "event_sums_date_available" now contains 56121 row +>>versions in 5504 pages +>>DETAIL: 102936 index row versions were removed. +>>2267 index pages have been deleted, 2202 are currently reusable. +>>CPU 0.15s/0.25u sec elapsed 13.91 sec. +>>INFO: index "event_sums_price_available" now contains 56121 row +>>versions in 4929 pages +>>DETAIL: 102936 index row versions were removed. +>>149 index pages have been deleted, 149 are currently reusable. +>>CPU 0.13s/0.33u sec elapsed 0.51 sec. +>>INFO: "event_sums": removed 102936 row versions in 3796 pages +>>DETAIL: CPU 0.31s/0.26u sec elapsed 0.92 sec. +>>INFO: "event_sums": found 102936 removable, 35972 nonremovable row +>>versions in 170937 pages +>>DETAIL: 8008 dead row versions cannot be removed yet. +>>There were 4840134 unused item pointers. +>>0 pages are entirely empty. +>>CPU 5.13s/1.68u sec elapsed 209.38 sec. +>>INFO: analyzing "public.event_sums" +>>INFO: "event_sums": 171629 pages, 3000 rows sampled, 7328 +>>estimated total rows +> +>Hmmm..I was looking for something that looks like this: +> +>INFO: free space map: 109 relations, 204 pages stored; 1792 total +>pages needed +>DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB +>shared memory. +>VACUUM +> +>Maybe 7.4 doesn't give this? Or maybe you need to run vacuumdb -a +>-v to get it? +> +> +> +>>---------------------------- +>> +>>There are a few things in the second vacuum results that catch my +>>eye, but I don't have the skill set to diagnose the problem. I do +>>know, however, that a REINDEX followed by a VACUUM FULL seems to +>>make the symptoms go away for a while. +>> +>>And I agree that we should upgrade to an 8.x version of PG, but as +>>with many things in life time, money, and risk conspire against me. +> +>You should still be able to use autovacuum, which might make you a +>little happier. Which 7.4 version are you using? +> +> +>> +>>-William +>> +>> +>> +>> +>>At 04:18 PM 7/7/2006, you wrote: +>>>On Fri, 7 Jul 2006, William Scott Jordan wrote: +>>> +>>>>Hi all! +>>>>Can anyone explain to me what VACUUM does that REINDEX +>>>>doesn't? We have a frequently updated table on Postgres 7.4 on +>>>>FC3 with about 35000 rows which we VACUUM hourly and VACUUM FULL +>>>>once per day. It seem like the table still slows to a crawl +>>>>every few weeks. Running a REINDEX by itself or a VACUUM FULL by +>>>>itself doesn't seem to help, but running a REINDEX followed +>>>>immediately by a VACUUM FULL seems to solve the problem. +>>>>I'm trying to decide now if we need to include a daily REINDEX +>>>>along with our daily VACUUM FULL, and more importantly I'm just +>>>>curious to know why we should or shouldn't do that. +>>>>Any information on this subject would be appreciated. +>>>William, +>>>If you're having to VACUUM FULL that often, then it's likely your +>>>FSM settings are too low. What does the last few lines of VACUUM +>>>VERBOSE say? Also, are you running ANALYZE with the vacuums or +>>>just running VACUUM? You still need to run ANALYZE to update the +>>>planner statistics, otherwise things might slowly grind to a +>>>halt. Also, you should probably consider setting up autovacuum +>>>and upgrading to 8.0 or 8.1 for better performance overall. +>>> +>>>-- +>>>Jeff Frost, Owner +>>>Frost Consulting, LLC http://www.frostconsultingllc.com/ +>>>Phone: 650-780-7908 FAX: 650-649-1954 +>> +>> +> +>-- +>Jeff Frost, Owner +>Frost Consulting, LLC http://www.frostconsultingllc.com/ +>Phone: 650-780-7908 FAX: 650-649-1954 + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 22:15:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2022C9FB1CF + for ; + Fri, 7 Jul 2006 22:15:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09066-06 for + ; + Fri, 7 Jul 2006 22:15:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id B74F49FB1C6 + for ; + Fri, 7 Jul 2006 22:15:32 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k681FK6D004024; Fri, 7 Jul 2006 18:15:21 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +To: pgsql-performance@postgresql.org +Subject: Re: VACUUM vs. REINDEX +Date: Fri, 7 Jul 2006 18:15:40 -0700 +User-Agent: KMail/1.9.1 +Cc: William Scott Jordan , + Jeff Frost +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + + <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> +In-Reply-To: <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200607071815.41311.jd@commandprompt.com> +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Fri, 07 Jul 2006 18:15:22 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/79 +X-Sequence-Number: 19939 + +On Friday 07 July 2006 17:48, William Scott Jordan wrote: +> Hi Jeff, +> +> Ah, okay. I see what information you were looking for. Doing a +> VACUUM on the full DB, we get the following results: +> +> ---------------------------- +> INFO: free space map: 885 relations, 8315 pages stored; 177632 total +> pages needed +> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 178 kB +> shared memory. +> ---------------------------- +> + +There is one problem right there. Your max_fsm_pages is not enough, or at +least you aren't vacuuming enough. + +Either increase your max_fsm_pages or vacuum more often. + +Also, honestly -- upgrade to 8.1 :) + +Joshua D. Drake + + +> -William +> +> At 05:22 PM 7/7/2006, you wrote: +> >On Fri, 7 Jul 2006, William Scott Jordan wrote: +> >>Hi Jeff, +> >> +> >>We are running ANALYZE with the hourly VACUUMs. Most of the time +> >>the VACUUM for this table looks like this: +> >> +> >>INFO: vacuuming "public.event_sums" +> >>INFO: index "event_sums_event_available" now contains 56121 row +> >>versions in 2256 pages +> >>DETAIL: 102936 index row versions were removed. +> >>1777 index pages have been deleted, 1635 are currently reusable. +> >>CPU 0.03s/0.16u sec elapsed 1.04 sec. +> >>INFO: index "event_sums_date_available" now contains 56121 row +> >>versions in 5504 pages +> >>DETAIL: 102936 index row versions were removed. +> >>2267 index pages have been deleted, 2202 are currently reusable. +> >>CPU 0.15s/0.25u sec elapsed 13.91 sec. +> >>INFO: index "event_sums_price_available" now contains 56121 row +> >>versions in 4929 pages +> >>DETAIL: 102936 index row versions were removed. +> >>149 index pages have been deleted, 149 are currently reusable. +> >>CPU 0.13s/0.33u sec elapsed 0.51 sec. +> >>INFO: "event_sums": removed 102936 row versions in 3796 pages +> >>DETAIL: CPU 0.31s/0.26u sec elapsed 0.92 sec. +> >>INFO: "event_sums": found 102936 removable, 35972 nonremovable row +> >>versions in 170937 pages +> >>DETAIL: 8008 dead row versions cannot be removed yet. +> >>There were 4840134 unused item pointers. +> >>0 pages are entirely empty. +> >>CPU 5.13s/1.68u sec elapsed 209.38 sec. +> >>INFO: analyzing "public.event_sums" +> >>INFO: "event_sums": 171629 pages, 3000 rows sampled, 7328 +> >>estimated total rows +> > +> >Hmmm..I was looking for something that looks like this: +> > +> >INFO: free space map: 109 relations, 204 pages stored; 1792 total +> >pages needed +> >DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB +> >shared memory. +> >VACUUM +> > +> >Maybe 7.4 doesn't give this? Or maybe you need to run vacuumdb -a +> >-v to get it? +> > +> >>---------------------------- +> >> +> >>There are a few things in the second vacuum results that catch my +> >>eye, but I don't have the skill set to diagnose the problem. I do +> >>know, however, that a REINDEX followed by a VACUUM FULL seems to +> >>make the symptoms go away for a while. +> >> +> >>And I agree that we should upgrade to an 8.x version of PG, but as +> >>with many things in life time, money, and risk conspire against me. +> > +> >You should still be able to use autovacuum, which might make you a +> >little happier. Which 7.4 version are you using? +> > +> >>-William +> >> +> >>At 04:18 PM 7/7/2006, you wrote: +> >>>On Fri, 7 Jul 2006, William Scott Jordan wrote: +> >>>>Hi all! +> >>>>Can anyone explain to me what VACUUM does that REINDEX +> >>>>doesn't? We have a frequently updated table on Postgres 7.4 on +> >>>>FC3 with about 35000 rows which we VACUUM hourly and VACUUM FULL +> >>>>once per day. It seem like the table still slows to a crawl +> >>>>every few weeks. Running a REINDEX by itself or a VACUUM FULL by +> >>>>itself doesn't seem to help, but running a REINDEX followed +> >>>>immediately by a VACUUM FULL seems to solve the problem. +> >>>>I'm trying to decide now if we need to include a daily REINDEX +> >>>>along with our daily VACUUM FULL, and more importantly I'm just +> >>>>curious to know why we should or shouldn't do that. +> >>>>Any information on this subject would be appreciated. +> >>> +> >>>William, +> >>>If you're having to VACUUM FULL that often, then it's likely your +> >>>FSM settings are too low. What does the last few lines of VACUUM +> >>>VERBOSE say? Also, are you running ANALYZE with the vacuums or +> >>>just running VACUUM? You still need to run ANALYZE to update the +> >>>planner statistics, otherwise things might slowly grind to a +> >>>halt. Also, you should probably consider setting up autovacuum +> >>>and upgrading to 8.0 or 8.1 for better performance overall. +> >>> +> >>>-- +> >>>Jeff Frost, Owner +> >>>Frost Consulting, LLC http://www.frostconsultingllc.com/ +> >>>Phone: 650-780-7908 FAX: 650-649-1954 +> > +> >-- +> >Jeff Frost, Owner +> >Frost Consulting, LLC http://www.frostconsultingllc.com/ +> >Phone: 650-780-7908 FAX: 650-649-1954 +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org + +-- + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Fri Jul 7 22:29:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B6A869FB1D8 + for ; + Fri, 7 Jul 2006 22:29:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35327-02 for + ; + Fri, 7 Jul 2006 22:28:53 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.202]) + by postgresql.org (Postfix) with ESMTP id BA15A9FB1CF + for ; + Fri, 7 Jul 2006 22:28:53 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id s13so839240wxc + for ; + Fri, 07 Jul 2006 18:28:52 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=WTB1S41qg4Pm9g1oNxYqiVtxuaUsvNdmy4jJqH+odOSCgH6KD521mkpTVrN5sF4H6Uv+B6tRo9qnW8phh3c006aN1AdCwnkYnveDWh0v+6daV7L8flSRMbvQYiZ0r58tu3GWNQBu8xELDd/DO/HHJs0Z/QPXejz60XTs7vEV+us= +Received: by 10.70.52.14 with SMTP id z14mr1810493wxz; + Fri, 07 Jul 2006 18:28:52 -0700 (PDT) +Received: by 10.70.73.15 with HTTP; Fri, 7 Jul 2006 18:28:52 -0700 (PDT) +Message-ID: <1d219a6f0607071828q1d63fe55k8a1faeccf03b0884@mail.gmail.com> +Date: Fri, 7 Jul 2006 21:28:52 -0400 +From: "Chris Hoover" +To: "William Scott Jordan" +Subject: Re: VACUUM vs. REINDEX +Cc: "Jeff Frost" , + pgsql-performance@postgresql.org +In-Reply-To: <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_131798_24752520.1152322132184" +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + + <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> + + <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/80 +X-Sequence-Number: 19940 + +------=_Part_131798_24752520.1152322132184 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 7/7/06, William Scott Jordan wrote: +> +> Hi Jeff, +> +> Ah, okay. I see what information you were looking for. Doing a +> VACUUM on the full DB, we get the following results: +> +> ---------------------------- +> INFO: free space map: 885 relations, 8315 pages stored; 177632 total +> pages needed +> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 178 kB +> shared memory. +> ---------------------------- +> +> -William + +William, + +You need to increase your fsm settings. The database is telling you it is +trying to store 177K+ pages, but you have only provided it with 20K. Since +these pages are cheap, I would set your fsm up with at least the following. + +max_fsm_pages 500000 +max_fsm_relations 5000 + +This should provide PostgreSQL with enough space to work. You still might +need to run one more vacuum full once you change the setting so that you can +recover the space that was lost due to your fsm begin to small. Keep an eye +on these last couple of lines from vacuum and adjust your setting +accordingly. It may take a couple of tries to get PostgreSQL happy. Once +your fsm is large enough, you should be able to dispense with the vacuum +fulls and reindexes and just do normal vacuuming. + +Also in regards to the vacuum vs reindex. Reindexing is great and gives you +nice clean "virgin" indexes, however, if you do not run an analyze (or +vacuum analyze), the database will not have statistics for the new indexes. +This will cause the planner to make bad choices. + +What I used to do before upgrading to 8.1 was run a vacuum full, reindexdb, +vacuum analyze every weekend (we were on 7.3.4). This gave me pristine +indexes and tables for Monday's start of the week. + +If you can, look hard at upgrading to 8.1.x as it will fix a lot of the +issues you are having with autovacuum (along with a ton of other +improvements). + +HTH, + +Chris + +------=_Part_131798_24752520.1152322132184 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

On 7/7/06, William Scott Jordan <wsjordan@brownpapertickets.com> wrote:
+Hi Jeff,

Ah, okay.  I see what information you were looking for.  Doing a
VACUUM on the full DB, we get the following results:

----------------------------
INFO:  free space map: 885 relations, 8315 pages stored; 177632 total +
pages needed
DETAIL:  Allocated FSM size: 1000 relations + 20000 pages = 178 kB
shared memory.
----------------------------

-William
William,

You need to increase your fsm settings.  The database is telling you it is trying to store 177K+ pages, but you have only provided it with 20K.  Since these pages are cheap, I would set your fsm up with at least the following. +

max_fsm_pages 500000
max_fsm_relations 5000

This should provide PostgreSQL with enough space to work.  You still might need to run one more vacuum full once you change the setting so that you can recover the space that was lost due to your fsm begin to small.  Keep an eye on these last couple of lines from vacuum and adjust your setting accordingly.  It may take a couple of tries to get PostgreSQL happy.  Once your fsm is large enough, you should be able to dispense with the vacuum fulls and reindexes and just do normal vacuuming. +

Also in regards to the vacuum vs reindex.  Reindexing is great and gives you nice clean "virgin" indexes, however, if you do not run an analyze (or vacuum analyze), the database will not have statistics for the new indexes.  This will cause the planner to make bad choices. +

What I used to do before upgrading to 8.1 was run a vacuum full, reindexdb, vacuum analyze every weekend (we were on 7.3.4).  This gave me pristine indexes and tables for Monday's start of the week.

If you can, look hard at upgrading to +8.1.x as it will fix a lot of the issues you are having with autovacuum (along with a ton of other improvements).

HTH,

Chris


+ +------=_Part_131798_24752520.1152322132184-- + +From pgsql-performance-owner@postgresql.org Sat Jul 8 00:25:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C11E49FAD5A + for ; + Sat, 8 Jul 2006 00:25:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47263-08 for + ; + Sat, 8 Jul 2006 00:25:01 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 50D529FA5E9 + for ; + Sat, 8 Jul 2006 00:25:00 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k683OeHj005887; Fri, 7 Jul 2006 20:24:42 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +To: pgsql-performance@postgresql.org +Subject: Re: VACUUM vs. REINDEX +Date: Fri, 7 Jul 2006 20:24:24 -0700 +User-Agent: KMail/1.9.1 +Cc: "Chris Hoover" , + "William Scott Jordan" , + "Jeff Frost" +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> + <1d219a6f0607071828q1d63fe55k8a1faeccf03b0884@mail.gmail.com> +In-Reply-To: <1d219a6f0607071828q1d63fe55k8a1faeccf03b0884@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-15" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200607072024.25142.jd@commandprompt.com> +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Fri, 07 Jul 2006 20:24:42 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/81 +X-Sequence-Number: 19941 + + +> William, +> +> You need to increase your fsm settings. The database is telling you it is +> trying to store 177K+ pages, but you have only provided it with 20K. Since +> these pages are cheap, I would set your fsm up with at least the following. +> +> max_fsm_pages 500000 +> max_fsm_relations 5000 +> +> This should provide PostgreSQL with enough space to work. You still might +> need to run one more vacuum full once you change the setting so that you +> can recover the space that was lost due to your fsm begin to small. +Yes he will need to run a vacuum full but I actually doubt he needs to +increase his max_fsm_pages that much, he just needs to vacuum more. + +Joshua D. Drake + +From pgsql-performance-owner@postgresql.org Sat Jul 8 05:14:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6037F9FB1FB + for ; + Sat, 8 Jul 2006 05:14:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84740-03 for + ; + Sat, 8 Jul 2006 05:14:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id EFE1C9FB1EF + for ; + Sat, 8 Jul 2006 05:14:16 -0300 (ADT) +Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1Fz7x7-0003eq-K3 + for pgsql-performance@postgresql.org; Sat, 08 Jul 2006 10:14:14 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1Fz7wC-0001gf-00 + for ; Sat, 08 Jul 2006 10:13:16 +0200 +Date: Sat, 8 Jul 2006 10:13:16 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: VACUUM vs. REINDEX +Message-ID: <20060708081316.GB6396@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + + <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> + + <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> + <1d219a6f0607071828q1d63fe55k8a1faeccf03b0884@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <1d219a6f0607071828q1d63fe55k8a1faeccf03b0884@mail.gmail.com> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/82 +X-Sequence-Number: 19942 + +On Fri, Jul 07, 2006 at 09:28:52PM -0400, Chris Hoover wrote: +> You need to increase your fsm settings. The database is telling you it is +> trying to store 177K+ pages, but you have only provided it with 20K. Since +> these pages are cheap, I would set your fsm up with at least the following. + +While we're at it, is there a good reason why we simply aren't upping the FSM +defaults? It seems like a lot of people are being bitten by it, and adding +more pages and relations is as you say cheap... + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sat Jul 8 06:17:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0A46C9FB1FB + for ; + Sat, 8 Jul 2006 06:17:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19578-06 for + ; + Sat, 8 Jul 2006 06:17:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id F3DBC9FB1DA + for ; + Sat, 8 Jul 2006 06:17:05 -0300 (ADT) +Received: from mastermind.kaltenbrunner.cc ([83.215.233.60]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1Fz8vf-000KED-0I; Sat, 08 Jul 2006 11:17:02 +0200 +Message-ID: <44AF77FE.5040901@kaltenbrunner.cc> +Date: Sat, 08 Jul 2006 11:16:46 +0200 +From: Stefan Kaltenbrunner +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: "Steinar H. Gunderson" +CC: pgsql-performance@postgresql.org +Subject: Re: VACUUM vs. REINDEX +References: <6.2.3.0.2.20060707145857.0342ca58@mail.pandimensional.com> + + <6.2.3.0.2.20060707163917.06ae3ea8@mail.brownpapertickets.com> + + <6.2.3.0.2.20060707174316.0742f670@mail.brownpapertickets.com> + <1d219a6f0607071828q1d63fe55k8a1faeccf03b0884@mail.gmail.com> + <20060708081316.GB6396@uio.no> +In-Reply-To: <20060708081316.GB6396@uio.no> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/83 +X-Sequence-Number: 19943 + +Steinar H. Gunderson wrote: +> On Fri, Jul 07, 2006 at 09:28:52PM -0400, Chris Hoover wrote: +>> You need to increase your fsm settings. The database is telling you it is +>> trying to store 177K+ pages, but you have only provided it with 20K. Since +>> these pages are cheap, I would set your fsm up with at least the following. +> +> While we're at it, is there a good reason why we simply aren't upping the FSM +> defaults? It seems like a lot of people are being bitten by it, and adding +> more pages and relations is as you say cheap... + +that is already done in -HEAD at the initdb stage: + +... +selecting default shared_buffers/max_fsm_pages ... 4000/200000 +... + +Stefan + +From pgsql-performance-owner@postgresql.org Sun Jul 9 11:48:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3EB649FB1EC + for ; + Sun, 9 Jul 2006 11:48:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50448-04 for + ; + Sun, 9 Jul 2006 11:47:53 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wr-out-0506.google.com (wr-out-0506.google.com + [64.233.184.229]) + by postgresql.org (Postfix) with ESMTP id F25D69FA634 + for ; + Sun, 9 Jul 2006 11:47:53 -0300 (ADT) +Received: by wr-out-0506.google.com with SMTP id i12so1814023wra + for ; + Sun, 09 Jul 2006 07:47:52 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=Nj0ij6eYELslFCoNxhKSdg9YTZ1P0VOPO+tvOrsbC496tzrPhy354e6KiA/pU/IIr5x0loTyjikI0pJcjmDKxYuRpnAkxqCKnb8POmbN0g1nDB2QAdrUHh/a5He6zVZQB90yMJ4YiXNxs+fW5Bu7Bspy2ir+TrbE8Kc1q0bW9WA= +Received: by 10.65.53.12 with SMTP id f12mr3758736qbk; + Sun, 09 Jul 2006 07:47:52 -0700 (PDT) +Received: by 10.65.139.14 with HTTP; Sun, 9 Jul 2006 07:47:52 -0700 (PDT) +Message-ID: +Date: Sun, 9 Jul 2006 10:47:52 -0400 +From: "Merlin Moncure" +To: "andy rost" +Subject: Re: Opteron/FreeBSD/PostgreSQL performance poor +Cc: pgsql-performance@postgresql.org, Bill.Sites@noaa.gov, + jeff@frostconsultingllc.com +In-Reply-To: <44AECDFD.4030502@noaa.gov> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <44ABCFF4.3010007@noaa.gov> + + <44AECDFD.4030502@noaa.gov> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/84 +X-Sequence-Number: 19944 + +On 7/7/06, andy rost wrote: +> Hi Merlin, +> Thanks for the input. Please see below ... + +no problem! + +[aside: jeff, great advice on tps determination] + +> >> fsync = on # turns forced synchronization +> > have you tried turning this off and measuring performance? +> +> No, not yet. We're trying a couple of outher avenues before manipulating +> this parameter. + +ok. just keep in mind that keeping fsync on keeps an aboslute upper +limit on your tps that is largely driven by hardware. with a raid +controller write caching controller caching writes the penalty is +extremely low but without write caching you might get ~150 tps on a +relatively high end raid system. moreover, your disks are totally +utilized providing those 150 tps. (transactions with writing, that +is) + +symptoms of sync bottleneck are little/no cpu utilization, sustained +high iowait, and extremely poor performance and an unresponsive +server. the best solution to sync issues is to have a +hardware/software strategy designed to deal with it. + +if you are having periodic performance issues, you might be having +checkpoint storms. Thse are controllable by tuning the wal and +especially the bgwriter. These are easy to spot: you can do manual +checkpoints in psql and closely monitor the load. + +> We've reduced the load significantly primarily by moving pg_xlog to its +> own drive and by increasing the effective cache size. While we still see +> high load levels, they don't last very long. We're trying improve +> performance from several angles but are taking it one step at a time. +> Eventually we'll experiment with fsynch + +good! + +merlin + +From pgsql-performance-owner@postgresql.org Sun Jul 9 21:52:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 146EA9FA147 + for ; + Sun, 9 Jul 2006 21:52:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 54983-06 for + ; + Sun, 9 Jul 2006 21:52:44 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.178]) + by postgresql.org (Postfix) with ESMTP id 3C0BC9FB1E7 + for ; + Sun, 9 Jul 2006 21:52:43 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id d80so3690546pyd + for ; + Sun, 09 Jul 2006 17:52:42 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; + b=EO1fvzsOuhx4joOeQZhpPB/vnSYHYTqAW2s+MVLpGb4ny3oDsWnh1sSqdTeVcTmqP7/cMoXhCbMcCgumpzih/AFV7K9IQxkur5446y96kdmOmuLPMHobcDaPTwxlx5e1ez2KpotYdWXiJEv2ss6z8qU+qlm1fQL2WFQ5+TI5oAU= +Received: by 10.35.82.15 with SMTP id j15mr4523408pyl; + Sun, 09 Jul 2006 17:52:42 -0700 (PDT) +Received: by 10.35.40.18 with HTTP; Sun, 9 Jul 2006 17:52:42 -0700 (PDT) +Message-ID: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> +Date: Mon, 10 Jul 2006 10:52:42 +1000 +From: "Neil Hepworth" +To: pgsql-performance@postgresql.org +Subject: High CPU Usage - PostgreSQL 7.3 +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/85 +X-Sequence-Number: 19945 + +Hi, + +I am running PostgreSQL 7.3 on a Linux box (RHEL 2.1 - Xeon 2.8GHz +with 1GB of RAM) and seeing very high CPU usage (normally over 90%) +when I am running the following queries, and the queries take a long +time to return; over an hour! + +CREATE TEMPORARY TABLE fttemp1600384653 AS SELECT * FROM ftoneway LIMIT 0; + +INSERT INTO fttemp1600384653 SELECT epId, TO_TIMESTAMP(start, +'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, 60 AS consolidation, +SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND start < +TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +HH24:00:00.0')::timestamp; + +DELETE FROM ONLY ftone WHERE ftoneway.epId= fttemp1600384653.epId; + +The only changes I've made to the default postgresql.comf file are listed below: + +LC_MESSAGES = 'en_US' +LC_MONETARY = 'en_US' +LC_NUMERIC = 'en_US' +LC_TIME = 'en_US' +tcpip_socket = true +max_connections = 20 +effective_cache_size = 32768 +wal_buffers = 128 +fsync = false +shared_buffers = 3000 +max_fsm_relations = 10000 +max_fsm_pages = 100000 + +The tables are around a million rows but when when I run against +tables of a few hundred thousand rows it still takes tens of minutes +with high CPU. My database does have a lot of tables (can be several +thousand), can that cause performance issues? + +Thanks, + Neil + +From pgsql-performance-owner@postgresql.org Sun Jul 9 22:25:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 894439FB1EA + for ; + Sun, 9 Jul 2006 22:25:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 59244-04 for + ; + Sun, 9 Jul 2006 22:24:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp106.sbc.mail.re2.yahoo.com (smtp106.sbc.mail.re2.yahoo.com + [68.142.229.99]) by postgresql.org (Postfix) with SMTP id 622199FA25A + for ; + Sun, 9 Jul 2006 22:24:59 -0300 (ADT) +Received: (qmail 98024 invoked from network); 10 Jul 2006 01:24:57 -0000 +Received: from unknown (HELO discord.home.frostconsultingllc.com) + (jeffroe996@sbcglobal.net@69.226.248.120 with plain) + by smtp106.sbc.mail.re2.yahoo.com with SMTP; 10 Jul 2006 01:24:57 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.home.frostconsultingllc.com (8.13.6/8.13.6) with ESMTP id + k6A1Ovor009957; Sun, 9 Jul 2006 18:24:57 -0700 +Date: Sun, 9 Jul 2006 18:24:57 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.home.frostconsultingllc.com +To: Neil Hepworth +cc: pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> +Message-ID: + +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/86 +X-Sequence-Number: 19946 + +On Mon, 10 Jul 2006, Neil Hepworth wrote: + +> I am running PostgreSQL 7.3 on a Linux box (RHEL 2.1 - Xeon 2.8GHz +> with 1GB of RAM) and seeing very high CPU usage (normally over 90%) +> when I am running the following queries, and the queries take a long +> time to return; over an hour! + +First off, when is the last time you vacuum analyzed this DB and how often +does the vacuum analyze happen. Please post the EXPLAIN ANALYZE output for +each of the queries below. + +Also, I would strongly urge you to upgrade to a more recent version of +postgresql. We're currently up to 8.1.4 and it has tons of excellent +performance enhancements as well as helpful features such as integrated +autovacuum, point in time recovery backups, etc. + +Also, I see that you're running with fsync = false. That's quite dangerous +especially on a production system. + + +> +> CREATE TEMPORARY TABLE fttemp1600384653 AS SELECT * FROM ftoneway LIMIT 0; +> +> INSERT INTO fttemp1600384653 SELECT epId, TO_TIMESTAMP(start, +> 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, 60 AS consolidation, +> SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND start < +> TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +> HH24:00:00.0')::timestamp; +> +> DELETE FROM ONLY ftone WHERE ftoneway.epId= fttemp1600384653.epId; +> +> The only changes I've made to the default postgresql.comf file are listed +> below: +> +> LC_MESSAGES = 'en_US' +> LC_MONETARY = 'en_US' +> LC_NUMERIC = 'en_US' +> LC_TIME = 'en_US' +> tcpip_socket = true +> max_connections = 20 +> effective_cache_size = 32768 +> wal_buffers = 128 +> fsync = false +> shared_buffers = 3000 +> max_fsm_relations = 10000 +> max_fsm_pages = 100000 +> +> The tables are around a million rows but when when I run against +> tables of a few hundred thousand rows it still takes tens of minutes +> with high CPU. My database does have a lot of tables (can be several +> thousand), can that cause performance issues? +> +> Thanks, +> Neil +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> +> + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Mon Jul 10 04:55:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 428799FB256 + for ; + Mon, 10 Jul 2006 04:55:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 36178-05 for + ; + Mon, 10 Jul 2006 04:55:39 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.179]) + by postgresql.org (Postfix) with ESMTP id A4C889FB251 + for ; + Mon, 10 Jul 2006 04:55:39 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id d80so3774440pyd + for ; + Mon, 10 Jul 2006 00:55:38 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=oILrND9c6jlaeM8wzxtQN25ShioCLCTLKODW9Wei/b9gJA14W9Ik0jdl946uCz6J5LiZHP723CdPtldh0b9DQYq3j5VxuhJhfTQyWEVwi6j9ijTU8p0374tW3Oy1mZKzbCBrhcbH9+oFo0JQrssbbqk7tUGHHQB7Q1dDDhbqBcA= +Received: by 10.35.111.14 with SMTP id o14mr4754900pym; + Mon, 10 Jul 2006 00:55:38 -0700 (PDT) +Received: by 10.35.40.18 with HTTP; Mon, 10 Jul 2006 00:55:37 -0700 (PDT) +Message-ID: <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> +Date: Mon, 10 Jul 2006 17:55:38 +1000 +From: "Neil Hepworth" +To: "Jeff Frost" +Subject: Re: High CPU Usage - PostgreSQL 7.3 +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/87 +X-Sequence-Number: 19947 + +Thanks for the reply. + +The database is vacuum analysed regularly and during my testing I +tried running the vacuum analyse full immediately before the running +through the set of queries (which does help a bit - reduces the time +to about 80% but is is still over an hour, with basically 100% CPU). + +I'll get back to you with the full explain analyse output (I need to +re-create my test database back to its original state and that takes a +while) but I assume the part you're after is that all queries are +sequential scans, which I initially thought was the problem. But it +is my understanding that I cannot make them index scans because a +large percentage of the table is being returned by the query +(typically 30%) so the planner will favour a sequential scan over an +index scan for such a query, correct? If the queries had been disk +bound (due to retrieving large amounts of data) I would have +understood but I am confused as to why a sequential scan would cause +such high CPU and not high disk activity. + +Yes, I wish I could upgrade to the latest version of PostgreSQL but at +the moment my hands are tied due to dependencies on other applications +running on our server (obviously we need to update certain queries, +e.g. delete .. using.. and test with 8.1 first) - I will be pushing +for an upgrade as soon as possible. And the fsync=false is a +"compromise" to try to improve performance (moving to 8.1 would be +better compromise). + +Neil + + +On 10/07/06, Jeff Frost wrote: +> On Mon, 10 Jul 2006, Neil Hepworth wrote: +> +> > I am running PostgreSQL 7.3 on a Linux box (RHEL 2.1 - Xeon 2.8GHz +> > with 1GB of RAM) and seeing very high CPU usage (normally over 90%) +> > when I am running the following queries, and the queries take a long +> > time to return; over an hour! +> +> First off, when is the last time you vacuum analyzed this DB and how often +> does the vacuum analyze happen. Please post the EXPLAIN ANALYZE output for +> each of the queries below. +> +> Also, I would strongly urge you to upgrade to a more recent version of +> postgresql. We're currently up to 8.1.4 and it has tons of excellent +> performance enhancements as well as helpful features such as integrated +> autovacuum, point in time recovery backups, etc. +> +> Also, I see that you're running with fsync = false. That's quite dangerous +> especially on a production system. +> +> +> > +> > CREATE TEMPORARY TABLE fttemp1600384653 AS SELECT * FROM ftoneway LIMIT 0; +> > +> > INSERT INTO fttemp1600384653 SELECT epId, TO_TIMESTAMP(start, +> > 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, 60 AS consolidation, +> > SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND start < +> > TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +> > HH24:00:00.0')::timestamp; +> > +> > DELETE FROM ONLY ftone WHERE ftoneway.epId= fttemp1600384653.epId; +> > +> > The only changes I've made to the default postgresql.comf file are listed +> > below: +> > +> > LC_MESSAGES = 'en_US' +> > LC_MONETARY = 'en_US' +> > LC_NUMERIC = 'en_US' +> > LC_TIME = 'en_US' +> > tcpip_socket = true +> > max_connections = 20 +> > effective_cache_size = 32768 +> > wal_buffers = 128 +> > fsync = false +> > shared_buffers = 3000 +> > max_fsm_relations = 10000 +> > max_fsm_pages = 100000 +> > +> > The tables are around a million rows but when when I run against +> > tables of a few hundred thousand rows it still takes tens of minutes +> > with high CPU. My database does have a lot of tables (can be several +> > thousand), can that cause performance issues? +> > +> > Thanks, +> > Neil +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 3: Have you checked our extensive FAQ? +> > +> > http://www.postgresql.org/docs/faq +> > +> > +> +> -- +> Jeff Frost, Owner +> Frost Consulting, LLC http://www.frostconsultingllc.com/ +> Phone: 650-780-7908 FAX: 650-649-1954 +> + +From pgsql-performance-owner@postgresql.org Mon Jul 10 06:13:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 30ADB9FB29A + for ; + Mon, 10 Jul 2006 06:13:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 59181-01 for + ; + Mon, 10 Jul 2006 06:12:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.180]) + by postgresql.org (Postfix) with ESMTP id 64C0F9FB256 + for ; + Mon, 10 Jul 2006 06:12:56 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id d80so3794262pyd + for ; + Mon, 10 Jul 2006 02:12:51 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=jS4FUoF1peEz3ej24DsI+ahWgpI6pIfKDeFyLmbbmA0R+uvFflJyVrAzsLvoU6pmtC22W5btiH4tu5r0Y9sQ4Fas06BWatx3tQiRKrbMCK2J1OopqnWDCT2VNIBhKmOrbGo7K0qz7Ka9fW7r8pKjQru1daioWKzCfmBs6wjnGdM= +Received: by 10.35.101.9 with SMTP id d9mr4821579pym; + Mon, 10 Jul 2006 02:12:51 -0700 (PDT) +Received: by 10.35.40.18 with HTTP; Mon, 10 Jul 2006 02:12:51 -0700 (PDT) +Message-ID: <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> +Date: Mon, 10 Jul 2006 19:12:51 +1000 +From: "Neil Hepworth" +To: "Jeff Frost" , + pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/88 +X-Sequence-Number: 19948 + +I should also explain that I run through these queries on multiple +tables and with some slightly different parameters for the +"consolidation" so I run through those 3 queries (or similar) 9 times +and this takes a total of about 2 hours, with high CPU usage. And I +am running the queries from a remote Java application (using JDBC), +the client is using postgresql-8.0-311.jdbc3.jar. The explain analyse +results I have provided below are from running via pgAdmin, not the +Java app (I did a vacuum analyse of the db before running them): + + +*** For the create ***: + +-- Executing query: + +BEGIN; +EXPLAIN ANALYZE CREATE TABLE fttemp1643 AS SELECT * FROM ftone LIMIT 0; +; +ROLLBACK; + +ERROR: parser: parse error at or near "CREATE" at character 25 + +Now that surprised me! I hadn't done an explain on that query before +as it was so simple. Perhaps not permitted for creates? If I just +run the create: + +-- Executing query: +CREATE TABLE fttemp1643 AS SELECT * FROM ftone LIMIT 0; + + +Query returned successfully with no result in 48 ms. + + + +*** For the insert ***: + +Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) + -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +time=16861.72..34243.63 rows=560094 loops=1) + -> Group (cost=59690.11..61451.32 rows=234827 width=16) +(actual time=16861.62..20920.12 rows=709461 loops=1) + -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +(actual time=16861.62..18081.07 rows=709461 loops=1) + Sort Key: eppairdefnid, "start" + -> Seq Scan on ftone (cost=0.00..36446.66 +rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 loops=1) + Filter: ((consolidation = 60) AND ("start" < +(to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +Total runtime: 55378.68 msec + + +*** For the delete ***: + +Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +time=3767.47..3767.47 rows=0 loops=1) + Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) + -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +(actual time=0.04..2299.94 rows=1286333 loops=1) + -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +time=206.01..206.01 rows=0 loops=1) + -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +width=4) (actual time=206.00..206.00 rows=0 loops=1) +Total runtime: 3767.52 msec + + +Thanks, +Neil + +On 10/07/06, Neil Hepworth wrote: +> Thanks for the reply. +> +> The database is vacuum analysed regularly and during my testing I +> tried running the vacuum analyse full immediately before the running +> through the set of queries (which does help a bit - reduces the time +> to about 80% but is is still over an hour, with basically 100% CPU). +> +> I'll get back to you with the full explain analyse output (I need to +> re-create my test database back to its original state and that takes a +> while) but I assume the part you're after is that all queries are +> sequential scans, which I initially thought was the problem. But it +> is my understanding that I cannot make them index scans because a +> large percentage of the table is being returned by the query +> (typically 30%) so the planner will favour a sequential scan over an +> index scan for such a query, correct? If the queries had been disk +> bound (due to retrieving large amounts of data) I would have +> understood but I am confused as to why a sequential scan would cause +> such high CPU and not high disk activity. +> +> Yes, I wish I could upgrade to the latest version of PostgreSQL but at +> the moment my hands are tied due to dependencies on other applications +> running on our server (obviously we need to update certain queries, +> e.g. delete .. using.. and test with 8.1 first) - I will be pushing +> for an upgrade as soon as possible. And the fsync=false is a +> "compromise" to try to improve performance (moving to 8.1 would be +> better compromise). +> +> Neil +> +> +> On 10/07/06, Jeff Frost wrote: +> > On Mon, 10 Jul 2006, Neil Hepworth wrote: +> > +> > > I am running PostgreSQL 7.3 on a Linux box (RHEL 2.1 - Xeon 2.8GHz +> > > with 1GB of RAM) and seeing very high CPU usage (normally over 90%) +> > > when I am running the following queries, and the queries take a long +> > > time to return; over an hour! +> > +> > First off, when is the last time you vacuum analyzed this DB and how often +> > does the vacuum analyze happen. Please post the EXPLAIN ANALYZE output for +> > each of the queries below. +> > +> > Also, I would strongly urge you to upgrade to a more recent version of +> > postgresql. We're currently up to 8.1.4 and it has tons of excellent +> > performance enhancements as well as helpful features such as integrated +> > autovacuum, point in time recovery backups, etc. +> > +> > Also, I see that you're running with fsync = false. That's quite dangerous +> > especially on a production system. +> > +> > +> > > +> > > CREATE TEMPORARY TABLE fttemp1600384653 AS SELECT * FROM ftoneway LIMIT 0; +> > > +> > > INSERT INTO fttemp1600384653 SELECT epId, TO_TIMESTAMP(start, +> > > 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, 60 AS consolidation, +> > > SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND start < +> > > TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +> > > HH24:00:00.0')::timestamp; +> > > +> > > DELETE FROM ONLY ftone WHERE ftoneway.epId= fttemp1600384653.epId; +> > > +> > > The only changes I've made to the default postgresql.comf file are listed +> > > below: +> > > +> > > LC_MESSAGES = 'en_US' +> > > LC_MONETARY = 'en_US' +> > > LC_NUMERIC = 'en_US' +> > > LC_TIME = 'en_US' +> > > tcpip_socket = true +> > > max_connections = 20 +> > > effective_cache_size = 32768 +> > > wal_buffers = 128 +> > > fsync = false +> > > shared_buffers = 3000 +> > > max_fsm_relations = 10000 +> > > max_fsm_pages = 100000 +> > > +> > > The tables are around a million rows but when when I run against +> > > tables of a few hundred thousand rows it still takes tens of minutes +> > > with high CPU. My database does have a lot of tables (can be several +> > > thousand), can that cause performance issues? +> > > +> > > Thanks, +> > > Neil +> > > +> > > ---------------------------(end of broadcast)--------------------------- +> > > TIP 3: Have you checked our extensive FAQ? +> > > +> > > http://www.postgresql.org/docs/faq +> > > +> > > +> > +> > -- +> > Jeff Frost, Owner +> > Frost Consulting, LLC http://www.frostconsultingllc.com/ +> > Phone: 650-780-7908 FAX: 650-649-1954 +> > +> + +From pgsql-performance-owner@postgresql.org Mon Jul 10 11:52:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7C3739FB253 + for ; + Mon, 10 Jul 2006 11:52:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 80149-08 for + ; + Mon, 10 Jul 2006 11:52:20 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by postgresql.org (Postfix) with ESMTP id 1ADF09FB24A + for ; + Mon, 10 Jul 2006 11:52:20 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id 2B4BBB826; + Mon, 10 Jul 2006 10:52:19 -0400 (EDT) +In-Reply-To: <20060705234617.GB2367@juniper.net> +References: <20060705234617.GB2367@juniper.net> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-5-289762944; + protocol="application/pkcs7-signature" +Message-Id: +Cc: pgsql-performance@postgresql.org +From: Vivek Khera +Subject: Re: suggested RAID controller for FreeBSD 6.1 + PostgreSQL 8.1 +Date: Mon, 10 Jul 2006 10:52:18 -0400 +To: Kenji Morishige +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/89 +X-Sequence-Number: 19949 + + +--Apple-Mail-5-289762944 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jul 5, 2006, at 7:46 PM, Kenji Morishige wrote: + +> like to know what an ideal RAID controller that would be compatible +> with +> FreeBSD 6.1 would be these days. + +LSI MegaRAID 320-2X and put half disks on one channel, half on the +other, and MIRROR+STRIPE them (ie, RAID10). + +There is nothing faster for FreeBSD 6. + +Just make sure you don't buy a Sun Fire X4100 to put it in, as it +will not fit :-( + + +--Apple-Mail-5-289762944 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGlDCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPSAR/ +p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/AgEAMEMGA1UdHwQ8MDow +OKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25hbEZyZWVtYWlsQ0EuY3Js +MAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJpdmF0ZUxhYmVsMi0xMzgw +DQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOWlJ1/TCG4+DYfqi2fNi/A +9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amcOY6MIE9lX5Xa9/eH1sYI +Tq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8wggNNMIICtqADAgECAhA6sDoA4m3lcimf +yUtGSQgmMA0GCSqGSIb3DQEBBAUAMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29u +c3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNz +dWluZyBDQTAeFw0wNjA1MDIxNDEyNDdaFw0wNzA1MDIxNDEyNDdaMIGKMR8wHQYDVQQDExZUaGF3 +dGUgRnJlZW1haWwgTWVtYmVyMR4wHAYJKoZIhvcNAQkBFg92aXZla0BraGVyYS5vcmcxIDAeBgkq +hkiG9w0BCQEWEWtoZXJhQGtjaWxpbmsuY29tMSUwIwYJKoZIhvcNAQkBFhZ2aXZla0BtYWlsZXJt +YWlsZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq+zHKYq9vZ4Dq1itNqT/ +OeJvWDvQ5JdQlRzwsJlvtJBknXsnOaJNabmjnu2s6XFMcP2srBZQ/WPvhsClajLQOcxnarrfB66N +DpMzXTxfYzX6m9TA/fEn64sNn+YnBZL6Dvid9kiAgP9LmqcTOIFdWUya3ZmQS5YTuLB+tkFSL8/h ++inDPN6dcsna8TcM1SAk+3upxOR7kyFM9T3vy25w62Nh1zK7Stp0vUZLU6GzzC1VvHGZHKGticD6 +o3uHaMr2LCFjptoIcfZL75LO/UaR9o7smgboW4yJyW5g9ZasyYQUXyvkitfyZuVWATb8ZSHOkjWJ +872Pyf5+HOevVUI0aQIDAQABo1cwVTBFBgNVHREEPjA8gQ92aXZla0BraGVyYS5vcmeBEWtoZXJh +QGtjaWxpbmsuY29tgRZ2aXZla0BtYWlsZXJtYWlsZXIuY29tMAwGA1UdEwEB/wQCMAAwDQYJKoZI +hvcNAQEEBQADgYEAYpaFKDj47pTQIUQi28MgtjKophopv4QJjvspXmy0qxd8t/M/zc7HuBy3i/9a +PrXDgKyNBzzlFTasTazAY53ntVpqw9k1NOeHmH6o3j/DBVa49bC6bbWfp9UGOwYChlDR0tngQZyC +MDMZEdYv4zpGfBTku5m1jb8Yz/qYqV4FWB4xggMQMIIDDAIBATB2MGIxCzAJBgNVBAYTAlpBMSUw +IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy +c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQOrA6AOJt5XIpn8lLRkkIJjAJBgUrDgMCGgUAoIIB +bzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjA3MTAxNDUyMTha +MCMGCSqGSIb3DQEJBDEWBBRFUuRLJKkMw2mju5BcTK1H8+6o9jCBhQYJKwYBBAGCNxAEMXgwdjBi +MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoG +A1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJ +CCYwgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENv +bnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElz +c3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJCCYwDQYJKoZIhvcNAQEBBQAEggEAoYU3x/wCi+Mjo/Z7 +5nM6zJmJwLApQhrG7oC/oHJ6Lbx+KK3IVZ5mTsTKOrY1at6C/SkgGhMNJV8uqeGyURUHI/IAFEB2 +eul5QSqWeJFQVLXhZIKdtvVMITeWTteX5+fNj+CB+smeAqWwHsX1DhDjM927d2ZdONHjXtq6GX6W +WjF0ui3Lfxt9r6Sc6lwi+4koNG14jn9zVa8cArk0HTnOzDcMcMpVQDdxX6OKABEvRliOYeyQjRm3 +lAo1e6ax9UOCmLvf4iUc3URqaMKBYbpox5bzIxY44AgQQIUSHLM5chgwZzlWnKVSZMaBQ/LuCxA0 +wjtaEZ3x6oiya2fukWyKbQAAAAAAAA== + +--Apple-Mail-5-289762944-- + +From pgsql-performance-owner@postgresql.org Mon Jul 10 12:27:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 373189FB267 + for ; + Mon, 10 Jul 2006 12:27:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88514-07 for + ; + Mon, 10 Jul 2006 12:26:53 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp111.sbc.mail.mud.yahoo.com (smtp111.sbc.mail.mud.yahoo.com + [68.142.198.210]) + by postgresql.org (Postfix) with SMTP id AC6BF9FB253 + for ; + Mon, 10 Jul 2006 12:26:53 -0300 (ADT) +Received: (qmail 61557 invoked from network); 10 Jul 2006 15:26:52 -0000 +Received: from unknown (HELO discord.home.frostconsultingllc.com) + (jeffroe996@sbcglobal.net@69.226.248.120 with plain) + by smtp111.sbc.mail.mud.yahoo.com with SMTP; 10 Jul 2006 15:26:52 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.home.frostconsultingllc.com (8.13.6/8.13.6) with ESMTP id + k6AFQpcE020850; Mon, 10 Jul 2006 08:26:51 -0700 +Date: Mon, 10 Jul 2006 08:26:51 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.home.frostconsultingllc.com +To: Neil Hepworth +cc: pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> +Message-ID: + +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/90 +X-Sequence-Number: 19950 + + + +On Mon, 10 Jul 2006, Neil Hepworth wrote: + +> I should also explain that I run through these queries on multiple +> tables and with some slightly different parameters for the +> "consolidation" so I run through those 3 queries (or similar) 9 times +> and this takes a total of about 2 hours, with high CPU usage. And I +> am running the queries from a remote Java application (using JDBC), +> the client is using postgresql-8.0-311.jdbc3.jar. The explain analyse +> results I have provided below are from running via pgAdmin, not the +> Java app (I did a vacuum analyse of the db before running them): +> +> + +Neil, did you ever answer which version of 7.3 this is? + +BTW, you mentioned that this takes 2 hours, but even looping over this 9 times +seems like it would only take 9 minutes (55 seconds for the SELECT and 4 +seconds for the DELETE = 59 seconds times 9). Perhaps you should post the +explain analyze for the actual query that takes so long as the planner output +will likely be quite different. + +One thing I noticed is that the planner seems quite incorrect about the number +of rows it expects in the SELECT. If you ran vacuum analyze before this, +perhaps your fsm settings are incorrect? What does vacuumdb -a -v output at +the end? I'm looking for something that looks like this: + +INFO: free space map: 109 relations, 204 pages stored; 1792 total pages +needed +DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared +memory. + +I see your fsm settings are non-default, so it's also possible I'm not used to +reading 7.3's explain analyze output. :-) + +Also, what does vmstat output look like while the query is running? Perhaps +you're running into some context switching problems. It would be interesting +to know how the query runs on 8.1.x just to know if we're chasing an +optimization that's fixed already in a later version. + + +> Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +> width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) +> -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +> time=16861.72..34243.63 rows=560094 loops=1) +> -> Group (cost=59690.11..61451.32 rows=234827 width=16) +> (actual time=16861.62..20920.12 rows=709461 loops=1) +> -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +> (actual time=16861.62..18081.07 rows=709461 loops=1) +> Sort Key: eppairdefnid, "start" +> -> Seq Scan on ftone (cost=0.00..36446.66 +> rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 loops=1) +> Filter: ((consolidation = 60) AND ("start" < +> (to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +> 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +> Total runtime: 55378.68 msec + +> *** For the delete ***: +> +> Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +> time=3767.47..3767.47 rows=0 loops=1) +> Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +> -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +> (actual time=0.04..2299.94 rows=1286333 loops=1) +> -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +> time=206.01..206.01 rows=0 loops=1) +> -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +> width=4) (actual time=206.00..206.00 rows=0 loops=1) +> Total runtime: 3767.52 msec + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Mon Jul 10 13:04:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B1B9E9FB2F6 + for ; + Mon, 10 Jul 2006 13:04:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 96065-03 for + ; + Mon, 10 Jul 2006 13:04:19 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 2197C9FB2E2 + for ; + Mon, 10 Jul 2006 13:04:18 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Mon, 10 Jul 2006 16:04:18 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 10 Jul 2006 11:04:18 -0500 +Subject: Re: High CPU Usage - PostgreSQL 7.3 +From: Scott Marlowe +To: Neil Hepworth +Cc: pgsql-performance@postgresql.org +In-Reply-To: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1152547458.6540.6.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Mon, 10 Jul 2006 11:04:18 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/91 +X-Sequence-Number: 19951 + +On Sun, 2006-07-09 at 19:52, Neil Hepworth wrote: +> Hi, +> +> I am running PostgreSQL 7.3 on a Linux box (RHEL 2.1 - Xeon 2.8GHz +> with 1GB of RAM) and seeing very high CPU usage (normally over 90%) +> when I am running the following queries, and the queries take a long +> time to return; over an hour! +> +> CREATE TEMPORARY TABLE fttemp1600384653 AS SELECT * FROM ftoneway LIMIT 0; +> +> INSERT INTO fttemp1600384653 SELECT epId, TO_TIMESTAMP(start, +> 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, 60 AS consolidation, +> SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND start < +> TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +> HH24:00:00.0')::timestamp; + +I don't need to see an explain analyze to make a guess here... + +start < TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +HH24:00:00.0')::timestamp + +is gonna be a problem because while you and I know that to_timestamp... +is gonna be a constant, pg 7.3 doesn't. I've run into this before. + +Just run a query ahead of time with a simple: + +select TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD +HH24:00:00.0')::timestamp as starttime + +and then pull that out and stick it into your query. do the same for +any other parts of the query like that. + +That's assuming the issue here is that you're getting seq scans cause of +that part of the query. + +From pgsql-performance-owner@postgresql.org Tue Jul 11 03:51:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4C9E59FB27E + for ; + Tue, 11 Jul 2006 03:51:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 91869-04 for + ; + Tue, 11 Jul 2006 03:51:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 4AD109FB26C + for ; + Tue, 11 Jul 2006 03:51:28 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6B76gX1031881 + for ; Tue, 11 Jul 2006 00:06:42 -0700 +Message-ID: <44B33C30.2070209@modgraph-usa.com> +Date: Mon, 10 Jul 2006 22:50:40 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Kill a session +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/92 +X-Sequence-Number: 19952 + +There have been dozens, perhaps hundreds, of entries in the pg-admin, pg-general, and pg-performance lists regarding killing a session, but as far as I can tell, there is no Postgres solution. Did I miss something? + +This raises the question: Why doesn't Postgres have a "kill session" command that works? Oracle has it, and it's invaluable; there is no substitute. Various writers to these PG lists have raised the question repeatedly. Is it just a matter that nobody has had the time to do it (which I respect!), or is there a reason why the Postgres team decided a "kill session" is a bad idea? + +The rest of this email is just to illustrate the convoluted solution I've had to adopt, and even with this, I can't get it to work quite right. + +Background: In our web app, we give our users a fair amount of power to formulate difficult queries. These long-running queries are fork/exec'd from the Apache CGI, and we give the user a "job status" page, with the option to kill the job. + +I can kill off the CGI, since Apache owns the process. But the "stock answer" of + + kill -2 backend-pid + +won't work, because I don't want my Apache jobs running as super-user (!) or as setuid processes. + +So here's my solution: Install a couple of C extensions like this: + + Datum get_session_id(PG_FUNCTION_ARGS) + { + PG_RETURN_INT32(getpid()); + } + + Datum kill_session(PG_FUNCTION_ARGS) + { + int4 session_id, status; + session_id = PG_GETARG_INT32(0); + fprintf(stderr, "KILLING SESSION: %d, 15\n", session_id); + status = kill(session_id, 15); + PG_RETURN_BOOL((status == 0) ? true : false); + } + +These are installed with the appropriate "CREATE OR REPLACE ..." sql. Although this is dangerous (anyone who can log in to Postgres can kill any Postgres job!), its safe enough in a controlled enviroment. It allows an Apache CGI to issue the kill(2) command through the Postgres backend, which is running as the Postgres user, and thus has permission to do the deed. When I start a job, I record the backend's PID, which allows another process to connect and kill the first one. Alright, it's a hack, but it's the best I could think of. + +But in spite earlier posting in these forums that say the killing the backend was the way to go, this doesn't really work. First, even though the "postgres" backend job is properly killed, a "postmaster" job keeps running at 99% CPU, which is pretty useless. Killing the client's backend didn't kill the process actually doing the work! + +Second, the "KILLING SESSION" message to stderr is only printed in the PG log file sporadically. This confuses me, since the "KILLING SESSION" is printed by a *different* process than the one being killed, so it shouldn't be affected. So what happens to fprintf()'s output? Most of the time, I just get "unexpected EOF on client connection" in the log which is presumably the postmaster complaining that the postgres child process died. + +I know the kill_session() is working because it returns "true", and the job is in fact killed. But the query keeps running in postmaster (or is it something else, like a rollback?), and the stderr output disappears. + +Thanks, +Craig + +From pgsql-performance-owner@postgresql.org Tue Jul 11 04:39:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6DA899FB281 + for ; + Tue, 11 Jul 2006 04:39:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99356-02-2 + for ; + Tue, 11 Jul 2006 04:39:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) + by postgresql.org (Postfix) with ESMTP id 0D2639FB278 + for ; + Tue, 11 Jul 2006 04:39:46 -0300 (ADT) +Received: from [10.100.1.52] (074-016-066-080.eggenet.de [80.66.16.74]) + by service-web.de (Postfix) with ESMTP id 9334D20002D; + Tue, 11 Jul 2006 09:39:43 +0200 (CEST) +Message-ID: <44B355BC.3040907@wildenhain.de> +Date: Tue, 11 Jul 2006 09:39:40 +0200 +From: Tino Wildenhain +User-Agent: Thunderbird 1.5.0.4 (X11/20060619) +MIME-Version: 1.0 +To: "Craig A. James" +Cc: pgsql-performance@postgresql.org +Subject: Re: Kill a session +References: <44B33C30.2070209@modgraph-usa.com> +In-Reply-To: <44B33C30.2070209@modgraph-usa.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/93 +X-Sequence-Number: 19953 + +Craig A. James wrote: +> There have been dozens, perhaps hundreds, of entries in the pg-admin, +> pg-general, and pg-performance lists regarding killing a session, but as +> far as I can tell, there is no Postgres solution. Did I miss something? +> +> This raises the question: Why doesn't Postgres have a "kill session" +> command that works? Oracle has it, and it's invaluable; there is no +> substitute. Various writers to these PG lists have raised the question +> repeatedly. Is it just a matter that nobody has had the time to do it +> (which I respect!), or is there a reason why the Postgres team decided a +> "kill session" is a bad idea? + +You are sure you read: + + +http://www.postgresql.org/docs/8.1/interactive/protocol-flow.html#AEN60635 + +? + + +Regards +Tino Wildenhain + +From pgsql-performance-owner@postgresql.org Tue Jul 11 08:39:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 958FA9FB2D0 + for ; + Tue, 11 Jul 2006 08:39:19 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 31057-10 for + ; + Tue, 11 Jul 2006 08:39:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) + by postgresql.org (Postfix) with ESMTP id 089919FB2CA + for ; + Tue, 11 Jul 2006 08:39:07 -0300 (ADT) +Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) + by mx-2.sollentuna.net (Postfix) with ESMTP + id 27BD9F405B; Tue, 11 Jul 2006 13:39:06 +0200 (CEST) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Subject: Re: Kill a session +Date: Tue, 11 Jul 2006 13:39:07 +0200 +Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> +In-Reply-To: <44B33C30.2070209@modgraph-usa.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Kill a session +thread-index: Acakt/5c83NFqghNQsCszA3MiMm3BwAJhfVA +From: "Magnus Hagander" +To: "Craig A. James" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/94 +X-Sequence-Number: 19954 + +> There have been dozens, perhaps hundreds, of entries in the=20 +> pg-admin, pg-general, and pg-performance lists regarding=20 +> killing a session, but as far as I can tell, there is no=20 +> Postgres solution. Did I miss something? +>=20 +> This raises the question: Why doesn't Postgres have a "kill=20 +> session" command that works? Oracle has it, and it's=20 +> invaluable; there is no substitute. Various writers to these=20 +> PG lists have raised the question repeatedly. Is it just a=20 +> matter that nobody has had the time to do it (which I=20 +> respect!), or is there a reason why the Postgres team decided=20 +> a "kill session" is a bad idea? + +[snip] + +I beleive the function to kill a backend is actually in the codebase, +it's just commented out because it's considered dangerous. There are +some possible issues (see -hackers archives) about sending SIGTERM +without actually shutting down the whole cluster. + +Doing the client-side function to call is the easy part. + +In many cases you just need to cancel a query, in which case you can use +pg_cancel_backend() for exmaple. If you need to actually kill it, your +only supported way is to restart postgresql.=20 + +> But in spite earlier posting in these forums that say the=20 +> killing the backend was the way to go, this doesn't really=20 +> work. First, even though the "postgres" backend job is=20 +> properly killed, a "postmaster" job keeps running at 99% CPU,=20 +> which is pretty useless. Killing the client's backend didn't=20 +> kill the process actually doing the work! + +Then you killed the wrong backend... + + +> Second, the "KILLING SESSION" message to stderr is only=20 +> printed in the PG log file sporadically. This confuses me,=20 +> since the "KILLING SESSION" is printed by a *different*=20 +> process than the one being killed, so it shouldn't be=20 +> affected. So what happens to fprintf()'s output? Most of=20 +> the time, I just get "unexpected EOF on client connection" in=20 +> the log which is presumably the postmaster complaining that=20 +> the postgres child process died. + +No, that's the postgres chlid process complaining that your client +(CGI?) died without sending a close message. + + +> I know the kill_session() is working because it returns=20 +> "true", and the job is in fact killed. But the query keeps=20 +> running in postmaster (or is it something else, like a=20 +> rollback?), and the stderr output disappears. + +No queries run in postmaster. They all run in postgres backends. The +postmaster does very little actual work, other than keeping track of +everybody else. + +//Magnus + +From pgsql-performance-owner@postgresql.org Tue Jul 11 19:57:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 966C39FB360 + for ; + Tue, 11 Jul 2006 17:43:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23439-05-2 + for ; + Tue, 11 Jul 2006 17:42:57 -0300 (ADT) +X-Greylist: delayed 00:24:28.880486 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 410039FB1E0 + for ; + Tue, 11 Jul 2006 17:42:54 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp9.clb.oleane.net (smtp9.clb.oleane.net [213.56.31.31]) + by svr4.postgresql.org (Postfix) with ESMTP id 6EB725AF06A + for ; + Tue, 11 Jul 2006 20:18:22 +0000 (GMT) +Received: from oleane.com (cust1.clb.oleane.net [213.56.26.161]) + (authenticated) by smtp9.clb.oleane.net with ESMTP id k6BKIIi4012971 + for ; Tue, 11 Jul 2006 22:18:18 +0200 +Date: Tue, 11 Jul 2006 22:18:19 +0200 +Message-Id: +Subject: =?iso-8859-1?Q?Unsubscribe?= +MIME-Version: 1.0 +X-Sensitivity: 3 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable +From: "Jghaffou" +To: "=?iso-8859-1?Q?pgsql-performance?=" +X-XaM3-API-Version: 3.2 R32 (B53pl7) +X-type: 0 +X-SenderIP: 82.231.148.216 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.135 tagged_above=0 required=5 tests=BAYES_80, + FORGED_RCVD_HELO, SUBJECT_EXCESS_QP +X-Spam-Level: ** +X-Archive-Number: 200607/95 +X-Sequence-Number: 19955 + +Best regards,=0D=0AJamal + + +From pgsql-performance-owner@postgresql.org Tue Jul 11 22:33:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1969E9FB200 + for ; + Tue, 11 Jul 2006 22:32:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 91724-09 for + ; + Tue, 11 Jul 2006 22:32:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 4FE189FA5CD + for ; + Tue, 11 Jul 2006 22:32:22 -0300 (ADT) +Received: (qmail 8830 invoked by uid 500); 12 Jul 2006 01:37:21 -0000 +Date: Tue, 11 Jul 2006 20:37:21 -0500 +From: Bruno Wolff III +To: Neil Hepworth +Cc: Jeff Frost , pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +Message-ID: <20060712013721.GA8481@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Neil Hepworth , + Jeff Frost , + pgsql-performance@postgresql.org +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/96 +X-Sequence-Number: 19956 + +On Mon, Jul 10, 2006 at 17:55:38 +1000, + Neil Hepworth wrote: +> +> running on our server (obviously we need to update certain queries, +> e.g. delete .. using.. and test with 8.1 first) - I will be pushing +> for an upgrade as soon as possible. And the fsync=false is a + +You can set add_missing_from if you want to delay rewriting queries that +use that feature. + +From pgsql-performance-owner@postgresql.org Wed Jul 12 00:11:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7359B9FB1BB + for ; + Wed, 12 Jul 2006 00:11:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27983-02 for + ; + Wed, 12 Jul 2006 00:10:51 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.177]) + by postgresql.org (Postfix) with ESMTP id 3A3F09FB1DB + for ; + Wed, 12 Jul 2006 00:10:51 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id s49so36572pyc + for ; + Tue, 11 Jul 2006 20:10:50 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; + b=WHa4GINbxJF+i/emOIRGDngLcMkQ7tKAK6eAXvcbvfijK9K/QLan32ePqR7CT2A6XUSfctU3b2NU+VPVijo+jMsS/No3Ybh1PMNgdZEvGAIceZQO2hIPZeSSBlpEB/kTF5YpNK6uSDT5GwGjs6DK27Om1jpNaDju4qWNgUfyp3M= +Received: by 10.35.91.10 with SMTP id t10mr350776pyl; + Tue, 11 Jul 2006 20:10:50 -0700 (PDT) +Received: by 10.35.40.18 with HTTP; Tue, 11 Jul 2006 20:10:50 -0700 (PDT) +Message-ID: <5a6f767a0607112010l4ee952e8vadade17f62f5cddd@mail.gmail.com> +Date: Wed, 12 Jul 2006 13:10:50 +1000 +From: "Neil Hepworth" +To: "Bruno Wolff III" , pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <20060712013721.GA8481@wolff.to> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_3375_29438370.1152673850448" +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <20060712013721.GA8481@wolff.to> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/97 +X-Sequence-Number: 19957 + +------=_Part_3375_29438370.1152673850448 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Thanks for the tip; I'll try that when we initially upgrade, hopefully soon. + +Neil + + +On 12/07/06, Bruno Wolff III wrote: +> +> On Mon, Jul 10, 2006 at 17:55:38 +1000, +> Neil Hepworth wrote: +> > +> > running on our server (obviously we need to update certain queries, +> > e.g. delete .. using.. and test with 8.1 first) - I will be pushing +> > for an upgrade as soon as possible. And the fsync=false is a +> +> You can set add_missing_from if you want to delay rewriting queries that +> use that feature. +> + +------=_Part_3375_29438370.1152673850448 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
Thanks for the tip; I'll try that when we initially upgrade, hopefully soon.
+
 
+
Neil

 
+
On 12/07/06, Bruno Wolff III <bruno@wolff.to> wrote: +
On Mon, Jul 10, 2006 at 17:55:38 +1000,
Neil Hepworth <nhepworth@gmail.com +> wrote:
>
> running on our server (obviously we need to update certain queries,
> e.g. delete .. using.. and test with 8.1 first) - I will be pushing
> for an upgrade as soon as possible.  And the fsync=false is a +

You can set add_missing_from if you want to delay rewriting queries that
use that feature.

+ +------=_Part_3375_29438370.1152673850448-- + +From pgsql-performance-owner@postgresql.org Wed Jul 12 00:28:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E97369FB1D4 + for ; + Wed, 12 Jul 2006 00:27:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30636-07 for + ; + Wed, 12 Jul 2006 00:27:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp107.sbc.mail.mud.yahoo.com (smtp107.sbc.mail.mud.yahoo.com + [68.142.198.206]) + by postgresql.org (Postfix) with SMTP id 251529FB1BE + for ; + Wed, 12 Jul 2006 00:27:46 -0300 (ADT) +Received: (qmail 66202 invoked from network); 12 Jul 2006 03:27:45 -0000 +Received: from unknown (HELO discord.home.frostconsultingllc.com) + (jeffroe996@sbcglobal.net@69.226.248.120 with plain) + by smtp107.sbc.mail.mud.yahoo.com with SMTP; 12 Jul 2006 03:27:44 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.home.frostconsultingllc.com (8.13.6/8.13.6) with ESMTP id + k6C3RhwA016801; Tue, 11 Jul 2006 20:27:43 -0700 +Date: Tue, 11 Jul 2006 20:27:43 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.home.frostconsultingllc.com +To: Neil Hepworth +cc: pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <5a6f767a0607112008m696a326bwe6425edf0455e390@mail.gmail.com> +Message-ID: + +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> + + <5a6f767a0607112008m696a326bwe6425edf0455e390@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/98 +X-Sequence-Number: 19958 + +On Wed, 12 Jul 2006, Neil Hepworth wrote: + +> I am using version PostgreSQL 7.3.10 (RPM: +> postgresql73-rhel21-7.3.10-2). Unfortunately vacuumdb -a -v does not +> give the FSM info at the end (need a newer version of postgres for +> that). Running the same queries on 8.1 reduces the time taken to +> about 16 minutes, though I didn't run the test on the same hardware or +> OS as I want to keep my test server as close to production as +> possible, so I ran the 8.1 server on my Windows laptop (2GHz Centrino +> Duo with 2GB of RAM, yes the laptop is brand new :). + +Well, looks like you're at least fairly up to date, but there is a fix in +7.3.11 that you might want to get by upgrading to 7.3.15: + + * Fix race condition in transaction log management + There was a narrow window in which an I/O operation could be + initiated for the wrong page, leading to an Assert failure or data + corruption. + +It also appears that you can run autovacuum with 7.3 (I thought maybe it only +went back as far as 7.4). + +So, is the 16 minutes on your laptop with 8.1 for windows vs 1hr on the server +for the whole set of loops? If so, 4x isn't a bad improvement. :-) So, +assuming you dumped/loaded the same DB onto your laptop's postgresql server, +what does the vacuumdb -a -v say on the laptop? Perhaps we can use it to see +if your fsm settings are ok. + +BTW, did you see Scott's posting here: + +http://archives.postgresql.org/pgsql-performance/2006-07/msg00091.php + +Since we didn't hear from you for a while, I thought perhaps Scott had hit on +the fix. Have you tried that yet? It certainly would help the planner out. + +You might also want to turn on autovacuum and see if that helps. + +What's your disk subsystem like? In fact, what's the entire DB server +hardware like? + +> +> I run through a loop, executing the following or similar queries 8 +> times (well actually 12 but the last 4 don't do anything) - Jeff I've +> attached complete outputs as files. +> +> A debug output further below (numbers after each method call name, +> above each SQL statement, are times to run that statement in +> milliseconds, the times on the lines "" are cumulative). So total for +> one loop is 515 seconds, multiple by 8 and that gets me to over an +> hour); it is actually the deletes that take the most time; 179 seconds +> and 185 seconds each loop. +> +> ---------------------------------------------------- +> +> CREATE TABLE fttemp670743219 AS SELECT * FROM ftone LIMIT 0 +> INSERT INTO fttemp670743219 ( epId, start, direction, classid, +> consolidation, cnt ) SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD +> HH24:00:00.0')::timestamp AS start, direction, classid, 60 AS +> consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND +> start < TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', 'YYYY-MM-DD +> HH24:00:00.0')::timestamp GROUP BY epId, direction, +> TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, classid +> DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND +> ftone.direction = fttemp670743219.direction AND ftone.start = +> fttemp670743219.start AND ftone.consolidation = +> fttemp670743219.consolidation AND ftone.classid = +> fttemp670743219.classid +> INSERT INTO ftone ( epId, start, consolidation, direction, classid, +> cnt ) SELECT epId, start, consolidation, direction, classid, cnt FROM +> fttemp670743219 +> DROP TABLE fttemp670743219 +> DELETE FROM ftone WHERE consolidation = 0 AND start < +> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', +> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +> 'YYYY-MM-DD 00:00:00.0')::timestamp +> +> ---------------------------------------------------- +> +> ftone: 0: +> createConsolidatedInTemporary: 188: +> CREATE TABLE fttemp678233382 AS SELECT * FROM ftone LIMIT 0 +> createConsolidatedInTemporary: 76783: +> INSERT INTO fttemp678233382 ( epPairdefnid, start, direction, classid, +> consolidation, cnt ) SELECT epPairdefnid, TO_TIMESTAMP(start, +> 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, direction, classid, 60 +> AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 +> AND start < TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +> 'YYYY-MM-DD HH24:00:00.0')::timestamp GROUP BY epPairdefnid, +> direction, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, +> classid +> replaceConsolidatedInMainTable: 179178: +> DELETE FROM ONLY ftone WHERE ftone.epPairdefnid = +> fttemp678233382.epPairdefnid AND ftone.direction = +> fttemp678233382.direction AND ftone.start = fttemp678233382.start AND +> ftone.consolidation = fttemp678233382.consolidation AND ftone.classid +> = fttemp678233382.classid +> replaceConsolidatedInMainTable: 61705: +> INSERT INTO ftone ( epPairdefnid, start, consolidation, direction, +> classid, cnt ) SELECT epPairdefnid, start, consolidation, direction, +> classid, cnt FROM fttemp678233382 +> consolidate: 2656: +> DROP TABLE fttemp678233382 +> MAIN LOOP TOTAL consolidate: 320526 +> deleteOlderThan: 184616: +> DELETE FROM ftone WHERE consolidation = 0 AND start < +> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +> 'YYYY-MM-DD 00:00:00.0')::timestamp +> MAIN LOOP TOTAL deleteExpiredData: 505142 +> MAIN LOOP TOTAL generateStatistics: 515611 +> +> ---------------------------------------------------- +> +> Thanks again, +> Neil +> +> +> On 11/07/06, Jeff Frost wrote: +>> +>> +>> On Mon, 10 Jul 2006, Neil Hepworth wrote: +>> +>> > I should also explain that I run through these queries on multiple +>> > tables and with some slightly different parameters for the +>> > "consolidation" so I run through those 3 queries (or similar) 9 times +>> > and this takes a total of about 2 hours, with high CPU usage. And I +>> > am running the queries from a remote Java application (using JDBC), +>> > the client is using postgresql-8.0-311.jdbc3.jar. The explain analyse +>> > results I have provided below are from running via pgAdmin, not the +>> > Java app (I did a vacuum analyse of the db before running them): +>> > +>> > +>> +>> Neil, did you ever answer which version of 7.3 this is? +>> +>> BTW, you mentioned that this takes 2 hours, but even looping over this 9 +>> times +>> seems like it would only take 9 minutes (55 seconds for the SELECT and 4 +>> seconds for the DELETE = 59 seconds times 9). Perhaps you should post the +>> explain analyze for the actual query that takes so long as the planner +>> output +>> will likely be quite different. +>> +>> One thing I noticed is that the planner seems quite incorrect about the +>> number +>> of rows it expects in the SELECT. If you ran vacuum analyze before this, +>> perhaps your fsm settings are incorrect? What does vacuumdb -a -v output +>> at +>> the end? I'm looking for something that looks like this: +>> +>> INFO: free space map: 109 relations, 204 pages stored; 1792 total pages +>> needed +>> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared +>> memory. +>> +>> I see your fsm settings are non-default, so it's also possible I'm not used +>> to +>> reading 7.3's explain analyze output. :-) +>> +>> Also, what does vmstat output look like while the query is running? +>> Perhaps +>> you're running into some context switching problems. It would be +>> interesting +>> to know how the query runs on 8.1.x just to know if we're chasing an +>> optimization that's fixed already in a later version. +>> +>> +>> > Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +>> > width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) +>> > -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +>> > time=16861.72..34243.63 rows=560094 loops=1) +>> > -> Group (cost=59690.11..61451.32 rows=234827 width=16) +>> > (actual time=16861.62..20920.12 rows=709461 loops=1) +>> > -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +>> > (actual time=16861.62..18081.07 rows=709461 loops=1) +>> > Sort Key: eppairdefnid, "start" +>> > -> Seq Scan on ftone (cost=0.00..36446.66 +>> > rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 loops=1) +>> > Filter: ((consolidation = 60) AND ("start" < +>> > (to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +>> > 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +>> > Total runtime: 55378.68 msec +>> +>> > *** For the delete ***: +>> > +>> > Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +>> > time=3767.47..3767.47 rows=0 loops=1) +>> > Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +>> > -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +>> > (actual time=0.04..2299.94 rows=1286333 loops=1) +>> > -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +>> > time=206.01..206.01 rows=0 loops=1) +>> > -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +>> > width=4) (actual time=206.00..206.00 rows=0 loops=1) +>> > Total runtime: 3767.52 msec +>> +>> -- +>> Jeff Frost, Owner +>> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>> Phone: 650-780-7908 FAX: 650-649-1954 +>> +> + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Wed Jul 12 00:43:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9C9CE9FB1C2 + for ; + Wed, 12 Jul 2006 00:43:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30600-08 for + ; + Wed, 12 Jul 2006 00:43:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp102.sbc.mail.mud.yahoo.com (smtp102.sbc.mail.mud.yahoo.com + [68.142.198.201]) + by postgresql.org (Postfix) with SMTP id 92B649FB1BE + for ; + Wed, 12 Jul 2006 00:43:10 -0300 (ADT) +Received: (qmail 42396 invoked from network); 12 Jul 2006 03:43:09 -0000 +Received: from unknown (HELO discord.home.frostconsultingllc.com) + (jeffroe996@sbcglobal.net@69.226.248.120 with plain) + by smtp102.sbc.mail.mud.yahoo.com with SMTP; 12 Jul 2006 03:43:08 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.home.frostconsultingllc.com (8.13.6/8.13.6) with ESMTP id + k6C3h7EP017207; Tue, 11 Jul 2006 20:43:07 -0700 +Date: Tue, 11 Jul 2006 20:43:07 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.home.frostconsultingllc.com +To: Neil Hepworth +cc: pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: + +Message-ID: + +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> + + <5a6f767a0607112008m696a326bwe6425edf0455e390@mail.gmail.com> + +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/99 +X-Sequence-Number: 19959 + +On Tue, 11 Jul 2006, Jeff Frost wrote: + +> On Wed, 12 Jul 2006, Neil Hepworth wrote: +> +> You might also want to turn on autovacuum and see if that helps. +> +> What's your disk subsystem like? In fact, what's the entire DB server +> hardware like? + +By the way, how big does the temp table get? If it's large, it might make the +DELETE slow because it doesn't have any indexes on any of the comparison +columns. + +DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND +ftone.direction = fttemp670743219.direction AND ftone.start = +fttemp670743219.start AND ftone.consolidation = fttemp670743219.consolidation +AND ftone.classid = fttemp670743219.classid + +In your explain analyze from before, it seems that there were 0 rows in that +table: + +> -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +> width=4) (actual time=206.00..206.00 rows=0 loops=1) +> Total runtime: 3767.52 msec + +but that was with the smaller set size I believe. + +> +>> +>> I run through a loop, executing the following or similar queries 8 +>> times (well actually 12 but the last 4 don't do anything) - Jeff I've +>> attached complete outputs as files. +>> +>> A debug output further below (numbers after each method call name, +>> above each SQL statement, are times to run that statement in +>> milliseconds, the times on the lines "" are cumulative). So total for +>> one loop is 515 seconds, multiple by 8 and that gets me to over an +>> hour); it is actually the deletes that take the most time; 179 seconds +>> and 185 seconds each loop. +>> +>> ---------------------------------------------------- +>> +>> CREATE TABLE fttemp670743219 AS SELECT * FROM ftone LIMIT 0 +>> INSERT INTO fttemp670743219 ( epId, start, direction, classid, +>> consolidation, cnt ) SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD +>> HH24:00:00.0')::timestamp AS start, direction, classid, 60 AS +>> consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND +>> start < TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', 'YYYY-MM-DD +>> HH24:00:00.0')::timestamp GROUP BY epId, direction, +>> TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, classid +>> DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND +>> ftone.direction = fttemp670743219.direction AND ftone.start = +>> fttemp670743219.start AND ftone.consolidation = +>> fttemp670743219.consolidation AND ftone.classid = +>> fttemp670743219.classid +>> INSERT INTO ftone ( epId, start, consolidation, direction, classid, +>> cnt ) SELECT epId, start, consolidation, direction, classid, cnt FROM +>> fttemp670743219 +>> DROP TABLE fttemp670743219 +>> DELETE FROM ftone WHERE consolidation = 0 AND start < +>> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', +>> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +>> 'YYYY-MM-DD 00:00:00.0')::timestamp +>> +>> ---------------------------------------------------- +>> +>> ftone: 0: +>> createConsolidatedInTemporary: 188: +>> CREATE TABLE fttemp678233382 AS SELECT * FROM ftone LIMIT 0 +>> createConsolidatedInTemporary: 76783: +>> INSERT INTO fttemp678233382 ( epPairdefnid, start, direction, classid, +>> consolidation, cnt ) SELECT epPairdefnid, TO_TIMESTAMP(start, +>> 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, direction, classid, 60 +>> AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 +>> AND start < TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +>> 'YYYY-MM-DD HH24:00:00.0')::timestamp GROUP BY epPairdefnid, +>> direction, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, +>> classid +>> replaceConsolidatedInMainTable: 179178: +>> DELETE FROM ONLY ftone WHERE ftone.epPairdefnid = +>> fttemp678233382.epPairdefnid AND ftone.direction = +>> fttemp678233382.direction AND ftone.start = fttemp678233382.start AND +>> ftone.consolidation = fttemp678233382.consolidation AND ftone.classid +>> = fttemp678233382.classid +>> replaceConsolidatedInMainTable: 61705: +>> INSERT INTO ftone ( epPairdefnid, start, consolidation, direction, +>> classid, cnt ) SELECT epPairdefnid, start, consolidation, direction, +>> classid, cnt FROM fttemp678233382 +>> consolidate: 2656: +>> DROP TABLE fttemp678233382 +>> MAIN LOOP TOTAL consolidate: 320526 +>> deleteOlderThan: 184616: +>> DELETE FROM ftone WHERE consolidation = 0 AND start < +>> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +>> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +>> 'YYYY-MM-DD 00:00:00.0')::timestamp +>> MAIN LOOP TOTAL deleteExpiredData: 505142 +>> MAIN LOOP TOTAL generateStatistics: 515611 +>> +>> ---------------------------------------------------- +>> +>> Thanks again, +>> Neil +>> +>> +>> On 11/07/06, Jeff Frost wrote: +>>> +>>> +>>> On Mon, 10 Jul 2006, Neil Hepworth wrote: +>>> +>>> > I should also explain that I run through these queries on multiple +>>> > tables and with some slightly different parameters for the +>>> > "consolidation" so I run through those 3 queries (or similar) 9 times +>>> > and this takes a total of about 2 hours, with high CPU usage. And I +>>> > am running the queries from a remote Java application (using JDBC), +>>> > the client is using postgresql-8.0-311.jdbc3.jar. The explain analyse +>>> > results I have provided below are from running via pgAdmin, not the +>>> > Java app (I did a vacuum analyse of the db before running them): +>>> > +>>> > +>>> +>>> Neil, did you ever answer which version of 7.3 this is? +>>> +>>> BTW, you mentioned that this takes 2 hours, but even looping over this 9 +>>> times +>>> seems like it would only take 9 minutes (55 seconds for the SELECT and 4 +>>> seconds for the DELETE = 59 seconds times 9). Perhaps you should post the +>>> explain analyze for the actual query that takes so long as the planner +>>> output +>>> will likely be quite different. +>>> +>>> One thing I noticed is that the planner seems quite incorrect about the +>>> number +>>> of rows it expects in the SELECT. If you ran vacuum analyze before this, +>>> perhaps your fsm settings are incorrect? What does vacuumdb -a -v output +>>> at +>>> the end? I'm looking for something that looks like this: +>>> +>>> INFO: free space map: 109 relations, 204 pages stored; 1792 total pages +>>> needed +>>> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared +>>> memory. +>>> +>>> I see your fsm settings are non-default, so it's also possible I'm not +>>> used to +>>> reading 7.3's explain analyze output. :-) +>>> +>>> Also, what does vmstat output look like while the query is running? +>>> Perhaps +>>> you're running into some context switching problems. It would be +>>> interesting +>>> to know how the query runs on 8.1.x just to know if we're chasing an +>>> optimization that's fixed already in a later version. +>>> +>>> +>>> > Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +>>> > width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) +>>> > -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +>>> > time=16861.72..34243.63 rows=560094 loops=1) +>>> > -> Group (cost=59690.11..61451.32 rows=234827 width=16) +>>> > (actual time=16861.62..20920.12 rows=709461 loops=1) +>>> > -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +>>> > (actual time=16861.62..18081.07 rows=709461 loops=1) +>>> > Sort Key: eppairdefnid, "start" +>>> > -> Seq Scan on ftone (cost=0.00..36446.66 +>>> > rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 loops=1) +>>> > Filter: ((consolidation = 60) AND ("start" < +>>> > (to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +>>> > 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +>>> > Total runtime: 55378.68 msec +>>> +>>> > *** For the delete ***: +>>> > +>>> > Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +>>> > time=3767.47..3767.47 rows=0 loops=1) +>>> > Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +>>> > -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +>>> > (actual time=0.04..2299.94 rows=1286333 loops=1) +>>> > -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +>>> > time=206.01..206.01 rows=0 loops=1) +>>> > -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +>>> > width=4) (actual time=206.00..206.00 rows=0 loops=1) +>>> > Total runtime: 3767.52 msec +>>> +>>> -- +>>> Jeff Frost, Owner +>>> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>>> Phone: 650-780-7908 FAX: 650-649-1954 +>>> +>> +> +> + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Wed Jul 12 00:48:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D784D9FB2B6 + for ; + Wed, 12 Jul 2006 00:48:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 34965-01 for + ; + Wed, 12 Jul 2006 00:48:41 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.181]) + by postgresql.org (Postfix) with ESMTP id 36F449FB1DA + for ; + Wed, 12 Jul 2006 00:48:41 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id s49so44136pyc + for ; + Tue, 11 Jul 2006 20:48:40 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=fmETbgZv85pcV7iCl9hDrsazABaU+0uLLzAhJKrIoz+VwOcdvsf7VCzhYbPodTxZiTTSNfu2m8ODcX08NuNXHznbkmBZsVFc9C6DiuJ1ol0ScPXQaLxeuUgtu2LLpW0kGPKfQ2rpyBZiGmwsuq0KvX/RnDUEk7xaokmcOElraoE= +Received: by 10.35.103.12 with SMTP id f12mr345209pym; + Tue, 11 Jul 2006 20:48:40 -0700 (PDT) +Received: by 10.35.40.18 with HTTP; Tue, 11 Jul 2006 20:48:40 -0700 (PDT) +Message-ID: <5a6f767a0607112048w2d492056y7796aa28a9aa3ea9@mail.gmail.com> +Date: Wed, 12 Jul 2006 13:48:40 +1000 +From: "Neil Hepworth" +To: "Jeff Frost" +Subject: Re: High CPU Usage - PostgreSQL 7.3 +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_3807_1858110.1152676120275" +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> + + <5a6f767a0607112008m696a326bwe6425edf0455e390@mail.gmail.com> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/100 +X-Sequence-Number: 19960 + +------=_Part_3807_1858110.1152676120275 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Yes, it was the same DB so, yes 8.1 gives roughly a four fold improvement +(assuming hardware and OS differences aren't that significant - I'd expect +the Linux version to be faster if anything); which certainly ain't bad! :) + +Good idea for the vacuumdb -a -v on the laptop, I re imported the database +and than ran it output below: + +INFO: free space map contains 949 pages in 537 relations +DETAIL: A total of 9024 page slots are in use (including overhead). +9024 page slots are required to track all free space. +Current limits are: 20000 page slots, 1000 relations, using 186 KB. +VACUUM + +I am about to start testing Scott's suggestion now (thanks Scott - wasn't +ignoring you, just didn't have time yesterday), and I'll get back with the +results. + +Before I posted the problem to this list I was focusing more on the settings +in postgresql.conf than optimising the query as I thought this might be a +general problem, for all my DB updates/queries, with the way the planner was +optimising queries; maybe assuming CPU cost was too cheap? Do you think I +was off track in my initial thinking? Optimising these queries is +certainly beneficial but I don't want postgres to hog the CPU for any +extended period (other apps also run on the server), so I was wondering if +the general config settings could to be tuned to always prevent this +(regardless of how poorly written my queries are :)? + +Neil + + +On 12/07/06, Jeff Frost wrote: +> +> On Wed, 12 Jul 2006, Neil Hepworth wrote: +> +> > I am using version PostgreSQL 7.3.10 (RPM: +> > postgresql73-rhel21-7.3.10-2). Unfortunately vacuumdb -a -v does not +> > give the FSM info at the end (need a newer version of postgres for +> > that). Running the same queries on 8.1 reduces the time taken to +> > about 16 minutes, though I didn't run the test on the same hardware or +> > OS as I want to keep my test server as close to production as +> > possible, so I ran the 8.1 server on my Windows laptop (2GHz Centrino +> > Duo with 2GB of RAM, yes the laptop is brand new :). +> +> Well, looks like you're at least fairly up to date, but there is a fix in +> 7.3.11 that you might want to get by upgrading to 7.3.15: +> +> * Fix race condition in transaction log management +> There was a narrow window in which an I/O operation could be +> initiated for the wrong page, leading to an Assert failure or data +> corruption. +> +> It also appears that you can run autovacuum with 7.3 (I thought maybe it +> only +> went back as far as 7.4). +> +> So, is the 16 minutes on your laptop with 8.1 for windows vs 1hr on the +> server +> for the whole set of loops? If so, 4x isn't a bad improvement. :-) So, +> assuming you dumped/loaded the same DB onto your laptop's postgresql +> server, +> what does the vacuumdb -a -v say on the laptop? Perhaps we can use it to +> see +> if your fsm settings are ok. +> +> BTW, did you see Scott's posting here: +> +> http://archives.postgresql.org/pgsql-performance/2006-07/msg00091.php +> +> Since we didn't hear from you for a while, I thought perhaps Scott had hit +> on +> the fix. Have you tried that yet? It certainly would help the planner +> out. +> +> You might also want to turn on autovacuum and see if that helps. +> +> What's your disk subsystem like? In fact, what's the entire DB server +> hardware like? +> +> > +> > I run through a loop, executing the following or similar queries 8 +> > times (well actually 12 but the last 4 don't do anything) - Jeff I've +> > attached complete outputs as files. +> > +> > A debug output further below (numbers after each method call name, +> > above each SQL statement, are times to run that statement in +> > milliseconds, the times on the lines "" are cumulative). So total for +> > one loop is 515 seconds, multiple by 8 and that gets me to over an +> > hour); it is actually the deletes that take the most time; 179 seconds +> > and 185 seconds each loop. +> > +> > ---------------------------------------------------- +> > +> > CREATE TABLE fttemp670743219 AS SELECT * FROM ftone LIMIT 0 +> > INSERT INTO fttemp670743219 ( epId, start, direction, classid, +> > consolidation, cnt ) SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD +> > HH24:00:00.0')::timestamp AS start, direction, classid, 60 AS +> > consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND +> > start < TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', 'YYYY-MM-DD +> > HH24:00:00.0')::timestamp GROUP BY epId, direction, +> > TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, classid +> > DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND +> > ftone.direction = fttemp670743219.direction AND ftone.start = +> > fttemp670743219.start AND ftone.consolidation = +> > fttemp670743219.consolidation AND ftone.classid = +> > fttemp670743219.classid +> > INSERT INTO ftone ( epId, start, consolidation, direction, classid, +> > cnt ) SELECT epId, start, consolidation, direction, classid, cnt FROM +> > fttemp670743219 +> > DROP TABLE fttemp670743219 +> > DELETE FROM ftone WHERE consolidation = 0 AND start < +> > TO_TIMESTAMP((TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', +> > 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +> > 'YYYY-MM-DD 00:00:00.0')::timestamp +> > +> > ---------------------------------------------------- +> > +> > ftone: 0: +> > createConsolidatedInTemporary: 188: +> > CREATE TABLE fttemp678233382 AS SELECT * FROM ftone LIMIT 0 +> > createConsolidatedInTemporary: 76783: +> > INSERT INTO fttemp678233382 ( epPairdefnid, start, direction, classid, +> > consolidation, cnt ) SELECT epPairdefnid, TO_TIMESTAMP(start, +> > 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, direction, classid, 60 +> > AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 +> > AND start < TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +> > 'YYYY-MM-DD HH24:00:00.0')::timestamp GROUP BY epPairdefnid, +> > direction, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, +> > classid +> > replaceConsolidatedInMainTable: 179178: +> > DELETE FROM ONLY ftone WHERE ftone.epPairdefnid = +> > fttemp678233382.epPairdefnid AND ftone.direction = +> > fttemp678233382.direction AND ftone.start = fttemp678233382.start AND +> > ftone.consolidation = fttemp678233382.consolidation AND ftone.classid +> > = fttemp678233382.classid +> > replaceConsolidatedInMainTable: 61705: +> > INSERT INTO ftone ( epPairdefnid, start, consolidation, direction, +> > classid, cnt ) SELECT epPairdefnid, start, consolidation, direction, +> > classid, cnt FROM fttemp678233382 +> > consolidate: 2656: +> > DROP TABLE fttemp678233382 +> > MAIN LOOP TOTAL consolidate: 320526 +> > deleteOlderThan: 184616: +> > DELETE FROM ftone WHERE consolidation = 0 AND start < +> > TO_TIMESTAMP((TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +> > 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +> > 'YYYY-MM-DD 00:00:00.0')::timestamp +> > MAIN LOOP TOTAL deleteExpiredData: 505142 +> > MAIN LOOP TOTAL generateStatistics: 515611 +> > +> > ---------------------------------------------------- +> > +> > Thanks again, +> > Neil +> > +> > +> > On 11/07/06, Jeff Frost wrote: +> >> +> >> +> >> On Mon, 10 Jul 2006, Neil Hepworth wrote: +> >> +> >> > I should also explain that I run through these queries on multiple +> >> > tables and with some slightly different parameters for the +> >> > "consolidation" so I run through those 3 queries (or similar) 9 times +> >> > and this takes a total of about 2 hours, with high CPU usage. And I +> >> > am running the queries from a remote Java application (using JDBC), +> >> > the client is using postgresql-8.0-311.jdbc3.jar. The explain +> analyse +> >> > results I have provided below are from running via pgAdmin, not the +> >> > Java app (I did a vacuum analyse of the db before running them): +> >> > +> >> > +> >> +> >> Neil, did you ever answer which version of 7.3 this is? +> >> +> >> BTW, you mentioned that this takes 2 hours, but even looping over this +> 9 +> >> times +> >> seems like it would only take 9 minutes (55 seconds for the SELECT and +> 4 +> >> seconds for the DELETE = 59 seconds times 9). Perhaps you should post +> the +> >> explain analyze for the actual query that takes so long as the planner +> >> output +> >> will likely be quite different. +> >> +> >> One thing I noticed is that the planner seems quite incorrect about the +> >> number +> >> of rows it expects in the SELECT. If you ran vacuum analyze before +> this, +> >> perhaps your fsm settings are incorrect? What does vacuumdb -a -v +> output +> >> at +> >> the end? I'm looking for something that looks like this: +> >> +> >> INFO: free space map: 109 relations, 204 pages stored; 1792 total +> pages +> >> needed +> >> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB +> shared +> >> memory. +> >> +> >> I see your fsm settings are non-default, so it's also possible I'm not +> used +> >> to +> >> reading 7.3's explain analyze output. :-) +> >> +> >> Also, what does vmstat output look like while the query is running? +> >> Perhaps +> >> you're running into some context switching problems. It would be +> >> interesting +> >> to know how the query runs on 8.1.x just to know if we're chasing an +> >> optimization that's fixed already in a later version. +> >> +> >> +> >> > Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +> >> > width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) +> >> > -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +> >> > time=16861.72..34243.63 rows=560094 loops=1) +> >> > -> Group (cost=59690.11..61451.32 rows=234827 width=16) +> >> > (actual time=16861.62..20920.12 rows=709461 loops=1) +> >> > -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +> >> > (actual time=16861.62..18081.07 rows=709461 loops=1) +> >> > Sort Key: eppairdefnid, "start" +> >> > -> Seq Scan on ftone (cost=0.00..36446.66 +> >> > rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 +> loops=1) +> >> > Filter: ((consolidation = 60) AND ("start" < +> >> > (to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +> >> > 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +> >> > Total runtime: 55378.68 msec +> >> +> >> > *** For the delete ***: +> >> > +> >> > Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +> >> > time=3767.47..3767.47 rows=0 loops=1) +> >> > Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +> >> > -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +> >> > (actual time=0.04..2299.94 rows=1286333 loops=1) +> >> > -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +> >> > time=206.01..206.01 rows=0 loops=1) +> >> > -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +> >> > width=4) (actual time=206.00..206.00 rows=0 loops=1) +> >> > Total runtime: 3767.52 msec +> >> +> >> -- +> >> Jeff Frost, Owner +> >> Frost Consulting, LLC http://www.frostconsultingllc.com/ +> >> Phone: 650-780-7908 FAX: 650-649-1954 +> >> +> > +> +> -- +> Jeff Frost, Owner +> Frost Consulting, LLC http://www.frostconsultingllc.com/ +> Phone: 650-780-7908 FAX: 650-649-1954 +> + +------=_Part_3807_1858110.1152676120275 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
Yes, it was the same DB so, yes 8.1 gives roughly a four fold improvement (assuming hardware and OS differences aren't that significant - I'd expect the Linux version to be faster if anything); which certainly ain't bad! :) +
+
 
+
Good idea for the vacuumdb -a -v on the laptop, I re imported the database and than ran it output below:
+
 
+
INFO:  free space map contains 949 pages in 537 relations
DETAIL:  A total of 9024 page slots are in use (including overhead).
9024 page slots are required to track all free space.
Current limits are:  20000 page slots, 1000 relations, using 186 KB. +
VACUUM
+
 
+
I am about to start testing Scott's suggestion now (thanks Scott - wasn't ignoring you, just didn't have time yesterday), and I'll get back with the results.
+
 
+
Before I posted the problem to this list I was focusing more on the settings in postgresql.conf than optimising the query as I thought this might be a general problem, for all my DB updates/queries, with the way the planner was optimising queries; maybe assuming CPU cost was too cheap?  Do you think I was off track in my initial thinking?  Optimising these queries is certainly beneficial but I don't want postgres to hog the CPU for any extended period (other apps also run on the server), so I was wondering if the general config settings could to be tuned to always prevent this (regardless of how poorly written my queries are :)? +
+
 
+
Neil

 
+
On 12/07/06, Jeff Frost <jeff@frostconsultingllc.com> wrote: +
On Wed, 12 Jul 2006, Neil Hepworth wrote:

> I am using version PostgreSQL 7.3.10 (RPM:
> postgresql73-rhel21-7.3.10-2 +).  Unfortunately vacuumdb -a -v does not
> give the FSM info at the end (need a newer version of postgres for
> that).  Running the same queries on 8.1 reduces the time taken to
> about 16 minutes, though I didn't run the test on the same hardware or +
> OS as I want to keep my test server as close to production as
> possible, so I ran the 8.1 server on my Windows laptop (2GHz Centrino
> Duo with 2GB of RAM, yes the laptop is brand new :).

Well, looks like you're at least fairly up to date, but there is a fix in +
7.3.11 that you might want to get by upgrading to 7.3.15:

     * Fix race condition in transaction log management
       There was a narrow window in which an I/O operation could be
       initiated for the wrong page, leading to an Assert failure or data +
       corruption.

It also appears that you can run autovacuum with 7.3 (I thought maybe it only
went back as far as 7.4).

So, is the 16 minutes on your laptop with 8.1 for windows vs 1hr on the server +
for the whole set of loops?  If so, 4x isn't a bad improvement. :-)  So,
assuming you dumped/loaded the same DB onto your laptop's postgresql server,
what does the vacuumdb -a -v say on the laptop?  Perhaps we can use it to see +
if your fsm settings are ok.

BTW, did you see Scott's posting here:

http://archives.postgresql.org/pgsql-performance/2006-07/msg00091.php +

Since we didn't hear from you for a while, I thought perhaps Scott had hit on
the fix.  Have you tried that yet?  It certainly would help the planner out.

You might also want to turn on autovacuum and see if that helps. +

What's your disk subsystem like?  In fact, what's the entire DB server
hardware like?

>
> I run through a loop, executing the following or similar queries 8
> times (well actually 12 but the last 4 don't do anything) - Jeff I've +
> attached complete outputs as files.
>
> A debug output further below (numbers after each method call name,
> above each SQL statement, are times to run that statement in
> milliseconds, the times on the lines "" are cumulative).  So total for +
> one loop is 515 seconds, multiple by 8 and that gets me to over an
> hour); it is actually the deletes that take the most time; 179 seconds
> and 185 seconds each loop.
>
>                 ---------------------------------------------------- +
>
> CREATE TABLE fttemp670743219 AS SELECT * FROM ftone LIMIT 0
> INSERT INTO fttemp670743219 ( epId, start, direction, classid,
> consolidation, cnt )  SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD +
> HH24:00:00.0')::timestamp AS start, direction, classid, 60 AS
> consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND
> start < TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', 'YYYY-MM-DD +
> HH24:00:00.0')::timestamp GROUP BY epId, direction,
> TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, classid
> DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND
> ftone.direction + = fttemp670743219.direction AND ftone.start =
> fttemp670743219.start AND ftone.consolidation =
> fttemp670743219.consolidation AND ftone.classid =
> fttemp670743219.classid
> INSERT INTO ftone ( epId, start, consolidation, direction, classid, +
> cnt ) SELECT epId, start, consolidation, direction, classid, cnt FROM
> fttemp670743219
> DROP TABLE fttemp670743219
> DELETE FROM ftone WHERE consolidation = 0 AND start <
> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-11 14:04: +34.156433+1000',
> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'),
> 'YYYY-MM-DD 00:00:00.0')::timestamp
>
>                 ----------------------------------------------------
+>
> ftone: 0:
> createConsolidatedInTemporary: 188:
> CREATE TABLE fttemp678233382 AS SELECT * FROM ftone LIMIT 0
> createConsolidatedInTemporary: 76783:
> INSERT INTO fttemp678233382 ( epPairdefnid, start, direction, classid, +
> consolidation, cnt )  SELECT epPairdefnid, TO_TIMESTAMP(start,
> 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, direction, classid, 60
> AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 +
> AND start < TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000',
> 'YYYY-MM-DD HH24:00:00.0')::timestamp GROUP BY epPairdefnid,
> direction, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp,
+> classid
> replaceConsolidatedInMainTable: 179178:
> DELETE FROM ONLY ftone WHERE ftone.epPairdefnid =
> fttemp678233382.epPairdefnid AND ftone.direction =
> fttemp678233382.direction AND ftone.start + = fttemp678233382.start AND
> ftone.consolidation = fttemp678233382.consolidation AND ftone.classid
> = fttemp678233382.classid
> replaceConsolidatedInMainTable: 61705:
> INSERT INTO ftone ( epPairdefnid, start, consolidation, direction, +
> classid, cnt ) SELECT epPairdefnid, start, consolidation, direction,
> classid, cnt FROM fttemp678233382
> consolidate: 2656:
> DROP TABLE fttemp678233382
> MAIN LOOP TOTAL consolidate: 320526 +
> deleteOlderThan: 184616:
> DELETE FROM ftone WHERE consolidation = 0 AND start <
> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000',
> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +
> 'YYYY-MM-DD 00:00:00.0')::timestamp
> MAIN LOOP TOTAL deleteExpiredData: 505142
> MAIN LOOP TOTAL generateStatistics: 515611
>
>                 ---------------------------------------------------- +
>
> Thanks again,
>   Neil
>
>
> On 11/07/06, Jeff Frost <jeff@frostconsultingllc.com> wrote:
>>
>>
>> On Mon, 10 Jul 2006, Neil Hepworth wrote: +
>>
>> > I should also explain that I run through these queries on multiple
>> > tables and with some slightly different parameters for the
>> > "consolidation" so I run through those 3 queries (or similar) 9 times +
>> > and this takes a total of about 2 hours, with high CPU usage.  And I
>> > am running the queries from a remote Java application (using JDBC),
>> > the client is using postgresql-8.0-311.jdbc3.jar +.  The explain analyse
>> > results I have provided below are from running via pgAdmin, not the
>> > Java app (I did a vacuum analyse of the db before running them):
>> >
>> > +
>>
>> Neil, did you ever answer which version of 7.3 this is?
>>
>> BTW, you mentioned that this takes 2 hours, but even looping over this 9
>> times
>> seems like it would only take 9 minutes (55 seconds for the SELECT and 4 +
>> seconds for the DELETE = 59 seconds times 9).  Perhaps you should post the
>> explain analyze for the actual query that takes so long as the planner
>> output
>> will likely be quite different. +
>>
>> One thing I noticed is that the planner seems quite incorrect about the
>> number
>> of rows it expects in the SELECT.  If you ran vacuum analyze before this,
>> perhaps your fsm settings are incorrect?  What does vacuumdb -a -v output +
>> at
>> the end?  I'm looking for something that looks like this:
>>
>> INFO:  free space map: 109 relations, 204 pages stored; 1792 total pages
>> needed
>> DETAIL:  Allocated FSM size: 1000 relations + 20000 pages = 182 kB shared +
>> memory.
>>
>> I see your fsm settings are non-default, so it's also possible I'm not used
>> to
>> reading 7.3's explain analyze output. :-)
>>
>> Also, what does vmstat output look like while the query is running? +
>> Perhaps
>> you're running into some context switching problems.  It would be
>> interesting
>> to know how the query runs on 8.1.x just to know if we're chasing an
>> optimization that's fixed already in a later version. +
>>
>>
>> > Subquery Scan "*SELECT*"  (cost=59690.11..62038.38 rows=23483
>> > width=16) (actual time=16861.73..36473.12 rows=560094 loops=1)
>> > ->  Aggregate  (cost= +59690.11..62038.38 rows=23483 width=16) (actual
>> > time=16861.72..34243.63 rows=560094 loops=1)
>> >       ->  Group  (cost=59690.11..61451.32 rows=234827 width=16)
>> > (actual time= +16861.62..20920.12 rows=709461 loops=1)
>> >             ->  Sort  (cost=59690.11..60277.18 rows=234827 width=16)
>> > (actual time=16861.62..18081.07 rows=709461 loops=1)
>> >                   Sort Key: eppairdefnid, "start" +
>> >                   ->  Seq Scan on ftone  (cost=0.00..36446.66
>> > rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 loops=1)
>> >                         Filter: ((consolidation = 60) AND ("start" < +
>> > (to_timestamp('2006-07-10 18:43:27.391103+1000'::text,
>> > 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone))
>> > Total runtime: 55378.68 msec
>>
>> > *** For the delete ***: +
>> >
>> > Hash Join  (cost=0.00..30020.31 rows=425 width=14) (actual
>> > time=3767.47..3767.47 rows=0 loops=1)
>> > Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +
>> > ->  Seq Scan on ftone  (cost=0.00..23583.33 rows=1286333 width=10)
>> > (actual time=0.04..2299.94 rows=1286333 loops=1)
>> > ->  Hash  (cost=0.00..0.00 rows=1 width=4) (actual +
>> > time=206.01..206.01 rows=0 loops=1)
>> >       ->  Seq Scan on fttemp1600384653  (cost=0.00..0.00 rows=1
>> > width=4) (actual time=206.00..206.00 rows=0 loops=1)
>> > Total runtime: +3767.52 msec
>>
>> --
>> Jeff Frost, Owner       <jeff@frostconsultingllc.com>
>> Frost Consulting, LLC   +http://www.frostconsultingllc.com/
>> Phone: 650-780-7908     FAX: 650-649-1954
>>
>

--
Jeff Frost, Owner       <jeff@frostconsultingllc.com +>
Frost Consulting, LLC   http://www.frostconsultingllc.com/
Phone: 650-780-7908     FAX: 650-649-1954

+ +------=_Part_3807_1858110.1152676120275-- + +From pgsql-performance-owner@postgresql.org Wed Jul 12 04:38:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AB4CD9FB1C9 + for ; + Wed, 12 Jul 2006 04:38:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 65374-03 for + ; + Wed, 12 Jul 2006 04:38:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp-vbr10.xs4all.nl (smtp-vbr10.xs4all.nl [194.109.24.30]) + by postgresql.org (Postfix) with ESMTP id 89D7B9FB297 + for ; + Wed, 12 Jul 2006 04:38:29 -0300 (ADT) +Received: from [10.0.0.12] (a80-126-182-198.adsl.xs4all.nl [80.126.182.198]) + (authenticated bits=0) + by smtp-vbr10.xs4all.nl (8.13.6/8.13.6) with ESMTP id k6C7cQ76033749 + for ; + Wed, 12 Jul 2006 09:38:27 +0200 (CEST) + (envelope-from nicky@valuecare.nl) +Message-ID: <44B4A6F6.8030609@valuecare.nl> +Date: Wed, 12 Jul 2006 09:38:30 +0200 +From: nicky +User-Agent: Thunderbird 1.5.0.4 (X11/20060621) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Out of Memory Problem. +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by XS4ALL Virus Scanner +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/101 +X-Sequence-Number: 19961 + +Hello Everyone, + +I'm trying to find out/understand what causes my 'out of memory' error. +I do not have enough experience with such logs to understand what is +wrong or how to fix it. So i hope someone can point me in the right +direction. + +The 'rpt.rpt_verrichting' table contains about 8.5 million records and +the 'rpt.rpt_dbc_traject' table contains 700k records. +It's part of a nightly process, so there is only 1 user active. + +The server PostgreSQL 8.1.4 is running on, has 4GB Ram, OS FreeBSD +6.1-Stable. + +postgresql.conf +shared_buffers = 8192 +work_mem = 524288 +maintenance_work_mem = 524288 +effective_cache_size = 104858 + + +Resource limits (current): + cputime infinity secs + filesize infinity kB + datasize 1048576 kB <---- could this be a problem? + stacksize 131072 kB <---- could this be a problem? + coredumpsize infinity kB + memoryuse infinity kB + memorylocked infinity kB + maxprocesses 5547 + openfiles 11095 + sbsize infinity bytes + vmemoryuse infinity kB + + +Thanks in advance. + +_*The Query that is causing the out of memory error.*_ +LOG: statement: insert into rpt.rpt_verrichting_dbc + ( + verrichting_id + , verrichting_secid + , dbcnr + , vc_dbcnr + ) + select + t1.verrichting_id + , t1.verrichting_secid + , t1.dbcnr + , max(t1.vc_dbcnr) as vc_dbcnr + from + rpt.rpt_verrichting t1 + , rpt.rpt_dbc_traject t00 + where + t1.vc_patientnr = t00.vc_patientnr + and + t1.vc_agb_specialisme_nr_toek = t00.agb_specialisme_nr + and + t1.verrichtingsdatum between t00.begindat_dbc and +COALESCE(t00.einddat_dbc, t00.begindat_dbc + interval '365 days') + group by + t1.verrichting_id + , t1.verrichting_secid + , t1.dbcnr + ; + +_*An EXPLAIN for the query:*_ + Subquery Scan "*SELECT*" (cost=1837154.04..1839811.72 rows=106307 +width=74) + -> HashAggregate (cost=1837154.04..1838482.88 rows=106307 width=56) + -> Merge Join (cost=1668759.55..1836090.97 rows=106307 width=56) + Merge Cond: ((("outer".vc_patientnr)::text = +"inner"."?column8?") AND ("outer".agb_specialisme_nr = +"inner".vc_agb_specialisme_nr_toek)) + Join Filter: (("inner".verrichtingsdatum >= +"outer".begindat_dbc) AND ("inner".verrichtingsdatum <= +COALESCE("outer".einddat_dbc, ("outer".begindat_dbc + '365 +days'::interval)))) + -> Index Scan using rpt_dbc_traject_idx1 on +rpt_dbc_traject t00 (cost=0.00..84556.01 rows=578274 width=37) + -> Sort (cost=1668759.55..1689806.46 rows=8418765 width=79) + Sort Key: (t1.vc_patientnr)::text, +t1.vc_agb_specialisme_nr_toek + -> Seq Scan on rpt_verrichting t1 +(cost=0.00..302720.65 rows=8418765 width=79) + +_*Out of memory log.*_ +TopMemoryContext: 16384 total in 2 blocks; 3824 free (4 chunks); 12560 used +Type information cache: 8192 total in 1 blocks; 1864 free (0 chunks); +6328 used +Operator class cache: 8192 total in 1 blocks; 4936 free (0 chunks); 3256 +used +TopTransactionContext: 8192 total in 1 blocks; 7856 free (0 chunks); 336 +used +MessageContext: 122880 total in 4 blocks; 64568 free (4 chunks); 58312 used +smgr relation table: 8192 total in 1 blocks; 2872 free (0 chunks); 5320 used +Portal hash: 8192 total in 1 blocks; 3912 free (0 chunks); 4280 used +PortalMemory: 8192 total in 1 blocks; 8040 free (0 chunks); 152 used +PortalHeapMemory: 1024 total in 1 blocks; 896 free (0 chunks); 128 used +ExecutorState: 8192 total in 1 blocks; 5304 free (1 chunks); 2888 used +ExecutorState: 562316108 total in 94 blocks; 528452720 free (2593154 +chunks); 33863388 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +ExprContext: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used +AggContext: 399499264 total in 58 blocks; 5928 free (110 chunks); +399493336 used +TupleHashTable: 109109272 total in 23 blocks; 2468576 free (70 chunks); +106640696 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +ExprContext: 0 total in 0 blocks; 0 free (0 chunks); 0 used +Relcache by OID: 8192 total in 1 blocks; 3376 free (0 chunks); 4816 used +CacheMemoryContext: 516096 total in 6 blocks; 83448 free (0 chunks); +432648 used +rpt_dbc_traject_idx1: 1024 total in 1 blocks; 328 free (0 chunks); 696 used +rpt_dbc_traject_pk: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +rpt_verrichting_idx2: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +rpt_verrichting_idx1: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_index_indrelid_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +pg_attrdef_adrelid_adnum_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_type_typname_nsp_index: 1024 total in 1 blocks; 328 free (0 chunks); +696 used +pg_type_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_trigger_tgrelid_tgname_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_statistic_relid_att_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_auth_members_member_role_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_auth_members_role_member_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_rewrite_rel_rulename_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_proc_proname_args_nsp_index: 1024 total in 1 blocks; 256 free (0 +chunks); 768 used +pg_proc_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_operator_oprname_l_r_n_index: 1024 total in 1 blocks; 192 free (0 +chunks); 832 used +pg_operator_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_opclass_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_opclass_am_name_nsp_index: 1024 total in 1 blocks; 256 free (0 +chunks); 768 used +pg_namespace_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 +used +pg_namespace_nspname_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +pg_language_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_language_name_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 +used +pg_inherits_relid_seqno_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_index_indexrelid_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +pg_authid_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_authid_rolname_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +pg_database_datname_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +pg_conversion_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +pg_conversion_name_nsp_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_conversion_default_index: 1024 total in 1 blocks; 192 free (0 +chunks); 832 used +pg_class_relname_nsp_index: 1024 total in 1 blocks; 328 free (0 chunks); +696 used +pg_class_oid_index: 1024 total in 1 blocks; 392 free (0 chunks); 632 used +pg_cast_source_target_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_attribute_relid_attnum_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_attribute_relid_attnam_index: 1024 total in 1 blocks; 328 free (0 +chunks); 696 used +pg_amproc_opc_proc_index: 1024 total in 1 blocks; 256 free (0 chunks); +768 used +pg_amop_opr_opc_index: 1024 total in 1 blocks; 328 free (0 chunks); 696 used +pg_amop_opc_strat_index: 1024 total in 1 blocks; 256 free (0 chunks); +768 used +pg_aggregate_fnoid_index: 1024 total in 1 blocks; 392 free (0 chunks); +632 used +MdSmgr: 8192 total in 1 blocks; 7312 free (0 chunks); 880 used +LockTable (locallock hash): 8192 total in 1 blocks; 3912 free (0 +chunks); 4280 used +Timezones: 47592 total in 2 blocks; 5968 free (0 chunks); 41624 used +ErrorContext: 8192 total in 1 blocks; 8176 free (4 chunks); 16 used +ERROR: out of memory +DETAIL: Failed on request of size 98. + +*Indexes* +CREATE INDEX rpt_verrichting_idx1 + ON rpt.rpt_verrichting + USING btree + (dbcnr) + TABLESPACE rpt_index; + +CREATE INDEX rpt_verrichting_idx2 + ON rpt.rpt_verrichting + USING btree + (vc_patientnr) + TABLESPACE rpt_index; + +CREATE INDEX rpt_dbc_traject_idx1 + ON rpt.rpt_dbc_traject + USING btree + (vc_patientnr, agb_specialisme_nr) + TABLESPACE rpt_index_all; + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 05:33:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A57F59FB1DC + for ; + Wed, 12 Jul 2006 05:33:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71578-10 for + ; + Wed, 12 Jul 2006 05:33:46 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from mail.gmx.net (mail.gmx.net [213.165.64.21]) + by postgresql.org (Postfix) with SMTP id A75849FA634 + for ; + Wed, 12 Jul 2006 05:33:46 -0300 (ADT) +Received: (qmail 23573 invoked by uid 0); 12 Jul 2006 08:33:44 -0000 +Received: from 82.103.0.42 by www032.gmx.net with HTTP; + Wed, 12 Jul 2006 10:33:44 +0200 (CEST) +Content-Type: multipart/alternative; + boundary="========GMXBoundary4421152693224656719" +Date: Wed, 12 Jul 2006 10:33:44 +0200 +From: "Thomas Radnetter" +Message-ID: <20060712083344.4420@gmx.net> +MIME-Version: 1.0 +Subject: Performance Problem between Ora 10g and Psql +To: pgsql-performance@postgresql.org +X-Authenticated: #6387982 +X-Flags: 0001 +X-GMX-UID: mqCBdUZxIyd16iscFWdrU99aa2FkZlWR +X-Mailer: WWW-Mail 6100 (Global Message Exchange) +X-Priority: 3 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/102 +X-Sequence-Number: 19962 + +--========GMXBoundary4421152693224656719 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Hello! + +We're facing a performance problem here in a Oracle 10g -> PostgreSQL +environment. The Oracle DB accesses the PostgreSQL DB via UnixODBC + +psqlODBC. + +There are some 100 records on the Oracle DB to be updated with data +obtained from a view of the PostgreSQL DB. The fetched data accumulates to +a few kB's and the update takes some 5 - 7 hours. During this time the +PostgreSQL machine is running at approx. 100% CPU usage. +If a select for the same data is issued from the Oracle DB the statement is +executed in half a second. + +Is this the correct place to issue this problem? + +How can I trace down the cause for this performance problem? + +Thanx in advance! + +Regards, +Thomas Radnetter + +p.s. Mr. Ludek Finstrle, can you help again? + +-- + + "Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ... + Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail +-- + + +"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ... +Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail + +--========GMXBoundary4421152693224656719 +Content-Type: text/html; charset="us-ascii" +Content-Transfer-Encoding: 7bit + + + + + + + + Hello!

We're facing a performance problem here in a Oracle 10g -> PostgreSQL environment. The Oracle DB accesses the PostgreSQL DB via UnixODBC + psqlODBC.

There are some 100 records on the Oracle DB to be updated with data obtained from a view of the PostgreSQL DB. The fetched data accumulates to a few kB's and the update takes some 5 - 7 hours. During this time the PostgreSQL machine is running at approx. 100% CPU usage.
If a select for the same data is issued from the Oracle DB the statement is executed in half a second.

Is this the correct place to issue this problem?

How can I trace down the cause for this performance problem?

Thanx in advance!


Regards,
Thomas Radnetter

p.s. Mr. Ludek Finstrle, can you help again?
+



--


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
+



--


+"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
+Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail +
+ + +--========GMXBoundary4421152693224656719-- + +From pgsql-performance-owner@postgresql.org Wed Jul 12 06:47:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 801299FB200 + for ; + Wed, 12 Jul 2006 06:47:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 97599-08 for + ; + Wed, 12 Jul 2006 06:47:08 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.180]) + by postgresql.org (Postfix) with ESMTP id 471119FB1DC + for ; + Wed, 12 Jul 2006 06:47:07 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id s49so118136pyc + for ; + Wed, 12 Jul 2006 02:47:06 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=n+sEIPd6TIiN0Ba+30gC4j6DRJInE30X05pigT3iJR1m3kUK6KqugHGW8fgzC5/V4AYEokUGtt8MvL8cJirNSYKnuEYouCl840GoRCZ3rSIr8omKgrvHEEtfItz8b9Cgx4zxMBn2kGqkW6pLHTlEmkcy6ON6Alqwflc6EJs0L9Y= +Received: by 10.35.20.14 with SMTP id x14mr647076pyi; + Wed, 12 Jul 2006 02:47:06 -0700 (PDT) +Received: by 10.35.53.5 with HTTP; Wed, 12 Jul 2006 02:47:06 -0700 (PDT) +Message-ID: <1d4e0c10607120247m4e7e4339p6dd97df9d8c641d7@mail.gmail.com> +Date: Wed, 12 Jul 2006 11:47:06 +0200 +From: "Guillaume Smet" +To: "Thomas Radnetter" +Subject: Re: Performance Problem between Ora 10g and Psql +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060712083344.4420@gmx.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <20060712083344.4420@gmx.net> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/103 +X-Sequence-Number: 19963 + +Thomas, + +On 7/12/06, Thomas Radnetter wrote: +> Is this the correct place to issue this problem? + +It is if your issue is due to a PostgreSQL performance problem. + +> How can I trace down the cause for this performance problem? + +The first thing to do is to determine if it is a problem due to the +Oracle -> ODBC -> PostgreSQL thing or if it is a problem with the +query. My advice is to set log_min_duration_statement to 0 in your +postgresql.conf (and set the logger so that you can see the log output +somewhere). Then you'll see if your query is slow. + +If your query is slow, post the output of an explain analyze on the +list with all the relevant information (structure of the concerned +tables, indexes, size...). + +If not, it's probably more an ODBC problem. + +Regards, + +-- +Guillaume Smet +Open Wide + +From pgsql-performance-owner@postgresql.org Wed Jul 12 11:44:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 933389FB377 + for ; + Wed, 12 Jul 2006 11:34:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41936-01 for + ; + Wed, 12 Jul 2006 11:34:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 503F69FB372 + for ; + Wed, 12 Jul 2006 11:34:01 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k6CEXqoq015859; Wed, 12 Jul 2006 07:33:54 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +To: pgsql-performance@postgresql.org +Subject: Re: Performance Problem between Ora 10g and Psql +Date: Wed, 12 Jul 2006 07:33:52 -0700 +User-Agent: KMail/1.9.1 +Cc: "Thomas Radnetter" +References: <20060712083344.4420@gmx.net> +In-Reply-To: <20060712083344.4420@gmx.net> +XIDTRACK: jd@commandprompt.com +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-15" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200607120733.52847.jd@commandprompt.com> +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Wed, 12 Jul 2006 07:33:54 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/104 +X-Sequence-Number: 19964 + +On Wednesday 12 July 2006 01:33, Thomas Radnetter wrote: +> Hello! +> +> We're facing a performance problem here in a Oracle 10g -> PostgreSQL +> environment. The Oracle DB accesses the PostgreSQL DB via UnixODBC + +> psqlODBC. +> +> There are some 100 records on the Oracle DB to be updated with data +> obtained from a view of the PostgreSQL DB. The fetched data accumulates to +> a few kB's and the update takes some 5 - 7 hours. During this time the +> PostgreSQL machine is running at approx. 100% CPU usage. +> If a select for the same data is issued from the Oracle DB the statement is +> executed in half a second. +> +> Is this the correct place to issue this problem? + +Sure but you haven't provided a TON of information that would be needed to +help? + +If you execute the same query that is being executed via ODBC, via psql is the +performance problem still there? + +If so, you probably have a postgresql issue, otherwise look at Oracle or ODBC. + +If it is a PostgreSQL issue: + Do you have indexes applied? + What is the explain plan? + When was the last time you analyzed? + What about vacuum? + +etc. etc. + +Sincerely, + +Joshua D. Drake + + +> +> How can I trace down the cause for this performance problem? +> +> Thanx in advance! +> +> Regards, +> Thomas Radnetter +> +> p.s. Mr. Ludek Finstrle, can you help again? +> +> -- +> +> "Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ... +> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail + +-- + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 11:53:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B4B439FB382 + for ; + Wed, 12 Jul 2006 11:52:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 45002-02 for + ; + Wed, 12 Jul 2006 11:52:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp113.sbc.mail.mud.yahoo.com (smtp113.sbc.mail.mud.yahoo.com + [68.142.198.212]) + by postgresql.org (Postfix) with SMTP id 7CD3F9FB364 + for ; + Wed, 12 Jul 2006 11:52:14 -0300 (ADT) +Received: (qmail 40921 invoked from network); 12 Jul 2006 14:52:12 -0000 +Received: from unknown (HELO discord.home.frostconsultingllc.com) + (jeffroe996@sbcglobal.net@69.226.248.120 with plain) + by smtp113.sbc.mail.mud.yahoo.com with SMTP; 12 Jul 2006 14:52:11 -0000 +Received: from localhost (localhost.localdomain [127.0.0.1]) + by discord.home.frostconsultingllc.com (8.13.6/8.13.6) with ESMTP id + k6CEq8e4021460; Wed, 12 Jul 2006 07:52:10 -0700 +Date: Wed, 12 Jul 2006 07:52:08 -0700 (PDT) +From: Jeff Frost +X-X-Sender: jeff@discord.home.frostconsultingllc.com +To: pgsql-performance@postgresql.org, Rizal +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <004301c6a57b$055ba390$db0aa8c0@vitrack.com> +Message-ID: + +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> + + <5a6f767a0607112008m696a326bwe6425edf0455e390@mail.gmail.com> + + <004301c6a57b$055ba390$db0aa8c0@vitrack.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/105 +X-Sequence-Number: 19965 + +Please Cc: the list when replying to things like this so everyone can see (and +likely help). + +I'm not sure what you're response is actually regarding. Could you give some +more detail? + +On Wed, 12 Jul 2006, Rizal wrote: + +> so, i must upgrade my PostgreSQL 803 which i have with a new version ? +> +> ----- Original Message ----- +> From: "Jeff Frost" +> To: "Neil Hepworth" +> Cc: +> Sent: Wednesday, July 12, 2006 10:27 AM +> Subject: Re: [PERFORM] High CPU Usage - PostgreSQL 7.3 +> +> +>> On Wed, 12 Jul 2006, Neil Hepworth wrote: +>> +>>> I am using version PostgreSQL 7.3.10 (RPM: +>>> postgresql73-rhel21-7.3.10-2). Unfortunately vacuumdb -a -v does not +>>> give the FSM info at the end (need a newer version of postgres for +>>> that). Running the same queries on 8.1 reduces the time taken to +>>> about 16 minutes, though I didn't run the test on the same hardware or +>>> OS as I want to keep my test server as close to production as +>>> possible, so I ran the 8.1 server on my Windows laptop (2GHz Centrino +>>> Duo with 2GB of RAM, yes the laptop is brand new :). +>> +>> Well, looks like you're at least fairly up to date, but there is a fix in +>> 7.3.11 that you might want to get by upgrading to 7.3.15: +>> +>> * Fix race condition in transaction log management +>> There was a narrow window in which an I/O operation could be +>> initiated for the wrong page, leading to an Assert failure or data +>> corruption. +>> +>> It also appears that you can run autovacuum with 7.3 (I thought maybe it +> only +>> went back as far as 7.4). +>> +>> So, is the 16 minutes on your laptop with 8.1 for windows vs 1hr on the +> server +>> for the whole set of loops? If so, 4x isn't a bad improvement. :-) So, +>> assuming you dumped/loaded the same DB onto your laptop's postgresql +> server, +>> what does the vacuumdb -a -v say on the laptop? Perhaps we can use it to +> see +>> if your fsm settings are ok. +>> +>> BTW, did you see Scott's posting here: +>> +>> http://archives.postgresql.org/pgsql-performance/2006-07/msg00091.php +>> +>> Since we didn't hear from you for a while, I thought perhaps Scott had hit +> on +>> the fix. Have you tried that yet? It certainly would help the planner +> out. +>> +>> You might also want to turn on autovacuum and see if that helps. +>> +>> What's your disk subsystem like? In fact, what's the entire DB server +>> hardware like? +>> +>>> +>>> I run through a loop, executing the following or similar queries 8 +>>> times (well actually 12 but the last 4 don't do anything) - Jeff I've +>>> attached complete outputs as files. +>>> +>>> A debug output further below (numbers after each method call name, +>>> above each SQL statement, are times to run that statement in +>>> milliseconds, the times on the lines "" are cumulative). So total for +>>> one loop is 515 seconds, multiple by 8 and that gets me to over an +>>> hour); it is actually the deletes that take the most time; 179 seconds +>>> and 185 seconds each loop. +>>> +>>> ---------------------------------------------------- +>>> +>>> CREATE TABLE fttemp670743219 AS SELECT * FROM ftone LIMIT 0 +>>> INSERT INTO fttemp670743219 ( epId, start, direction, classid, +>>> consolidation, cnt ) SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD +>>> HH24:00:00.0')::timestamp AS start, direction, classid, 60 AS +>>> consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND +>>> start < TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', 'YYYY-MM-DD +>>> HH24:00:00.0')::timestamp GROUP BY epId, direction, +>>> TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, classid +>>> DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND +>>> ftone.direction = fttemp670743219.direction AND ftone.start = +>>> fttemp670743219.start AND ftone.consolidation = +>>> fttemp670743219.consolidation AND ftone.classid = +>>> fttemp670743219.classid +>>> INSERT INTO ftone ( epId, start, consolidation, direction, classid, +>>> cnt ) SELECT epId, start, consolidation, direction, classid, cnt FROM +>>> fttemp670743219 +>>> DROP TABLE fttemp670743219 +>>> DELETE FROM ftone WHERE consolidation = 0 AND start < +>>> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', +>>> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +>>> 'YYYY-MM-DD 00:00:00.0')::timestamp +>>> +>>> ---------------------------------------------------- +>>> +>>> ftone: 0: +>>> createConsolidatedInTemporary: 188: +>>> CREATE TABLE fttemp678233382 AS SELECT * FROM ftone LIMIT 0 +>>> createConsolidatedInTemporary: 76783: +>>> INSERT INTO fttemp678233382 ( epPairdefnid, start, direction, classid, +>>> consolidation, cnt ) SELECT epPairdefnid, TO_TIMESTAMP(start, +>>> 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, direction, classid, 60 +>>> AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 +>>> AND start < TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +>>> 'YYYY-MM-DD HH24:00:00.0')::timestamp GROUP BY epPairdefnid, +>>> direction, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, +>>> classid +>>> replaceConsolidatedInMainTable: 179178: +>>> DELETE FROM ONLY ftone WHERE ftone.epPairdefnid = +>>> fttemp678233382.epPairdefnid AND ftone.direction = +>>> fttemp678233382.direction AND ftone.start = fttemp678233382.start AND +>>> ftone.consolidation = fttemp678233382.consolidation AND ftone.classid +>>> = fttemp678233382.classid +>>> replaceConsolidatedInMainTable: 61705: +>>> INSERT INTO ftone ( epPairdefnid, start, consolidation, direction, +>>> classid, cnt ) SELECT epPairdefnid, start, consolidation, direction, +>>> classid, cnt FROM fttemp678233382 +>>> consolidate: 2656: +>>> DROP TABLE fttemp678233382 +>>> MAIN LOOP TOTAL consolidate: 320526 +>>> deleteOlderThan: 184616: +>>> DELETE FROM ftone WHERE consolidation = 0 AND start < +>>> TO_TIMESTAMP((TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +>>> 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +>>> 'YYYY-MM-DD 00:00:00.0')::timestamp +>>> MAIN LOOP TOTAL deleteExpiredData: 505142 +>>> MAIN LOOP TOTAL generateStatistics: 515611 +>>> +>>> ---------------------------------------------------- +>>> +>>> Thanks again, +>>> Neil +>>> +>>> +>>> On 11/07/06, Jeff Frost wrote: +>>>> +>>>> +>>>> On Mon, 10 Jul 2006, Neil Hepworth wrote: +>>>> +>>>>> I should also explain that I run through these queries on multiple +>>>>> tables and with some slightly different parameters for the +>>>>> "consolidation" so I run through those 3 queries (or similar) 9 times +>>>>> and this takes a total of about 2 hours, with high CPU usage. And I +>>>>> am running the queries from a remote Java application (using JDBC), +>>>>> the client is using postgresql-8.0-311.jdbc3.jar. The explain +> analyse +>>>>> results I have provided below are from running via pgAdmin, not the +>>>>> Java app (I did a vacuum analyse of the db before running them): +>>>>> +>>>>> +>>>> +>>>> Neil, did you ever answer which version of 7.3 this is? +>>>> +>>>> BTW, you mentioned that this takes 2 hours, but even looping over this +> 9 +>>>> times +>>>> seems like it would only take 9 minutes (55 seconds for the SELECT and +> 4 +>>>> seconds for the DELETE = 59 seconds times 9). Perhaps you should post +> the +>>>> explain analyze for the actual query that takes so long as the planner +>>>> output +>>>> will likely be quite different. +>>>> +>>>> One thing I noticed is that the planner seems quite incorrect about the +>>>> number +>>>> of rows it expects in the SELECT. If you ran vacuum analyze before +> this, +>>>> perhaps your fsm settings are incorrect? What does vacuumdb -a -v +> output +>>>> at +>>>> the end? I'm looking for something that looks like this: +>>>> +>>>> INFO: free space map: 109 relations, 204 pages stored; 1792 total +> pages +>>>> needed +>>>> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB +> shared +>>>> memory. +>>>> +>>>> I see your fsm settings are non-default, so it's also possible I'm not +> used +>>>> to +>>>> reading 7.3's explain analyze output. :-) +>>>> +>>>> Also, what does vmstat output look like while the query is running? +>>>> Perhaps +>>>> you're running into some context switching problems. It would be +>>>> interesting +>>>> to know how the query runs on 8.1.x just to know if we're chasing an +>>>> optimization that's fixed already in a later version. +>>>> +>>>> +>>>>> Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +>>>>> width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) +>>>>> -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +>>>>> time=16861.72..34243.63 rows=560094 loops=1) +>>>>> -> Group (cost=59690.11..61451.32 rows=234827 width=16) +>>>>> (actual time=16861.62..20920.12 rows=709461 loops=1) +>>>>> -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +>>>>> (actual time=16861.62..18081.07 rows=709461 loops=1) +>>>>> Sort Key: eppairdefnid, "start" +>>>>> -> Seq Scan on ftone (cost=0.00..36446.66 +>>>>> rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 +> loops=1) +>>>>> Filter: ((consolidation = 60) AND ("start" < +>>>>> (to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +>>>>> 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +>>>>> Total runtime: 55378.68 msec +>>>> +>>>>> *** For the delete ***: +>>>>> +>>>>> Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +>>>>> time=3767.47..3767.47 rows=0 loops=1) +>>>>> Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +>>>>> -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +>>>>> (actual time=0.04..2299.94 rows=1286333 loops=1) +>>>>> -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +>>>>> time=206.01..206.01 rows=0 loops=1) +>>>>> -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +>>>>> width=4) (actual time=206.00..206.00 rows=0 loops=1) +>>>>> Total runtime: 3767.52 msec +>>>> +>>>> -- +>>>> Jeff Frost, Owner +>>>> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>>>> Phone: 650-780-7908 FAX: 650-649-1954 +>>>> +>>> +>> +>> -- +>> Jeff Frost, Owner +>> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>> Phone: 650-780-7908 FAX: 650-649-1954 +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 4: Have you searched our list archives? +>> +>> http://archives.postgresql.org +>> +> +> +> + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Wed Jul 12 13:55:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 665949FB3CE + for ; + Wed, 12 Jul 2006 13:44:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60521-09 for + ; + Wed, 12 Jul 2006 13:44:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 398829FB3AA + for ; + Wed, 12 Jul 2006 13:44:05 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6CGxYgt011613; Wed, 12 Jul 2006 09:59:34 -0700 +Message-ID: <44B51896.1000808@modgraph-usa.com> +Date: Wed, 12 Jul 2006 08:43:18 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Magnus Hagander +CC: pgsql-performance@postgresql.org +Subject: Re: Kill a session +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> +In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/106 +X-Sequence-Number: 19966 + +Magnus Hagander wrote: +>> This raises the question: Why doesn't Postgres have a "kill +>> session" command that works? Oracle has it, and it's +>> invaluable; there is no substitute. Various writers to these +>> PG lists have raised the question repeatedly. Is it just a +>> matter that nobody has had the time to do it (which I +>> respect!), or is there a reason why the Postgres team decided +>> a "kill session" is a bad idea? +> +> I beleive the function to kill a backend is actually in the codebase, +> it's just commented out because it's considered dangerous. There are +> some possible issues (see -hackers archives) about sending SIGTERM +> without actually shutting down the whole cluster. +> +> Doing the client-side function to call is the easy part. +> +> In many cases you just need to cancel a query, in which case you can use +> pg_cancel_backend() for exmaple. If you need to actually kill it, your +> only supported way is to restart postgresql. + +In other words, are you confirming that there is no way to kill a query from another process, other than shutting down the database? My understanding of the documentation tells me I can't use cancel, because the process doing the killing isn't the original process. + +>> But in spite earlier posting in these forums that say the +>> killing the backend was the way to go, this doesn't really +>> work. First, even though the "postgres" backend job is +>> properly killed, a "postmaster" job keeps running at 99% CPU, +>> which is pretty useless. Killing the client's backend didn't +>> kill the process actually doing the work! +> +> Then you killed the wrong backend... +> No queries run in postmaster. They all run in postgres backends. The +> postmaster does very little actual work, other than keeping track of +> everybody else. + +It turns out I was confused by this: ps(1) reports a process called "postgres", but top(1) reports a process called "postmaster", but they both have the same pid. I guess postmaster replaces its own name in the process table when it's executing a query, and it's not really the postmaster even though top(1) calls it postmaster. + +So "kill -15 " is NOT killing the process -- to kill the process, I have to use signal 9. But if I do that, ALL queries in progress are aborted. I might as well shut down and restart the database, which is an unacceptable solution for a web site. + +I'm back to my original question: How do you kill a runaway query without bringing down the whole database? Is there really no answer to this? + +Thanks, +Craig + +From pgsql-performance-owner@postgresql.org Wed Jul 12 14:04:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8724C9FB3AA + for ; + Wed, 12 Jul 2006 13:43:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63831-01 for + ; + Wed, 12 Jul 2006 13:42:52 -0300 (ADT) +X-Greylist: delayed 00:24:55.932763 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 596849FB3F6 + for ; + Wed, 12 Jul 2006 13:42:51 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp1.smiths.com (smtp1.smiths.com [192.208.34.50]) + by svr4.postgresql.org (Postfix) with ESMTP id 749985AF02A + for ; + Wed, 12 Jul 2006 16:17:54 +0000 (GMT) +Received: from COSSMGIMS03.EMAIL.CORP.TLD (cossmgims03.email.corp.tld + [10.225.225.145]) + by smtp1.smiths.com (Postfix) with ESMTP id 3362332D3E + for ; + Wed, 12 Jul 2006 10:17:53 -0600 (MDT) +Received: from COSSMGMBX04.EMAIL.CORP.TLD ([10.225.225.26]) by + COSSMGFEB02.EMAIL.CORP.TLD with Microsoft SMTPSVC(6.0.3790.1830); + Wed, 12 Jul 2006 10:17:52 -0600 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Subject: Commit slower on faster PC +Date: Wed, 12 Jul 2006 10:16:40 -0600 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Commit slower on faster PC +Thread-Index: Acalzo76eF5fXbRvSwWike7y2iYVTA== +From: "Koth, Christian (DWBI)" +To: +X-OriginalArrivalTime: 12 Jul 2006 16:17:52.0104 (UTC) + FILETIME=[B985D680:01C6A5CE] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/107 +X-Sequence-Number: 19967 + + +Hi, + +please help me with the following problem: + +I have noticed a strange performance behaviour using a commit statement on= + two different machines. On one of the machines the commit is many times= + faster than on the other machine which has faster hardware. Server and= + client are running always on the same machine. + +Server version (same on both machines): PostgreSQL 8.1.3. (same binaries as= + well) + +PC1:=0D +---- +Pentium 4 (2.8 GHz) +1GB RAM +IDE-HDD (approx. 50 MB/s rw), fs: ext3 +Mandrake Linux: Kernel 2.4.22 + + +PC2: +---- +Pentium 4 (3.0 GHz) +2GB RAM +SCSI-HDD (approx. 65 MB/s rw), fs: ext3 +Mandrake Linux: Kernel 2.4.32 + + +Both installations of the database have the same configuration, different= + from default are only the following settings on both machines: + +shared_buffers =3D 20000 +listen_addresses =3D '*' +max_stack_depth =3D 4096 + + +pgbench gives me the following results: +PC1: +---- +transaction type: TPC-B (sort of) +scaling factor: 1 +number of clients: 1 +number of transactions per client: 10 +number of transactions actually processed: 10/10 +tps =3D 269.905533 (including connections establishing) +tps =3D 293.625393 (excluding connections establishing) + +PC2: +---- +transaction type: TPC-B (sort of) +scaling factor: 1 +number of clients: 1 +number of transactions per client: 10 +number of transactions actually processed: 10/10 +tps =3D 46.061935 (including connections establishing) +tps =3D 46.519634 (excluding connections establishing) + + +My own performance test sql script which inserts and (auto)commits some= + data into a simple table produces the following log output in the server= + log: + +PC1: +---- +LOG: duration: 1.441 ms statement: INSERT INTO performance_test VALUES= + (500938362, 'Xawhefjmd'); +STATEMENT: INSERT INTO performance_test VALUES (500938362, 'Xawhefjmd'); + +PC2: +---- +LOG: duration: 29.979 ms statement: INSERT INTO performance_test VALUES= + (500938362, 'Xawhefjmd'); +STATEMENT: INSERT INTO performance_test VALUES (500938362, 'Xawhefjmd'); + + +I created a 'strace' one both machines which is interesting: + +Opening the socket: +------------------- +PC1: socket(PF_INET, SOCK_STREAM, IPPROTO_IP) =3D 10 <0.000021> +PC2: socket(PF_INET, SOCK_STREAM, IPPROTO_IP) =3D 8 <0.000015> + +PC1: bind(10, {sa_family=3DAF_INET, sin_port=3Dhtons(0), sin_addr= +=3Dinet_addr("0.0.0.0")}, 16) =3D 0 <0.000007> +PC2: bind (8, {sin_family=3DAF_INET, sin_port=3Dhtons(0), sin_addr= +=3Dinet_addr("0.0.0.0")}}, 16) =3D 0 <0.000007> + +PC1: getsockname(10, {sa_family=3DAF_INET, sin_port=3Dhtons(32820),= + sin_addr=3Dinet_addr("0.0.0.0")}, [16]) =3D 0 <0.000005> +PC2: getsockname( 8, {sin_family=3DAF_INET, sin_port=3Dhtons(36219),= + sin_addr=3Dinet_addr("0.0.0.0")}}, [16]) =3D 0 <0.000005> + +PC1: connect(10, {sa_family=3DAF_INET, sin_port=3Dhtons(5432), sin_addr= +=3Dinet_addr("127.0.0.1")}, 16) =3D 0 <0.000440> +PC2: connect( 8, {sin_family=3DAF_INET, sin_port=3Dhtons(5432), sin_addr= +=3Dinet_addr("127.0.0.1")}}, 16) =3D 0 <0.000394> + +PC1: setsockopt(10, SOL_TCP, TCP_NODELAY, [1], 4) =3D 0 <0.000006> +PC2: setsockopt (8, SOL_TCP, TCP_NODELAY, [1], 4) =3D 0 <0.000004> + + +Inserting and commiting the data: +--------------------------------- +PC1: +---- +send(10, "B\....\0<\0INSERT INTO performance_test VAL"..., 175, 0) =3D 175= + <0.000015> +recv(10, "2\....0\17INSERT 0 1\0Z\0\0\0\5T", 8192, 0) =3D 53 <0.000007> +send(10, "B\0\0\0\17\0S_2\0\0\0\0\0\0\0E\0\0\0\t\0\0\0\0\1S\0\0\0\4", 31,= + 0) =3D 31 <0.000011> +recv(10, "2\0\0\0\4C\0\0\0\vCOMMIT\0Z\0\0\0\5I", 8192, 0) =3D 23 <0.000211> + +PC2: +---- +send(8, "B\....\0<\0INSERT INTO performance_test VAL"..., 175, 0) =3D 175= + <0.000014> +recv(8, "2\....0\17INSERT 0 1\0Z\0\0\0\5T", 8192, 0) =3D 53 <0.000005> +send(8, "B\0\0\0\17\0S_2\0\0\0\0\0\0\0E\0\0\0\t\0\0\0\0\1S\0\0\0\4", 31, 0)= + =3D 31 <0.000009> +recv(8, "2\0\0\0\4C\0\0\0\vCOMMIT\0Z\0\0\0\5I", 8192, 0) =3D 23 <0.0253> + +Every command is a bit faster on PC2 except the last one which is many= + times slower. +Any help or hint where to look at would be highly appreciated because I'm= + running out of ideas ;-). + + +regards, +Christian + + +****************************************** +The information contained in, or attached to, this e-mail, may contain= + confidential information and is intended solely for the use of the= + individual or entity to whom they are addressed and may be subject to= + legal privilege. If you have received this e-mail in error you should= + notify the sender immediately by reply e-mail, delete the message from= + your system and notify your system manager. Please do not copy it for any= + purpose, or disclose its contents to any other person. The views or= + opinions presented in this e-mail are solely those of the author and do= + not necessarily represent those of the company. The recipient should= + check this e-mail and any attachments for the presence of viruses. The= + company accepts no liability for any damage caused, directly or= + indirectly, by any virus transmitted in this email. +****************************************** + +From pgsql-performance-owner@postgresql.org Wed Jul 12 16:29:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 17B769FB419 + for ; + Wed, 12 Jul 2006 14:40:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75355-01 for + ; + Wed, 12 Jul 2006 14:40:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id F329E9FB3F1 + for ; + Wed, 12 Jul 2006 14:40:40 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6CHuAJY012891 + for ; Wed, 12 Jul 2006 10:56:10 -0700 +Message-ID: <44B525DA.5080800@modgraph-usa.com> +Date: Wed, 12 Jul 2006 09:39:54 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: [Fwd: Delivery Status Notification (Failure)] +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/114 +X-Sequence-Number: 19974 + +I can't find an address to complain about the mailing list itself, so apologies but I'm posting directly to this list. Every time I post to this group, I get returned mails about OTHER subscribers' invalid accounts, like the one below. What's up? This seems to be a new phenomenon. Should the postmaster@postgresql.org be getting these and discarding them? + +Thanks, +Craig + + +-------- Original Message -------- +Subject: Delivery Status Notification (Failure) +Date: Wed, 12 Jul 2006 13:15:16 -0400 +From: postmaster@usaemail.enpocket.com +To: cjames@modgraph-usa.com + +This is an automatically generated Delivery Status Notification. + +Delivery to the following recipients failed. + + martin@usaemail.enpocket.com + + + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 14:06:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7208C9FB400 + for ; + Wed, 12 Jul 2006 14:05:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 67330-02 for + ; + Wed, 12 Jul 2006 14:05:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id B63FA9FB3E2 + for ; + Wed, 12 Jul 2006 14:05:30 -0300 (ADT) +Received: from trofast.sesse.net ([129.241.93.32]) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1G0i9P-0004l4-4i + for pgsql-performance@postgresql.org; Wed, 12 Jul 2006 19:05:28 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1G0i84-00078X-00 + for ; Wed, 12 Jul 2006 19:04:04 +0200 +Date: Wed, 12 Jul 2006 19:04:04 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: Kill a session +Message-ID: <20060712170404.GA27392@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <44B51896.1000808@modgraph-usa.com> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/108 +X-Sequence-Number: 19968 + +On Wed, Jul 12, 2006 at 08:43:18AM -0700, Craig A. James wrote: +>> Then you killed the wrong backend... +>> No queries run in postmaster. They all run in postgres backends. The +>> postmaster does very little actual work, other than keeping track of +>> everybody else. +> +> It turns out I was confused by this: ps(1) reports a process called +> "postgres", but top(1) reports a process called "postmaster", but they both +> have the same pid. I guess postmaster replaces its own name in the process +> table when it's executing a query, and it's not really the postmaster even +> though top(1) calls it postmaster. +> +> So "kill -15 " is NOT killing the process -- to kill the process, I +> have to use signal 9. But if I do that, ALL queries in progress are +> aborted. I might as well shut down and restart the database, which is an +> unacceptable solution for a web site. + +I don't follow your logic here. If you do "kill -15 " of the postmaster +doing the work, the query should be aborted without taking down the entire +cluster. I don't see why you'd need -9 (which is a really bad idea anyhow)... + +> I'm back to my original question: How do you kill a runaway query without +> bringing down the whole database? Is there really no answer to this? + +Kill it with -15. If you're worried about your CGI scripts, use sudo or some +sort of client/server solution. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Wed Jul 12 15:24:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6A8DA9FB3B8 + for ; + Wed, 12 Jul 2006 14:20:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71139-04 for + ; + Wed, 12 Jul 2006 14:20:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx-2.sollentuna.net (mx-2.sollentuna.net [195.84.163.199]) + by postgresql.org (Postfix) with ESMTP id 5AEAF9FB39E + for ; + Wed, 12 Jul 2006 14:20:36 -0300 (ADT) +Received: from ALGOL.sollentuna.se (janus.sollentuna.se [62.65.68.67]) + by mx-2.sollentuna.net (Postfix) with ESMTP + id 1E19DF4073; Wed, 12 Jul 2006 19:20:35 +0200 (CEST) +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Subject: Re: Kill a session +Date: Wed, 12 Jul 2006 19:20:38 +0200 +Message-ID: <6BCB9D8A16AC4241919521715F4D8BCEA0FAF4@algol.sollentuna.se> +In-Reply-To: <44B51896.1000808@modgraph-usa.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Kill a session +thread-index: Acal0ma1u/0BDXR8S1+rs6xhGdVkeAABMFnw +From: "Magnus Hagander" +To: "Craig A. James" +Cc: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/111 +X-Sequence-Number: 19971 + +> > I beleive the function to kill a backend is actually in the=20 +> codebase,=20 +> > it's just commented out because it's considered dangerous.=20 +> There are=20 +> > some possible issues (see -hackers archives) about sending SIGTERM=20 +> > without actually shutting down the whole cluster. +> >=20 +> > Doing the client-side function to call is the easy part. +> >=20 +> > In many cases you just need to cancel a query, in which=20 +> case you can=20 +> > use +> > pg_cancel_backend() for exmaple. If you need to actually=20 +> kill it, your=20 +> > only supported way is to restart postgresql. +>=20 +> In other words, are you confirming that there is no way to=20 +> kill a query from another process, other than shutting down=20 +> the database? My understanding of the documentation tells me=20 +> I can't use cancel, because the process doing the killing=20 +> isn't the original process. + +You can't kill another backend, no. +You can *cancel* a query on it and return it to idle state. See +http://www.postgresql.org/docs/8.1/interactive/functions-admin.html, +pg_cancel_backend(). + + +> So "kill -15 " is NOT killing the process -- to kill the=20 +> process, I have to use signal 9. But if I do that, ALL=20 +> queries in progress are aborted. I might as well shut down=20 +> and restart the database, which is an unacceptable solution=20 +> for a web site. +>=20 +> I'm back to my original question: How do you kill a runaway=20 +> query without bringing down the whole database? Is there=20 +> really no answer to this? + +Runaway queries can be killed with pg_cancel_backend(), or from the +commandline using kill -INT . The backend will still be around, but +it will have cancelled the query. + +//Magnus + +From pgsql-performance-owner@postgresql.org Wed Jul 12 14:26:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2949E9FB3F1 + for ; + Wed, 12 Jul 2006 14:26:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72221-05 for + ; + Wed, 12 Jul 2006 14:26:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 971539FB3D3 + for ; + Wed, 12 Jul 2006 14:26:33 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 12 Jul 2006 10:26:31 -0700 +Subject: Re: Commit slower on faster PC +From: Mark Lewis +To: "Koth, Christian (DWBI)" +Cc: pgsql-performance@postgresql.org +In-Reply-To: + +References: + +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Wed, 12 Jul 2006 10:26:31 -0700 +Message-Id: <1152725191.30994.433.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/109 +X-Sequence-Number: 19969 + +The IDE drive is almost certainly lying about flushing data to the disk. +Lower-end consumer drives often do. + +What this means is that commits will be a whole lot faster, but the +database loses its ACID guarantees, because a power failure at the wrong +moment could corrupt the whole database. + +If you don't care about your data and want the SCSI drive to perform +fast just like the IDE drive, you can set fsync = off in your +configuration file. + +-- Mark + +On Wed, 2006-07-12 at 10:16 -0600, Koth, Christian (DWBI) wrote: +> Hi, +> +> please help me with the following problem: +> +> I have noticed a strange performance behaviour using a commit statement on two different machines. On one of the machines the commit is many times faster than on the other machine which has faster hardware. Server and client are running always on the same machine. +> +> Server version (same on both machines): PostgreSQL 8.1.3. (same binaries as well) +> +> PC1: +> ---- +> Pentium 4 (2.8 GHz) +> 1GB RAM +> IDE-HDD (approx. 50 MB/s rw), fs: ext3 +> Mandrake Linux: Kernel 2.4.22 +> +> +> PC2: +> ---- +> Pentium 4 (3.0 GHz) +> 2GB RAM +> SCSI-HDD (approx. 65 MB/s rw), fs: ext3 +> Mandrake Linux: Kernel 2.4.32 +> +> +> Both installations of the database have the same configuration, different from default are only the following settings on both machines: +> +> shared_buffers = 20000 +> listen_addresses = '*' +> max_stack_depth = 4096 +> +> +> pgbench gives me the following results: +> PC1: +> ---- +> transaction type: TPC-B (sort of) +> scaling factor: 1 +> number of clients: 1 +> number of transactions per client: 10 +> number of transactions actually processed: 10/10 +> tps = 269.905533 (including connections establishing) +> tps = 293.625393 (excluding connections establishing) +> +> PC2: +> ---- +> transaction type: TPC-B (sort of) +> scaling factor: 1 +> number of clients: 1 +> number of transactions per client: 10 +> number of transactions actually processed: 10/10 +> tps = 46.061935 (including connections establishing) +> tps = 46.519634 (excluding connections establishing) +> +> +> My own performance test sql script which inserts and (auto)commits some data into a simple table produces the following log output in the server log: +> +> PC1: +> ---- +> LOG: duration: 1.441 ms statement: INSERT INTO performance_test VALUES (500938362, 'Xawhefjmd'); +> STATEMENT: INSERT INTO performance_test VALUES (500938362, 'Xawhefjmd'); +> +> PC2: +> ---- +> LOG: duration: 29.979 ms statement: INSERT INTO performance_test VALUES (500938362, 'Xawhefjmd'); +> STATEMENT: INSERT INTO performance_test VALUES (500938362, 'Xawhefjmd'); +> +> +> I created a 'strace' one both machines which is interesting: +> +> Opening the socket: +> ------------------- +> PC1: socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 10 <0.000021> +> PC2: socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 8 <0.000015> +> +> PC1: bind(10, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 <0.000007> +> PC2: bind (8, {sin_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}}, 16) = 0 <0.000007> +> +> PC1: getsockname(10, {sa_family=AF_INET, sin_port=htons(32820), sin_addr=inet_addr("0.0.0.0")}, [16]) = 0 <0.000005> +> PC2: getsockname( 8, {sin_family=AF_INET, sin_port=htons(36219), sin_addr=inet_addr("0.0.0.0")}}, [16]) = 0 <0.000005> +> +> PC1: connect(10, {sa_family=AF_INET, sin_port=htons(5432), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 <0.000440> +> PC2: connect( 8, {sin_family=AF_INET, sin_port=htons(5432), sin_addr=inet_addr("127.0.0.1")}}, 16) = 0 <0.000394> +> +> PC1: setsockopt(10, SOL_TCP, TCP_NODELAY, [1], 4) = 0 <0.000006> +> PC2: setsockopt (8, SOL_TCP, TCP_NODELAY, [1], 4) = 0 <0.000004> +> +> +> Inserting and commiting the data: +> --------------------------------- +> PC1: +> ---- +> send(10, "B\....\0<\0INSERT INTO performance_test VAL"..., 175, 0) = 175 <0.000015> +> recv(10, "2\....0\17INSERT 0 1\0Z\0\0\0\5T", 8192, 0) = 53 <0.000007> +> send(10, "B\0\0\0\17\0S_2\0\0\0\0\0\0\0E\0\0\0\t\0\0\0\0\1S\0\0\0\4", 31, 0) = 31 <0.000011> +> recv(10, "2\0\0\0\4C\0\0\0\vCOMMIT\0Z\0\0\0\5I", 8192, 0) = 23 <0.000211> +> +> PC2: +> ---- +> send(8, "B\....\0<\0INSERT INTO performance_test VAL"..., 175, 0) = 175 <0.000014> +> recv(8, "2\....0\17INSERT 0 1\0Z\0\0\0\5T", 8192, 0) = 53 <0.000005> +> send(8, "B\0\0\0\17\0S_2\0\0\0\0\0\0\0E\0\0\0\t\0\0\0\0\1S\0\0\0\4", 31, 0) = 31 <0.000009> +> recv(8, "2\0\0\0\4C\0\0\0\vCOMMIT\0Z\0\0\0\5I", 8192, 0) = 23 <0.0253> +> +> Every command is a bit faster on PC2 except the last one which is many times slower. +> Any help or hint where to look at would be highly appreciated because I'm running out of ideas ;-). +> +> +> regards, +> Christian +> +> +> ****************************************** +> The information contained in, or attached to, this e-mail, may contain confidential information and is intended solely for the use of the individual or entity to whom they are addressed and may be subject to legal privilege. If you have received this e-mail in error you should notify the sender immediately by reply e-mail, delete the message from your system and notify your system manager. Please do not copy it for any purpose, or disclose its contents to any other person. The views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the company. The recipient should check this e-mail and any attachments for the presence of viruses. The company accepts no liability for any damage caused, directly or indirectly, by any virus transmitted in this email. +> ****************************************** +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + +From pgsql-performance-owner@postgresql.org Wed Jul 12 14:52:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 60A399FB3E4 + for ; + Wed, 12 Jul 2006 14:27:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71194-08 for + ; + Wed, 12 Jul 2006 14:26:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from druid.net (druid.net [66.96.28.249]) + by postgresql.org (Postfix) with ESMTP id 352BD9FB3D3 + for ; + Wed, 12 Jul 2006 14:26:58 -0300 (ADT) +Received: from dilbert (H245.C18.B96.tor.eicat.ca [66.96.18.245]) + by druid.net (Postfix) with SMTP id 56232B473; + Wed, 12 Jul 2006 13:26:59 -0400 (EDT) +Date: Wed, 12 Jul 2006 13:26:57 -0400 +From: "D'Arcy J.M. Cain" +To: "Koth, Christian (DWBI)" +Cc: pgsql-performance@postgresql.org +Subject: Re: Commit slower on faster PC +Message-Id: <20060712132657.f733a393.darcy@druid.net> +In-Reply-To: + +References: + +X-Mailer: Sylpheed version 2.2.6 (GTK+ 2.8.18; i386--netbsdelf) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/110 +X-Sequence-Number: 19970 + +On Wed, 12 Jul 2006 10:16:40 -0600 +"Koth, Christian (DWBI)" wrote: +> I have noticed a strange performance behaviour using a commit statement on two different machines. On one of the machines the commit is many times faster than on the other machine which has faster hardware. Server and client are running always on the same machine. +> +> Server version (same on both machines): PostgreSQL 8.1.3. (same binaries as well) +> +> PC1: +> ---- +> Pentium 4 (2.8 GHz) +> 1GB RAM +> IDE-HDD (approx. 50 MB/s rw), fs: ext3 +> Mandrake Linux: Kernel 2.4.22 +> +> +> PC2: +> ---- +> Pentium 4 (3.0 GHz) +> 2GB RAM +> SCSI-HDD (approx. 65 MB/s rw), fs: ext3 +> Mandrake Linux: Kernel 2.4.32 +> +> +> Both installations of the database have the same configuration, different from default are only the following settings on both machines: +> +> shared_buffers = 20000 +> listen_addresses = '*' +> max_stack_depth = 4096 +> +> +> pgbench gives me the following results: +> PC1: +> ---- +> transaction type: TPC-B (sort of) +> scaling factor: 1 +> number of clients: 1 +> number of transactions per client: 10 +> number of transactions actually processed: 10/10 +> tps = 269.905533 (including connections establishing) +> tps = 293.625393 (excluding connections establishing) +> +> PC2: +> ---- +> transaction type: TPC-B (sort of) +> scaling factor: 1 +> number of clients: 1 +> number of transactions per client: 10 +> number of transactions actually processed: 10/10 +> tps = 46.061935 (including connections establishing) +> tps = 46.519634 (excluding connections establishing) + +I'm not sure 10 transactions is enough of a test. You could just be +seeing the result of your IDE drive lying to you about actually writing +your data. There may be other considerations but I would start with +checking with 10,000 or 100,000 transactions to overcome the driver +buffering. + +-- +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 Wed Jul 12 16:32:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 56BB19FB3F1 + for ; + Wed, 12 Jul 2006 14:39:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 72603-09 for + ; + Wed, 12 Jul 2006 14:39:39 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cronos.madness.at (madness.at [217.196.146.217]) + by postgresql.org (Postfix) with ESMTP id AD2EC9FB419 + for ; + Wed, 12 Jul 2006 14:39:39 -0300 (ADT) +Received: from mastermind.kaltenbrunner.cc ([83.215.233.60]) + by cronos.madness.at with esmtpsa (TLSv1:AES256-SHA:256) + (Exim 4.62 (FreeBSD)) (envelope-from ) + id 1G0igM-000EOB-Sm; Wed, 12 Jul 2006 19:39:35 +0200 +Message-ID: <44B533D2.2010203@kaltenbrunner.cc> +Date: Wed, 12 Jul 2006 19:39:30 +0200 +From: Stefan Kaltenbrunner +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: "Craig A. James" +CC: Magnus Hagander , + pgsql-performance@postgresql.org +Subject: Re: Kill a session +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> +In-Reply-To: <44B51896.1000808@modgraph-usa.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/115 +X-Sequence-Number: 19975 + +Craig A. James wrote: +> Magnus Hagander wrote: +>>> This raises the question: Why doesn't Postgres have a "kill session" +>>> command that works? Oracle has it, and it's invaluable; there is no +>>> substitute. Various writers to these PG lists have raised the +>>> question repeatedly. Is it just a matter that nobody has had the +>>> time to do it (which I respect!), or is there a reason why the +>>> Postgres team decided a "kill session" is a bad idea? +>> +>> I beleive the function to kill a backend is actually in the codebase, +>> it's just commented out because it's considered dangerous. There are +>> some possible issues (see -hackers archives) about sending SIGTERM +>> without actually shutting down the whole cluster. +>> +>> Doing the client-side function to call is the easy part. +>> +>> In many cases you just need to cancel a query, in which case you can use +>> pg_cancel_backend() for exmaple. If you need to actually kill it, your +>> only supported way is to restart postgresql. +> +> In other words, are you confirming that there is no way to kill a query +> from another process, other than shutting down the database? My +> understanding of the documentation tells me I can't use cancel, because +> the process doing the killing isn't the original process. +> +>>> But in spite earlier posting in these forums that say the killing the +>>> backend was the way to go, this doesn't really work. First, even +>>> though the "postgres" backend job is properly killed, a "postmaster" +>>> job keeps running at 99% CPU, which is pretty useless. Killing the +>>> client's backend didn't kill the process actually doing the work! +>> +>> Then you killed the wrong backend... +>> No queries run in postmaster. They all run in postgres backends. The +>> postmaster does very little actual work, other than keeping track of +>> everybody else. +> +> It turns out I was confused by this: ps(1) reports a process called +> "postgres", but top(1) reports a process called "postmaster", but they +> both have the same pid. I guess postmaster replaces its own name in the +> process table when it's executing a query, and it's not really the +> postmaster even though top(1) calls it postmaster. +> +> So "kill -15 " is NOT killing the process -- to kill the process, I +> have to use signal 9. But if I do that, ALL queries in progress are +> aborted. I might as well shut down and restart the database, which is +> an unacceptable solution for a web site. +> +> I'm back to my original question: How do you kill a runaway query +> without bringing down the whole database? Is there really no answer to +> this? + +are you maybe looking for pg_cancel_backend() ? + +http://www.postgresql.org/docs/current/interactive/functions-admin.html#FUNCTIONS-ADMIN-SIGNAL-TABLE + +Stefan + +From pgsql-performance-owner@postgresql.org Wed Jul 12 16:16:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8060B9FB453 + for ; + Wed, 12 Jul 2006 14:46:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75236-05 for + ; + Wed, 12 Jul 2006 14:46:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 4A28A9FB3B5 + for ; + Wed, 12 Jul 2006 14:46:06 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k6CHk5GN019549; Wed, 12 Jul 2006 10:46:07 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +To: pgsql-performance@postgresql.org +Subject: Re: Commit slower on faster PC +Date: Wed, 12 Jul 2006 10:46:05 -0700 +User-Agent: KMail/1.9.1 +Cc: "Koth, Christian (DWBI)" +References: + +In-Reply-To: + +XIDTRACK: jd@commandprompt.com +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200607121046.05709.jd@commandprompt.com> +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Wed, 12 Jul 2006 10:46:08 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/113 +X-Sequence-Number: 19973 + +On Wednesday 12 July 2006 09:16, Koth, Christian (DWBI) wrote: +> Hi, +> +> please help me with the following problem: +> +> I have noticed a strange performance behaviour using a commit statement on +> two different machines. On one of the machines the commit is many times +> faster than on the other machine which has faster hardware. Server and +> client are running always on the same machine. +> +> Server version (same on both machines): PostgreSQL 8.1.3. (same binaries as +> well) + +Heh, I bet you are being bit by the cache on the IDE drive. What happens if +you turn fsync off? + +Sincerely, + +Joshua D. Drake +-- + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 15:38:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E7FBF9FB256 + for ; + Wed, 12 Jul 2006 15:35:50 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 09275-09 for + ; + Wed, 12 Jul 2006 15:35:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from srv-external.emprisanetworks.com + (static-138-88-161-105.res.east.verizon.net [138.88.161.105]) + by postgresql.org (Postfix) with ESMTP id 556A59FB250 + for ; + Wed, 12 Jul 2006 15:35:45 -0300 (ADT) +Received: from EmprisaNetworks.com (srv-external [10.1.1.10]) + by srv-external.emprisanetworks.com (8.12.8/8.12.5) with SMTP id + k6CIaR1P019760 + for ; Wed, 12 Jul 2006 14:36:27 -0400 +Received: from 10.1.1.126 (SquirrelMail authenticated user smcwilliams) + by portal.emprisanetworks.com with HTTP; + Wed, 12 Jul 2006 14:36:27 -0400 (EDT) +Message-ID: <3985.10.1.1.126.1152729387.squirrel@portal.emprisanetworks.com> +Date: Wed, 12 Jul 2006 14:36:27 -0400 (EDT) +Subject: size of pg_dump files containing bytea values +From: "Steve McWilliams" +To: +X-Priority: 3 +Importance: Normal +X-Mailer: SquirrelMail (version 1.2.11 [cvs]) +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/112 +X-Sequence-Number: 19972 + +I notice that non-printables in bytea values are being spit out by pg_dump +using escaped octet sequences even when the "-Fc" option is present +specifying use of the custom binary output format rather than plain text +format. This bloats the size of bytea values in the dump file by a factor +of 3+ typically. When you have alot of large bytea values in your db this +can add up very quickly. + +Shouldn't the custom format be smart and just write the raw bytes to the +output file rather than trying to make them ascii readable? + +Thanks. + +Steve McWilliams +Software Engineer +Emprisa Networks +703-691-0433x21 +smcwilliams@emprisanetworks.com + +The information contained in this communication is intended only for the +use of the recipient named above, and may be legally privileged, +confidential and exempt from disclosure under applicable law. If the +reader of this communication is not the intended recipient, you are hereby +notified that any dissemination, distribution or copying of this +communication, or any of its contents, is strictly prohibited. If you have +received this communication in error, please resend this communication to +the sender and delete the original communication and any copy of it from +your computer system. Thank you. + + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 17:53:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5A0159FB388 + for ; + Wed, 12 Jul 2006 16:51:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93196-03-2 + for ; + Wed, 12 Jul 2006 16:51:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 2508A9FB47C + for ; + Wed, 12 Jul 2006 16:50:39 -0300 (ADT) +Received: (qmail 7758 invoked by uid 500); 12 Jul 2006 19:25:39 -0000 +Date: Wed, 12 Jul 2006 14:25:39 -0500 +From: Bruno Wolff III +To: "Koth, Christian \(DWBI\)" +Cc: pgsql-performance@postgresql.org +Subject: Re: Commit slower on faster PC +Message-ID: <20060712192539.GD29575@wolff.to> +Mail-Followup-To: Bruno Wolff III , + "Koth, Christian (DWBI)" , + pgsql-performance@postgresql.org +References: + +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/117 +X-Sequence-Number: 19977 + +On Wed, Jul 12, 2006 at 10:16:40 -0600, + "Koth, Christian (DWBI)" wrote: +> +> I have noticed a strange performance behaviour using a commit statement on two different machines. On one of the machines the commit is many times faster than on the other machine which has faster hardware. Server and client are running always on the same machine. +> +> Server version (same on both machines): PostgreSQL 8.1.3. (same binaries as well) +> +> PC1: +> ---- +> IDE-HDD (approx. 50 MB/s rw), fs: ext3 +> +> PC2: +> ---- +> SCSI-HDD (approx. 65 MB/s rw), fs: ext3 +> +> Both installations of the database have the same configuration, different from default are only the following settings on both machines: +> +> pgbench gives me the following results: +> PC1: +> ---- +> tps = 293.625393 (excluding connections establishing) +> +> PC2: +> ---- +> tps = 46.519634 (excluding connections establishing) + +Have you checked to see if the ide drive is lying about having written the +data to the platters? + +From pgsql-performance-owner@postgresql.org Wed Jul 12 17:26:54 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 27FBF9FB217 + for ; + Wed, 12 Jul 2006 17:23:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33306-05 for + ; + Wed, 12 Jul 2006 17:23:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from grzm.com (grzm.com [200.46.204.98]) + by postgresql.org (Postfix) with ESMTP id DD45D9FB1FD + for ; + Wed, 12 Jul 2006 17:23:13 -0300 (ADT) +Received: from localhost (unknown [200.46.208.251]) + by grzm.com (Postfix) with ESMTP id EACE1127E14E + for ; + Wed, 12 Jul 2006 21:23:10 +0100 (BST) +Received: from grzm.com ([200.46.204.98]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 46205-04; Wed, 12 Jul 2006 17:23:10 -0300 (ADT) +Received: from [192.168.0.106] (12-226-29-139.client.mchsi.com + [12.226.29.139]) + by grzm.com (Postfix) with ESMTP id 55CBA127C525; + Wed, 12 Jul 2006 21:23:07 +0100 (BST) +In-Reply-To: <44B525DA.5080800@modgraph-usa.com> +References: <44B525DA.5080800@modgraph-usa.com> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Michael Glaesemann +Subject: Re: [Fwd: Delivery Status Notification (Failure)] +Date: Wed, 12 Jul 2006 15:23:06 -0500 +To: Craig A. James +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/116 +X-Sequence-Number: 19976 + + +On Jul 12, 2006, at 11:39 , Craig A. James wrote: + +> I can't find an address to complain about the mailing list itself, +> so apologies but I'm posting directly to this list. Every time I +> post to this group, I get returned mails about OTHER subscribers' +> invalid accounts, like the one below. + +Is this when you're replying to a post or creating a new post? If the +former, and you're using reply-to-all, you'll be sending one message +to the list and another directly to the poster of the message you're +responding to. The directly sent message is outside of the list +entirely, so any returned mail is also outside of the list. I've seen +this happen occasionally myself. Could this be what you're seeing? +AFAICT, such messages sent to the list *do* get filtered out. + +Michael Glaesemann +grzm seespotcode net + + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 18:51:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BDCFE9FB229 + for ; + Wed, 12 Jul 2006 17:39:07 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68919-03 for + ; + Wed, 12 Jul 2006 17:38:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web31804.mail.mud.yahoo.com (web31804.mail.mud.yahoo.com + [68.142.207.67]) by postgresql.org (Postfix) with SMTP id 6176F9FB217 + for ; + Wed, 12 Jul 2006 17:38:56 -0300 (ADT) +Received: (qmail 55217 invoked by uid 60001); 12 Jul 2006 20:38:55 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=EPF1Ov3VGwlLgWsjW7E9H5cgvUEl+4hmOKr3ymvF1/QhNglkAyPjjTtRNCMcW/PuFFXwdJsuPq74jLAHzN8wfSqFijNYTTHJlxqHZuMO5wxlWmgwy29yDeDgQV0r60jFXOCOPc7j8vNQjo/eacaGbNi7Zb35BsJPFAla0HVokRY= + ; +Message-ID: <20060712203855.55215.qmail@web31804.mail.mud.yahoo.com> +Received: from [63.203.180.122] by web31804.mail.mud.yahoo.com via HTTP; + Wed, 12 Jul 2006 13:38:55 PDT +Date: Wed, 12 Jul 2006 13:38:55 -0700 (PDT) +From: Richard Broersma Jr +Subject: Re: [Fwd: Delivery Status Notification (Failure)] +To: "Craig A. James" , + pgsql-performance@postgresql.org +In-Reply-To: <44B525DA.5080800@modgraph-usa.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/120 +X-Sequence-Number: 19980 + +> I can't find an address to complain about the mailing list itself, so apologies but I'm posting +> directly to this list. Every time I post to this group, I get returned mails about OTHER +> subscribers' invalid accounts, like the one below. What's up? This seems to be a new +> phenomenon. Should the postmaster@postgresql.org be getting these and discarding them? +> +> Thanks, +> Craig + +Does the message come from postgresql.org or is the bounced email coming from these specific users +when you include them in reply-all? + +Regards, + +Richard Broersma jr. + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 18:19:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1B5EB9FB229 + for ; + Wed, 12 Jul 2006 17:41:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 56695-06 for + ; + Wed, 12 Jul 2006 17:40:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from glacier.frostconsultingllc.com (glacier.frostconsultingllc.com + [64.127.99.90]) by postgresql.org (Postfix) with ESMTP id 0CB989FB217 + for ; + Wed, 12 Jul 2006 17:40:46 -0300 (ADT) +Received: from localhost ([127.0.0.1]:56430) + by glacier.frostconsultingllc.com with esmtp (Exim 4.62) + (envelope-from ) + id 1G0lVl-0004Qi-1S; Wed, 12 Jul 2006 13:40:45 -0700 +Date: Wed, 12 Jul 2006 13:40:45 -0700 (PDT) +From: Jeff Frost +To: Neil Hepworth +cc: pgsql-performance@postgresql.org +Subject: Re: High CPU Usage - PostgreSQL 7.3 +In-Reply-To: <5a6f767a0607112048w2d492056y7796aa28a9aa3ea9@mail.gmail.com> +Message-ID: + +References: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> + + <5a6f767a0607100055w2677d4c2u8597e394206e86d1@mail.gmail.com> + <5a6f767a0607100212p55050c79lc456013f90d2c7bc@mail.gmail.com> + + <5a6f767a0607112008m696a326bwe6425edf0455e390@mail.gmail.com> + + <5a6f767a0607112048w2d492056y7796aa28a9aa3ea9@mail.gmail.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-SA-Exim-Connect-IP: 127.0.0.1 +X-SA-Exim-Mail-From: jeff@frostconsultingllc.com +X-SA-Exim-Scanned: No (on glacier.frostconsultingllc.com); + SAEximRunCond expanded to false +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/118 +X-Sequence-Number: 19978 + +On Wed, 12 Jul 2006, Neil Hepworth wrote: + +> Yes, it was the same DB so, yes 8.1 gives roughly a four fold improvement +> (assuming hardware and OS differences aren't that significant - I'd expect +> the Linux version to be faster if anything); which certainly ain't bad! :) +> +> Good idea for the vacuumdb -a -v on the laptop, I re imported the database +> and than ran it output below: +> +> INFO: free space map contains 949 pages in 537 relations +> DETAIL: A total of 9024 page slots are in use (including overhead). +> 9024 page slots are required to track all free space. +> Current limits are: 20000 page slots, 1000 relations, using 186 KB. +> VACUUM + +Well, this looks like it's probably on track already even though it'll change +as there are updates/deletes, but I suspect you're more or less ok with the +FSM settings you have. + +> +> I am about to start testing Scott's suggestion now (thanks Scott - wasn't +> ignoring you, just didn't have time yesterday), and I'll get back with the +> results. +> +> Before I posted the problem to this list I was focusing more on the settings +> in postgresql.conf than optimising the query as I thought this might be a +> general problem, for all my DB updates/queries, with the way the planner was +> optimising queries; maybe assuming CPU cost was too cheap? Do you think I +> was off track in my initial thinking? Optimising these queries is +> certainly beneficial but I don't want postgres to hog the CPU for any +> extended period (other apps also run on the server), so I was wondering if +> the general config settings could to be tuned to always prevent this +> (regardless of how poorly written my queries are :)? +> + +I guess you could nice the postmaster, on startup or renice after startup but +I'm not aware of any conf settings that would tune postgres to avoid using the +CPU. + +> Neil +> +> +> On 12/07/06, Jeff Frost wrote: +>> +>> On Wed, 12 Jul 2006, Neil Hepworth wrote: +>> +>> > I am using version PostgreSQL 7.3.10 (RPM: +>> > postgresql73-rhel21-7.3.10-2). Unfortunately vacuumdb -a -v does not +>> > give the FSM info at the end (need a newer version of postgres for +>> > that). Running the same queries on 8.1 reduces the time taken to +>> > about 16 minutes, though I didn't run the test on the same hardware or +>> > OS as I want to keep my test server as close to production as +>> > possible, so I ran the 8.1 server on my Windows laptop (2GHz Centrino +>> > Duo with 2GB of RAM, yes the laptop is brand new :). +>> +>> Well, looks like you're at least fairly up to date, but there is a fix in +>> 7.3.11 that you might want to get by upgrading to 7.3.15: +>> +>> * Fix race condition in transaction log management +>> There was a narrow window in which an I/O operation could be +>> initiated for the wrong page, leading to an Assert failure or data +>> corruption. +>> +>> It also appears that you can run autovacuum with 7.3 (I thought maybe it +>> only +>> went back as far as 7.4). +>> +>> So, is the 16 minutes on your laptop with 8.1 for windows vs 1hr on the +>> server +>> for the whole set of loops? If so, 4x isn't a bad improvement. :-) So, +>> assuming you dumped/loaded the same DB onto your laptop's postgresql +>> server, +>> what does the vacuumdb -a -v say on the laptop? Perhaps we can use it to +>> see +>> if your fsm settings are ok. +>> +>> BTW, did you see Scott's posting here: +>> +>> http://archives.postgresql.org/pgsql-performance/2006-07/msg00091.php +>> +>> Since we didn't hear from you for a while, I thought perhaps Scott had hit +>> on +>> the fix. Have you tried that yet? It certainly would help the planner +>> out. +>> +>> You might also want to turn on autovacuum and see if that helps. +>> +>> What's your disk subsystem like? In fact, what's the entire DB server +>> hardware like? +>> +>> > +>> > I run through a loop, executing the following or similar queries 8 +>> > times (well actually 12 but the last 4 don't do anything) - Jeff I've +>> > attached complete outputs as files. +>> > +>> > A debug output further below (numbers after each method call name, +>> > above each SQL statement, are times to run that statement in +>> > milliseconds, the times on the lines "" are cumulative). So total for +>> > one loop is 515 seconds, multiple by 8 and that gets me to over an +>> > hour); it is actually the deletes that take the most time; 179 seconds +>> > and 185 seconds each loop. +>> > +>> > ---------------------------------------------------- +>> > +>> > CREATE TABLE fttemp670743219 AS SELECT * FROM ftone LIMIT 0 +>> > INSERT INTO fttemp670743219 ( epId, start, direction, classid, +>> > consolidation, cnt ) SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD +>> > HH24:00:00.0')::timestamp AS start, direction, classid, 60 AS +>> > consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND +>> > start < TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', 'YYYY-MM-DD +>> > HH24:00:00.0')::timestamp GROUP BY epId, direction, +>> > TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, classid +>> > DELETE FROM ONLY ftone WHERE ftone.epId = fttemp670743219.epId AND +>> > ftone.direction = fttemp670743219.direction AND ftone.start = +>> > fttemp670743219.start AND ftone.consolidation = +>> > fttemp670743219.consolidation AND ftone.classid = +>> > fttemp670743219.classid +>> > INSERT INTO ftone ( epId, start, consolidation, direction, classid, +>> > cnt ) SELECT epId, start, consolidation, direction, classid, cnt FROM +>> > fttemp670743219 +>> > DROP TABLE fttemp670743219 +>> > DELETE FROM ftone WHERE consolidation = 0 AND start < +>> > TO_TIMESTAMP((TO_TIMESTAMP('2006-07-11 14:04:34.156433+1000', +>> > 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +>> > 'YYYY-MM-DD 00:00:00.0')::timestamp +>> > +>> > ---------------------------------------------------- +>> > +>> > ftone: 0: +>> > createConsolidatedInTemporary: 188: +>> > CREATE TABLE fttemp678233382 AS SELECT * FROM ftone LIMIT 0 +>> > createConsolidatedInTemporary: 76783: +>> > INSERT INTO fttemp678233382 ( epPairdefnid, start, direction, classid, +>> > consolidation, cnt ) SELECT epPairdefnid, TO_TIMESTAMP(start, +>> > 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, direction, classid, 60 +>> > AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 +>> > AND start < TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +>> > 'YYYY-MM-DD HH24:00:00.0')::timestamp GROUP BY epPairdefnid, +>> > direction, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp, +>> > classid +>> > replaceConsolidatedInMainTable: 179178: +>> > DELETE FROM ONLY ftone WHERE ftone.epPairdefnid = +>> > fttemp678233382.epPairdefnid AND ftone.direction = +>> > fttemp678233382.direction AND ftone.start = fttemp678233382.start AND +>> > ftone.consolidation = fttemp678233382.consolidation AND ftone.classid +>> > = fttemp678233382.classid +>> > replaceConsolidatedInMainTable: 61705: +>> > INSERT INTO ftone ( epPairdefnid, start, consolidation, direction, +>> > classid, cnt ) SELECT epPairdefnid, start, consolidation, direction, +>> > classid, cnt FROM fttemp678233382 +>> > consolidate: 2656: +>> > DROP TABLE fttemp678233382 +>> > MAIN LOOP TOTAL consolidate: 320526 +>> > deleteOlderThan: 184616: +>> > DELETE FROM ftone WHERE consolidation = 0 AND start < +>> > TO_TIMESTAMP((TO_TIMESTAMP('2006-07-12 11:02:13.865444+1000', +>> > 'YYYY-MM-DD 00:00:00.0')::timestamp - INTERVAL '10080 MINUTE'), +>> > 'YYYY-MM-DD 00:00:00.0')::timestamp +>> > MAIN LOOP TOTAL deleteExpiredData: 505142 +>> > MAIN LOOP TOTAL generateStatistics: 515611 +>> > +>> > ---------------------------------------------------- +>> > +>> > Thanks again, +>> > Neil +>> > +>> > +>> > On 11/07/06, Jeff Frost wrote: +>> >> +>> >> +>> >> On Mon, 10 Jul 2006, Neil Hepworth wrote: +>> >> +>> >> > I should also explain that I run through these queries on multiple +>> >> > tables and with some slightly different parameters for the +>> >> > "consolidation" so I run through those 3 queries (or similar) 9 times +>> >> > and this takes a total of about 2 hours, with high CPU usage. And I +>> >> > am running the queries from a remote Java application (using JDBC), +>> >> > the client is using postgresql-8.0-311.jdbc3.jar. The explain +>> analyse +>> >> > results I have provided below are from running via pgAdmin, not the +>> >> > Java app (I did a vacuum analyse of the db before running them): +>> >> > +>> >> > +>> >> +>> >> Neil, did you ever answer which version of 7.3 this is? +>> >> +>> >> BTW, you mentioned that this takes 2 hours, but even looping over this +>> 9 +>> >> times +>> >> seems like it would only take 9 minutes (55 seconds for the SELECT and +>> 4 +>> >> seconds for the DELETE = 59 seconds times 9). Perhaps you should post +>> the +>> >> explain analyze for the actual query that takes so long as the planner +>> >> output +>> >> will likely be quite different. +>> >> +>> >> One thing I noticed is that the planner seems quite incorrect about the +>> >> number +>> >> of rows it expects in the SELECT. If you ran vacuum analyze before +>> this, +>> >> perhaps your fsm settings are incorrect? What does vacuumdb -a -v +>> output +>> >> at +>> >> the end? I'm looking for something that looks like this: +>> >> +>> >> INFO: free space map: 109 relations, 204 pages stored; 1792 total +>> pages +>> >> needed +>> >> DETAIL: Allocated FSM size: 1000 relations + 20000 pages = 182 kB +>> shared +>> >> memory. +>> >> +>> >> I see your fsm settings are non-default, so it's also possible I'm not +>> used +>> >> to +>> >> reading 7.3's explain analyze output. :-) +>> >> +>> >> Also, what does vmstat output look like while the query is running? +>> >> Perhaps +>> >> you're running into some context switching problems. It would be +>> >> interesting +>> >> to know how the query runs on 8.1.x just to know if we're chasing an +>> >> optimization that's fixed already in a later version. +>> >> +>> >> +>> >> > Subquery Scan "*SELECT*" (cost=59690.11..62038.38 rows=23483 +>> >> > width=16) (actual time=16861.73..36473.12 rows=560094 loops=1) +>> >> > -> Aggregate (cost=59690.11..62038.38 rows=23483 width=16) (actual +>> >> > time=16861.72..34243.63 rows=560094 loops=1) +>> >> > -> Group (cost=59690.11..61451.32 rows=234827 width=16) +>> >> > (actual time=16861.62..20920.12 rows=709461 loops=1) +>> >> > -> Sort (cost=59690.11..60277.18 rows=234827 width=16) +>> >> > (actual time=16861.62..18081.07 rows=709461 loops=1) +>> >> > Sort Key: eppairdefnid, "start" +>> >> > -> Seq Scan on ftone (cost=0.00..36446.66 +>> >> > rows=234827 width=16) (actual time=0.45..10320.91 rows=709461 +>> loops=1) +>> >> > Filter: ((consolidation = 60) AND ("start" < +>> >> > (to_timestamp('2006-07-10 18:43:27.391103+1000'::text, +>> >> > 'YYYY-MM-DDHH24:00:00.0'::text))::timestamp without time zone)) +>> >> > Total runtime: 55378.68 msec +>> >> +>> >> > *** For the delete ***: +>> >> > +>> >> > Hash Join (cost=0.00..30020.31 rows=425 width=14) (actual +>> >> > time=3767.47..3767.47 rows=0 loops=1) +>> >> > Hash Cond: ("outer".eppairdefnid = "inner".eppairdefnid) +>> >> > -> Seq Scan on ftone (cost=0.00..23583.33 rows=1286333 width=10) +>> >> > (actual time=0.04..2299.94 rows=1286333 loops=1) +>> >> > -> Hash (cost=0.00..0.00 rows=1 width=4) (actual +>> >> > time=206.01..206.01 rows=0 loops=1) +>> >> > -> Seq Scan on fttemp1600384653 (cost=0.00..0.00 rows=1 +>> >> > width=4) (actual time=206.00..206.00 rows=0 loops=1) +>> >> > Total runtime: 3767.52 msec +>> >> +>> >> -- +>> >> Jeff Frost, Owner +>> >> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>> >> Phone: 650-780-7908 FAX: 650-649-1954 +>> >> +>> > +>> +>> -- +>> Jeff Frost, Owner +>> Frost Consulting, LLC http://www.frostconsultingllc.com/ +>> Phone: 650-780-7908 FAX: 650-649-1954 +>> +> + +-- +Jeff Frost, Owner +Frost Consulting, LLC http://www.frostconsultingllc.com/ +Phone: 650-780-7908 FAX: 650-649-1954 + +From pgsql-performance-owner@postgresql.org Wed Jul 12 18:28:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 599409FB42D + for ; + Wed, 12 Jul 2006 17:59:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74975-01 for + ; + Wed, 12 Jul 2006 17:59:27 -0300 (ADT) +X-Greylist: delayed 00:18:16.723434 by SQLgrey- +Received: from keys.fairfield.com (fairfield.com [65.161.19.68]) + by postgresql.org (Postfix) with ESMTP id 97B109FB426 + for ; + Wed, 12 Jul 2006 17:59:27 -0300 (ADT) +Received: from keys.fairfield.com (localhost.localdomain [127.0.0.1]) + by keys.fairfield.com (PGP Universal) with ESMTP id D42A0565EE5 + for ; + Wed, 12 Jul 2006 15:41:08 -0500 (CDT) +Received: from smtpproxy.fairind.fairfield.com ([10.1.1.30]) + by keys.fairfield.com (PGP Universal service); + Wed, 12 Jul 2006 15:41:08 -0500 +X-PGP-Universal: processed; + by keys.fairfield.com on Wed, 12 Jul 2006 15:41:08 -0500 +Received: from lincoln.FAIRIND.FAIRFIELD.COM ([172.16.10.11]) by + smtpproxy.fairind.fairfield.com with InterScan Message Security + Suite; Wed, 12 Jul 2006 15:23:25 -0500 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C6A5F3.84FAA950" +Subject: hyper slow after upgrade to 8.1.4 +Date: Wed, 12 Jul 2006 15:41:14 -0500 +Message-ID: + <1CA058827877644DAB54FB930FFA3B05A679AB@lincoln.FAIRIND.FAIRFIELD.COM> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: hyper slow after upgrade to 8.1.4 +Thread-Index: Acal84S1l8ffmPddSyqERFZKnZJuXA== +From: "Medora Schauer" +To: "postgresql" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/119 +X-Sequence-Number: 19979 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C6A5F3.84FAA950 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +I have just upgraded from 7.3.4 to 8.1.4 and now *all* db access calls +are extremely slow. I didn't need to preserve any old data so at this +point all my tables are empty. Just connecting to a db takes several +seconds. + +=20 + +When I was accidentally linking my app with the 7.3.4 libs but running +the 8.1.4 postmaster everything was fine. + +=20 + +I know I'm not giving much to go on but I'm stumped. Can anyone suggest +how I might track down the cause of this problem? + +=20 + +Medora Schauer + +=20 + +=20 + + +------_=_NextPart_001_01C6A5F3.84FAA950 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + + + + + + + +
+ +

I have just upgraded from 7.3.4 to 8.1.4 and now = +*all* db access calls are extremely = +slow.  I +didn’t need to preserve any old data so at this point all my = +tables are +empty.  Just connecting to a db takes several = +seconds.

+ +

 

+ +

When I was accidentally linking my app with the 7.3.4 = +libs +but running the 8.1.4 postmaster everything was = +fine.

+ +

 

+ +

I know I’m not giving much to go on but = +I’m +stumped.  Can anyone suggest how I might track down the cause of = +this problem?

+ +

 

+ +

Medora Schauer

+ +

 

+ +

 

+ +
+ + + + + +------_=_NextPart_001_01C6A5F3.84FAA950-- + +From pgsql-performance-owner@postgresql.org Wed Jul 12 20:06:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DD1539FB390 + for ; + Wed, 12 Jul 2006 18:48:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79384-10 for + ; + Wed, 12 Jul 2006 18:48:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id C52BB9FB45C + for ; + Wed, 12 Jul 2006 18:48:25 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6CM3tZG018204 + for ; Wed, 12 Jul 2006 15:03:56 -0700 +Message-ID: <44B55FEA.4080806@modgraph-usa.com> +Date: Wed, 12 Jul 2006 13:47:38 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: [Fwd: Delivery Status Notification (Failure)] +References: <44B525DA.5080800@modgraph-usa.com> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/122 +X-Sequence-Number: 19982 + +I wrote: +>> I can't find an address to complain about the mailing list itself, so +>> apologies but I'm posting directly to this list. Every time I post to +>> this group, I get returned mails about OTHER subscribers' invalid +>> accounts, like the one below. + +Michael Glaesemann replied: +> Is this when you're replying to a post or creating a new post? If the +> former, and you're using reply-to-all, you'll be sending one message to +> the list and another directly to the poster of the message you're +> responding to. + +And Richard Broersma Jr replied: +> Does the message come from postgresql.org or is the bounced email coming from these specific users +> when you include them in reply-all? + +Thanks to both for your answers. But no -- It's for new posts. In fact, when writing the email that started this thread, it was only to pgsql-performance@postgresql.org (I double-checked by using emacs on my Thunderbird "Sent" folder), yet I still got another "undeliverable" reply along with your message: + +> This is an automatically generated Delivery Status Notification. +> Delivery to the following recipients failed. +> martin@usaemail.enpocket.com + + +Craig + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 19:56:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 87CE39FB399 + for ; + Wed, 12 Jul 2006 19:06:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82503-06 for + ; + Wed, 12 Jul 2006 19:06:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from projects.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id E955D9FB397 + for ; + Wed, 12 Jul 2006 19:06:30 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by projects.commandprompt.com (8.13.6/8.13.6) with ESMTP id + k6CM6Gmr024777; Wed, 12 Jul 2006 15:06:18 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +To: pgsql-performance@postgresql.org +Subject: Re: hyper slow after upgrade to 8.1.4 +Date: Wed, 12 Jul 2006 15:06:15 -0700 +User-Agent: KMail/1.9.1 +Cc: "Medora Schauer" +References: + <1CA058827877644DAB54FB930FFA3B05A679AB@lincoln.FAIRIND.FAIRFIELD.COM> +In-Reply-To: + <1CA058827877644DAB54FB930FFA3B05A679AB@lincoln.FAIRIND.FAIRFIELD.COM> +XIDTRACK: jd@commandprompt.com +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-15" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +Message-Id: <200607121506.15586.jd@commandprompt.com> +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (projects.commandprompt.com + [192.168.2.159]); Wed, 12 Jul 2006 15:06:18 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/121 +X-Sequence-Number: 19981 + +On Wednesday 12 July 2006 13:41, Medora Schauer wrote: +> I have just upgraded from 7.3.4 to 8.1.4 and now *all* db access calls +> are extremely slow. I didn't need to preserve any old data so at this +> point all my tables are empty. Just connecting to a db takes several +> seconds. +> +> +> +> When I was accidentally linking my app with the 7.3.4 libs but running +> the 8.1.4 postmaster everything was fine. +> +> +> +> I know I'm not giving much to go on but I'm stumped. Can anyone suggest +> how I might track down the cause of this problem? + +analyze? + +Sincerely, + +Joshua D. Drake + + +> +> +> +> Medora Schauer + +-- + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 21:54:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 26C5D9FB203 + for ; + Wed, 12 Jul 2006 21:54:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21206-08 for + ; + Wed, 12 Jul 2006 21:54:18 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web31806.mail.mud.yahoo.com (web31806.mail.mud.yahoo.com + [68.142.207.69]) by postgresql.org (Postfix) with SMTP id 1AB549FB1F5 + for ; + Wed, 12 Jul 2006 21:54:17 -0300 (ADT) +Received: (qmail 21284 invoked by uid 60001); 13 Jul 2006 00:54:16 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=RqvGvTX8C7S6961jhG2r4ED66NToqm+qS1kNhyPU9ckp5GxG8qYdS9fD6ELkzlgQcFjRvTiSY9+FPehzxIsDu3H20Z3Y+Fb9zPZq+w8AecTCutLFGJjkXr3LIcbzB2qchT3GPQOWZMZ3CYu2mq7ynMXgSmZtZFlWghnvv4mdAcQ= + ; +Message-ID: <20060713005416.21282.qmail@web31806.mail.mud.yahoo.com> +Received: from [24.54.196.198] by web31806.mail.mud.yahoo.com via HTTP; + Wed, 12 Jul 2006 17:54:16 PDT +Date: Wed, 12 Jul 2006 17:54:16 -0700 (PDT) +From: Richard Broersma Jr +Subject: Re: [Fwd: Delivery Status Notification (Failure)] +To: "Craig A. James" , + pgsql-performance@postgresql.org +In-Reply-To: <44B55FEA.4080806@modgraph-usa.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/123 +X-Sequence-Number: 19983 + +> > This is an automatically generated Delivery Status Notification. +> > Delivery to the following recipients failed. +> > martin@usaemail.enpocket.com + +yes, I got the same thing that you did here. only i got when I replied all to your email. Are you +sure this individual wasn't listed in any of your CC or BCC addresses? + +This is an automatically generated Delivery Status Notification. +Delivery to the following recipients failed. + martin@usaemail.enpocket.com + +Reporting-MTA: dns;enpocket-exch.usaemail.enpocket.com +Received-From-MTA: dns;middx.enpocketbureau.com +Arrival-Date: Wed, 12 Jul 2006 18:10:58 -0400 + +Final-Recipient: rfc822;martin@usaemail.enpocket.com +Action: failed +Status: 5.1.1 + + + +From pgsql-performance-owner@postgresql.org Wed Jul 12 23:53:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D586F9FB201 + for ; + Wed, 12 Jul 2006 23:53:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47695-03 for + ; + Wed, 12 Jul 2006 23:53:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 2B2559FB200 + for ; + Wed, 12 Jul 2006 23:53:28 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6D2rPk0001821; + Wed, 12 Jul 2006 22:53:26 -0400 (EDT) +To: "Steve McWilliams" +cc: pgsql-performance@postgresql.org +Subject: Re: size of pg_dump files containing bytea values +In-reply-to: <3985.10.1.1.126.1152729387.squirrel@portal.emprisanetworks.com> +References: <3985.10.1.1.126.1152729387.squirrel@portal.emprisanetworks.com> +Comments: In-reply-to "Steve McWilliams" + message dated "Wed, 12 Jul 2006 14:36:27 -0400" +Date: Wed, 12 Jul 2006 22:53:25 -0400 +Message-ID: <1820.1152759205@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/125 +X-Sequence-Number: 19985 + +"Steve McWilliams" writes: +> I notice that non-printables in bytea values are being spit out by pg_dump +> using escaped octet sequences even when the "-Fc" option is present +> specifying use of the custom binary output format rather than plain text +> format. This bloats the size of bytea values in the dump file by a factor +> of 3+ typically. + +No, because the subsequent compression step should buy back most of +that. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Wed Jul 12 23:49:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 97C289FB23B + for ; + Wed, 12 Jul 2006 23:49:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 35599-09 for + ; + Wed, 12 Jul 2006 23:48:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 9C9499FB20E + for ; + Wed, 12 Jul 2006 23:48:57 -0300 (ADT) +Received: (qmail 31982 invoked by uid 500); 13 Jul 2006 02:53:52 -0000 +Date: Wed, 12 Jul 2006 21:53:52 -0500 +From: Bruno Wolff III +To: Medora Schauer +Cc: postgresql +Subject: Re: hyper slow after upgrade to 8.1.4 +Message-ID: <20060713025352.GA27215@wolff.to> +Mail-Followup-To: Bruno Wolff III , + Medora Schauer , + postgresql +References: + <1CA058827877644DAB54FB930FFA3B05A679AB@lincoln.FAIRIND.FAIRFIELD.COM> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + <1CA058827877644DAB54FB930FFA3B05A679AB@lincoln.FAIRIND.FAIRFIELD.COM> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/124 +X-Sequence-Number: 19984 + +On Wed, Jul 12, 2006 at 15:41:14 -0500, + Medora Schauer wrote: +> I have just upgraded from 7.3.4 to 8.1.4 and now *all* db access calls +> are extremely slow. I didn't need to preserve any old data so at this +> point all my tables are empty. Just connecting to a db takes several +> seconds. +> +> I know I'm not giving much to go on but I'm stumped. Can anyone suggest +> how I might track down the cause of this problem? + +That connections are slow makes me think DNS is worth looking at. It might +be that reverse lookups are timing out. + +From pgsql-performance-owner@postgresql.org Thu Jul 13 00:07:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 45B819FB1FC + for ; + Thu, 13 Jul 2006 00:07:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 67121-07 for + ; + Thu, 13 Jul 2006 00:07:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 937EB9FB227 + for ; + Thu, 13 Jul 2006 00:07:21 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6D37Imr002092; + Wed, 12 Jul 2006 23:07:18 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org +Subject: Re: [Fwd: Delivery Status Notification (Failure)] +In-reply-to: <44B55FEA.4080806@modgraph-usa.com> +References: <44B525DA.5080800@modgraph-usa.com> + + <44B55FEA.4080806@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Wed, 12 Jul 2006 13:47:38 -0700" +Date: Wed, 12 Jul 2006 23:07:18 -0400 +Message-ID: <2091.1152760038@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/126 +X-Sequence-Number: 19986 + +"Craig A. James" writes: +> Thanks to both for your answers. But no -- It's for new posts. In fact, when writing the email that started this thread, it was only to pgsql-performance@postgresql.org (I double-checked by using emacs on my Thunderbird "Sent" folder), yet I still got another "undeliverable" reply along with your message: + +>> This is an automatically generated Delivery Status Notification. +>> Delivery to the following recipients failed. +>> martin@usaemail.enpocket.com + +This means that usaemail.enpocket.com has seriously misconfigured mail +software --- it's bouncing undeliverable messages to the From: address +rather than to the envelope sender (which will be pgsql-performance-owner +for a message coming through the pgsql-performance list). This is +generally considered sufficiently unfriendly behavior that proof of it +is grounds for instant ejection from a mailing list, because the From: +address is someone who has no control over where the mailing list tries +to deliver to. Certainly it's grounds for ejection from any PG list. +Send the bounce message with full headers to the list admin (Marc +Fournier, scrappy at postgresql.org) and martin@usaemail.enpocket.com +will soon be an ex-subscriber. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 13 05:59:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5382F9FB1C7 + for ; + Thu, 13 Jul 2006 05:59:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47815-10 for + ; + Thu, 13 Jul 2006 05:59:38 -0300 (ADT) +X-Greylist: delayed 16:41:40.572154 by SQLgrey- +Received: from smtp1.smiths.com (smtp1.smiths.com [192.208.34.50]) + by postgresql.org (Postfix) with ESMTP id 897A19FAC76 + for ; + Thu, 13 Jul 2006 05:59:39 -0300 (ADT) +Received: from COSSMGIMS03.EMAIL.CORP.TLD (cossmgims03.email.corp.tld + [10.225.225.145]) + by smtp1.smiths.com (Postfix) with ESMTP id 8D28F32D4E + for ; + Thu, 13 Jul 2006 02:59:35 -0600 (MDT) +Received: from COSSMGMBX04.EMAIL.CORP.TLD ([10.225.225.26]) by + COSSMGFEB03.EMAIL.CORP.TLD with Microsoft SMTPSVC(6.0.3790.1830); + Thu, 13 Jul 2006 02:59:34 -0600 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +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: Commit slower on faster PC +Date: Thu, 13 Jul 2006 02:59:31 -0600 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Re: [PERFORM] Commit slower on faster PC +Thread-Index: Acalzo76eF5fXbRvSwWike7y2iYVTAAh3GqQ +From: "Koth, Christian (DWBI)" +To: "Koth, Christian (DWBI)" +Cc: +X-OriginalArrivalTime: 13 Jul 2006 08:59:34.0780 (UTC) + FILETIME=[A98263C0:01C6A65A] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/127 +X-Sequence-Number: 19987 + + +Hello all,=0D +thanks a lot for your help so far. You all where right about the IDE drive= + is=0D +somehow caching the data. See the test results below. I also get different = +=0D +tps values every time I run pgbench on PC1 (between 300 and 80 tps for 100= + transactions).=0D + +I don't think it's a good idea to disable fsync even if ext3 (doing a sync= + also=0D +every x second or so) and a UPS is used.=0D + +Christian + + + +PC1 (IDE): +---------- + +fsynch on: +---------- +number of transactions per client: 100 +number of transactions actually processed: 100/100 +tps =3D 213.115558 (including connections establishing) +tps =3D 214.710227 (excluding connections establishing) + +number of transactions per client: 10000 +number of transactions actually processed: 10000/10000 +tps =3D 126.159130 (including connections establishing) +tps =3D 126.163172 (excluding connections establishing) + + +fsynch off: +----------- +number of transactions per client: 100 +number of transactions actually processed: 100/100 +tps =3D 413.849044 (including connections establishing) +tps =3D 419.028942 (excluding connections establishing) + +number of transactions per client: 10000 +number of transactions actually processed: 10000/10000 +tps =3D 166.057838 (including connections establishing) +tps =3D 166.064227 (excluding connections establishing) + + + +PC2 (SCSI): +----------- + +fsynch on: +---------- +number of transactions per client: 100 +number of transactions actually processed: 100/100 +tps =3D 44.640785 (including connections establishing) +tps =3D 44.684649 (excluding connections establishing) + +number of transactions per client: 10000 +number of transactions actually processed: 10000/10000 +tps =3D 42.322486 (including connections establishing) +tps =3D 42.324096 (excluding connections establishing) + + +fsynch off: +----------- +number of transactions per client: 100 +number of transactions actually processed: 100/100 +tps =3D 910.406861 (including connections establishing) +tps =3D 925.428936 (excluding connections establishing) + +number of transactions per client: 10000 +number of transactions actually processed: 10000/10000 +tps =3D 957.376543 (including connections establishing) +tps =3D 957.603815 (excluding connections establishing) + +****************************************** +The information contained in, or attached to, this e-mail, may contain= + confidential information and is intended solely for the use of the= + individual or entity to whom they are addressed and may be subject to= + legal privilege. If you have received this e-mail in error you should= + notify the sender immediately by reply e-mail, delete the message from= + your system and notify your system manager. Please do not copy it for any= + purpose, or disclose its contents to any other person. The views or= + opinions presented in this e-mail are solely those of the author and do= + not necessarily represent those of the company. The recipient should= + check this e-mail and any attachments for the presence of viruses. The= + company accepts no liability for any damage caused, directly or= + indirectly, by any virus transmitted in this email. +****************************************** + +From pgsql-performance-owner@postgresql.org Thu Jul 13 06:02:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 99DCF9FB1C7; + Thu, 13 Jul 2006 06:02:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 47353-10; Thu, 13 Jul 2006 06:02:24 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sraigw.sra.co.jp (sraigw.sra.co.jp [202.32.10.2]) + by postgresql.org (Postfix) with ESMTP id 7B9609FAC76; + Thu, 13 Jul 2006 06:02:23 -0300 (ADT) +Received: from srascb.sra.co.jp (srascb [133.137.8.65]) + by sraigw.sra.co.jp (Postfix) with ESMTP + id 7C5836215D; Thu, 13 Jul 2006 18:02:20 +0900 (JST) +Received: from srascb.sra.co.jp (localhost [127.0.0.1]) + by localhost.sra.co.jp (Postfix) with ESMTP + id 6441510CD06; Thu, 13 Jul 2006 18:02:20 +0900 (JST) +Received: from sranhm.sra.co.jp (sranhm [133.137.16.38]) + by srascb.sra.co.jp (Postfix) with ESMTP + id 404B110CD04; Thu, 13 Jul 2006 18:02:20 +0900 (JST) +Received: from localhost (dhcp-17-178.sra.co.jp [133.137.17.178]) + by sranhm.sra.co.jp (8.9.3+3.2W/3.7W-srambox) with ESMTP id SAA06946; + Thu, 13 Jul 2006 18:02:20 +0900 +Date: Thu, 13 Jul 2006 18:02:34 +0900 (JST) +Message-Id: <20060713.180234.45872055.t-ishii@sraoss.co.jp> +To: tgl@sss.pgh.pa.us +Cc: Robert.Lor@Sun.COM, pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +From: Tatsuo Ishii +In-Reply-To: <20060617.111838.39487910.t-ishii@sraoss.co.jp> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> +X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) +Mime-Version: 1.0 +Content-Type: Text/Plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/128 +X-Sequence-Number: 19988 + +> > Tatsuo Ishii writes: +> > > Interesting. We (some Japanese companies including SRA OSS, +> > > Inc. Japan) did some PG scalability testing using a Unisys's big 16 +> > > (physical) CPU machine and found PG scales up to 8 CPUs. However +> > > beyond 8 CPU PG does not scale anymore. The result can be viewed at +> > > "OSS iPedia" web site (http://ossipedia.ipa.go.jp). Our conclusion was +> > > PG has a serious lock contention problem in the environment by +> > > analyzing the oprofile result. +> > +> > 18% in s_lock is definitely bad :-(. Were you able to determine which +> > LWLock(s) are accounting for the contention? +> +> Yes. We were interested in that too. Some people did addtional tests +> to determin that. I don't have the report handy now. I will report +> back next week. + +Sorry for the delay. Finally I got the oprofile data. It's +huge(34MB). If you are interested, I can put somewhere. Please let me +know. +-- +Tatsuo Ishii +SRA OSS, Inc. Japan + +From pgsql-performance-owner@postgresql.org Thu Jul 13 10:22:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B25899FB2C0 + for ; + Thu, 13 Jul 2006 10:22:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 87606-04 for + ; + Thu, 13 Jul 2006 10:22:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from keys.fairfield.com (keys.fairfield.com [65.161.19.68]) + by postgresql.org (Postfix) with ESMTP id C2DD29FAE4E + for ; + Thu, 13 Jul 2006 10:22:43 -0300 (ADT) +Received: from keys.fairfield.com (localhost.localdomain [127.0.0.1]) + by keys.fairfield.com (PGP Universal) with ESMTP id 59403565891 + for ; + Thu, 13 Jul 2006 08:22:41 -0500 (CDT) +Received: from smtpproxy.fairind.fairfield.com ([10.1.1.30]) + by keys.fairfield.com (PGP Universal service); + Thu, 13 Jul 2006 08:22:41 -0500 +X-PGP-Universal: processed; + by keys.fairfield.com on Thu, 13 Jul 2006 08:22:41 -0500 +Received: from lincoln.FAIRIND.FAIRFIELD.COM ([172.16.10.11]) by + smtpproxy.fairind.fairfield.com with InterScan Message Security + Suite; Thu, 13 Jul 2006 08:04:56 -0500 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: hyper slow after upgrade to 8.1.4 +Date: Thu, 13 Jul 2006 08:22:46 -0500 +Message-ID: + <1CA058827877644DAB54FB930FFA3B05A67A7A@lincoln.FAIRIND.FAIRFIELD.COM> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: hyper slow after upgrade to 8.1.4 +Thread-Index: AcamJujj6J8hbCC9S42SlICtrJLzjwAVjHLg +From: "Medora Schauer" +To: "Bruno Wolff III" +Cc: "postgresql" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/129 +X-Sequence-Number: 19989 + +> From: Bruno Wolff III [mailto:bruno@wolff.to] +> Sent: Wednesday, July 12, 2006 8:54 PM +> To: Medora Schauer +> Cc: postgresql +> Subject: Re: hyper slow after upgrade to 8.1.4 +>=20 +> On Wed, Jul 12, 2006 at 15:41:14 -0500, +> Medora Schauer wrote: +> > I have just upgraded from 7.3.4 to 8.1.4 and now *all* db access +calls +> > are extremely slow. I didn't need to preserve any old data so at +this +> > point all my tables are empty. Just connecting to a db takes +several +> > seconds. +> > +> > I know I'm not giving much to go on but I'm stumped. Can anyone +suggest +> > how I might track down the cause of this problem? +>=20 +> That connections are slow makes me think DNS is worth looking at. It +might +> be that reverse lookups are timing out. + +It does seem to be network related. Using the 8.1.4 psql on a machine +other than the db server connecting to a database takes ~11 secs. Using +it on the db server the connection is virtually instantaneous. Using +the 7.3.4 psql (still the 8.1.4 postmaster) the connection is fast +regardless of what machine I am on. + +The pg.log contains the following at the top: + +LOG: could not create IPv6 socket: Address family not supported by +protocol + +I am using a 2.4.25 linux kernel. For reasons I can't get into I have +no choice but to use this kernel. The config utility for the kernel +shows support for the IPv6 protocol as "experimental" and is not +included in my current build. I can try building a kernel that includes +IPv6 but the "experimental" caveat is scary. + +Can it be that the connection delay is because first an IPv6 socket is +trying to be established and when that fails an IPv4 socket is created? +If so, is there any way to make 8.1.4 use only IPv4 sockets? + +BTW - The slowness seems to be only during db connection. Once the +connection is established queries seem to execute in a timely manner. + +Medora + + + +From pgsql-performance-owner@postgresql.org Thu Jul 13 12:46:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 35BAA9FB404 + for ; + Thu, 13 Jul 2006 10:54:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 93584-03 for + ; + Thu, 13 Jul 2006 10:54:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by postgresql.org (Postfix) with ESMTP id 0B1909FB412 + for ; + Thu, 13 Jul 2006 10:54:38 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.7/8.13.7) with ESMTP id k6DDsL3T099428 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Thu, 13 Jul 2006 07:54:24 -0600 (MDT) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.6/8.13.6) with ESMTP id k6DDsLB7085028; + Thu, 13 Jul 2006 07:54:21 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.6/8.13.6/Submit) id k6DDsLGQ085027; + Thu, 13 Jul 2006 07:54:21 -0600 (MDT) (envelope-from mfuhr) +Date: Thu, 13 Jul 2006 07:54:21 -0600 +From: Michael Fuhr +To: Medora Schauer +Cc: Bruno Wolff III , + postgresql +Subject: Re: hyper slow after upgrade to 8.1.4 +Message-ID: <20060713135421.GA79008@winnie.fuhr.org> +References: + <1CA058827877644DAB54FB930FFA3B05A67A7A@lincoln.FAIRIND.FAIRFIELD.COM> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: + <1CA058827877644DAB54FB930FFA3B05A67A7A@lincoln.FAIRIND.FAIRFIELD.COM> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/131 +X-Sequence-Number: 19991 + +On Thu, Jul 13, 2006 at 08:22:46AM -0500, Medora Schauer wrote: +> Can it be that the connection delay is because first an IPv6 socket is +> trying to be established and when that fails an IPv4 socket is created? + +A sniffer like tcpdump or ethereal might reveal why connecting is +so slow. The problem might be with DNS queries for AAAA (IPv6) +records prior to queries for A (IPv4) records; see this thread from +almost a year ago: + +http://archives.postgresql.org/pgsql-general/2005-08/msg00216.php + +-- +Michael Fuhr + +From pgsql-performance-owner@postgresql.org Thu Jul 13 12:13:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A45A89FB35B; + Thu, 13 Jul 2006 11:44:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03028-02; Thu, 13 Jul 2006 11:44:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id A8B839FB32E; + Thu, 13 Jul 2006 11:44:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6DEiJ7p013405; + Thu, 13 Jul 2006 10:44:19 -0400 (EDT) +To: Tatsuo Ishii +cc: Robert.Lor@Sun.COM, pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <20060713.180234.45872055.t-ishii@sraoss.co.jp> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> +Comments: In-reply-to Tatsuo Ishii + message dated "Thu, 13 Jul 2006 18:02:34 +0900" +Date: Thu, 13 Jul 2006 10:44:19 -0400 +Message-ID: <13404.1152801859@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/130 +X-Sequence-Number: 19990 + +Tatsuo Ishii writes: +>>> 18% in s_lock is definitely bad :-(. Were you able to determine which +>>> LWLock(s) are accounting for the contention? +>> +>> Yes. We were interested in that too. Some people did addtional tests +>> to determin that. I don't have the report handy now. I will report +>> back next week. + +> Sorry for the delay. Finally I got the oprofile data. It's +> huge(34MB). If you are interested, I can put somewhere. Please let me +> know. + +Yes, please. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 13 14:12:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 599C59FB2E0 + for ; + Thu, 13 Jul 2006 13:31:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19995-01 for + ; + Thu, 13 Jul 2006 13:31:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id 18D679FA31F + for ; + Thu, 13 Jul 2006 13:31:05 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1G145T-0000Em-00; Thu, 13 Jul 2006 12:30:51 -0400 +To: Tom Lane +Cc: "Steve McWilliams" , + pgsql-performance@postgresql.org +Subject: Re: size of pg_dump files containing bytea values +References: <3985.10.1.1.126.1152729387.squirrel@portal.emprisanetworks.com> + <1820.1152759205@sss.pgh.pa.us> +In-Reply-To: <1820.1152759205@sss.pgh.pa.us> +From: Greg Stark +Organization: The Emacs Conspiracy; member since 1992 +Date: 13 Jul 2006 12:30:50 -0400 +Message-ID: <87k66hii11.fsf@stark.xeocode.com> +Lines: 17 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/132 +X-Sequence-Number: 19992 + +Tom Lane writes: + +> "Steve McWilliams" writes: +> > I notice that non-printables in bytea values are being spit out by pg_dump +> > using escaped octet sequences even when the "-Fc" option is present +> > specifying use of the custom binary output format rather than plain text +> > format. This bloats the size of bytea values in the dump file by a factor +> > of 3+ typically. +> +> No, because the subsequent compression step should buy back most of +> that. + +Didn't byteas used to get printed as hex? Even in psql they're now being +printed in the escaped octet sequence. When did this change? + +-- +greg + + +From pgsql-performance-owner@postgresql.org Thu Jul 13 14:12:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 34AC89FB420 + for ; + Thu, 13 Jul 2006 14:12:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26586-03 for + ; + Thu, 13 Jul 2006 14:12:15 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 35B739FB449 + for ; + Thu, 13 Jul 2006 14:11:58 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6DHBuFb016045; + Thu, 13 Jul 2006 13:11:56 -0400 (EDT) +To: Michael Fuhr +cc: Medora Schauer , Bruno Wolff III , + postgresql +Subject: Re: hyper slow after upgrade to 8.1.4 +In-reply-to: <20060713135421.GA79008@winnie.fuhr.org> +References: + <1CA058827877644DAB54FB930FFA3B05A67A7A@lincoln.FAIRIND.FAIRFIELD.COM> + <20060713135421.GA79008@winnie.fuhr.org> +Comments: In-reply-to Michael Fuhr + message dated "Thu, 13 Jul 2006 07:54:21 -0600" +Date: Thu, 13 Jul 2006 13:11:56 -0400 +Message-ID: <16044.1152810716@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/133 +X-Sequence-Number: 19993 + +Michael Fuhr writes: +> On Thu, Jul 13, 2006 at 08:22:46AM -0500, Medora Schauer wrote: +>> Can it be that the connection delay is because first an IPv6 socket is +>> trying to be established and when that fails an IPv4 socket is created? + +> A sniffer like tcpdump or ethereal might reveal why connecting is +> so slow. + +I'd try strace'ing the client process first --- whatever is slow might +not be exposed as TCP traffic. It does sound though that the problem +is related to userland expecting IPv6 support that the kernel doesn't +actually have. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 13 14:42:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 55FE29FB1C3 + for ; + Thu, 13 Jul 2006 14:42:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 31993-03 for + ; + Thu, 13 Jul 2006 14:42:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 43FAB9FB1B7 + for ; + Thu, 13 Jul 2006 14:42:48 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6DHggYa016772; + Thu, 13 Jul 2006 13:42:42 -0400 (EDT) +To: Greg Stark +cc: "Steve McWilliams" , + pgsql-performance@postgresql.org +Subject: Re: size of pg_dump files containing bytea values +In-reply-to: <87k66hii11.fsf@stark.xeocode.com> +References: <3985.10.1.1.126.1152729387.squirrel@portal.emprisanetworks.com> + <1820.1152759205@sss.pgh.pa.us> <87k66hii11.fsf@stark.xeocode.com> +Comments: In-reply-to Greg Stark + message dated "13 Jul 2006 12:30:50 -0400" +Date: Thu, 13 Jul 2006 13:42:41 -0400 +Message-ID: <16771.1152812561@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/134 +X-Sequence-Number: 19994 + +Greg Stark writes: +> Didn't byteas used to get printed as hex? + +No, not that I recall. I don't have anything older than 7.0 running, +but it behaves the same as now: + +play=> select 'xyz\\001'::bytea; + ?column? +---------- + xyz\001 +(1 row) + +play=> + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 13 15:25:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 393A19FB1C7 + for ; + Thu, 13 Jul 2006 15:25:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 38193-03 for + ; + Thu, 13 Jul 2006 15:25:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from keys.fairfield.com (keys.fairfield.com [65.161.19.68]) + by postgresql.org (Postfix) with ESMTP id 3095E9FB1BC + for ; + Thu, 13 Jul 2006 15:25:22 -0300 (ADT) +Received: from keys.fairfield.com (localhost.localdomain [127.0.0.1]) + by keys.fairfield.com (PGP Universal) with ESMTP id D65B0565EE0 + for ; + Thu, 13 Jul 2006 13:25:20 -0500 (CDT) +Received: from smtpproxy.fairind.fairfield.com ([10.1.1.30]) + by keys.fairfield.com (PGP Universal service); + Thu, 13 Jul 2006 13:25:20 -0500 +X-PGP-Universal: processed; + by keys.fairfield.com on Thu, 13 Jul 2006 13:25:20 -0500 +Received: from lincoln.FAIRIND.FAIRFIELD.COM ([172.16.10.11]) by + smtpproxy.fairind.fairfield.com with InterScan Message Security + Suite; Thu, 13 Jul 2006 13:07:13 -0500 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: hyper slow after upgrade to 8.1.4 +Date: Thu, 13 Jul 2006 13:25:03 -0500 +Message-ID: + <1CA058827877644DAB54FB930FFA3B05A67C31@lincoln.FAIRIND.FAIRFIELD.COM> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] hyper slow after upgrade to 8.1.4 +Thread-Index: Acamn3qMSs0iKRapQ42qJZs5YoJRSwACHa2g +From: "Medora Schauer" +To: "Tom Lane" , "Michael Fuhr" +Cc: "Bruno Wolff III" , + "postgresql" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/135 +X-Sequence-Number: 19995 + +> From: Tom Lane [mailto:tgl@sss.pgh.pa.us] +> Sent: Thursday, July 13, 2006 11:12 AM +>=20 +> Michael Fuhr writes: +> > On Thu, Jul 13, 2006 at 08:22:46AM -0500, Medora Schauer wrote: +> >> Can it be that the connection delay is because first an IPv6 socket +is +> >> trying to be established and when that fails an IPv4 socket is +created? +>=20 +> > A sniffer like tcpdump or ethereal might reveal why connecting is +> > so slow. +>=20 +> I'd try strace'ing the client process first --- whatever is slow might +> not be exposed as TCP traffic. It does sound though that the problem +> is related to userland expecting IPv6 support that the kernel doesn't +> actually have. +>=20 +> regards, tom lane + +Good idea Tom. Strace showed communications with a machine that didn't +make sense. Turns out someone had configured DNS on the "slow" machine +but the DNS server wasn't running. When I use the IP address of the PG +server rather than the name with psql, the connection is made quickly. + +Thanks for all the help everyone, + +Medora Schauer + + + +From pgsql-performance-owner@postgresql.org Thu Jul 13 19:33:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BFC049FA441 + for ; + Thu, 13 Jul 2006 19:33:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76349-01 for + ; + Thu, 13 Jul 2006 19:33:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8B9439FA322 + for ; + Thu, 13 Jul 2006 19:33:04 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6DMWwno021982; + Thu, 13 Jul 2006 18:32:59 -0400 (EDT) +To: jkapad@csd.uoc.gr +cc: pgsql-performance@postgresql.org +Subject: Re: Problem with bitmap-index-scan plan +In-reply-to: <1152078884.44ab542441450@ermis.edu.uoc.gr> +References: <1152078884.44ab542441450@ermis.edu.uoc.gr> +Comments: In-reply-to jkapad@csd.uoc.gr + message dated "Wed, 05 Jul 2006 08:54:44 +0300" +Date: Thu, 13 Jul 2006 18:32:58 -0400 +Message-ID: <21981.1152829978@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/136 +X-Sequence-Number: 19996 + +jkapad@csd.uoc.gr writes: +> ... is quite reasonable.The table has 1.000.000 rows (17.242 pages). From +> pg_stat_get_blocks_fetched I can see that there were 102 page requests for +> table. So all things seem to work great here! + +> But if I multiply the size of the table ten-times (10.000.000 rows - 172.414 +> pages) and run the same query I get: +> ... +> which is slower even than a seq scan. Now I get that there were 131.398 page +> requests for table in order to retrieve almost 1250 tuples!Can someone explain +> why this is happening? All memory parameters are set to default. + +You probably need to increase work_mem so that the bitmaps don't become +lossy ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 13 22:31:26 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 515BF9FB365 + for ; + Thu, 13 Jul 2006 22:31:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 98778-05 for + ; + Thu, 13 Jul 2006 22:31:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-3.paradise.net.nz (bm-3a.paradise.net.nz + [203.96.152.182]) + by postgresql.org (Postfix) with ESMTP id 95A649FB317 + for ; + Thu, 13 Jul 2006 22:31:18 -0300 (ADT) +Received: from smtp-2.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-3.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J2D00010DK39V@linda-3.paradise.net.nz> for + pgsql-performance@postgresql.org; Fri, 14 Jul 2006 13:31:15 +1200 (NZST) +Received: from [192.168.1.11] (218-101-29-75.dsl.clear.net.nz [218.101.29.75]) + by smtp-2.paradise.net.nz (Postfix) with ESMTP id 90B093B1652; Fri, + 14 Jul 2006 13:31:14 +1200 (NZST) +Date: Fri, 14 Jul 2006 13:30:39 +1200 +From: Mark Kirkwood +Subject: Re: Kill a session +In-reply-to: <44B51896.1000808@modgraph-usa.com> +To: "Craig A. James" +Cc: Magnus Hagander , pgsql-performance@postgresql.org +Message-id: <44B6F3BF.1000602@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/137 +X-Sequence-Number: 19997 + +Craig A. James wrote: +> +> +> I'm back to my original question: How do you kill a runaway query +> without bringing down the whole database? Is there really no answer to +> this? +> + +As others have mentioned, pg_cancel_backend(pid) will stop query +execution by backend process id 'pid'. + +While this is often enough, if you actually want to disconnect a backend +process then there is nothing to let you do this remotely. I recently +did a patch for Bizgres that just implements the +pg_terminate_backend(pid) function (currently #ifdef'ed out of the +codebase) as a contrib so it can be easily installed. See +http://pgfoundry.org/pipermail/bizgres-general/2006-May/000484.html + +If you want to try it out, please read the README (it discusses possible +dangers associated with sending SIGTERM to backends). And I would +certainly be interested in hearing what level of success (or otherwise) +you have with it! + +Best wishes + +Mark + + + +From pgsql-performance-owner@postgresql.org Fri Jul 14 00:18:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 736CC9FB2DB + for ; + Fri, 14 Jul 2006 00:18:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 20286-10 for + ; + Fri, 14 Jul 2006 00:18:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id DD8B19FB2D5 + for ; + Fri, 14 Jul 2006 00:18:08 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6E3XhjN024405; Thu, 13 Jul 2006 20:33:43 -0700 +Message-ID: <44B6FEAA.7070708@modgraph-usa.com> +Date: Thu, 13 Jul 2006 19:17:14 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Mark Kirkwood +CC: Magnus Hagander , pgsql-performance@postgresql.org +Subject: Re: Kill a session +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> + <44B6F3BF.1000602@paradise.net.nz> +In-Reply-To: <44B6F3BF.1000602@paradise.net.nz> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/138 +X-Sequence-Number: 19998 + +Thanks for your reply, Mark: +>> I'm back to my original question: How do you kill a runaway query +>> without bringing down the whole database? Is there really no answer +>> to this? +> +> ... if you actually want to disconnect a backend +> process then there is nothing to let you do this remotely. I recently +> did a patch for Bizgres that just implements the +> pg_terminate_backend(pid) function (currently #ifdef'ed out of the +> codebase) as a contrib so it can be easily installed. See +> http://pgfoundry.org/pipermail/bizgres-general/2006-May/000484.html + +This answers my question. I've finally got a statement in concrete terms, Postgres has no way to kill a backend process via an SQL statement. "If Mark had to resort to this, then there is no other way." + +> If you want to try it out, please read the README (it discusses possible +> dangers associated with sending SIGTERM to backends). And I would +> certainly be interested in hearing what level of success (or otherwise) +> you have with it! + +Thanks, but I've already implemented my own, which is essentially identical in concept to yours, but simpler in the sense of being even less safe than yours -- I just let anyone send the signal, since I have no users other than my own app. I'll keep my version since it's embedded in my own plug-in. That way I won't have to keep remembering to modify the Postgres code when I upgrade. I like to keep Postgres "stock". + +Craig + +From pgsql-performance-owner@postgresql.org Fri Jul 14 00:24:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2EB609FB2D5 + for ; + Fri, 14 Jul 2006 00:24:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44345-07 for + ; + Fri, 14 Jul 2006 00:24:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 1A0179FB2DB + for ; + Fri, 14 Jul 2006 00:24:11 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6E3dm72024591; Thu, 13 Jul 2006 20:39:48 -0700 +Message-ID: <44B70017.6000703@modgraph-usa.com> +Date: Thu, 13 Jul 2006 19:23:19 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org, sgunderson@bigfoot.com +Subject: Re: Kill a session +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> <20060712170404.GA27392@uio.no> +In-Reply-To: <20060712170404.GA27392@uio.no> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/139 +X-Sequence-Number: 19999 + +Steinar H. Gunderson wrote: +> On Wed, Jul 12, 2006 at 08:43:18AM -0700, Craig A. James wrote: +>>> Then you killed the wrong backend... +>>> No queries run in postmaster. They all run in postgres backends. The +>>> postmaster does very little actual work, other than keeping track of +>>> everybody else. +>> It turns out I was confused by this: ps(1) reports a process called +>> "postgres", but top(1) reports a process called "postmaster", but they both +>> have the same pid. I guess postmaster replaces its own name in the process +>> table when it's executing a query, and it's not really the postmaster even +>> though top(1) calls it postmaster. +>> +>> So "kill -15 " is NOT killing the process -- to kill the process, I +>> have to use signal 9. But if I do that, ALL queries in progress are +>> aborted. I might as well shut down and restart the database, which is an +>> unacceptable solution for a web site. +> +> I don't follow your logic here. If you do "kill -15 " of the postmaster +> doing the work, the query should be aborted without taking down the entire +> cluster. I don't see why you'd need -9 (which is a really bad idea anyhow)... + +I've solved this mystery. "kill -15" doesn't immediately kill the job -- it aborts the query, but it might take 15-30 seconds to clean up. + +This confused me, because the query I was using to test took about 30 seconds, so the SIGTERM didn't seem to make a difference. But when I used a harder query, one that would run for 5-10 minutes, SIGTERM still stopped it after 15 seconds, which isn't great but it's acceptable. + +Bottom line is that I was expecting "instant death" with SIGTERM, but instead got an agonizing, drawn out -- but safe -- death of the query. At least that's my deduction based on experiments. I haven't dug into the source to confirm. + +Thanks everyone for your answers. My "kill this query" feature is now acceptable. + +Craig + +From pgsql-performance-owner@postgresql.org Fri Jul 14 02:50:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 47D6F9FB2E0 + for ; + Fri, 14 Jul 2006 02:50:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25257-10 for + ; + Fri, 14 Jul 2006 02:50:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 6F65E9FB2A2 + for ; + Fri, 14 Jul 2006 02:50:31 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6E5oM7S008781; + Fri, 14 Jul 2006 01:50:22 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org, sgunderson@bigfoot.com +Subject: Re: Kill a session +In-reply-to: <44B70017.6000703@modgraph-usa.com> +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> <20060712170404.GA27392@uio.no> + <44B70017.6000703@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Thu, 13 Jul 2006 19:23:19 -0700" +Date: Fri, 14 Jul 2006 01:50:22 -0400 +Message-ID: <8780.1152856222@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/140 +X-Sequence-Number: 20000 + +"Craig A. James" writes: +> Bottom line is that I was expecting "instant death" with SIGTERM, but +> instead got an agonizing, drawn out -- but safe -- death of the query. + +What was the query exactly? + +Our expectation is that all or at least most queries should respond to +SIGINT or SIGTERM interrupts pretty rapidly, say on a less-than-a-second +timescale. However there are various loops in the backend that fail to +execute CHECK_FOR_INTERRUPTS sufficiently often :-(. We've been +gradually finding and fixing these, and will be glad to fix your case +if you provide enough details to pin it down. You might be interested +in this current thread about a similar problem: + +http://archives.postgresql.org/pgsql-patches/2006-07/msg00039.php + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 14 04:05:55 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 81F149FB2E0 + for ; + Fri, 14 Jul 2006 04:05:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40888-08 for + ; + Fri, 14 Jul 2006 04:05:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.ext.bfk.de (mx00.ext.bfk.de [217.29.46.125]) + by postgresql.org (Postfix) with ESMTP id 216909FB2A7 + for ; + Fri, 14 Jul 2006 04:05:45 -0300 (ADT) +Received: from fweimer by bfk.de with local id 1G1Hjv-0005zv-RO; + Fri, 14 Jul 2006 09:05:31 +0200 +To: Greg Stark +Cc: Tom Lane , + "Steve McWilliams" , + pgsql-performance@postgresql.org +Subject: Re: size of pg_dump files containing bytea values +References: <3985.10.1.1.126.1152729387.squirrel@portal.emprisanetworks.com> + <1820.1152759205@sss.pgh.pa.us> <87k66hii11.fsf@stark.xeocode.com> +From: Florian Weimer +Date: Fri, 14 Jul 2006 09:05:31 +0200 +In-Reply-To: <87k66hii11.fsf@stark.xeocode.com> (Greg Stark's message of "13 + Jul 2006 12:30:50 -0400") +Message-ID: <82k66g64zo.fsf@mid.bfk.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/141 +X-Sequence-Number: 20001 + +* Greg Stark: + +> Didn't byteas used to get printed as hex? + +No, they didn't. It would be useful to support hexadecimal BYTEA +literals, though. Unfortunately, X'DEADBEEF' has already been taken +by bit strings. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + +From pgsql-performance-owner@postgresql.org Fri Jul 14 08:28:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E1BBD9FB35B + for ; + Fri, 14 Jul 2006 08:28:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78425-05 for + ; + Fri, 14 Jul 2006 08:28:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 1F30F9FB352 + for ; + Fri, 14 Jul 2006 08:28:14 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (T9049.t.pppool.de + [89.55.144.73]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id AC3B7656BB + for ; + Fri, 14 Jul 2006 13:29:52 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 94A33185B293B + for ; + Fri, 14 Jul 2006 13:28:29 +0200 (CEST) +Message-ID: <44B77FDD.2000900@logix-tt.com> +Date: Fri, 14 Jul 2006 13:28:29 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Kill a session +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> <20060712170404.GA27392@uio.no> + <44B70017.6000703@modgraph-usa.com> <8780.1152856222@sss.pgh.pa.us> +In-Reply-To: <8780.1152856222@sss.pgh.pa.us> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/142 +X-Sequence-Number: 20002 + +Hi, Tom, + +Tom Lane wrote: +> Our expectation is that all or at least most queries should respond to +> SIGINT or SIGTERM interrupts pretty rapidly, say on a less-than-a-second +> timescale. However there are various loops in the backend that fail to +> execute CHECK_FOR_INTERRUPTS sufficiently often :-(. + +The same is true for user-defined C funtions. + +The PostGIS GEOS geometry functions come to mind, for complex +geometries, they can need hours to complete. And as GEOS is a 3rd-Party +library, I don't see an easy way to make them CHECK_FOR_INTERRUPTS. + +Does anybody know how this is for plpgsql, pljava and plpython? + + +HTH, +Markus +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Fri Jul 14 13:18:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8AACA9FB1C7 + for ; + Fri, 14 Jul 2006 13:18:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37570-10 for + ; + Fri, 14 Jul 2006 13:18:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 0500D9FB1C4 + for ; + Fri, 14 Jul 2006 13:18:32 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6EGYCg1009144; Fri, 14 Jul 2006 09:34:12 -0700 +Message-ID: <44B7B592.1090405@modgraph-usa.com> +Date: Fri, 14 Jul 2006 08:17:38 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Tom Lane +CC: pgsql-performance@postgresql.org, sgunderson@bigfoot.com +Subject: Re: Kill a session +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> <20060712170404.GA27392@uio.no> + <44B70017.6000703@modgraph-usa.com> <8780.1152856222@sss.pgh.pa.us> +In-Reply-To: <8780.1152856222@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/143 +X-Sequence-Number: 20003 + +Tom Lane wrote: +> "Craig A. James" writes: +>> Bottom line is that I was expecting "instant death" with SIGTERM, but +>> instead got an agonizing, drawn out -- but safe -- death of the query. +> +> What was the query exactly? +> +> Our expectation is that all or at least most queries should respond to +> SIGINT or SIGTERM interrupts pretty rapidly, say on a less-than-a-second +> timescale. However there are various loops in the backend that fail to +> execute CHECK_FOR_INTERRUPTS sufficiently often :-(. We've been +> gradually finding and fixing these, and will be glad to fix your case +> if you provide enough details to pin it down. You might be interested +> in this current thread about a similar problem: +> +> http://archives.postgresql.org/pgsql-patches/2006-07/msg00039.php + +Thanks, this is good information. The qsort is a distinct possibility. The query is a big + + insert into some_hitlist (select id from another_hitlist join data_table on (...)) + +where the hitlists are unindexed. So it may be using a merge-join with qsort. When I have a few minutes, I'll turn on logging in the app and find the exact SQL, and run an EXPLAIN ANALYZE and see what's really happening. + +It's also possible that the INSERT itself is the problem, or adds to the problem. The SIGINT may come after a few million rows have been inserted, so it would have to clean that up, right? + +Thanks, +Craig + + +From pgsql-performance-owner@postgresql.org Fri Jul 14 13:25:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 21C059FB1C4 + for ; + Fri, 14 Jul 2006 13:25:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40749-07 for + ; + Fri, 14 Jul 2006 13:25:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id A997A9FB1C7 + for ; + Fri, 14 Jul 2006 13:25:21 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6EGPDg5022034; + Fri, 14 Jul 2006 12:25:13 -0400 (EDT) +To: "Craig A. James" +cc: pgsql-performance@postgresql.org, sgunderson@bigfoot.com +Subject: Re: Kill a session +In-reply-to: <44B7B592.1090405@modgraph-usa.com> +References: <6BCB9D8A16AC4241919521715F4D8BCEA0FAE8@algol.sollentuna.se> + <44B51896.1000808@modgraph-usa.com> <20060712170404.GA27392@uio.no> + <44B70017.6000703@modgraph-usa.com> <8780.1152856222@sss.pgh.pa.us> + <44B7B592.1090405@modgraph-usa.com> +Comments: In-reply-to "Craig A. James" + message dated "Fri, 14 Jul 2006 08:17:38 -0700" +Date: Fri, 14 Jul 2006 12:25:13 -0400 +Message-ID: <22033.1152894313@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/144 +X-Sequence-Number: 20004 + +"Craig A. James" writes: +> It's also possible that the INSERT itself is the problem, or adds to the problem. The SIGINT may come after a few million rows have been inserted, so it would have to clean that up, right? + +No, because we don't use UNDO. The next VACUUM would have a bit of a +mess to clean up, but you wouldn't pay for it at the time of the abort. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 14 15:57:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id F0E379FAE4E + for ; + Fri, 14 Jul 2006 15:57:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40552-03 for + ; + Fri, 14 Jul 2006 15:57:04 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 8931C9FAC76 + for ; + Fri, 14 Jul 2006 15:57:04 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id EBEDE30B98; Fri, 14 Jul 2006 20:57:00 +0200 (MET DST) +From: worky.workerson@gmail.com +X-Newsgroups: pgsql.performance +Subject: Self-join query and index usage +Date: 14 Jul 2006 11:56:53 -0700 +Organization: http://groups.google.com +Lines: 31 +Message-ID: <1152903413.210226.284600@75g2000cwc.googlegroups.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="iso-8859-1" +X-Complaints-To: groups-abuse@google.com +User-Agent: G2/0.2 +X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; + rv:1.8.0.4) Gecko/20060508 + Firefox/1.5.0.4,gzip(gfe),gzip(gfe) +Complaints-To: groups-abuse@google.com +Injection-Info: 75g2000cwc.googlegroups.com; posting-host=63.239.69.1; + posting-account=EhkmOg0AAAAu8-rAx4_fA4J_FdZnfg8I +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/145 +X-Sequence-Number: 20005 + +I'm doing a self join of some shipping data and wanted to get the best +query possible. The interesting table is the event table, and it has +the following structure: + + startnode int, + endnode int, + weight int, + starttime timestamp, + endtime timestamp + +and the query that I would like to run is: + +SELECT e1.endnode, count(*), sum(e1.weight) AS weight1, sum(e2.weight) +AS weight2 +FROM event e1, event e2 +WHERE e1.endnode = e2.startnode AND e1.starttime < e2.starttime AND +e2.starttime < e1.endtime +GROUP BY e1.endnode + +Assuming that I have indexes on all the columns, should this query be +able to make use of the indexes on starttime and endtime? + +The "best" plan that I could see is a merge join between a sorted +sequential scan on e2.startnode and an index scan on e1.endnode, which +I figure takes care of the "e1.endnode = e2.startnode". The join +filter is then "e1.starttime < e2.starttime AND e2.starttime < +e1.endtime" ... does this use an index? Can the planner to use a +bitmap index scan to use the indexes on the start/endtimes in the join? + +Table is about 3GB. + + +From pgsql-performance-owner@postgresql.org Fri Jul 14 16:19:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C7E989FAD5A + for ; + Fri, 14 Jul 2006 16:19:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 40362-09 for + ; + Fri, 14 Jul 2006 16:19:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id A6C879FAC76 + for ; + Fri, 14 Jul 2006 16:19:20 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6EJJIvV004261; + Fri, 14 Jul 2006 15:19:18 -0400 (EDT) +To: worky.workerson@gmail.com +cc: pgsql-performance@postgresql.org +Subject: Re: Self-join query and index usage +In-reply-to: <1152903413.210226.284600@75g2000cwc.googlegroups.com> +References: <1152903413.210226.284600@75g2000cwc.googlegroups.com> +Comments: In-reply-to worky.workerson@gmail.com + message dated "14 Jul 2006 11:56:53 -0700" +Date: Fri, 14 Jul 2006 15:19:18 -0400 +Message-ID: <4260.1152904758@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/146 +X-Sequence-Number: 20006 + +worky.workerson@gmail.com writes: +> and the query that I would like to run is: + +> SELECT e1.endnode, count(*), sum(e1.weight) AS weight1, sum(e2.weight) +> AS weight2 +> FROM event e1, event e2 +> WHERE e1.endnode = e2.startnode AND e1.starttime < e2.starttime AND +> e2.starttime < e1.endtime +> GROUP BY e1.endnode + +> Assuming that I have indexes on all the columns, should this query be +> able to make use of the indexes on starttime and endtime? + +This is just really poorly suited for btree indexes. What you're +looking for is an interval overlap test, which is something that can be +handled by rtree or gist indexes, but you'll need to change the form of +the query ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jul 15 11:14:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 56CC99FB218 + for ; + Sat, 15 Jul 2006 11:14:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84201-06 for + ; + Sat, 15 Jul 2006 11:14:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.l39a.com (host123-67.pool8288.interbusiness.it + [82.88.67.123]) by postgresql.org (Postfix) with ESMTP id D85BA9FB217 + for ; + Sat, 15 Jul 2006 11:14:16 -0300 (ADT) +Received: from [172.16.0.1] (unknown [151.57.253.237]) + by mail.l39a.com (Postfix) with ESMTP id 3C29025F0E4 + for ; + Sat, 15 Jul 2006 16:14:14 +0200 (CEST) +Subject: Big differences in plans between 8.0 and 8.1 +From: Gabriele Turchi +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Organization: L39A S.r.l. +Date: Sat, 15 Jul 2006 16:14:11 +0200 +Message-Id: <1152972852.3541.0.camel@apollo5.casa.intranet> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.5) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/147 +X-Sequence-Number: 20007 + +Hi all. I have a strange (and serious) problem with an application +ported from postgres 8.0 to 8.1. + +The old installation is postgresql-8.0.4-2.FC4.1 running on a Fedora 4, +the new one is postgresql-8.1.4-1.FC5.1 running on a fedora 5. + +Some query is now _very_ slow. I've found some deep differences between +query plans. + +As example. The query is: + +select count(*) from orario_ap join registrazioni using(treno, data) +join personale using(personale_id) join ruoli using(ruolo_id) where +data=today_or) where data=today_orario(); + +orario_ap is a view. + +On 8.0 the query runs in 138.146 ms +On 8.1 the query runs in 6761.112 ms +On 8.1 with nested loops disabled: 63.184 ms + +This is not the only query affected. + +Two notes: please cc answer directly to me, and I'm sorry, my english is +alpha version. + + +On a 8.0 the plan is: + +railcomm04=# explain analyze select count(*) from orario_ap join +registrazioni using(treno, data) join personale using(personale_id) join +ruoli using(ruolo_id) where data=today_or) where data=today_orario(); + +QUERY PLAN +------------------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=1106.77..1106.77 rows=1 width=0) (actual +time=137.786..137.787 rows=1 loops=1) + -> Merge Join (cost=1088.96..1105.66 rows=444 width=0) (actual +time=124.173..137.190 rows=349 loops=1) + Merge Cond: (("outer".tipo_treno = "inner".tipo_treno) AND +("outer".num_treno = "inner".num_treno) AND ("outer".orario = +"inner".orario)) + -> Sort (cost=574.10..575.09 rows=395 width=26) (actual +time=97.647..98.010 rows=349 loops=1) + Sort Key: o1.tipo_treno, o1.num_treno, o1.orario + -> Hash Join (cost=28.45..557.06 rows=395 width=26) +(actual time=35.326..93.415 rows=349 loops=1) + Hash Cond: ("outer".ruolo_id = "inner".ruolo_id) + -> Hash Join (cost=27.41..550.10 rows=395 +width=30) (actual time=12.827..69.411 rows=349 loops=1) + Hash Cond: ("outer".personale_id = +"inner".personale_id) + -> Hash Join (cost=12.85..529.61 rows=395 +width=34) (actual time=10.453..65.365 rows=349 loops=1) + Hash Cond: ("outer".treno = +"inner".treno) + -> Seq Scan on orario o1 +(cost=0.00..504.38 rows=843 width=33) (actual time=3.691..57.487 +rows=797 loops=1) + Filter: ((seq_fermata = 1) AND +(data = date((now() - '02:00:00'::interval)))) + -> Hash (cost=11.98..11.98 rows=349 +width=19) (actual time=2.665..2.665 rows=0 loops=1) + -> Seq Scan on registrazioni +(cost=0.00..11.98 rows=349 width=19) (actual time=0.029..2.042 rows=349 +loops=1) + Filter: (date((now() - +'02:00:00'::interval)) = data) + -> Hash (cost=12.85..12.85 rows=685 +width=4) (actual time=2.350..2.350 rows=0 loops=1) + -> Seq Scan on personale +(cost=0.00..12.85 rows=685 width=4) (actual time=0.005..1.350 rows=685 +loops=1) + -> Hash (cost=1.03..1.03 rows=3 width=4) (actual +time=22.479..22.479 rows=0 loops=1) + -> Seq Scan on ruoli (cost=0.00..1.03 +rows=3 width=4) (actual time=22.461..22.468 rows=3 loops=1) + -> Sort (cost=514.86..516.94 rows=831 width=26) (actual +time=26.493..27.490 rows=949 loops=1) + Sort Key: o2.tipo_treno, o2.num_treno, o2.orario + -> Seq Scan on orario o2 (cost=0.00..474.56 rows=831 +width=26) (actual time=0.056..17.398 rows=797 loops=1) + Filter: ((orario_partenza IS NULL) AND (date((now() +- '02:00:00'::interval)) = data)) + Total runtime: 138.146 ms + + + +On a standard 8.1 is: + +railcomm04=# explain analyze select count(*) from orario_ap join +registrazioni using(treno, data) join personale using(personale_id) join +ruoli using(ruolo_id) where data=today_orario(); + +QUERY PLAN +---------------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=500.45..500.46 rows=1 width=0) (actual +time=6760.876..6760.877 rows=1 loops=1) + -> Nested Loop (cost=0.00..500.44 rows=1 width=0) (actual +time=5.915..6759.550 rows=349 loops=1) + Join Filter: (("outer".orario = "inner".orario) AND +("outer".num_treno = "inner".num_treno) AND ("outer".tipo_treno = +"inner".tipo_treno)) + -> Nested Loop (cost=0.00..25.87 rows=1 width=72) (actual +time=0.124..42.617 rows=349 loops=1) + -> Nested Loop (cost=0.00..20.15 rows=1 width=76) +(actual time=0.106..34.330 rows=349 loops=1) + -> Nested Loop (cost=0.00..14.12 rows=1 width=40) +(actual time=0.045..12.037 rows=349 loops=1) + Join Filter: ("outer".ruolo_id = +"inner".ruolo_id) + -> Seq Scan on registrazioni +(cost=0.00..11.98 rows=2 width=44) (actual time=0.025..2.315 rows=349 +loops=1) + Filter: (date((now() - +'02:00:00'::interval)) = data) + -> Seq Scan on ruoli (cost=0.00..1.03 +rows=3 width=4) (actual time=0.003..0.009 rows=3 loops=349) + -> Index Scan using orario_pkey on orario o1 +(cost=0.00..6.02 rows=1 width=104) (actual time=0.053..0.056 rows=1 +loops=349) + Index Cond: ((o1.treno = "outer".treno) AND +(o1.seq_fermata = 1)) + Filter: (data = date((now() - +'02:00:00'::interval))) + -> Index Scan using personale_pkey on personale +(cost=0.00..5.71 rows=1 width=4) (actual time=0.013..0.017 rows=1 +loops=349) + Index Cond: ("outer".personale_id = +personale.personale_id) + -> Seq Scan on orario o2 (cost=0.00..474.56 rows=1 width=72) +(actual time=0.030..17.784 rows=797 loops=349) + Filter: ((orario_partenza IS NULL) AND (date((now() - +'02:00:00'::interval)) = data)) + Total runtime: 6761.112 ms + + +On a 8.1 with nested loops disabled: + +railcomm04=# explain analyze select count(*) from orario_ap join +registrazioni using(treno, data) join personale using(personale_id) join +ruoli using(ruolo_id) where data=today_orario(); + +QUERY PLAN +----------------------------------------------------------------------------------------------------------------------------------------------------------- + Aggregate (cost=802.82..802.83 rows=1 width=0) (actual +time=62.309..62.310 rows=1 loops=1) + -> Hash Join (cost=328.23..802.82 rows=1 width=0) (actual +time=44.443..61.867 rows=349 loops=1) + Hash Cond: (("outer".orario = "inner".orario) AND +("outer".num_treno = "inner".num_treno) AND ("outer".tipo_treno = +"inner".tipo_treno)) + -> Seq Scan on orario o2 (cost=0.00..474.56 rows=1 width=72) +(actual time=0.068..16.558 rows=797 loops=1) + Filter: ((orario_partenza IS NULL) AND (date((now() - +'02:00:00'::interval)) = data)) + -> Hash (cost=328.22..328.22 rows=1 width=72) (actual +time=38.479..38.479 rows=349 loops=1) + -> Hash Join (cost=29.33..328.22 rows=1 width=72) +(actual time=6.700..37.530 rows=349 loops=1) + Hash Cond: ("outer".treno = "inner".treno) + -> Index Scan using orario_pkey on orario o1 +(cost=0.00..298.88 rows=1 width=104) (actual time=0.069..29.033 rows=797 +loops=1) + Index Cond: (seq_fermata = 1) + Filter: (data = date((now() - +'02:00:00'::interval))) + -> Hash (cost=29.32..29.32 rows=1 width=36) +(actual time=6.595..6.595 rows=349 loops=1) + -> Hash Join (cost=13.04..29.32 rows=1 +width=36) (actual time=3.361..5.887 rows=349 loops=1) + Hash Cond: ("outer".personale_id = +"inner".personale_id) + -> Seq Scan on personale +(cost=0.00..12.85 rows=685 width=4) (actual time=0.013..1.098 rows=685 +loops=1) + -> Hash (cost=13.04..13.04 rows=1 +width=40) (actual time=3.301..3.301 rows=349 loops=1) + -> Hash Join (cost=1.04..13.04 +rows=1 width=40) (actual time=0.090..2.602 rows=349 loops=1) + Hash Cond: +("outer".ruolo_id = "inner".ruolo_id) + -> Seq Scan on +registrazioni (cost=0.00..11.98 rows=2 width=44) (actual +time=0.025..1.465 rows=349 loops=1) + Filter: (date((now() +- '02:00:00'::interval)) = data) + -> Hash (cost=1.03..1.03 +rows=3 width=4) (actual time=0.040..0.040 rows=3 loops=1) + -> Seq Scan on ruoli +(cost=0.00..1.03 rows=3 width=4) (actual time=0.014..0.025 rows=3 +loops=1) + Total runtime: 63.184 ms + + +Regards, +Gabriele + + +From pgsql-performance-owner@postgresql.org Sat Jul 15 15:28:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 3CB5A9FB216 + for ; + Sat, 15 Jul 2006 15:28:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 16773-01 for + ; + Sat, 15 Jul 2006 18:28:13 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 24D5E9FA6AF + for ; + Sat, 15 Jul 2006 15:28:13 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6FIi4MQ010964; Sat, 15 Jul 2006 11:44:04 -0700 +Message-ID: <44B92578.1060705@modgraph-usa.com> +Date: Sat, 15 Jul 2006 10:27:20 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Hassan Adekoya +CC: pgsql-performance@postgresql.org +Subject: Re: increment Rows in an SQL Result Set postgresql +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/149 +X-Sequence-Number: 20009 + +Hassan, + +> 1. I have a function that given two parameter produces an arbitrary id, and +> text. However arbitrary the id and text are, they are in certain order. i.e. it +> is imperative that whatever processing I do, the order is preserved. + +What type of function is this? Did you write it in C? An SQL procedure? + +If the function is written in C, you can create a static local variable which you increment every time you call your function, and which you return along with your other two values. As long as your client is connected to the back-end server, you're guaranteed that it's a single process, and it's not multi-threaded, so this is a safe approach. However, note that if you disconnect and reconnect, your counter will be reset to zero. + +If your function is written in a different language or is a procedure, you might create a sequence that your function can query. + +The trick is that it is the function itself that must return the incremented value, i.e. you must return three, not two, values from your function. That way, you're not relying on any specific features of the planner, so your three values will stick together. + +Craig + +From pgsql-performance-owner@postgresql.org Sat Jul 15 15:05:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id D12D99FB216 + for ; + Sat, 15 Jul 2006 15:05:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 65592-07 for + ; + Sat, 15 Jul 2006 18:05:13 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) + by postgresql.org (Postfix) with ESMTP id 20AA09FA4A8 + for ; + Sat, 15 Jul 2006 15:05:10 -0300 (ADT) +Received: from root by ciao.gmane.org with local (Exim 4.43) + id 1G1oVi-00044J-1M + for pgsql-performance@postgresql.org; Sat, 15 Jul 2006 20:05:02 +0200 +Received: from 7Cust139.VR3.NYC4.broadband.uu.net ([63.13.248.139]) + by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) + id 1AlnuQ-0007hv-00 + for ; Sat, 15 Jul 2006 20:05:02 +0200 +Received: from hechy_man by 7Cust139.VR3.NYC4.broadband.uu.net with local + (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 + for ; Sat, 15 Jul 2006 20:05:02 +0200 +X-Injected-Via-Gmane: http://gmane.org/ +To: pgsql-performance@postgresql.org +From: Hassan Adekoya +Subject: increment Rows in an SQL Result Set postgresql +Date: Sat, 15 Jul 2006 17:46:40 +0000 (UTC) +Lines: 44 +Message-ID: +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Complaints-To: usenet@sea.gmane.org +X-Gmane-NNTP-Posting-Host: main.gmane.org +User-Agent: Loom/3.14 (http://gmane.org/) +X-Loom-IP: 63.13.248.139 (Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/148 +X-Sequence-Number: 20008 + +HI, + +1. I have a function that given two parameter produces an arbitrary id, and +text. However arbitrary the id and text are, they are in certain order. i.e. it +is imperative that whatever processing I do, the order is preserved. + +2. An odd thing happens when I perform a join on the result set such that the +order that I hope to preserved in destroyed. The same result set but different +ordering. I gather this is due to the query planner. Enough said. + +I was hoping to insert a counter in the select query of 1. such that when I +perform the join of 2, I can order by the counter. + + +i.e. + +1. select id, astext from function1(1,2) +2. select id, astext, table2.name from function1(1,2) as tmp, table2 where +tmp.id = table2.id + +when I perform 1., I get something of sort + +id | astext +2 | abc +6 | efg +3 | fhg + +I will like to preserve ordering.... + +When I perform 2, I get somthing of sort + +id | astext | table2.name +6 | efg | joe +2 | abc | zyi +3 | fgh | mec + +Can someone help such that I get something like + +id | astext | table2.name | increment +6 | efg | joe | 2 +2 | abc | zyi | 1 +3 | fgh | mec | 3 + +Thanks! + + +From pgsql-performance-owner@postgresql.org Sat Jul 15 15:53:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id AC67E9FB216 + for ; + Sat, 15 Jul 2006 15:53:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 47140-03 for + ; + Sat, 15 Jul 2006 18:53:09 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web30109.mail.mud.yahoo.com (web30109.mail.mud.yahoo.com + [68.142.200.82]) by postgresql.org (Postfix) with SMTP id E0A659FA666 + for ; + Sat, 15 Jul 2006 15:53:08 -0300 (ADT) +Received: (qmail 5591 invoked by uid 60001); 15 Jul 2006 18:53:07 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; + b=g9ajFKmWTxw042LjUEgWx3mszl+X2TTFMJgRvstMEzZ4TZ3jSjaTKwwD7J0bnWQ1zVF8yrGdf7BNbrSI5B8uUcU9fyEFUtoFObIFW17dNMRWN2O6Y+s78KoG820RwL5gKFaZ4YcUxsmsjAw5um5jWvtip965qjdTsKgd8hhxe7k= + ; +Message-ID: <20060715185307.5589.qmail@web30109.mail.mud.yahoo.com> +Received: from [63.13.248.139] by web30109.mail.mud.yahoo.com via HTTP; + Sat, 15 Jul 2006 11:53:07 PDT +Date: Sat, 15 Jul 2006 11:53:07 -0700 (PDT) +From: Hassan +Reply-To: Hassan +Subject: Re: increment Rows in an SQL Result Set postgresql +To: pgsql-performance@postgresql.org +In-Reply-To: <44B92578.1060705@modgraph-usa.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/150 +X-Sequence-Number: 20010 + +Sadly I didnt write this function. It was written in C and packaged in a shared module .so. I access it thru postgresql as plpgsql function. I cannot edit the function thus. + + I tried this + + CREATE TEMPORARY SEQUENCE serial START 1; + SELECT nextval('serial'), astext(tmp.the_geom), street FROM shortest_path_as_geometry('bklion', 185, 10953) AS tmp LEFT JOIN (SELECT * FROM bklion) AS ss ON ss.the_geom = tmp.the_geom; + + I know this is inefficient, and I surely dont know the repercussion of using the temporary sequence in a web application. Do you? + + Appreciate any input. + + Thanks! + + - Hassan Adekoya + + +----- Original Message ---- +From: Craig A. James +To: Hassan Adekoya +Cc: pgsql-performance@postgresql.org +Sent: Saturday, July 15, 2006 1:27:20 PM +Subject: Re: [PERFORM] increment Rows in an SQL Result Set postgresql + +Hassan, + +> 1. I have a function that given two parameter produces an arbitrary id, and +> text. However arbitrary the id and text are, they are in certain order. i.e. it +> is imperative that whatever processing I do, the order is preserved. + +What type of function is this? Did you write it in C? An SQL procedure? + +If the function is written in C, you can create a static local variable which you increment every time you call your function, and which you return along with your other two values. As long as your client is connected to the back-end server, you're guaranteed that it's a single process, and it's not multi-threaded, so this is a safe approach. However, note that if you disconnect and reconnect, your counter will be reset to zero. + +If your function is written in a different language or is a procedure, you might create a sequence that your function can query. + +The trick is that it is the function itself that must return the incremented value, i.e. you must return three, not two, values from your function. That way, you're not relying on any specific features of the planner, so your three values will stick together. + +Craig + + + + +From pgsql-performance-owner@postgresql.org Sat Jul 15 16:02:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3B13A9FB216 + for ; + Sat, 15 Jul 2006 16:02:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 24461-01 for + ; + Sat, 15 Jul 2006 16:02:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) + by postgresql.org (Postfix) with ESMTP id 996049FA666 + for ; + Sat, 15 Jul 2006 16:02:31 -0300 (ADT) +Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) + by tigger.fuhr.org (8.13.7/8.13.7) with ESMTP id k6FJ2E18002587 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Sat, 15 Jul 2006 13:02:17 -0600 (MDT) +Received: from winnie.fuhr.org (localhost [127.0.0.1]) + by winnie.fuhr.org (8.13.6/8.13.6) with ESMTP id k6FJ2DKk076470; + Sat, 15 Jul 2006 13:02:13 -0600 (MDT) + (envelope-from mfuhr@winnie.fuhr.org) +Received: (from mfuhr@localhost) + by winnie.fuhr.org (8.13.6/8.13.6/Submit) id k6FJ2AO8076469; + Sat, 15 Jul 2006 13:02:10 -0600 (MDT) (envelope-from mfuhr) +Date: Sat, 15 Jul 2006 13:02:10 -0600 +From: Michael Fuhr +To: Gabriele Turchi +Cc: pgsql-performance@postgresql.org +Subject: Re: Big differences in plans between 8.0 and 8.1 +Message-ID: <20060715190210.GA76277@winnie.fuhr.org> +References: <1152972852.3541.0.camel@apollo5.casa.intranet> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1152972852.3541.0.camel@apollo5.casa.intranet> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/151 +X-Sequence-Number: 20011 + +On Sat, Jul 15, 2006 at 04:14:11PM +0200, Gabriele Turchi wrote: +> Hi all. I have a strange (and serious) problem with an application +> ported from postgres 8.0 to 8.1. +> +> The old installation is postgresql-8.0.4-2.FC4.1 running on a Fedora 4, +> the new one is postgresql-8.1.4-1.FC5.1 running on a fedora 5. +> +> Some query is now _very_ slow. I've found some deep differences between +> query plans. + +Have you run ANALYZE in 8.1? Some of the row count estimates in +the 8.1 plan differ significantly from the actual number of rows +returned, while in the 8.0 plan the estimates are accurate. For +example, in one case the 8.0 plan shows 349 rows estimated, 349 +rows returned: + + -> Seq Scan on registrazioni (cost=0.00..11.98 rows=349 width=19) (actual time=0.029..2.042 rows=349 loops=1) + Filter: (date((now() - '02:00:00'::interval)) = data) + +but the 8.1 plan shows 2 rows estimated, 349 rows returned: + + -> Seq Scan on registrazioni (cost=0.00..11.98 rows=2 width=44) (actual time=0.025..2.315 rows=349 loops=1) + Filter: (date((now() - '02:00:00'::interval)) = data) + +This suggests that the 8.1 statistics are out of date, possibly +because ANALYZE or VACUUM ANALYZE hasn't been run since the data +was loaded. Try running ANALYZE in 8.1 and post the new plans if +that doesn't help. + +-- +Michael Fuhr + +From pgsql-performance-owner@postgresql.org Sat Jul 15 16:55:58 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id A5E539FB216 + for ; + Sat, 15 Jul 2006 16:55:57 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 26045-09 for + ; + Sat, 15 Jul 2006 19:55:53 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.l39a.com (host123-67.pool8288.interbusiness.it + [82.88.67.123]) by postgresql.org (Postfix) with ESMTP id 6C9B59FA66C + for ; + Sat, 15 Jul 2006 16:55:53 -0300 (ADT) +Received: from [172.16.0.1] (unknown [151.57.253.237]) + by mail.l39a.com (Postfix) with ESMTP id 3D3C725F0E4; + Sat, 15 Jul 2006 21:55:51 +0200 (CEST) +Subject: Re: Big differences in plans between 8.0 and 8.1 +From: Gabriele Turchi +To: Michael Fuhr +Cc: pgsql-performance@postgresql.org, Marco Colombo +In-Reply-To: <20060715190210.GA76277@winnie.fuhr.org> +References: <1152972852.3541.0.camel@apollo5.casa.intranet> + <20060715190210.GA76277@winnie.fuhr.org> +Content-Type: text/plain +Organization: L39A S.r.l. +Date: Sat, 15 Jul 2006 21:55:49 +0200 +Message-Id: <1152993350.3541.22.camel@apollo5.casa.intranet> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.5) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/152 +X-Sequence-Number: 20012 + +Il giorno sab, 15/07/2006 alle 13.02 -0600, Michael Fuhr ha scritto: +> On Sat, Jul 15, 2006 at 04:14:11PM +0200, Gabriele Turchi wrote: +> > Hi all. I have a strange (and serious) problem with an application +> > ported from postgres 8.0 to 8.1. +> > +> > The old installation is postgresql-8.0.4-2.FC4.1 running on a Fedora 4, +> > the new one is postgresql-8.1.4-1.FC5.1 running on a fedora 5. +> > +> > Some query is now _very_ slow. I've found some deep differences between +> > query plans. +> +> Have you run ANALYZE in 8.1? Some of the row count estimates in +> the 8.1 plan differ significantly from the actual number of rows +> returned, while in the 8.0 plan the estimates are accurate. For + +Running an ANALYZE really change the plan, now it is fast as before +(8.0). + +On the production system a VACUUM FULL ANALYZE is run every morning +after a clean-up, when the "registrazioni" table is empty. During the +day this table fills up (about 500 record any day), and apparently the +performances are free-falling very quickly. This behaviour has not +changed between the old and the new installation. + +Can you suggest an easy way to collect and keep up-to-date these +statistics in a very low-impact way? + +I'm stunned from a so big difference in execution time from a so small +difference in the records number... + +> example, in one case the 8.0 plan shows 349 rows estimated, 349 +> rows returned: +> +> -> Seq Scan on registrazioni (cost=0.00..11.98 rows=349 width=19) (actual time=0.029..2.042 rows=349 loops=1) +> Filter: (date((now() - '02:00:00'::interval)) = data) +> +> but the 8.1 plan shows 2 rows estimated, 349 rows returned: +> +> -> Seq Scan on registrazioni (cost=0.00..11.98 rows=2 width=44) (actual time=0.025..2.315 rows=349 loops=1) +> Filter: (date((now() - '02:00:00'::interval)) = data) +> +> This suggests that the 8.1 statistics are out of date, possibly +> because ANALYZE or VACUUM ANALYZE hasn't been run since the data +> was loaded. Try running ANALYZE in 8.1 and post the new plans if +> that doesn't help. +> + +Thank you very much, +Gabriele + + + +From pgsql-performance-owner@postgresql.org Sat Jul 15 17:04:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 9823A9FB216 + for ; + Sat, 15 Jul 2006 17:04:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 47875-07 for + ; + Sat, 15 Jul 2006 20:04:35 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from joeconway.com (wsip-68-15-9-201.sd.sd.cox.net [68.15.9.201]) + by postgresql.org (Postfix) with ESMTP id 222559FB210 + for ; + Sat, 15 Jul 2006 17:04:34 -0300 (ADT) +Received: from [192.168.4.40] (account jconway [192.168.4.40] verified) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 4050702; Sat, 15 Jul 2006 13:04:34 -0700 +Message-ID: <44B94A51.9050108@joeconway.com> +Date: Sat, 15 Jul 2006 13:04:33 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; + rv:1.7.13) Gecko/20060501 Fedora/1.7.13-1.1.fc5 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gabriele Turchi +CC: Michael Fuhr , pgsql-performance@postgresql.org, + Marco Colombo +Subject: Re: Big differences in plans between 8.0 and 8.1 +References: <1152972852.3541.0.camel@apollo5.casa.intranet> + <20060715190210.GA76277@winnie.fuhr.org> + <1152993350.3541.22.camel@apollo5.casa.intranet> +In-Reply-To: <1152993350.3541.22.camel@apollo5.casa.intranet> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/153 +X-Sequence-Number: 20013 + +Gabriele Turchi wrote: +> Running an ANALYZE really change the plan, now it is fast as before +> (8.0). +> +> On the production system a VACUUM FULL ANALYZE is run every morning +> after a clean-up, when the "registrazioni" table is empty. During the +> day this table fills up (about 500 record any day), and apparently the +> performances are free-falling very quickly. This behaviour has not +> changed between the old and the new installation. +> +> Can you suggest an easy way to collect and keep up-to-date these +> statistics in a very low-impact way? +> + +Why not just periodically (once an hour?) run "ANALYZE registrazioni;" +during the day. This will only update the statistics, and should be very +low impact. + +HTH, + +Joe + +From pgsql-performance-owner@postgresql.org Sat Jul 15 17:23:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B8FA19FB216 + for ; + Sat, 15 Jul 2006 17:23:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 94212-10 for + ; + Sat, 15 Jul 2006 17:22:53 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.l39a.com (host123-67.pool8288.interbusiness.it + [82.88.67.123]) by postgresql.org (Postfix) with ESMTP id B71079FB210 + for ; + Sat, 15 Jul 2006 17:22:53 -0300 (ADT) +Received: from [172.16.0.1] (unknown [151.57.253.237]) + by mail.l39a.com (Postfix) with ESMTP id 174CC25F481; + Sat, 15 Jul 2006 22:22:52 +0200 (CEST) +Subject: Re: Big differences in plans between 8.0 and 8.1 +From: Gabriele Turchi +To: Joe Conway +Cc: Michael Fuhr , pgsql-performance@postgresql.org, + Marco Colombo +In-Reply-To: <44B94A51.9050108@joeconway.com> +References: <1152972852.3541.0.camel@apollo5.casa.intranet> + <20060715190210.GA76277@winnie.fuhr.org> + <1152993350.3541.22.camel@apollo5.casa.intranet> + <44B94A51.9050108@joeconway.com> +Content-Type: text/plain +Organization: L39A S.r.l. +Date: Sat, 15 Jul 2006 22:22:50 +0200 +Message-Id: <1152994970.3541.31.camel@apollo5.casa.intranet> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.5) +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/154 +X-Sequence-Number: 20014 + +Il giorno sab, 15/07/2006 alle 13.04 -0700, Joe Conway ha scritto: +> Gabriele Turchi wrote: +> > Running an ANALYZE really change the plan, now it is fast as before +> > (8.0). +> > +> > On the production system a VACUUM FULL ANALYZE is run every morning +> > after a clean-up, when the "registrazioni" table is empty. During the +> > day this table fills up (about 500 record any day), and apparently the +> > performances are free-falling very quickly. This behaviour has not +> > changed between the old and the new installation. +> > +> > Can you suggest an easy way to collect and keep up-to-date these +> > statistics in a very low-impact way? +> > +> +> Why not just periodically (once an hour?) run "ANALYZE registrazioni;" +> during the day. This will only update the statistics, and should be very +> low impact. +> + +This is my "solution" too... but: is enough? Or else: there is a better +way to do this? If the performance in the better case is 50 times faster +than the worse case, during an hour (50/100 record inserted in +"registrazioni") how much the performance can fall before the new +"ANALYZE" is run? Otherwise, running ANALYZE more frequently can badly +affect the overall performance? + +A so big difference in postgres performance, can be considered a bug or +a over-optimization in the plan making? Why (at least apparently) the +8.0 version is not affected? + +> HTH, +> +> Joe +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + +Thank you all very much, +Gabriele + + + +From pgsql-performance-owner@postgresql.org Sat Jul 15 20:53:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 160779FB210 + for ; + Sat, 15 Jul 2006 20:53:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 98329-01 for + ; + Sat, 15 Jul 2006 23:53:38 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from mail.gmx.net (mail.gmx.de [213.165.64.21]) + by postgresql.org (Postfix) with SMTP id 5F7EA9FA60B + for ; + Sat, 15 Jul 2006 20:53:38 -0300 (ADT) +Received: (qmail invoked by alias); 15 Jul 2006 23:53:36 -0000 +Received: from dslb-084-063-102-169.pools.arcor-ip.net (EHLO colt.pezone.net) + [84.63.102.169] + by mail.gmx.net (mp034) with SMTP; 16 Jul 2006 01:53:36 +0200 +X-Authenticated: #495269 +From: Peter Eisentraut +To: pgsql-performance@postgresql.org +Subject: Re: increment Rows in an SQL Result Set postgresql +Date: Sun, 16 Jul 2006 01:53:30 +0200 +User-Agent: KMail/1.9.1 +Cc: Hassan Adekoya +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: <200607160153.31333.peter_e@gmx.net> +X-Y-GMX-Trusted: 0 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/155 +X-Sequence-Number: 20015 + +Hassan Adekoya wrote: +> I will like to preserve ordering.... + +Tables are inherently unordered. If you want a particular order, you +need to use the ORDER BY clause. And you will need to have a column to +sort by. If you don't have one, the generate_series() function may +help. + +This has nothing to do with performance, I gather, so it might be more +appropriate for the pgsql-sql list. + +-- +Peter Eisentraut +http://developer.postgresql.org/~petere/ + +From pgsql-performance-owner@postgresql.org Sun Jul 16 15:08:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id E5F799FA25A + for ; + Sun, 16 Jul 2006 15:08:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 21317-01 for + ; + Sun, 16 Jul 2006 18:08:09 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from joeconway.com (wsip-68-15-9-201.sd.sd.cox.net [68.15.9.201]) + by postgresql.org (Postfix) with ESMTP id 8901D9FA21D + for ; + Sun, 16 Jul 2006 15:08:09 -0300 (ADT) +Received: from [192.168.4.40] (account jconway [192.168.4.40] verified) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 4051478; Sun, 16 Jul 2006 11:08:07 -0700 +Message-ID: <44BA8087.9010007@joeconway.com> +Date: Sun, 16 Jul 2006 11:08:07 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; + rv:1.7.13) Gecko/20060501 Fedora/1.7.13-1.1.fc5 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Gabriele Turchi +CC: Michael Fuhr , pgsql-performance@postgresql.org, + Marco Colombo +Subject: Re: Big differences in plans between 8.0 and 8.1 +References: <1152972852.3541.0.camel@apollo5.casa.intranet> + <20060715190210.GA76277@winnie.fuhr.org> + <1152993350.3541.22.camel@apollo5.casa.intranet> + <44B94A51.9050108@joeconway.com> + <1152994970.3541.31.camel@apollo5.casa.intranet> +In-Reply-To: <1152994970.3541.31.camel@apollo5.casa.intranet> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/156 +X-Sequence-Number: 20016 + +Gabriele Turchi wrote: +> Il giorno sab, 15/07/2006 alle 13.04 -0700, Joe Conway ha scritto: +>>Why not just periodically (once an hour?) run "ANALYZE registrazioni;" +>>during the day. This will only update the statistics, and should be very +>>low impact. +> +> This is my "solution" too... but: is enough? Or else: there is a better +> way to do this? If the performance in the better case is 50 times faster +> than the worse case, during an hour (50/100 record inserted in +> "registrazioni") how much the performance can fall before the new +> "ANALYZE" is run? Otherwise, running ANALYZE more frequently can badly +> affect the overall performance? + +One thing I noticed is that in both plans there is a seq scan on +registrazioni. Given that performance degrades so quickly as records are +inserted into registrazioni, I'm wondering if you're missing an index. +What indexes do you have on registrazioni? + +Joe + +From pgsql-performance-owner@postgresql.org Sun Jul 16 19:50:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 191B69FA2A7 + for ; + Sun, 16 Jul 2006 19:50:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 00386-07 for + ; + Sun, 16 Jul 2006 22:50:48 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id BA7909FA27F + for ; + Sun, 16 Jul 2006 19:50:48 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Mon, 17 Jul 2006 00:50:44 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C6A92A.7CE59D82" +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: RAID stripe size question +Date: Mon, 17 Jul 2006 00:52:17 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: RAID stripe size question +Thread-Index: AcapKnxPieat2sJBSF6tUmjwvmCbMw== +From: "Mikael Carneholm" +To: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/157 +X-Sequence-Number: 20017 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C6A92A.7CE59D82 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +I have finally gotten my hands on the MSA1500 that we ordered some time +ago. It has 28 x 10K 146Gb drives, currently grouped as 10 (for wal) + +18 (for data). There's only one controller (an emulex), but I hope +performance won't suffer too much from that. Raid level is 0+1, +filesystem is ext3.=20 + +Now to the interesting part: would it make sense to use different stripe +sizes on the separate disk arrays? In theory, a smaller stripe size +(8-32K) should increase sequential write throughput at the cost of +decreased positioning performance, which sounds good for WAL (assuming +WAL is never "searched" during normal operation). And for disks holding +the data, a larger stripe size (>32K) should provide for more concurrent +(small) reads/writes at the cost of decreased raw throughput. This is +with an OLTP type application in mind, so I'd rather have high +transaction throughput than high sequential read speed. The interface is +a 2Gb FC so I'm throttled to (theoretically) 192Mb/s, anyway. + +So, does this make sense? Has anyone tried it and seen any performance +gains from it? + +Regards, +Mikael. + +------_=_NextPart_001_01C6A92A.7CE59D82 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + +RAID stripe size question + + + + +

I have finally gotten = +my hands on the MSA1500 that we ordered some time ago. It has 28 x 10K = +146Gb drives, currently grouped as 10 (for wal) + 18 (for data). = +There's only one controller (an emulex), but I hope performance won't = +suffer too much from that. Raid level is 0+1, filesystem is ext3. = +

+ +

Now to the = +interesting part: would it make sense to use different stripe sizes on = +the separate disk arrays? In theory, a smaller stripe size (8-32K) = +should increase sequential write throughput at the cost of decreased = +positioning performance, which sounds good for WAL (assuming WAL is = +never "searched" during normal operation). And for disks = +holding the data, a larger stripe size (>32K) should provide for more = +concurrent (small) reads/writes at the cost of decreased raw throughput. = +This is with an OLTP type application in mind, so I'd rather have high = +transaction throughput than high sequential read speed. The interface is = +a 2Gb FC so I'm throttled to (theoretically) 192Mb/s, = +anyway.

+ +

So, does this make = +sense? Has anyone tried it and seen any performance gains from = +it? +

+ +

Regards, + +
Mikael. +

+ + + +------_=_NextPart_001_01C6A92A.7CE59D82-- + +From pgsql-performance-owner@postgresql.org Sun Jul 16 20:12:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 4869C9FA2A7 + for ; + Sun, 16 Jul 2006 20:12:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 83101-08 for + ; + Sun, 16 Jul 2006 23:11:56 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id 187C19FA27F + for ; + Sun, 16 Jul 2006 20:11:56 -0300 (ADT) +Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1G2FmC-0006TY-Ut + for pgsql-performance@postgresql.org; Mon, 17 Jul 2006 01:11:53 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1G2FkT-0001FI-00 + for ; Mon, 17 Jul 2006 01:10:05 +0200 +Date: Mon, 17 Jul 2006 01:10:05 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: RAID stripe size question +Message-ID: <20060716231005.GA4746@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/158 +X-Sequence-Number: 20018 + +On Mon, Jul 17, 2006 at 12:52:17AM +0200, Mikael Carneholm wrote: +> Now to the interesting part: would it make sense to use different stripe +> sizes on the separate disk arrays? In theory, a smaller stripe size +> (8-32K) should increase sequential write throughput at the cost of +> decreased positioning performance, which sounds good for WAL (assuming +> WAL is never "searched" during normal operation). + +For large writes (ie. sequential write throughput), it doesn't really matter +what the stripe size is; all the disks will have to both seek and write +anyhow. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Sun Jul 16 21:04:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id DC2419F9F27 + for ; + Sun, 16 Jul 2006 21:04:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 85270-02 for + ; + Mon, 17 Jul 2006 00:03:53 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by postgresql.org (Postfix) with ESMTP id D57C29F9840 + for ; + Sun, 16 Jul 2006 21:03:53 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.236]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J2I009ETTI91101@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Sun, 16 Jul 2006 19:03:46 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 24EB96E9B1 for + ; + Sun, 16 Jul 2006 20:03:44 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id zmqqzDe5Mcgb for ; Sun, + 16 Jul 2006 20:03:42 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id B12FB6E797; Sun, 16 Jul 2006 20:03:42 -0400 (EDT) +Date: Sun, 16 Jul 2006 20:03:40 -0400 +From: Michael Stone +Subject: Re: RAID stripe size question +In-reply-to: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +To: pgsql-performance@postgresql.org +Mail-followup-to: pgsql-performance@postgresql.org +Message-id: <20060717000337.GA8069@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/159 +X-Sequence-Number: 20019 + +On Mon, Jul 17, 2006 at 12:52:17AM +0200, Mikael Carneholm wrote: +>I have finally gotten my hands on the MSA1500 that we ordered some time +>ago. It has 28 x 10K 146Gb drives, currently grouped as 10 (for wal) + +>18 (for data). There's only one controller (an emulex), but I hope + +You've got 1.4TB assigned to the WAL, which doesn't normally have more +than a couple of gigs? + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jul 17 03:13:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 787439FA502 + for ; + Mon, 17 Jul 2006 03:13:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 54026-02 for + ; + Mon, 17 Jul 2006 06:13:06 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.187]) + by postgresql.org (Postfix) with ESMTP id D47469F9F27 + for ; + Mon, 17 Jul 2006 03:13:05 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id p77so391142nfc + for ; + Sun, 16 Jul 2006 23:13:04 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=N+eJuqLUyQkxY8+ZcAjJ8+3KA+c2f4ijdoa93XMP8xRC4leodR7ThiTCRj+659feHez6CRMLey4No67joj9aiHeEotmko15Q9nQHXj+4lX1VAwmzM2+/j/WgGraB45449+N4wFFNbP5G9kWpXxSPDX9MSquzGuFbRr0IHfQ82wk= +Received: by 10.78.156.6 with SMTP id d6mr700085hue; + Sun, 16 Jul 2006 23:13:04 -0700 (PDT) +Received: by 10.78.140.7 with HTTP; Sun, 16 Jul 2006 23:13:04 -0700 (PDT) +Message-ID: <33c6269f0607162313k1770ac16ld5e90e106bf5e8dc@mail.gmail.com> +Date: Mon, 17 Jul 2006 02:13:04 -0400 +From: "Alex Turner" +To: "Mikael Carneholm" +Subject: Re: RAID stripe size question +Cc: pgsql-performance@postgresql.org +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_72759_32639676.1153116784159" +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BB1@sesrv12.wirelesscar.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/160 +X-Sequence-Number: 20020 + +------=_Part_72759_32639676.1153116784159 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +With 18 disks dedicated to data, you could make 100/7*9 seeks/second (7ms +av seeks time, 9 independant units) which is 128seeks/second writing on +average 64kb of data, which is 4.1MB/sec throughput worst case, probably 10x +best case so 40Mb/sec - you might want to take more disks for your data and +less for your WAL. + +Someone check my math here... + +And as always - run benchmarks with your app to verify + +Alex. + +On 7/16/06, Mikael Carneholm wrote: +> +> I have finally gotten my hands on the MSA1500 that we ordered some time +> ago. It has 28 x 10K 146Gb drives, currently grouped as 10 (for wal) + 18 +> (for data). There's only one controller (an emulex), but I hope performance +> won't suffer too much from that. Raid level is 0+1, filesystem is ext3. +> +> Now to the interesting part: would it make sense to use different stripe +> sizes on the separate disk arrays? In theory, a smaller stripe size (8-32K) +> should increase sequential write throughput at the cost of decreased +> positioning performance, which sounds good for WAL (assuming WAL is never +> "searched" during normal operation). And for disks holding the data, a +> larger stripe size (>32K) should provide for more concurrent (small) +> reads/writes at the cost of decreased raw throughput. This is with an OLTP +> type application in mind, so I'd rather have high transaction throughput +> than high sequential read speed. The interface is a 2Gb FC so I'm throttled +> to (theoretically) 192Mb/s, anyway. +> +> So, does this make sense? Has anyone tried it and seen any performance +> gains from it? +> +> Regards, +> Mikael. +> + +------=_Part_72759_32639676.1153116784159 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +With 18 disks dedicated to  data, you could make 100/7*9 seeks/second (7ms av seeks time, 9 independant units) which is 128seeks/second writing on average 64kb of data, which is 4.1MB/sec throughput worst case, probably 10x best case so 40Mb/sec - you might want to take more disks for your data and less for your WAL. +

Someone check my math here...

And as always - run benchmarks with your app to verify

Alex.

On 7/16/06, Mikael Carneholm < +Mikael.Carneholm@wirelesscar.com> wrote:
+ + + + + + +
+ + +

I have finally gotten my hands on the MSA1500 that we ordered some time ago. It has 28 x 10K 146Gb drives, currently grouped as 10 (for wal) + 18 (for data). There's only one controller (an emulex), but I hope performance won't suffer too much from that. Raid level is 0+1, filesystem is ext3. +

+ +

Now to the interesting part: would it make sense to use different stripe sizes on the separate disk arrays? In theory, a smaller stripe size (8-32K) should increase sequential write throughput at the cost of decreased positioning performance, which sounds good for WAL (assuming WAL is never "searched" during normal operation). And for disks holding the data, a larger stripe size (>32K) should provide for more concurrent (small) reads/writes at the cost of decreased raw throughput. This is with an OLTP type application in mind, so I'd rather have high transaction throughput than high sequential read speed. The interface is a 2Gb FC so I'm throttled to (theoretically) 192Mb/s, anyway. +

+ +

So, does this make sense? Has anyone tried it and seen any performance gains from it? +

+ +

Regards, + +
Mikael. +

+ +
+ +

+ +------=_Part_72759_32639676.1153116784159-- + +From pgsql-performance-owner@postgresql.org Mon Jul 17 04:59:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 1C6809FB1D7 + for ; + Mon, 17 Jul 2006 04:59:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 72108-06 for + ; + Mon, 17 Jul 2006 07:59:33 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 2E5A79FA163 + for ; + Mon, 17 Jul 2006 04:59:32 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Mon, 17 Jul 2006 09:59:05 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: RAID stripe size question +Date: Mon, 17 Jul 2006 10:00:39 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BC3@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] RAID stripe size question +Thread-Index: AcapNPG7v7px6bC7ScOE9/L2c4Cr2AAPxxMA +From: "Mikael Carneholm" +To: "Michael Stone" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/161 +X-Sequence-Number: 20021 + +Yeah, it seems to be a waste of disk space (spindles as well?). I was +unsure how much activity the WAL disks would have compared to the data +disks, so I created an array from 10 disks as the application is very +write intense (many spindles / high throughput is crucial). I guess that +a mirror of two disks is enough from a disk space perspective, but from +a throughput perspective it will limit me to ~25Mb/s (roughly +calculated).=20 + +An 0+1 array of 4 disks *could* be enough, but I'm still unsure how WAL +activity correlates to "normal data" activity (is it 1:1, 1:2, 1:4, +...?)=20 + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Michael +Stone +Sent: den 17 juli 2006 02:04 +To: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] RAID stripe size question + +On Mon, Jul 17, 2006 at 12:52:17AM +0200, Mikael Carneholm wrote: +>I have finally gotten my hands on the MSA1500 that we ordered some time + +>ago. It has 28 x 10K 146Gb drives, currently grouped as 10 (for wal) + +>18 (for data). There's only one controller (an emulex), but I hope + +You've got 1.4TB assigned to the WAL, which doesn't normally have more +than a couple of gigs? + +Mike Stone + +---------------------------(end of broadcast)--------------------------- +TIP 9: In versions below 8.0, the planner will ignore your desire to + choose an index scan if your joining column's datatypes do not + match + + +From pgsql-performance-owner@postgresql.org Mon Jul 17 06:46:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B2ECC9FA5CD + for ; + Mon, 17 Jul 2006 06:46:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63511-07 for + ; + Mon, 17 Jul 2006 06:46:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id E8B1C9FA502 + for ; + Mon, 17 Jul 2006 06:46:49 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tb2bf.t.pppool.de + [89.55.178.191]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id C7B096588C; + Mon, 17 Jul 2006 11:48:29 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 8BE4C181C1C49; + Mon, 17 Jul 2006 11:47:05 +0200 (CEST) +Message-ID: <44BB5C99.5070205@logix-tt.com> +Date: Mon, 17 Jul 2006 11:47:05 +0200 +From: Markus Schaber +Reply-To: pgsql-performance@postgresql.org +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: Mikael Carneholm +Subject: Re: RAID stripe size question +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BC3@sesrv12.wirelesscar.com> +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BC3@sesrv12.wirelesscar.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/162 +X-Sequence-Number: 20022 + +Hi, Mikael, + +Mikael Carneholm wrote: +> An 0+1 array of 4 disks *could* be enough, but I'm still unsure how WAL +> activity correlates to "normal data" activity (is it 1:1, 1:2, 1:4, +> ...?) + +I think the main difference is that the WAL activity is mostly linear, +where the normal data activity is rather random access. Thus, a mirror +of few disks (or, with good controller hardware, raid6 on 4 disks or so) +for WAL should be enough to cope with a large set of data and index +disks, who have a lot more time spent in seeking. + +Btw, it may make sense to spread different tables or tables and indices +onto different Raid-Sets, as you seem to have enough spindles. + +And look into the commit_delay/commit_siblings settings, they allow you +to deal latency for throughput (means a little more latency per +transaction, but much more transactions per second throughput for the +whole system.) + + +HTH, +Markus + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Mon Jul 17 08:32:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id ABDD49FB1B7 + for ; + Mon, 17 Jul 2006 08:32:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 79227-01 for + ; + Mon, 17 Jul 2006 08:32:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 3845E9FA163 + for ; + Mon, 17 Jul 2006 08:32:34 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Mon, 17 Jul 2006 13:32:21 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: RAID stripe size question +Date: Mon, 17 Jul 2006 13:33:55 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BD6@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] RAID stripe size question +Thread-Index: AcaphinYozMIAzwrQ8mX+JV7rdn4IAACsitA +From: "Mikael Carneholm" +To: +Cc: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/163 +X-Sequence-Number: 20023 + +>I think the main difference is that the WAL activity is mostly linear, +where the normal data activity is rather random access.=20 + +That was what I was expecting, and after reading +http://www.pcguide.com/ref/hdd/perf/raid/concepts/perfStripe-c.html I +figured that a different stripe size for the WAL set could be worth +investigating. I have now dropped the old sets (10+18) and created two +new raid1+0 sets (4 for WAL, 24 for data) instead. Bonnie++ is still +running, but I'll post the numbers as soon as it has finished. I did +actually use different stripe sizes for the sets as well, 8k for the WAL +disks and 64k for the data. It's quite painless to do these things with +HBAnywhere, so it's no big deal if I have to go back to another +configuration. The battery cache only has 256Mb though and that botheres +me, I assume a larger (512Mb - 1Gb) cache would make quite a difference. +Oh well. + +>Btw, it may make sense to spread different tables or tables and indices +onto different Raid-Sets, as you seem to have enough spindles. + +This is something I'd also would like to test, as a common best-practice +these days is to go for a SAME (stripe all, mirror everything) setup. +>From a development perspective it's easier to use SAME as the developers +won't have to think about physical location for new tables/indices, so +if there's no performance penalty with SAME I'll gladly keep it that +way. + +>And look into the commit_delay/commit_siblings settings, they allow you +to deal latency for throughput (means a little more latency per +transaction, but much more transactions per second throughput for the +whole system.) + +In a previous test, using cd=3D5000 and cs=3D20 increased transaction +throughput by ~20% so I'll definitely fiddle with that in the coming +tests as well. + +Regards, +Mikael. + +From pgsql-performance-owner@postgresql.org Mon Jul 17 08:40:26 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 68E479FB1B8 + for ; + Mon, 17 Jul 2006 08:40:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77551-09 for + ; + Mon, 17 Jul 2006 08:40:16 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 46E079FA163 + for ; + Mon, 17 Jul 2006 08:40:16 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (Tb2bf.t.pppool.de + [89.55.178.191]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 3EFAC65874; + Mon, 17 Jul 2006 13:42:01 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id C9620181C1C49; + Mon, 17 Jul 2006 13:40:36 +0200 (CEST) +Message-ID: <44BB7734.8080801@logix-tt.com> +Date: Mon, 17 Jul 2006 13:40:36 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: Mikael Carneholm +Cc: pgsql-performance@postgresql.org +Subject: Re: RAID stripe size question +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BD6@sesrv12.wirelesscar.com> +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BD6@sesrv12.wirelesscar.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/164 +X-Sequence-Number: 20024 + +Hi, Mikael, + +Mikael Carneholm wrote: + +> This is something I'd also would like to test, as a common best-practice +> these days is to go for a SAME (stripe all, mirror everything) setup. +> From a development perspective it's easier to use SAME as the developers +> won't have to think about physical location for new tables/indices, so +> if there's no performance penalty with SAME I'll gladly keep it that +> way. + +Usually, it's not the developers task to care about that, but the DBAs +responsibility. + +>> And look into the commit_delay/commit_siblings settings, they allow you +> to deal latency for throughput (means a little more latency per +> transaction, but much more transactions per second throughput for the +> whole system.) +> +> In a previous test, using cd=5000 and cs=20 increased transaction +> throughput by ~20% so I'll definitely fiddle with that in the coming +> tests as well. + +How many parallel transactions do you have? + +Markus + + + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Mon Jul 17 09:51:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D3B509FA4E0 + for ; + Mon, 17 Jul 2006 09:51:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 86263-04 for + ; + Mon, 17 Jul 2006 09:50:59 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 8F6F09FA418 + for ; + Mon, 17 Jul 2006 09:50:57 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Mon, 17 Jul 2006 14:50:53 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: RAID stripe size question +Date: Mon, 17 Jul 2006 14:52:28 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BDF@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] RAID stripe size question +Thread-Index: Acaplf3ZyVvTIFHJSBW+KW0alCJxAwAABLtQ +From: "Mikael Carneholm" +To: "Markus Schaber" +Cc: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/165 +X-Sequence-Number: 20025 + +>> This is something I'd also would like to test, as a common=20 +>> best-practice these days is to go for a SAME (stripe all, mirror +everything) setup. +>> From a development perspective it's easier to use SAME as the=20 +>> developers won't have to think about physical location for new=20 +>> tables/indices, so if there's no performance penalty with SAME I'll=20 +>> gladly keep it that way. + +>Usually, it's not the developers task to care about that, but the DBAs +responsibility. + +As we don't have a full-time dedicated DBA (although I'm the one who do +most DBA related tasks) I would aim for making physical location as +transparent as possible, otherwise I'm afraid I won't be doing anything +else than supporting developers with that - and I *do* have other things +to do as well :) + +>> In a previous test, using cd=3D5000 and cs=3D20 increased transaction = + +>> throughput by ~20% so I'll definitely fiddle with that in the coming=20 +>> tests as well. + +>How many parallel transactions do you have? + +That was when running BenchmarkSQL +(http://sourceforge.net/projects/benchmarksql) with 100 concurrent users +("terminals"), which I assume means 100 parallel transactions at most. +The target application for this DB has 3-4 times as many concurrent +connections so it's possible that one would have to find other cs/cd +numbers better suited for that scenario. Tweaking bgwriter is another +task I'll look into as well.. + +Btw, here's the bonnie++ results from two different array sets (10+18, +4+24) on the MSA1500: + +LUN: WAL, 10 disks, stripe size 32K +------------------------------------ +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +sesell01 32G 56139 93 73250 22 16530 3 30488 45 57489 5 +477.3 1 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 2458 90 +++++ +++ +++++ +++ 3121 99 +++++ +++ +10469 98 + + +LUN: WAL, 4 disks, stripe size 8K +---------------------------------- +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +sesell01 32G 49170 82 60108 19 13325 2 15778 24 21489 2 +266.4 0 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 2432 86 +++++ +++ +++++ +++ 3106 99 +++++ +++ +10248 98 + + +LUN: DATA, 18 disks, stripe size 32K +------------------------------------- +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +sesell01 32G 59990 97 87341 28 19158 4 30200 46 57556 6 +495.4 1 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 1640 92 +++++ +++ +++++ +++ 1736 99 +++++ +++ +10919 99 + + +LUN: DATA, 24 disks, stripe size 64K +------------------------------------- +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +sesell01 32G 59443 97 118515 39 25023 5 30926 49 60835 6 +531.8 1 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 2499 90 +++++ +++ +++++ +++ 2817 99 +++++ +++ +10971 100 + +Regards, +Mikael + +From pgsql-performance-owner@postgresql.org Mon Jul 17 10:40:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 095F69FB1B8 + for ; + Mon, 17 Jul 2006 10:40:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 43387-06 for + ; + Mon, 17 Jul 2006 13:40:35 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id D73199FA506 + for ; + Mon, 17 Jul 2006 10:40:33 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtpauth04.mail.atl.earthlink.net + (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) + by svr4.postgresql.org (Postfix) with ESMTP id D30C55AF033 + for ; + Mon, 17 Jul 2006 13:40:32 +0000 (GMT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; + d=earthlink.net; + b=CgsoIzV7sYgB/q6q8/BVUSp2FrnBqT4FYplDRG2BZI/FknkainZH9KkBRb5y4ryb; + h=Message-ID:Date:From:Reply-To:To:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; +Received: from [209.86.224.35] (helo=elwamui-huard.atl.sa.earthlink.net) + by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) + id 1G2TKo-00067W-DP; Mon, 17 Jul 2006 09:40:30 -0400 +Received: from 71.243.31.238 by webmail.pas.earthlink.net with HTTP; + Mon, 17 Jul 2006 09:40:30 -0400 +Message-ID: + <14770266.1153143630410.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +Date: Mon, 17 Jul 2006 09:40:30 -0400 (EDT) +From: Ron Peacetree +Reply-To: Ron Peacetree +To: Mikael Carneholm , + pgsql-performance@postgresql.org +Subject: Re: RAID stripe size question +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: EarthLink Zoo Mail 1.0 +X-ELNK-Trace: + acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc4836997c1aa45fb845bdeaead1ef4c58350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c +X-Originating-IP: 209.86.224.35 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/166 +X-Sequence-Number: 20026 + +>From: Mikael Carneholm +>Sent: Jul 16, 2006 6:52 PM +>To: pgsql-performance@postgresql.org +>Subject: [PERFORM] RAID stripe size question +> +>I have finally gotten my hands on the MSA1500 that we ordered some time +>ago. It has 28 x 10K 146Gb drives, +> +Unless I'm missing something, the only FC or SCSI HDs of ~147GB capacity are 15K, not 10K. +(unless they are old?) +I'm not just being pedantic. The correct, let alone optimal, answer to your question depends on your exact HW characteristics as well as your SW config and your usage pattern. +15Krpm HDs will have average access times of 5-6ms. 10Krpm ones of 7-8ms. +Most modern HDs in this class will do ~60MB/s inner tracks ~75MB/s avg and ~90MB/s outer tracks. + +If you are doing OLTP-like things, you are more sensitive to latency than most and should use the absolute lowest latency HDs available within you budget. The current latency best case is 15Krpm FC HDs. + + +>currently grouped as 10 (for wal) + 18 (for data). There's only one controller (an emulex), but I hope +>performance won't suffer too much from that. Raid level is 0+1, +>filesystem is ext3. +> +I strongly suspect having only 1 controller is an I/O choke w/ 28 HDs. + +28HDs as above setup as 2 RAID 10's => ~75MBps*5= ~375MB/s, ~75*9= ~675MB/s. +If both sets are to run at peak average speed, the Emulex would have to be able to handle ~1050MBps on average. +It is doubtful the 1 Emulex can do this. + +In order to handle this level of bandwidth, a RAID controller must aggregate multiple FC, SCSI, or SATA streams as well as down any RAID 5 checksumming etc that is required. +Very, very few RAID controllers can do >= 1GBps +One thing that help greatly with bursty IO patterns is to up your battery backed RAID cache as high as you possibly can. Even multiple GBs of BBC can be worth it. Another reason to have multiple controllers ;-) + +Then there is the question of the BW of the bus that the controller is plugged into. +~800MB/s is the RW max to be gotten from a 64b 133MHz PCI-X channel. +PCI-E channels are usually good for 1/10 their rated speed in bps as Bps. +So a PCI-Ex4 10Gbps bus can be counted on for 1GBps, PCI-Ex8 for 2GBps, etc. +At present I know of no RAID controllers that can singlely saturate a PCI-Ex4 or greater bus. + +...and we haven't even touched on OS, SW, and usage pattern issues. + +Bottom line is that the IO chain is only as fast as its slowest component. + + +>Now to the interesting part: would it make sense to use different stripe +>sizes on the separate disk arrays? +> +The short answer is Yes. +WAL's are basically appends that are written in bursts of your chosen log chunk size and that are almost never read afterwards. Big DB pages and big RAID stripes makes sense for WALs. + +Tables with OLTP-like characteristics need smaller DB pages and stripes to minimize latency issues (although locality of reference can make the optimum stripe size larger). + +Tables with Data Mining like characteristics usually work best with larger DB pages sizes and RAID stripe sizes. + +OS and FS overhead can make things more complicated. So can DB layout and access pattern issues. + +Side note: a 10 HD RAID 10 seems a bit much for WAL. Do you really need 375MBps IO on average to your WAL more than you need IO capacity for other tables? +If WAL IO needs to be very high, I'd suggest getting a SSD or SSD-like device that fits your budget and having said device async mirror to HD. + +Bottom line is to optimize your RAID stripe sizes =after= you optimize your OS, FS, and pg design for best IO for your usage pattern(s). + +Hope this helps, +Ron + +From pgsql-performance-owner@postgresql.org Mon Jul 17 11:53:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 277F19FA506 + for ; + Mon, 17 Jul 2006 11:53:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 98384-01 for + ; + Mon, 17 Jul 2006 11:53:40 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from cassarossa.samfundet.no (cassarossa.samfundet.no + [129.241.93.19]) + by postgresql.org (Postfix) with ESMTP id E72749FA159 + for ; + Mon, 17 Jul 2006 11:53:40 -0300 (ADT) +Received: from [2001:700:300:dc0f:216:3eff:fe40:5a47] (helo=trofast.sesse.net) + by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1G2UTa-0005jm-7m + for pgsql-performance@postgresql.org; Mon, 17 Jul 2006 16:53:38 +0200 +Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) + id 1G2URm-0003Gp-00 + for ; Mon, 17 Jul 2006 16:51:46 +0200 +Date: Mon, 17 Jul 2006 16:51:46 +0200 +From: "Steinar H. Gunderson" +To: pgsql-performance@postgresql.org +Subject: Re: RAID stripe size question +Message-ID: <20060717145146.GA12199@uio.no> +Mail-Followup-To: pgsql-performance@postgresql.org +References: + <14770266.1153143630410.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: + <14770266.1153143630410.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +X-Operating-System: Linux 2.6.16trofastxen on a x86_64 +X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/167 +X-Sequence-Number: 20027 + +On Mon, Jul 17, 2006 at 09:40:30AM -0400, Ron Peacetree wrote: +> Unless I'm missing something, the only FC or SCSI HDs of ~147GB capacity are 15K, not 10K. +> (unless they are old?) + +There are still 146GB SCSI 10000rpm disks being sold here, at least. + +/* Steinar */ +-- +Homepage: http://www.sesse.net/ + +From pgsql-performance-owner@postgresql.org Mon Jul 17 12:23:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 5E1A99FA50D + for ; + Mon, 17 Jul 2006 12:23:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 98861-01 for + ; + Mon, 17 Jul 2006 15:23:27 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.186]) + by postgresql.org (Postfix) with ESMTP id 51E009FA159 + for ; + Mon, 17 Jul 2006 12:23:26 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id p77so512975nfc + for ; + Mon, 17 Jul 2006 08:23:23 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=nfSNAmZzbdh5UVJhgMtlgQglFacOw1Dmx/VkQwraeocAcK8UT+odxbMPQLVK/Dli7u0cA+qjV4wYSduz0aK6ySdZPeOei1fZu+6udgIcdsrOS9tJHW0g7mh5ynoHlP/qtHGPZc6cRDOR9baJQdNoC8chbxNK3D8//dhmQpgopgE= +Received: by 10.78.165.16 with SMTP id n16mr879381hue; + Mon, 17 Jul 2006 08:23:23 -0700 (PDT) +Received: by 10.78.140.7 with HTTP; Mon, 17 Jul 2006 08:23:23 -0700 (PDT) +Message-ID: <33c6269f0607170823v7df531a8o678505125e85880@mail.gmail.com> +Date: Mon, 17 Jul 2006 11:23:23 -0400 +From: "Alex Turner" +To: "Mikael Carneholm" +Subject: Re: RAID stripe size question +Cc: "Markus Schaber" , pgsql-performance@postgresql.org +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BDF@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_7022_27002787.1153149803519" +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BDF@sesrv12.wirelesscar.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/168 +X-Sequence-Number: 20028 + +------=_Part_7022_27002787.1153149803519 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +On 7/17/06, Mikael Carneholm wrote: +> +> >> This is something I'd also would like to test, as a common +> >> best-practice these days is to go for a SAME (stripe all, mirror +> everything) setup. +> >> From a development perspective it's easier to use SAME as the +> >> developers won't have to think about physical location for new +> >> tables/indices, so if there's no performance penalty with SAME I'll +> >> gladly keep it that way. +> +> >Usually, it's not the developers task to care about that, but the DBAs +> responsibility. +> +> As we don't have a full-time dedicated DBA (although I'm the one who do +> most DBA related tasks) I would aim for making physical location as +> transparent as possible, otherwise I'm afraid I won't be doing anything +> else than supporting developers with that - and I *do* have other things +> to do as well :) +> +> >> In a previous test, using cd=5000 and cs=20 increased transaction +> >> throughput by ~20% so I'll definitely fiddle with that in the coming +> >> tests as well. +> +> >How many parallel transactions do you have? +> +> That was when running BenchmarkSQL +> (http://sourceforge.net/projects/benchmarksql) with 100 concurrent users +> ("terminals"), which I assume means 100 parallel transactions at most. +> The target application for this DB has 3-4 times as many concurrent +> connections so it's possible that one would have to find other cs/cd +> numbers better suited for that scenario. Tweaking bgwriter is another +> task I'll look into as well.. +> +> Btw, here's the bonnie++ results from two different array sets (10+18, +> 4+24) on the MSA1500: +> +> LUN: WAL, 10 disks, stripe size 32K +> ------------------------------------ +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> sesell01 32G 56139 93 73250 22 16530 3 30488 45 57489 5 +> 477.3 1 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 2458 90 +++++ +++ +++++ +++ 3121 99 +++++ +++ +> 10469 98 +> +> +> LUN: WAL, 4 disks, stripe size 8K +> ---------------------------------- +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> sesell01 32G 49170 82 60108 19 13325 2 15778 24 21489 2 +> 266.4 0 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 2432 86 +++++ +++ +++++ +++ 3106 99 +++++ +++ +> 10248 98 +> +> +> LUN: DATA, 18 disks, stripe size 32K +> ------------------------------------- +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> sesell01 32G 59990 97 87341 28 19158 4 30200 46 57556 6 +> 495.4 1 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 1640 92 +++++ +++ +++++ +++ 1736 99 +++++ +++ +> 10919 99 +> +> +> LUN: DATA, 24 disks, stripe size 64K +> ------------------------------------- +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> sesell01 32G 59443 97 118515 39 25023 5 30926 49 60835 6 +> 531.8 1 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 2499 90 +++++ +++ +++++ +++ 2817 99 +++++ +++ +> 10971 100 + + + +These bonnie++ number are very worrying. Your controller should easily max +out your FC interface on these tests passing 192MB/sec with ease on anything +more than an 6 drive RAID 10 . This is a bad omen if you want high +performance... Each mirror pair can do 60-80MB/sec. A 24Disk RAID 10 can +do 12*60MB/sec which is 740MB/sec - I have seen this performance, it's not +unreachable, but time and again, we see these bad perf numbers from FC and +SCSI systems alike. Consider a different controller, because this one is +not up to snuff. A single drive would get better numbers than your 4 disk +RAID 10, 21MB/sec read speed is really pretty sorry, it should be closer to +120Mb/sec. If you can't swap out, software RAID may turn out to be your +friend. The only saving grace is that this is OLTP, and perhaps, just +maybe, the controller will be better at ordering IOs, but I highly doubt it. + +Please people, do the numbers, benchmark before you buy, many many HBAs +really suck under Linux/Free BSD, and you may end up paying vast sums of +money for very sub-optimal performance (I'd say sub-standard, but alas, it +seems that this kind of poor performance is tolerated, even though it's way +off where it should be). There's no point having a 40disk cab, if your +controller can't handle it. + +Maximum theoretical linear throughput can be acheived in a White Box for +under $20k, and I have seen this kind of system outperform a server 5 times +it's price even in OLTP. + +Alex + +------=_Part_7022_27002787.1153149803519 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +Content-Disposition: inline + +

On 7/17/06, Mikael Carneholm <Mikael.Carneholm@wirelesscar.com> wrote: +>> This is something I'd also would like to test, as a common
>= +> best-practice these days is to go for a SAME (stripe all, mirror
ev= +erything) setup.
>> From a development perspective it's easier to = +use SAME as the +
>> developers won't have to think about physical location for new= +
>> tables/indices, so if there's no performance penalty with SAME= + I'll
>> gladly keep it that way.

>Usually, it's not the= + developers task to care about that, but the DBAs +
responsibility.

As we don't have a full-time dedicated DBA (alth= +ough I'm the one who do
most DBA related tasks) I would aim for making p= +hysical location as
transparent as possible, otherwise I'm afraid I won'= +t be doing anything +
else than supporting developers with that - and I *do* have other thing= +s
to do as well :)

>> In a previous test, using cd=3D5000 a= +nd cs=3D20 increased transaction
>> throughput by ~20% so I'll def= +initely fiddle with that in the coming +
>> tests as well.

>How many parallel transactions do yo= +u have?

That was when running BenchmarkSQL
(http://sourceforge.net/projects/benchma= +rksql +) with 100 concurrent users
("terminals"), which I assume = +means 100 parallel transactions at most.
The target application for this= + DB has 3-4 times as many concurrent
connections so it's possible that o= +ne would have to find other cs/cd +
numbers better suited for that scenario. Tweaking bgwriter is anothertask I'll look into as well..

Btw, here's the bonnie++ results fro= +m two different array sets (10+18,
4+24) on the MSA1500:

LUN: WAL= +, 10 disks, stripe size 32K +
------------------------------------
Version  1.03     &= +nbsp; ------Sequential Output------ --Sequential Input-
+--Random-
     &n= +bsp;            = +;  -Per Chr- --Block-- -Rewrite- -Per Chr- --Block--
+--Seeks--
Machine        = +Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +
/sec %CP
sesell01        32G 56139 &nb= +sp;93 73250  22 16530   3 30488  45 57489&nbs= +p;  5 +
477.3   1
          &nb= +sp;         ------Sequential C= +reate------ --------Random +
Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- = +-Create-- --Read---
-Delete--
+    = +;          files &nb= +sp;/sec %CP  /sec %CP  /sec %CP  /sec %CP&nbs= +p; /sec %CP
+/sec %CP
     &nb= +sp;           16 &nb= +sp;2458  90 +++++ +++ +++++ +++  3121  99 +++= +++ +++
+10469  98


LUN: WAL, 4 disks, stripe size 8K
-----------------------= +-----------
Version&= +nbsp; 1.03       ------Sequential Output= +------ --Sequential Input- +
--Random-
            &= +nbsp;       -Per Chr- --Block-- -Rewrite= +- -Per Chr- --Block-- +
--Seeks--
Machine        Size K/sec %CP K/s= +ec %CP K/sec %CP K/sec %CP K/sec %CP +
/sec %CP
sesell01        32G 49170 &nb= +sp;82 60108  19 13325   2 15778  24 21489&nbs= +p;  2 +
266.4   0
          &nb= +sp;         ------Sequential C= +reate------ --------Random +
Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- = +-Create-- --Read---
-Delete--
+    = +;          files &nb= +sp;/sec %CP  /sec %CP  /sec %CP  /sec %CP&nbs= +p; /sec %CP
+/sec %CP

     &nb= +sp;           16 &nb= +sp;2432  86 +++++ +++ +++++ +++  3106  99 +++= +++ +++
+10248  98


LUN: DATA, 18 disks, stripe size 32K
--------------------= +-----------------
Ve= +rsion  1.03 +       ------Sequential Output------ --Sequen= +tial Input-
--Random-
+    = +;            &n= +bsp;   -Per Chr- --Block-- -Rewrite- -Per Chr- --Block--
+--Seeks--
Machine    &= +nbsp;   Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %= +CP
+/sec %CP
sesell01        = +32G 59990  97 87341  28 19158   4 30200 = + 46 57556   6 +
495.4   1
          &nb= +sp;         ------Sequential C= +reate------ --------Random +
Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- = +-Create-- --Read---
-Delete--
+    = +;          files &nb= +sp;/sec %CP  /sec %CP  /sec %CP  /sec %CP&nbs= +p; /sec %CP
+/sec %CP

     &nb= +sp;           16 &nb= +sp;1640  92 +++++ +++ +++++ +++  1736  99 +++= +++ +++
+10919  99


LUN: DATA, 24 disks, stripe size 64K
--------------------= +-----------------
Ve= +rsion  1.03 +       ------Sequential Output------ --Sequen= +tial Input-
--Random-
+    = +;            &n= +bsp;   -Per Chr- --Block-- -Rewrite- -Per Chr- --Block--
+--Seeks--
Machine    &= +nbsp;   Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %= +CP
+/sec %CP
sesell01        = +32G 59443  97 118515  39 25023   5 30926 = +; 49 60835   6 +
531.8   1
          &nb= +sp;         ------Sequential C= +reate------ --------Random +
Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- = +-Create-- --Read---
-Delete--
+    = +;          files &nb= +sp;/sec %CP  /sec %CP  /sec %CP  /sec %CP&nbs= +p; /sec %CP
+/sec %CP

     &nb= +sp;           16 &nb= +sp;2499  90 +++++ +++ +++++ +++  2817  99 +++= +++ +++
+10971 100


These bonnie++ number are very worrying.  Your cont= +roller should easily max out your FC interface on these tests passing 192MB= +/sec with ease on anything more than an 6 drive RAID 10 .  This is a b= +ad omen if you want high performance...  Each mirror pair can do 60-80= +MB/sec.  A 24Disk RAID 10 can do 12*60MB/sec which is 740MB/sec - I ha= +ve seen this performance, it's not unreachable, but time and again, we see = +these bad perf numbers from FC and SCSI systems alike.  Consider a dif= +ferent controller, because this one is not up to snuff.  A single driv= +e would get better numbers than your 4 disk RAID 10, 21MB/sec read speed is= + really pretty sorry, it should be closer to 120Mb/sec.  If you can't = +swap out, software RAID may turn out to be your friend.  The only savi= +ng grace is that this is OLTP, and perhaps, just maybe, the controller will= + be better at ordering IOs, but I highly doubt it. +

Please people, do the numbers, benchmark before you buy, many many = +HBAs really suck under Linux/Free BSD, and you may end up paying vast sums = +of money for very sub-optimal performance (I'd say sub-standard, but alas, = +it seems that this kind of poor performance is tolerated, even though it's = +way off where it should be).  There's no point having a 40disk cab, if= + your controller can't handle it. +

Maximum theoretical linear throughput can be acheived in a White Bo= +x for under $20k, and I have seen this kind of system outperform a server 5= + times it's price even in OLTP.

Alex
+ +------=_Part_7022_27002787.1153149803519-- + +From pgsql-performance-owner@postgresql.org Mon Jul 17 17:19:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6E0049FA0B9 + for ; + Mon, 17 Jul 2006 17:19:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 53907-10 for + ; + Mon, 17 Jul 2006 17:19:18 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.207]) + by postgresql.org (Postfix) with ESMTP id 13FCA9F9F27 + for ; + Mon, 17 Jul 2006 17:19:17 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id t5so723626wxc + for ; + Mon, 17 Jul 2006 13:19:15 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=Mfb1NlosqGwCcns2Y2uEiVR7IJNYCFAKZCi+2ziKtV7pcM8QELtlMLutrxl5k2JycBLcxA+Rqoh29IobiWmAHYSJi8JZ9X8VXxJiugZyZ1tQ669xlMiXlc6AqDTXO0FGQs6/ZvK3xZKudgD5aQQdmKNuhri9KUdX5GHGSHudHQ0= +Received: by 10.70.14.18 with SMTP id 18mr3390174wxn; + Mon, 17 Jul 2006 13:19:14 -0700 (PDT) +Received: by 10.70.73.15 with HTTP; Mon, 17 Jul 2006 13:19:14 -0700 (PDT) +Message-ID: <1d219a6f0607171319k731ae186wc85cdca45851a51@mail.gmail.com> +Date: Mon, 17 Jul 2006 16:19:14 -0400 +From: "Chris Hoover" +To: "Gabriele Turchi" +Subject: Re: Big differences in plans between 8.0 and 8.1 +Cc: "Joe Conway" , "Michael Fuhr" , + pgsql-performance@postgresql.org, "Marco Colombo" +In-Reply-To: <1152994970.3541.31.camel@apollo5.casa.intranet> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_65397_23033031.1153167554040" +References: <1152972852.3541.0.camel@apollo5.casa.intranet> + <20060715190210.GA76277@winnie.fuhr.org> + <1152993350.3541.22.camel@apollo5.casa.intranet> + <44B94A51.9050108@joeconway.com> + <1152994970.3541.31.camel@apollo5.casa.intranet> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/169 +X-Sequence-Number: 20029 + +------=_Part_65397_23033031.1153167554040 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Just turn on autovacuuming on your 8.1 database. You can tune the vacuum +and autovacuum parameters to minimize the impact to your system. This is +the optimal route to take since PG will maintain the tables for you as +needed. + +HTH, + +Chris + +On 7/15/06, Gabriele Turchi wrote: +> +> Il giorno sab, 15/07/2006 alle 13.04 -0700, Joe Conway ha scritto: +> > Gabriele Turchi wrote: +> > > Running an ANALYZE really change the plan, now it is fast as before +> > > (8.0). +> > > +> > > On the production system a VACUUM FULL ANALYZE is run every morning +> > > after a clean-up, when the "registrazioni" table is empty. During the +> > > day this table fills up (about 500 record any day), and apparently the +> > > performances are free-falling very quickly. This behaviour has not +> > > changed between the old and the new installation. +> > > +> > > Can you suggest an easy way to collect and keep up-to-date these +> > > statistics in a very low-impact way? +> > > +> > +> > Why not just periodically (once an hour?) run "ANALYZE registrazioni;" +> > during the day. This will only update the statistics, and should be very +> > low impact. +> > +> +> This is my "solution" too... but: is enough? Or else: there is a better +> way to do this? If the performance in the better case is 50 times faster +> than the worse case, during an hour (50/100 record inserted in +> "registrazioni") how much the performance can fall before the new +> "ANALYZE" is run? Otherwise, running ANALYZE more frequently can badly +> affect the overall performance? +> +> A so big difference in postgres performance, can be considered a bug or +> a over-optimization in the plan making? Why (at least apparently) the +> 8.0 version is not affected? +> +> > HTH, +> > +> > Joe +> > +> > ---------------------------(end of broadcast)--------------------------- +> > TIP 6: explain analyze is your friend +> +> Thank you all very much, +> Gabriele +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly +> + +------=_Part_65397_23033031.1153167554040 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Just turn on autovacuuming on your 8.1 database.  You can tune the vacuum and autovacuum parameters to minimize the impact to  your system.  This is the optimal route to take since PG will maintain the tables for you as needed. +

HTH,

Chris

On 7/15/06, Gabriele Turchi <gabriele.turchi@l39a.com> wrote:
+Il giorno sab, 15/07/2006 alle 13.04 -0700, Joe Conway ha scritto:
> Gabriele Turchi wrote:
> > Running an ANALYZE really change the plan, now it is fast as before
> > (8.0).
> >
> > On the production system a VACUUM FULL ANALYZE is run every morning +
> > after a clean-up, when the "registrazioni" table is empty. During the
> > day this table fills up (about 500 record any day), and apparently the
> > performances are free-falling very quickly. This behaviour has not +
> > changed between the old and the new installation.
> >
> > Can you suggest an easy way to collect and keep up-to-date these
> > statistics in a very low-impact way?
> >
+>
> Why not just periodically (once an hour?) run "ANALYZE registrazioni;"
> during the day. This will only update the statistics, and should be very
> low impact.
>

This is my "solution" too... but: is enough? Or else: there is a better +
way to do this? If the performance in the better case is 50 times faster
than the worse case, during an hour (50/100 record inserted in
"registrazioni") how much the performance can fall before the new +
"ANALYZE" is run? Otherwise, running ANALYZE more frequently can badly
affect the overall performance?

A so big difference in postgres performance, can be considered a bug or
a over-optimization in the plan making? Why (at least apparently) the +
8.0 version is not affected?

> HTH,
>
> Joe
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

Thank you all very much, +
Gabriele



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to +majordomo@postgresql.org so that your
       message can get through to the mailing list cleanly

+ +------=_Part_65397_23033031.1153167554040-- + +From pgsql-performance-owner@postgresql.org Mon Jul 17 18:15:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CCB369FA0EC + for ; + Mon, 17 Jul 2006 18:15:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 60537-04 for + ; + Mon, 17 Jul 2006 18:15:23 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id 7A1E89FA0B9 + for ; + Mon, 17 Jul 2006 18:15:23 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Mon, 17 Jul 2006 23:15:16 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: RAID stripe size question +Date: Mon, 17 Jul 2006 23:16:51 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BFA@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] RAID stripe size question +Thread-Index: AcappswmY07cQIZ1QNWWKvJkWYfhAQAASPuw +From: "Mikael Carneholm" +To: "Ron Peacetree" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/170 +X-Sequence-Number: 20030 + +>Unless I'm missing something, the only FC or SCSI HDs of ~147GB = +capacity are 15K, not 10K. + +In the spec we got from HP, they are listed as model 286716-B22 = +(http://www.dealtime.com/xPF-Compaq_HP_146_8_GB_286716_B22) which seems = +to run at 10K. Don't know how old those are, but that's what we got from = +HP anyway. + +>15Krpm HDs will have average access times of 5-6ms. 10Krpm ones of = +7-8ms. + +Average seek time for that disk is listed as 4.9ms, maybe sounds a bit = +optimistic? + +> 28HDs as above setup as 2 RAID 10's =3D> ~75MBps*5=3D ~375MB/s, = +~75*9=3D ~675MB/s. + +I guess it's still limited by the 2Gbit FC (192Mb/s), right? + +>Very, very few RAID controllers can do >=3D 1GBps One thing that help = +greatly with bursty IO patterns is to up your battery backed RAID cache = +as high as you possibly can. Even multiple GBs of BBC can be worth it. = +Another reason to have multiple controllers ;-) + +I use 90% of the raid cache for writes, don't think I could go higher = +than that. Too bad the emulex only has 256Mb though :/ + +>Then there is the question of the BW of the bus that the controller is = +plugged into. +>~800MB/s is the RW max to be gotten from a 64b 133MHz PCI-X channel. +>PCI-E channels are usually good for 1/10 their rated speed in bps as = +Bps. +>So a PCI-Ex4 10Gbps bus can be counted on for 1GBps, PCI-Ex8 for 2GBps, = +etc. +>At present I know of no RAID controllers that can singlely saturate a = +PCI-Ex4 or greater bus. + +The controller is a FC2143 = +(http://h71016.www7.hp.com/dstore/MiddleFrame.asp?page=3Dconfig&ProductLi= +neId=3D450&FamilyId=3D1449&BaseId=3D17621&oi=3DE9CED&BEID=3D19701&SBLID=3D= +), which uses PCI-E. Don't know how it compares to other controllers, = +haven't had the time to search for / read any reviews yet. + +>>Now to the interesting part: would it make sense to use different=20 +>>stripe sizes on the separate disk arrays? +>> +>The short answer is Yes. + +Ok + +>WAL's are basically appends that are written in bursts of your chosen = +log chunk size and that are almost never read afterwards. Big DB pages = +and big RAID stripes makes sense for WALs. + +According to = +http://www.pcguide.com/ref/hdd/perf/raid/concepts/perfStripe-c.html, it = +seems to be the other way around? ("As stripe size is decreased, files = +are broken into smaller and smaller pieces. This increases the number of = +drives that an average file will use to hold all the blocks containing = +the data of that file, theoretically increasing transfer performance, = +but decreasing positioning performance.") + +I guess I'll have to find out which theory that holds by good ol=B4 = +trial and error... :) + +- Mikael + +From pgsql-performance-owner@postgresql.org Mon Jul 17 21:23:04 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 676089F94F3 + for ; + Mon, 17 Jul 2006 21:23:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 70292-01 for + ; + Tue, 18 Jul 2006 00:22:52 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-1.paradise.net.nz (bm-1a.paradise.net.nz + [203.96.152.180]) + by postgresql.org (Postfix) with ESMTP id 67FA49F9316 + for ; + Mon, 17 Jul 2006 21:22:53 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-1.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J2K00JHKP21WV@linda-1.paradise.net.nz> for + pgsql-performance@postgresql.org; Tue, 18 Jul 2006 12:22:50 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-28-217.dsl.clear.net.nz [218.101.28.217]) by + smtp-3.paradise.net.nz (Postfix) with ESMTP id 3C6D4BBA4A5; + Tue, 18 Jul 2006 12:22:49 +1200 (NZST) +Date: Tue, 18 Jul 2006 12:22:29 +1200 +From: Mark Kirkwood +Subject: Re: RAID stripe size question +In-reply-to: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BDF@sesrv12.wirelesscar.com> +To: Mikael Carneholm +Cc: Markus Schaber , pgsql-performance@postgresql.org +Message-id: <44BC29C5.5090607@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BDF@sesrv12.wirelesscar.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/171 +X-Sequence-Number: 20031 + +Mikael Carneholm wrote: +> +> Btw, here's the bonnie++ results from two different array sets (10+18, +> 4+24) on the MSA1500: +> +> +> LUN: DATA, 24 disks, stripe size 64K +> ------------------------------------- +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> sesell01 32G 59443 97 118515 39 25023 5 30926 49 60835 6 +> 531.8 1 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 2499 90 +++++ +++ +++++ +++ 2817 99 +++++ +++ +> 10971 100 +> + + +It might be interesting to see if 128K or 256K stripe size gives better +sequential throughput, while still leaving the random performance ok. +Having said that, the seeks/s figure of 531 not that great - for +instance I've seen a 12 disk (15K SCSI) system report about 1400 seeks/s +in this test. + +Sorry if you mentioned this already - but what OS and filesystem are you +using? (if Linux and ext3, it might be worth experimenting with xfs or jfs). + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Tue Jul 18 00:08:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 26E989F9F73 + for ; + Tue, 18 Jul 2006 00:08:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99673-03 for + ; + Tue, 18 Jul 2006 00:08:06 -0300 (ADT) +X-Greylist: delayed 13:27:39.715643 by SQLgrey- +Received: from smtpauth04.mail.atl.earthlink.net + (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) + by postgresql.org (Postfix) with ESMTP id D115D9F9F27 + for ; + Tue, 18 Jul 2006 00:07:56 -0300 (ADT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; + d=earthlink.net; + b=Pxe6ASL17YgAD/wTSb2Bh7o8Mi/125dDnsGdOvEOybFLmAzlD3459vnZ/kpmaUD9; + h=Message-ID:Date:From:Reply-To:To:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; +Received: from [209.86.224.35] (helo=elwamui-huard.atl.sa.earthlink.net) + by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) + id 1G2fwB-00077R-Oi; Mon, 17 Jul 2006 23:07:55 -0400 +Received: from 71.243.31.238 by webmail.pas.earthlink.net with HTTP; + Mon, 17 Jul 2006 23:07:55 -0400 +Message-ID: + <13498289.1153192075696.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +Date: Mon, 17 Jul 2006 23:07:55 -0400 (EDT) +From: Ron Peacetree +Reply-To: Ron Peacetree +To: Mikael Carneholm , + pgsql-performance@postgresql.org +Subject: Re: RAID stripe size question +Mime-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +X-Mailer: EarthLink Zoo Mail 1.0 +X-ELNK-Trace: + acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bc40ff71132c4afb4f5ca025ea7bf86f51350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c +X-Originating-IP: 209.86.224.35 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/172 +X-Sequence-Number: 20032 + +-----Original Message----- +>From: Mikael Carneholm +>Sent: Jul 17, 2006 5:16 PM +>To: Ron Peacetree , pgsql-performance@postgresql.o= +rg +>Subject: RE: [PERFORM] RAID stripe size question +> +>>15Krpm HDs will have average access times of 5-6ms. 10Krpm ones of 7-8ms= +. +> +>Average seek time for that disk is listed as 4.9ms, maybe sounds a bit opt= +imistic? +> +Ah, the games vendors play. "average seek time" for a 10Krpm HD may very w= +ell be 4.9ms. However, what matters to you the user is "average =3Daccess= +=3D time". The 1st is how long it takes to position the heads to the corre= +ct track. The 2nd is how long it takes to actually find and get data from = +a specified HD sector. + +>> 28HDs as above setup as 2 RAID 10's =3D> ~75MBps*5=3D ~375MB/s, ~75*9= +=3D ~675MB/s. +> +>I guess it's still limited by the 2Gbit FC (192Mb/s), right? +> +No. A decent HBA has multiple IO channels on it. So for instance Areca's = +ARC-6080 (8/12/16-port 4Gbps Fibre-to-SATA ll Controller) has 2 4Gbps FCs i= +n it (...and can support up to 4GB of BB cache!). Nominally, this card can= + push 8Gbps=3D 800MBps. ~600-700MBps is the RW number. + +Assuming ~75MBps ASTR per HD, that's ~ enough bandwidth for a 16 HD RAID 10= + set per ARC-6080. =20 + +>>Very, very few RAID controllers can do >=3D 1GBps One thing that help gre= +atly with=20 +>>bursty IO patterns is to up your battery backed RAID cache as high as you= + possibly +>>can. Even multiple GBs of BBC can be worth it. =20 +>>Another reason to have multiple controllers ;-) +> +>I use 90% of the raid cache for writes, don't think I could go higher than= + that.=20 +>Too bad the emulex only has 256Mb though :/ +> +If your RAID cache hit rates are in the 90+% range, you probably would find= + it profitable to make it greater. I've definitely seen access patterns th= +at benefitted from increased RAID cache for any size I could actually insta= +ll. For those access patterns, no amount of RAID cache commercially availa= +ble was enough to find the "flattening" point of the cache percentage curve= +. 256MB of BB RAID cache per HBA is just not that much for many IO pattern= +s. + + +>The controller is a FC2143 (http://h71016.www7.hp.com/dstore/MiddleFrame.a= +sp?page=3Dconfig&ProductLineId=3D450&FamilyId=3D1449&BaseId=3D17621&oi=3DE9= +CED&BEID=3D19701&SBLID=3D), which uses PCI-E. Don't know how it compares to= + other controllers, haven't had the time to search for / read any reviews y= +et. +> +This is a relatively low end HBA with 1 4Gb FC on it. Max sustained IO on = +it is going to be ~320MBps. Or ~ enough for an 8 HD RAID 10 set made of 75= +MBps ASTR HD's. + +28 such HDs are =3Ddefinitely=3D IO choked on this HBA. =20 + +The arithmatic suggests you need a better HBA or more HBAs or both. + + +>>WAL's are basically appends that are written in bursts of your chosen log= + chunk size and that are almost never read afterwards. Big DB pages and bi= +g RAID stripes makes sense for WALs. +> +>According to http://www.pcguide.com/ref/hdd/perf/raid/concepts/perfStripe-= +c.html, it seems to be the other way around? ("As stripe size is decreased,= + files are broken into smaller and smaller pieces. This increases the numbe= +r of drives that an average file will use to hold all the blocks containing= + the data of that file, theoretically increasing transfer performance, but = +decreasing positioning performance.") +> +>I guess I'll have to find out which theory that holds by good ol=EF=BF=BD = +trial and error... :) +> +IME, stripe sizes of 64, 128, or 256 are the most common found to be optima= +l for most access patterns + SW + FS + OS + HW. + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 01:21:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 566D89FA47F + for ; + Tue, 18 Jul 2006 01:21:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14459-05 for + ; + Tue, 18 Jul 2006 01:21:53 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) + by postgresql.org (Postfix) with ESMTP id CF9939FA425 + for ; + Tue, 18 Jul 2006 01:21:52 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id u2so152376uge + for ; + Mon, 17 Jul 2006 21:21:51 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=H3oatjl2jHkRu973YIYyy4It419tEyVVTjZFqt/Kd8zFOw48DYlFH10bOX+ydbqkqJNisS+OTyTwD4xyKissuicso2wQabaynKkvUlcfAnL/RqS3dFZQ8jVL4nsnVPJfiO0Y9u8K0kisowCbXDado65lVrqo1eLjr8D03BGuclc= +Received: by 10.78.166.7 with SMTP id o7mr1246492hue; + Mon, 17 Jul 2006 21:21:51 -0700 (PDT) +Received: by 10.78.140.7 with HTTP; Mon, 17 Jul 2006 21:21:51 -0700 (PDT) +Message-ID: <33c6269f0607172121i1b6610b1j3fc686d4132f880b@mail.gmail.com> +Date: Tue, 18 Jul 2006 00:21:51 -0400 +From: "Alex Turner" +To: "Ron Peacetree" +Subject: Re: RAID stripe size question +Cc: "Mikael Carneholm" , + pgsql-performance@postgresql.org +In-Reply-To: + <13498289.1153192075696.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_23008_6780422.1153196511311" +References: + <13498289.1153192075696.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/173 +X-Sequence-Number: 20033 + +------=_Part_23008_6780422.1153196511311 +Content-Type: text/plain; charset=UTF-8; format=flowed +Content-Transfer-Encoding: base64 +Content-Disposition: inline + +T24gNy8xNy8wNiwgUm9uIFBlYWNldHJlZSA8cmpwZWFjZUBlYXJ0aGxpbmsubmV0PiB3cm90ZToK +Pgo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tCj4gPkZyb206IE1pa2FlbCBDYXJuZWhvbG0g +PE1pa2FlbC5DYXJuZWhvbG1AV2lyZWxlc3NDYXIuY29tPgo+ID5TZW50OiBKdWwgMTcsIDIwMDYg +NToxNiBQTQo+ID5UbzogUm9uICBQZWFjZXRyZWUgPHJqcGVhY2VAZWFydGhsaW5rLm5ldD4sCj4g +cGdzcWwtcGVyZm9ybWFuY2VAcG9zdGdyZXNxbC5vcmcKPiA+U3ViamVjdDogUkU6IFtQRVJGT1JN +XSBSQUlEIHN0cmlwZSBzaXplIHF1ZXN0aW9uCj4gPgo+ID4+MTVLcnBtIEhEcyB3aWxsIGhhdmUg +YXZlcmFnZSBhY2Nlc3MgdGltZXMgb2YgNS02bXMuICAxMEtycG0gb25lcyBvZgo+IDctOG1zLgo+ +ID4KPiA+QXZlcmFnZSBzZWVrIHRpbWUgZm9yIHRoYXQgZGlzayBpcyBsaXN0ZWQgYXMgNC45bXMs +IG1heWJlIHNvdW5kcyBhIGJpdAo+IG9wdGltaXN0aWM/Cj4gPgo+IEFoLCB0aGUgZ2FtZXMgdmVu +ZG9ycyBwbGF5LiAgImF2ZXJhZ2Ugc2VlayB0aW1lIiBmb3IgYSAxMEtycG0gSEQgbWF5IHZlcnkK +PiB3ZWxsIGJlIDQuOW1zLiAgSG93ZXZlciwgd2hhdCBtYXR0ZXJzIHRvIHlvdSB0aGUgdXNlciBp +cyAiYXZlcmFnZSA9YWNjZXNzPQo+IHRpbWUiLiAgVGhlIDFzdCBpcyBob3cgbG9uZyBpdCB0YWtl +cyB0byBwb3NpdGlvbiB0aGUgaGVhZHMgdG8gdGhlIGNvcnJlY3QKPiB0cmFjay4gIFRoZSAybmQg +aXMgaG93IGxvbmcgaXQgdGFrZXMgdG8gYWN0dWFsbHkgZmluZCBhbmQgZ2V0IGRhdGEgZnJvbSBh +Cj4gc3BlY2lmaWVkIEhEIHNlY3Rvci4KPgo+ID4+IDI4SERzIGFzIGFib3ZlIHNldHVwIGFzIDIg +UkFJRCAxMCdzID0+IH43NU1CcHMqNT0gfjM3NU1CL3MsICB+NzUqOT0KPiB+Njc1TUIvcy4KPiA+ +Cj4gPkkgZ3Vlc3MgaXQncyBzdGlsbCBsaW1pdGVkIGJ5IHRoZSAyR2JpdCBGQyAoMTkyTWIvcyks +IHJpZ2h0Pwo+ID4KPiBOby4gIEEgZGVjZW50IEhCQSBoYXMgbXVsdGlwbGUgSU8gY2hhbm5lbHMg +b24gaXQuICBTbyBmb3IgaW5zdGFuY2UgQXJlY2Encwo+IEFSQy02MDgwICg4LzEyLzE2LXBvcnQg +NEdicHMgRmlicmUtdG8tU0FUQSBsbCBDb250cm9sbGVyKSBoYXMgMiA0R2JwcyBGQ3MgaW4KPiBp +dCAoLi4uYW5kIGNhbiBzdXBwb3J0IHVwIHRvIDRHQiBvZiBCQiBjYWNoZSEpLiAgTm9taW5hbGx5 +LCB0aGlzIGNhcmQgY2FuCj4gcHVzaCA4R2Jwcz0gODAwTUJwcy4gIH42MDAtNzAwTUJwcyBpcyB0 +aGUgUlcgbnVtYmVyLgo+Cj4gQXNzdW1pbmcgfjc1TUJwcyBBU1RSIHBlciBIRCwgdGhhdCdzIH4g +ZW5vdWdoIGJhbmR3aWR0aCBmb3IgYSAxNiBIRCBSQUlECj4gMTAgc2V0IHBlciBBUkMtNjA4MC4K +Pgo+ID4+VmVyeSwgdmVyeSBmZXcgUkFJRCBjb250cm9sbGVycyBjYW4gZG8gPj0gMUdCcHMgT25l +IHRoaW5nIHRoYXQgaGVscAo+IGdyZWF0bHkgd2l0aAo+ID4+YnVyc3R5IElPIHBhdHRlcm5zIGlz +IHRvIHVwIHlvdXIgYmF0dGVyeSBiYWNrZWQgUkFJRCBjYWNoZSBhcyBoaWdoIGFzCj4geW91IHBv +c3NpYmx5Cj4gPj5jYW4uICBFdmVuIG11bHRpcGxlIEdCcyBvZiBCQkMgY2FuIGJlIHdvcnRoIGl0 +Lgo+ID4+QW5vdGhlciByZWFzb24gdG8gaGF2ZSBtdWx0aXBsZSBjb250cm9sbGVycyA7LSkKPiA+ +Cj4gPkkgdXNlIDkwJSBvZiB0aGUgcmFpZCBjYWNoZSBmb3Igd3JpdGVzLCBkb24ndCB0aGluayBJ +IGNvdWxkIGdvIGhpZ2hlcgo+IHRoYW4gdGhhdC4KPiA+VG9vIGJhZCB0aGUgZW11bGV4IG9ubHkg +aGFzIDI1Nk1iIHRob3VnaCA6Lwo+ID4KPiBJZiB5b3VyIFJBSUQgY2FjaGUgaGl0IHJhdGVzIGFy +ZSBpbiB0aGUgOTArJSByYW5nZSwgeW91IHByb2JhYmx5IHdvdWxkCj4gZmluZCBpdCBwcm9maXRh +YmxlIHRvIG1ha2UgaXQgZ3JlYXRlci4gIEkndmUgZGVmaW5pdGVseSBzZWVuIGFjY2VzcyBwYXR0 +ZXJucwo+IHRoYXQgYmVuZWZpdHRlZCBmcm9tIGluY3JlYXNlZCBSQUlEIGNhY2hlIGZvciBhbnkg +c2l6ZSBJIGNvdWxkIGFjdHVhbGx5Cj4gaW5zdGFsbC4gIEZvciB0aG9zZSBhY2Nlc3MgcGF0dGVy +bnMsIG5vIGFtb3VudCBvZiBSQUlEIGNhY2hlIGNvbW1lcmNpYWxseQo+IGF2YWlsYWJsZSB3YXMg +ZW5vdWdoIHRvIGZpbmQgdGhlICJmbGF0dGVuaW5nIiBwb2ludCBvZiB0aGUgY2FjaGUgcGVyY2Vu +dGFnZQo+IGN1cnZlLiAgMjU2TUIgb2YgQkIgUkFJRCBjYWNoZSBwZXIgSEJBIGlzIGp1c3Qgbm90 +IHRoYXQgbXVjaCBmb3IgbWFueSBJTwo+IHBhdHRlcm5zLgoKCjkwJSBhcyBpbiA5MCUgb2YgdGhl +IFJBTSwgbm90IDkwJSBoaXQgcmF0ZSBJJ20gaW1hZ2luaW5nLgoKPlRoZSBjb250cm9sbGVyIGlz +IGEgRkMyMTQzICgKPiBodHRwOi8vaDcxMDE2Lnd3dzcuaHAuY29tL2RzdG9yZS9NaWRkbGVGcmFt +ZS5hc3A/cGFnZT1jb25maWcmUHJvZHVjdExpbmVJZD00NTAmRmFtaWx5SWQ9MTQ0OSZCYXNlSWQ9 +MTc2MjEmb2k9RTlDRUQmQkVJRD0xOTcwMSZTQkxJRD0pLAo+IHdoaWNoIHVzZXMgUENJLUUuIERv +bid0IGtub3cgaG93IGl0IGNvbXBhcmVzIHRvIG90aGVyIGNvbnRyb2xsZXJzLCBoYXZlbid0Cj4g +aGFkIHRoZSB0aW1lIHRvIHNlYXJjaCBmb3IgLyByZWFkIGFueSByZXZpZXdzIHlldC4KPiA+Cj4g +VGhpcyBpcyBhIHJlbGF0aXZlbHkgbG93IGVuZCBIQkEgd2l0aCAxIDRHYiBGQyBvbiBpdC4gIE1h +eCBzdXN0YWluZWQgSU8gb24KPiBpdCBpcyBnb2luZyB0byBiZSB+MzIwTUJwcy4gIE9yIH4gZW5v +dWdoIGZvciBhbiA4IEhEIFJBSUQgMTAgc2V0IG1hZGUgb2YKPiA3NU1CcHMgQVNUUiBIRCdzLgo+ +Cj4gMjggc3VjaCBIRHMgYXJlID1kZWZpbml0ZWx5PSBJTyBjaG9rZWQgb24gdGhpcyBIQkEuCgoK +Ck5vdCB0aGV5IGFyZW4ndC4gIFRoaXMgaXMgT0xUUCwgbm90IGRhdGEgd2FyZWhvdXNpbmcuICBJ +IGFscmVhZHkgcG9zdGVkIG1hdGgKZm9yIE9MVFAgdGhyb3VnaHB1dCwgd2hpY2ggaXMgaW4gdGhl +IG9yZGVyIG9mIDgtODBNQi9zZWNvbmQgYWN0dWFsIGRhdGEKdGhyb3VnaHB1dCBiYXNlZCBvbiBt +YXhpbXVtIHRoZW9yZXRpY2FsIHNlZWtzL3NlY29uZC4KClRoZSBhcml0aG1hdGljIHN1Z2dlc3Rz +IHlvdSBuZWVkIGEgYmV0dGVyIEhCQSBvciBtb3JlIEhCQXMgb3IgYm90aC4KPgo+Cj4gPj5XQUwn +cyBhcmUgYmFzaWNhbGx5IGFwcGVuZHMgdGhhdCBhcmUgd3JpdHRlbiBpbiBidXJzdHMgb2YgeW91 +ciBjaG9zZW4KPiBsb2cgY2h1bmsgc2l6ZSBhbmQgdGhhdCBhcmUgYWxtb3N0IG5ldmVyIHJlYWQg +YWZ0ZXJ3YXJkcy4gIEJpZyBEQiBwYWdlcyBhbmQKPiBiaWcgUkFJRCBzdHJpcGVzIG1ha2VzIHNl +bnNlIGZvciBXQUxzLgoKCnVubGVzcyBvZiBjb3Vyc2UgeW91IGFyZSBydW5uaW5nIE9MVFAsIGlu +IHdoaWNoIGNhc2UgYSBiaWcgc3RyaXBlIGlzbid0Cm5lY2Vzc2FyeSwgc3BlbmQgdGhlIGRpc2tz +IG9uIHlvdXIgZGF0YSBwYXJpdGlvbiwgYmVjYXVzZSB5b3VyIFdBTCBhY3Rpdml0eQppcyBnb2lu +ZyB0byBiZSBzbWFsbCBjb21wYXJlZCB3aXRoIHlvdXIgcmFuZG9tIElPLgoKPgo+ID5BY2NvcmRp +bmcgdG8KPiBodHRwOi8vd3d3LnBjZ3VpZGUuY29tL3JlZi9oZGQvcGVyZi9yYWlkL2NvbmNlcHRz +L3BlcmZTdHJpcGUtYy5odG1sLCBpdAo+IHNlZW1zIHRvIGJlIHRoZSBvdGhlciB3YXkgYXJvdW5k +PyAoIkFzIHN0cmlwZSBzaXplIGlzIGRlY3JlYXNlZCwgZmlsZXMgYXJlCj4gYnJva2VuIGludG8g +c21hbGxlciBhbmQgc21hbGxlciBwaWVjZXMuIFRoaXMgaW5jcmVhc2VzIHRoZSBudW1iZXIgb2Yg +ZHJpdmVzCj4gdGhhdCBhbiBhdmVyYWdlIGZpbGUgd2lsbCB1c2UgdG8gaG9sZCBhbGwgdGhlIGJs +b2NrcyBjb250YWluaW5nIHRoZSBkYXRhIG9mCj4gdGhhdCBmaWxlLCB0aGVvcmV0aWNhbGx5IGlu +Y3JlYXNpbmcgdHJhbnNmZXIgcGVyZm9ybWFuY2UsIGJ1dCBkZWNyZWFzaW5nCj4gcG9zaXRpb25p +bmcgcGVyZm9ybWFuY2UuIikKPiA+Cj4gPkkgZ3Vlc3MgSSdsbCBoYXZlIHRvIGZpbmQgb3V0IHdo +aWNoIHRoZW9yeSB0aGF0IGhvbGRzIGJ5IGdvb2Qgb2zvv70gdHJpYWwKPiBhbmQgZXJyb3IuLi4g +OikKPiA+Cj4gSU1FLCBzdHJpcGUgc2l6ZXMgb2YgNjQsIDEyOCwgb3IgMjU2IGFyZSB0aGUgbW9z +dCBjb21tb24gZm91bmQgdG8gYmUKPiBvcHRpbWFsIGZvciBtb3N0IGFjY2VzcyBwYXR0ZXJucyAr +IFNXICsgRlMgKyBPUyArIEhXLgoKCk5ldyByZWNvcmRzIHdpbGwgYmUgcG9zdGVkIGF0IHRoZSBl +bmQgb2YgYSBmaWxlLCBhbmQgd2lsbCBvbmx5IGluY3JlYXNlIHRoZQpmaWxlIGJ5IHRoZSBudW1i +ZXIgb2YgYmxvY2tzIGluIHRoZSB0cmFuc2FjdGlvbnMgcG9zdGVkIGF0IHdyaXRlIHRpbWUuClVw +ZGF0ZWQgcmVjb3JkcyBhcmUgbW9kaWZpZWQgaW4gcGxhY2UgdW5sZXNzIHRoZXkgaGF2ZSBncm93 +biB0b28gYmlnIHRvIGJlCmluIHBsYWNlLiAgSWYgeW91IGFyZSB1cGRhdGVkIG11dGlwbGUgdGFi +bGVzIG9uIGVhY2ggdHJhbnNhY3Rpb24sIGEgNjRrYgpzdHJpcGUgc2l6ZSBvciBsb3dlciBpcyBw +cm9iYWJseSBnb2luZyB0byBiZSBiZXN0IGFzIGJsb2NrIHNpemVzIGFyZSBqdXN0CjhrYi4gIEhv +dyBtdWNoIGRhdGEgZG9lcyB5b3VyIGF2ZXJhZ2UgdHJhbnNhY3Rpb24gd3JpdGU/ICBIb3cgbWFu +eSB4YWN0cyBwZXIKc2Vjb25kLCB0aGlzIHdpbGwgaGVscCBkZXRlcm1pbmUgaG93IG1hbnkgd3Jp +dGVzIHlvdXIgY2FjaGUgd2lsbCBxdWV1ZSB1cApiZWZvcmUgaXQgZmx1c2hlcywgYW5kIHRoZXJl +Zm9yZSB3aGF0IHRoZSBvcHRpbWFsIHN0cmlwZSBzaXplIHdpbGwgYmUuICBPZgpjb3Vyc2UsIHRo +ZSBmYXN0ZXN0IGFuZCBtb3N0IGFjY3VyYXRlIHdheSBpcyBwcm9iYWJseSBqdXN0IHRvIHRyeSBk +aWZmZXJlbnQKc2V0dGluZ3MgYW5kIHNlZSBob3cgaXQgd29ya3MuICBBbGFzIHNvbWUgY29udHJv +bGxlcnMgc2VlbSB0byBoYW5kbGUgc29tZQpzdHJpcGUgc2l6ZXMgbW9yZSBlZmZlY2llbnRseSBp +biBkZWZpYW5jZSBvZiBhbnkgbG9naWMuCgpXb3JrIG91dCBob3cgYmlnIHlvdXIgeGFjdHMgYXJl +LCBob3cgbWFueSB4YWN0cy9zZWNvbmQgeW91IGNhbiBwb3N0LCBhbmQgeW91CndpbGwgZmlndXJl +IG91dCBob3cgZmFzdCBXQUwgd2lsbCBiZSB3cml0dGluZy4gIEFsbG9jYXRlIGVub3VnaCBkaXNr +IGZvcgpwZWFrIGxvYWQgcGx1cyBwbGFubmVkIGV4cGFuc2lvbiBvbiBXQUwgYW5kIHRoZW4gcHV0 +IHRoZSByZXN0IHRvCnRhYmxlc3BhY2UuICBZb3UgbWF5IHdlbGwgZmluZCB0aGF0IGEgc2luZ2xl +IFJBSUQgMSBpcyBlbm91Z2ggZm9yIFdBTCAoaWYKeW91IGFjaGVpdmUgdGhlb3JldGljYWwgcGVy +Zm9ybWFuY2UgbGV2ZWxzLCB3aGljaCBpdCdzIGNsZWFyIHlvdXIgY29udHJvbGxlcgppc24ndCku +CgpGb3IgZXhhbXBsZSwgeW91IGJvbm5pZSsrIGJlbmNobWFyayBzaG93cyA1Mzggc2Vla3Mvc2Vj +b25kLiAgSWYgb24gZWFjaCBzZWVrCm9uZSB3cml0ZXMgOGsgb2YgZGF0YSAob25lIGJsb2NrKSB0 +aGVuIHlvdXIgdG90YWwgdGhyb3VnaHB1dCB0byBkaXNrIGlzCjUzOCo4az00MzA0ayB3aGljaCBp +cyBqdXN0IDRNQi9zZWNvbmQgYWN0dWFsIHRocm91Z2hwdXQgZm9yIFdBTCwgd2hpY2ggaXMKYWJv +dXQgd2hhdCBJIGVzdGltYXRlZCBpbiBteSBjYWxjdWxhdGlvbnMgZWFybGllci4gICBBIHNpbmds +ZSBSQUlEIDEgd2lsbAplYXNpbHkgc3VmZmljZSB0byBoYW5kbGUgV0FMIGZvciB0aGlzIGtpbmQg +b2YgT0xUUCB4YWN0IHJhdGUuICBFdmVuIGlmIHlvdQp3cml0ZSBhIGZ1bGwgc3RyaXBlIG9uIGV2 +ZXJ5IHBhc3MgYXQgNjRrYiwgdGhhdHMgc3RpbGwgb25seSA1MzgqNjRrID0gMzQ0MzJrCm9yIGFy +b3VuZCAzNE1lZywgc3RpbGwgd2l0aGluIHRoZSBjYXBhYmlsaXR5IG9mIGEgY29ycmVjdGx5IHJ1 +bm5pbmcgUkFJRCAxLAphbmQgZXZlbiB3aXRoIHlvdXIgbG93IGJvbm5pZSBzY29yZXMsIHdpdGhp +biB0aGUgY2FwYWJpbGl0eSBvZiB5b3VyIDQgZGlzawpSQUlEIDEwLgoKUmVtZW1iZXIgd2hlbiBp +dCBjb21lcyB0byBPTFRQLCBtYXNzaXZlIHNlcmlhbCB0aHJvdWdocHV0IGlzIG5vdCBnb25uYSBo +ZWxwCnlvdSwgaXQncyBsb3cgc2VlayB0aW1lcywgd2hpY2ggaXMgd2h5IHBlb3BsZSBzdGlsbCBi +dXkgMTVrIFJQTSBkcml2ZXMsIGFuZAp3aHkgeW91IGRvbid0IG5lY2Vzc2FyaWx5IG5lZWQgYSBo +b25raW5nIFNBUy9TQVRBIGNvbnRyb2xsZXIgd2hpY2ggY2FuCmhhcm5lc3MgdGhlIGZ1bGwgMTA2 +Nk1CL3NlYyBvZiB5b3VyIFBDSS1YIGJ1cywgb3IgbW9yZSBmb3IgUENJZS4gIE9mIGNvdXJzZSwK +b25jZSB5b3UgaGF2ZSBhIGJ1bmNoIG9mIE9MVFAgZGF0YSwgcGVvcGxlIHdpbGwgaW5uZXZpdGFi +bHkgd2FudCByZXBvcnRzIG9uCnRoYXQgc3R1ZmYsIGFuZCB3aGF0IHdhcyBtYWlubHkgYW4gT0xU +UCBkYXRhYmFzZSBzdWRkZW5seSBiZWNvbWVzIGEgZGF0YQp3YXJlaG91c2UgaW4gYSBtYXR0ZXIg +b2YgbW9udGhzLCBzbyBkb24ndCBuZWdsZWN0IHRvIGNvbnNpZGVyIHRoYXQgcHJvYmxlbQphbHNv +LgoKQWxzbyBtb3JlIFJBTSBvbiB0aGUgUkFJRCBjYXJkIHdpbGwgc2VyaW91c2x5IGhlbHAgYm9s +c3RlciB5b3VyIHRyYW5zYWN0aW9uCnJhdGUsIGFzIHlvdXIgY29udHJvbGxlciBjYW4gcXVldWUg +dXAgYSB3aG9sZSBidW5jaCBvZiB0YWJsZSB3cml0ZXMgYW5kCmJ1cnN0IHRoZW0gYWxsIGF0IG9u +Y2UgaW4gYSBzaW5nbGUgc2Vlaywgd2hpY2ggd2lsbCBpbmNyZWFzZSB5b3VyIG92ZXJhbGwKdGhy +b3VnaHB1dCBieSBhcyBtdWNoIGFzIGFuIG9yZGVyIG9mIG1hZ25pdHVkZSAoYW5kIHlvdSB3b3Vs +ZCBoYXZlIHRvCmluY3JlYXNlIFdBTCBhY2NvcmRpbmdseSB0aGVyZWZvcmUpLgoKQnV0IGZpbmFs +bHkgLSBpZiB5b3VyIGNhcmQvY2FiIGlzbid0IHBlcmZvcm1pbmcgUk1BIGl0LiAgU2VuZCB0aGUg +ZGFtbiB0aGluZwpiYWNrIGFuZCBnZXQgc29tZXRoaW5nIHRoYXQgYWN0dWFseSBjYW4gZG8gd2hh +dCBpdCBzaG91bGQuICBEb24ndCB0b2xlcmF0ZQptYW51ZmFjdHVyZXJzIEJTISEKCkFsZXgK +------=_Part_23008_6780422.1153196511311 +Content-Type: text/html; charset=UTF-8 +Content-Transfer-Encoding: base64 +Content-Disposition: inline + +PGJyPjxicj48ZGl2PjxzcGFuIGNsYXNzPSJnbWFpbF9xdW90ZSI+T24gNy8xNy8wNiwgPGIgY2xh +c3M9ImdtYWlsX3NlbmRlcm5hbWUiPlJvbiBQZWFjZXRyZWU8L2I+ICZsdDs8YSBocmVmPSJtYWls +dG86cmpwZWFjZUBlYXJ0aGxpbmsubmV0Ij5yanBlYWNlQGVhcnRobGluay5uZXQ8L2E+Jmd0OyB3 +cm90ZTo8L3NwYW4+PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0iYm9yZGVy +LWxlZnQ6IDFweCBzb2xpZCByZ2IoMjA0LCAyMDQsIDIwNCk7IG1hcmdpbjogMHB0IDBwdCAwcHQg +MC44ZXg7IHBhZGRpbmctbGVmdDogMWV4OyI+Ci0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tPGJy +PiZndDtGcm9tOiBNaWthZWwgQ2FybmVob2xtICZsdDs8YSBocmVmPSJtYWlsdG86TWlrYWVsLkNh +cm5laG9sbUBXaXJlbGVzc0Nhci5jb20iPk1pa2FlbC5DYXJuZWhvbG1AV2lyZWxlc3NDYXIuY29t +PC9hPiZndDs8YnI+Jmd0O1NlbnQ6IEp1bCAxNywgMjAwNiA1OjE2IFBNPGJyPiZndDtUbzogUm9u +Jm5ic3A7Jm5ic3A7UGVhY2V0cmVlICZsdDs8YSBocmVmPSJtYWlsdG86cmpwZWFjZUBlYXJ0aGxp +bmsubmV0Ij4KcmpwZWFjZUBlYXJ0aGxpbmsubmV0PC9hPiZndDssIDxhIGhyZWY9Im1haWx0bzpw +Z3NxbC1wZXJmb3JtYW5jZUBwb3N0Z3Jlc3FsLm9yZyI+cGdzcWwtcGVyZm9ybWFuY2VAcG9zdGdy +ZXNxbC5vcmc8L2E+PGJyPiZndDtTdWJqZWN0OiBSRTogW1BFUkZPUk1dIFJBSUQgc3RyaXBlIHNp +emUgcXVlc3Rpb248YnI+Jmd0Ozxicj4mZ3Q7Jmd0OzE1S3JwbSBIRHMgd2lsbCBoYXZlIGF2ZXJh +Z2UgYWNjZXNzIHRpbWVzIG9mIDUtNm1zLiZuYnNwOyZuYnNwOzEwS3JwbSBvbmVzIG9mIDctOG1z +Lgo8YnI+Jmd0Ozxicj4mZ3Q7QXZlcmFnZSBzZWVrIHRpbWUgZm9yIHRoYXQgZGlzayBpcyBsaXN0 +ZWQgYXMgNC45bXMsIG1heWJlIHNvdW5kcyBhIGJpdCBvcHRpbWlzdGljPzxicj4mZ3Q7PGJyPkFo +LCB0aGUgZ2FtZXMgdmVuZG9ycyBwbGF5LiZuYnNwOyZuYnNwOyZxdW90O2F2ZXJhZ2Ugc2VlayB0 +aW1lJnF1b3Q7IGZvciBhIDEwS3JwbSBIRCBtYXkgdmVyeSB3ZWxsIGJlIDQuOW1zLiZuYnNwOyZu +YnNwO0hvd2V2ZXIsIHdoYXQgbWF0dGVycyB0byB5b3UgdGhlIHVzZXIgaXMgJnF1b3Q7YXZlcmFn +ZSA9YWNjZXNzPSB0aW1lJnF1b3Q7LiZuYnNwOyZuYnNwO1RoZSAxc3QgaXMgaG93IGxvbmcgaXQg +dGFrZXMgdG8gcG9zaXRpb24gdGhlIGhlYWRzIHRvIHRoZSBjb3JyZWN0IHRyYWNrLiZuYnNwOyZu +YnNwO1RoZSAybmQgaXMgaG93IGxvbmcgaXQgdGFrZXMgdG8gYWN0dWFsbHkgZmluZCBhbmQgZ2V0 +IGRhdGEgZnJvbSBhIHNwZWNpZmllZCBIRCBzZWN0b3IuCjxicj48YnI+Jmd0OyZndDsgMjhIRHMg +YXMgYWJvdmUgc2V0dXAgYXMgMiBSQUlEIDEwJ3MgPSZndDsgfjc1TUJwcyo1PSB+Mzc1TUIvcywm +bmJzcDsmbmJzcDt+NzUqOT0gfjY3NU1CL3MuPGJyPiZndDs8YnI+Jmd0O0kgZ3Vlc3MgaXQncyBz +dGlsbCBsaW1pdGVkIGJ5IHRoZSAyR2JpdCBGQyAoMTkyTWIvcyksIHJpZ2h0Pzxicj4mZ3Q7PGJy +Pk5vLiZuYnNwOyZuYnNwO0EgZGVjZW50IEhCQSBoYXMgbXVsdGlwbGUgSU8gY2hhbm5lbHMgb24g +aXQuJm5ic3A7Jm5ic3A7U28gZm9yIGluc3RhbmNlIEFyZWNhJ3MgQVJDLTYwODAgKDgvMTIvMTYt +cG9ydCA0R2JwcyBGaWJyZS10by1TQVRBIGxsIENvbnRyb2xsZXIpIGhhcyAyIDRHYnBzIEZDcyBp +biBpdCAoLi4uYW5kIGNhbiBzdXBwb3J0IHVwIHRvIDRHQiBvZiBCQiBjYWNoZSEpLiZuYnNwOyZu +YnNwO05vbWluYWxseSwgdGhpcyBjYXJkIGNhbiBwdXNoIDhHYnBzPSA4MDBNQnBzLiZuYnNwOyZu +YnNwO342MDAtNzAwTUJwcyBpcyB0aGUgUlcgbnVtYmVyLgo8YnI+PGJyPkFzc3VtaW5nIH43NU1C +cHMgQVNUUiBwZXIgSEQsIHRoYXQncyB+IGVub3VnaCBiYW5kd2lkdGggZm9yIGEgMTYgSEQgUkFJ +RCAxMCBzZXQgcGVyIEFSQy02MDgwLjxicj48YnI+Jmd0OyZndDtWZXJ5LCB2ZXJ5IGZldyBSQUlE +IGNvbnRyb2xsZXJzIGNhbiBkbyAmZ3Q7PSAxR0JwcyBPbmUgdGhpbmcgdGhhdCBoZWxwIGdyZWF0 +bHkgd2l0aDxicj4mZ3Q7Jmd0O2J1cnN0eSBJTyBwYXR0ZXJucyBpcyB0byB1cCB5b3VyIGJhdHRl +cnkgYmFja2VkIFJBSUQgY2FjaGUgYXMgaGlnaCBhcyB5b3UgcG9zc2libHkKPGJyPiZndDsmZ3Q7 +Y2FuLiZuYnNwOyZuYnNwO0V2ZW4gbXVsdGlwbGUgR0JzIG9mIEJCQyBjYW4gYmUgd29ydGggaXQu +PGJyPiZndDsmZ3Q7QW5vdGhlciByZWFzb24gdG8gaGF2ZSBtdWx0aXBsZSBjb250cm9sbGVycyA7 +LSk8YnI+Jmd0Ozxicj4mZ3Q7SSB1c2UgOTAlIG9mIHRoZSByYWlkIGNhY2hlIGZvciB3cml0ZXMs +IGRvbid0IHRoaW5rIEkgY291bGQgZ28gaGlnaGVyIHRoYW4gdGhhdC48YnI+Jmd0O1RvbyBiYWQg +dGhlIGVtdWxleCBvbmx5IGhhcyAyNTZNYiB0aG91Z2ggOi8KPGJyPiZndDs8YnI+SWYgeW91ciBS +QUlEIGNhY2hlIGhpdCByYXRlcyBhcmUgaW4gdGhlIDkwKyUgcmFuZ2UsIHlvdSBwcm9iYWJseSB3 +b3VsZCBmaW5kIGl0IHByb2ZpdGFibGUgdG8gbWFrZSBpdCBncmVhdGVyLiZuYnNwOyZuYnNwO0kn +dmUgZGVmaW5pdGVseSBzZWVuIGFjY2VzcyBwYXR0ZXJucyB0aGF0IGJlbmVmaXR0ZWQgZnJvbSBp +bmNyZWFzZWQgUkFJRCBjYWNoZSBmb3IgYW55IHNpemUgSSBjb3VsZCBhY3R1YWxseSBpbnN0YWxs +LiZuYnNwOyZuYnNwO0ZvciB0aG9zZSBhY2Nlc3MgcGF0dGVybnMsIG5vIGFtb3VudCBvZiBSQUlE +IGNhY2hlIGNvbW1lcmNpYWxseSBhdmFpbGFibGUgd2FzIGVub3VnaCB0byBmaW5kIHRoZSAmcXVv +dDtmbGF0dGVuaW5nJnF1b3Q7IHBvaW50IG9mIHRoZSBjYWNoZSBwZXJjZW50YWdlIGN1cnZlLiZu +YnNwOyZuYnNwOzI1Nk1CIG9mIEJCIFJBSUQgY2FjaGUgcGVyIEhCQSBpcyBqdXN0IG5vdCB0aGF0 +IG11Y2ggZm9yIG1hbnkgSU8gcGF0dGVybnMuCjwvYmxvY2txdW90ZT48ZGl2Pjxicj45MCUgYXMg +aW4gOTAlIG9mIHRoZSBSQU0sIG5vdCA5MCUgaGl0IHJhdGUgSSdtIGltYWdpbmluZy48YnI+PC9k +aXY+PGJyPjxibG9ja3F1b3RlIGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9ImJvcmRlci1sZWZ0 +OiAxcHggc29saWQgcmdiKDIwNCwgMjA0LCAyMDQpOyBtYXJnaW46IDBwdCAwcHQgMHB0IDAuOGV4 +OyBwYWRkaW5nLWxlZnQ6IDFleDsiPgomZ3Q7VGhlIGNvbnRyb2xsZXIgaXMgYSBGQzIxNDMgKDxh +IGhyZWY9Imh0dHA6Ly9oNzEwMTYud3d3Ny5ocC5jb20vZHN0b3JlL01pZGRsZUZyYW1lLmFzcD9w +YWdlPWNvbmZpZyZhbXA7UHJvZHVjdExpbmVJZD00NTAmYW1wO0ZhbWlseUlkPTE0NDkmYW1wO0Jh +c2VJZD0xNzYyMSZhbXA7b2k9RTlDRUQmYW1wO0JFSUQ9MTk3MDEmYW1wO1NCTElEPSI+aHR0cDov +L2g3MTAxNi53d3c3LmhwLmNvbS9kc3RvcmUvTWlkZGxlRnJhbWUuYXNwP3BhZ2U9Y29uZmlnJmFt +cDtQcm9kdWN0TGluZUlkPTQ1MCZhbXA7RmFtaWx5SWQ9MTQ0OSZhbXA7QmFzZUlkPTE3NjIxJmFt +cDtvaT1FOUNFRCZhbXA7QkVJRD0xOTcwMSZhbXA7U0JMSUQ9CjwvYT4pLCB3aGljaCB1c2VzIFBD +SS1FLiBEb24ndCBrbm93IGhvdyBpdCBjb21wYXJlcyB0byBvdGhlciBjb250cm9sbGVycywgaGF2 +ZW4ndCBoYWQgdGhlIHRpbWUgdG8gc2VhcmNoIGZvciAvIHJlYWQgYW55IHJldmlld3MgeWV0Ljxi +cj4mZ3Q7PGJyPlRoaXMgaXMgYSByZWxhdGl2ZWx5IGxvdyBlbmQgSEJBIHdpdGggMSA0R2IgRkMg +b24gaXQuJm5ic3A7Jm5ic3A7TWF4IHN1c3RhaW5lZCBJTyBvbiBpdCBpcyBnb2luZyB0byBiZSB+ +MzIwTUJwcy4mbmJzcDsmbmJzcDtPciB+IGVub3VnaCBmb3IgYW4gOCBIRCBSQUlEIDEwIHNldCBt +YWRlIG9mIDc1TUJwcyBBU1RSIEhEJ3MuCjxicj48YnI+Mjggc3VjaCBIRHMgYXJlID1kZWZpbml0 +ZWx5PSBJTyBjaG9rZWQgb24gdGhpcyBIQkEuPC9ibG9ja3F1b3RlPjxkaXY+PGJyPjxicj5Ob3Qg +dGhleSBhcmVuJ3QuJm5ic3A7IFRoaXMgaXMgT0xUUCwgbm90IGRhdGEgd2FyZWhvdXNpbmcuJm5i +c3A7IEkgYWxyZWFkeSBwb3N0ZWQgbWF0aCBmb3IgT0xUUCB0aHJvdWdocHV0LCB3aGljaCBpcyBp +biB0aGUgb3JkZXIgb2YgOC04ME1CL3NlY29uZCBhY3R1YWwgZGF0YSB0aHJvdWdocHV0IGJhc2Vk +IG9uIG1heGltdW0gdGhlb3JldGljYWwgc2Vla3Mvc2Vjb25kLgo8YnI+PC9kaXY+PGJyPjxibG9j +a3F1b3RlIGNsYXNzPSJnbWFpbF9xdW90ZSIgc3R5bGU9ImJvcmRlci1sZWZ0OiAxcHggc29saWQg +cmdiKDIwNCwgMjA0LCAyMDQpOyBtYXJnaW46IDBwdCAwcHQgMHB0IDAuOGV4OyBwYWRkaW5nLWxl +ZnQ6IDFleDsiPlRoZSBhcml0aG1hdGljIHN1Z2dlc3RzIHlvdSBuZWVkIGEgYmV0dGVyIEhCQSBv +ciBtb3JlIEhCQXMgb3IgYm90aC48YnI+PGJyPjxicj4KJmd0OyZndDtXQUwncyBhcmUgYmFzaWNh +bGx5IGFwcGVuZHMgdGhhdCBhcmUgd3JpdHRlbiBpbiBidXJzdHMgb2YgeW91ciBjaG9zZW4gbG9n +IGNodW5rIHNpemUgYW5kIHRoYXQgYXJlIGFsbW9zdCBuZXZlciByZWFkIGFmdGVyd2FyZHMuJm5i +c3A7Jm5ic3A7QmlnIERCIHBhZ2VzIGFuZCBiaWcgUkFJRCBzdHJpcGVzIG1ha2VzIHNlbnNlIGZv +ciBXQUxzLjwvYmxvY2txdW90ZT48ZGl2Pjxicj51bmxlc3Mgb2YgY291cnNlIHlvdSBhcmUgcnVu +bmluZyBPTFRQLCBpbiB3aGljaCBjYXNlIGEgYmlnIHN0cmlwZSBpc24ndCBuZWNlc3NhcnksIHNw +ZW5kIHRoZSBkaXNrcyBvbiB5b3VyIGRhdGEgcGFyaXRpb24sIGJlY2F1c2UgeW91ciBXQUwgYWN0 +aXZpdHkgaXMgZ29pbmcgdG8gYmUgc21hbGwgY29tcGFyZWQgd2l0aCB5b3VyIHJhbmRvbSBJTy4g +Cjxicj48L2Rpdj48YnI+PGJsb2NrcXVvdGUgY2xhc3M9ImdtYWlsX3F1b3RlIiBzdHlsZT0iYm9y +ZGVyLWxlZnQ6IDFweCBzb2xpZCByZ2IoMjA0LCAyMDQsIDIwNCk7IG1hcmdpbjogMHB0IDBwdCAw +cHQgMC44ZXg7IHBhZGRpbmctbGVmdDogMWV4OyI+Jmd0Ozxicj4mZ3Q7QWNjb3JkaW5nIHRvIDxh +IGhyZWY9Imh0dHA6Ly93d3cucGNndWlkZS5jb20vcmVmL2hkZC9wZXJmL3JhaWQvY29uY2VwdHMv +cGVyZlN0cmlwZS1jLmh0bWwiPgpodHRwOi8vd3d3LnBjZ3VpZGUuY29tL3JlZi9oZGQvcGVyZi9y +YWlkL2NvbmNlcHRzL3BlcmZTdHJpcGUtYy5odG1sPC9hPiwgaXQgc2VlbXMgdG8gYmUgdGhlIG90 +aGVyIHdheSBhcm91bmQ/ICgmcXVvdDtBcyBzdHJpcGUgc2l6ZSBpcyBkZWNyZWFzZWQsIGZpbGVz +IGFyZSBicm9rZW4gaW50byBzbWFsbGVyIGFuZCBzbWFsbGVyIHBpZWNlcy4gVGhpcyBpbmNyZWFz +ZXMgdGhlIG51bWJlciBvZiBkcml2ZXMgdGhhdCBhbiBhdmVyYWdlIGZpbGUgd2lsbCB1c2UgdG8g +aG9sZCBhbGwgdGhlIGJsb2NrcyBjb250YWluaW5nIHRoZSBkYXRhIG9mIHRoYXQgZmlsZSwgdGhl +b3JldGljYWxseSBpbmNyZWFzaW5nIHRyYW5zZmVyIHBlcmZvcm1hbmNlLCBidXQgZGVjcmVhc2lu +ZyBwb3NpdGlvbmluZyBwZXJmb3JtYW5jZS4mcXVvdDspCjxicj4mZ3Q7PGJyPiZndDtJIGd1ZXNz +IEknbGwgaGF2ZSB0byBmaW5kIG91dCB3aGljaCB0aGVvcnkgdGhhdCBob2xkcyBieSBnb29kIG9s +77+9IHRyaWFsIGFuZCBlcnJvci4uLiA6KTxicj4mZ3Q7PGJyPklNRSwgc3RyaXBlIHNpemVzIG9m +IDY0LCAxMjgsIG9yIDI1NiBhcmUgdGhlIG1vc3QgY29tbW9uIGZvdW5kIHRvIGJlIG9wdGltYWwg +Zm9yIG1vc3QgYWNjZXNzIHBhdHRlcm5zICsgU1cgKyBGUyArIE9TICsgSFcuCjwvYmxvY2txdW90 +ZT48ZGl2Pjxicj5OZXcgcmVjb3JkcyB3aWxsIGJlIHBvc3RlZCBhdCB0aGUgZW5kIG9mIGEgZmls +ZSwgYW5kIHdpbGwgb25seSBpbmNyZWFzZSB0aGUgZmlsZSBieSB0aGUgbnVtYmVyIG9mIGJsb2Nr +cyBpbiB0aGUgdHJhbnNhY3Rpb25zIHBvc3RlZCBhdCB3cml0ZSB0aW1lLiZuYnNwOyBVcGRhdGVk +IHJlY29yZHMgYXJlIG1vZGlmaWVkIGluIHBsYWNlIHVubGVzcyB0aGV5IGhhdmUgZ3Jvd24gdG9v +IGJpZyB0byBiZSBpbiBwbGFjZS4mbmJzcDsgSWYgeW91IGFyZSB1cGRhdGVkIG11dGlwbGUgdGFi +bGVzIG9uIGVhY2ggdHJhbnNhY3Rpb24sIGEgNjRrYiBzdHJpcGUgc2l6ZSBvciBsb3dlciBpcyBw +cm9iYWJseSBnb2luZyB0byBiZSBiZXN0IGFzIGJsb2NrIHNpemVzIGFyZSBqdXN0IDhrYi4mbmJz +cDsgSG93IG11Y2ggZGF0YSBkb2VzIHlvdXIgYXZlcmFnZSB0cmFuc2FjdGlvbiB3cml0ZT8mbmJz +cDsgSG93IG1hbnkgeGFjdHMgcGVyIHNlY29uZCwgdGhpcyB3aWxsIGhlbHAgZGV0ZXJtaW5lIGhv +dyBtYW55IHdyaXRlcyB5b3VyIGNhY2hlIHdpbGwgcXVldWUgdXAgYmVmb3JlIGl0IGZsdXNoZXMs +IGFuZCB0aGVyZWZvcmUgd2hhdCB0aGUgb3B0aW1hbCBzdHJpcGUgc2l6ZSB3aWxsIGJlLiZuYnNw +OyBPZiBjb3Vyc2UsIHRoZSBmYXN0ZXN0IGFuZCBtb3N0IGFjY3VyYXRlIHdheSBpcyBwcm9iYWJs +eSBqdXN0IHRvIHRyeSBkaWZmZXJlbnQgc2V0dGluZ3MgYW5kIHNlZSBob3cgaXQgd29ya3MuJm5i +c3A7IEFsYXMgc29tZSBjb250cm9sbGVycyBzZWVtIHRvIGhhbmRsZSBzb21lIHN0cmlwZSBzaXpl +cyBtb3JlIGVmZmVjaWVudGx5IGluIGRlZmlhbmNlIG9mIGFueSBsb2dpYy4KPGJyPjxicj5Xb3Jr +IG91dCBob3cgYmlnIHlvdXIgeGFjdHMgYXJlLCBob3cgbWFueSB4YWN0cy9zZWNvbmQgeW91IGNh +biBwb3N0LCBhbmQgeW91IHdpbGwgZmlndXJlIG91dCBob3cgZmFzdCBXQUwgd2lsbCBiZSB3cml0 +dGluZy4mbmJzcDsgQWxsb2NhdGUgZW5vdWdoIGRpc2sgZm9yIHBlYWsgbG9hZCBwbHVzIHBsYW5u +ZWQgZXhwYW5zaW9uIG9uIFdBTCBhbmQgdGhlbiBwdXQgdGhlIHJlc3QgdG8gdGFibGVzcGFjZS4m +bmJzcDsgWW91IG1heSB3ZWxsIGZpbmQgdGhhdCBhIHNpbmdsZSBSQUlEIDEgaXMgZW5vdWdoIGZv +ciBXQUwgKGlmIHlvdSBhY2hlaXZlIHRoZW9yZXRpY2FsIHBlcmZvcm1hbmNlIGxldmVscywgd2hp +Y2ggaXQncyBjbGVhciB5b3VyIGNvbnRyb2xsZXIgaXNuJ3QpLgo8YnI+PGJyPkZvciBleGFtcGxl +LCB5b3UgYm9ubmllKysgYmVuY2htYXJrIHNob3dzIDUzOCBzZWVrcy9zZWNvbmQuJm5ic3A7IElm +IG9uIGVhY2ggc2VlayBvbmUgd3JpdGVzIDhrIG9mIGRhdGEgKG9uZSBibG9jaykgdGhlbiB5b3Vy +IHRvdGFsIHRocm91Z2hwdXQgdG8gZGlzayBpcyA1MzgqOGs9NDMwNGsgd2hpY2ggaXMganVzdCA0 +TUIvc2Vjb25kIGFjdHVhbCB0aHJvdWdocHV0IGZvciBXQUwsIHdoaWNoIGlzIGFib3V0IHdoYXQg +SSBlc3RpbWF0ZWQgaW4gbXkgY2FsY3VsYXRpb25zIGVhcmxpZXIuJm5ic3A7Jm5ic3A7IEEgc2lu +Z2xlIFJBSUQgMSB3aWxsIGVhc2lseSBzdWZmaWNlIHRvIGhhbmRsZSBXQUwgZm9yIHRoaXMga2lu +ZCBvZiBPTFRQIHhhY3QgcmF0ZS4mbmJzcDsgRXZlbiBpZiB5b3Ugd3JpdGUgYSBmdWxsIHN0cmlw +ZSBvbiBldmVyeSBwYXNzIGF0IDY0a2IsIHRoYXRzIHN0aWxsIG9ubHkgNTM4KjY0ayA9IDM0NDMy +ayBvciBhcm91bmQgMzRNZWcsIHN0aWxsIHdpdGhpbiB0aGUgY2FwYWJpbGl0eSBvZiBhIGNvcnJl +Y3RseSBydW5uaW5nIFJBSUQgMSwgYW5kIGV2ZW4gd2l0aCB5b3VyIGxvdyBib25uaWUgc2NvcmVz +LCB3aXRoaW4gdGhlIGNhcGFiaWxpdHkgb2YgeW91ciA0IGRpc2sgUkFJRCAxMC4KPGJyPjxicj5S +ZW1lbWJlciB3aGVuIGl0IGNvbWVzIHRvIE9MVFAsIG1hc3NpdmUgc2VyaWFsIHRocm91Z2hwdXQg +aXMgbm90IGdvbm5hIGhlbHAgeW91LCBpdCdzIGxvdyBzZWVrIHRpbWVzLCB3aGljaCBpcyB3aHkg +cGVvcGxlIHN0aWxsIGJ1eSAxNWsgUlBNIGRyaXZlcywgYW5kIHdoeSB5b3UgZG9uJ3QgbmVjZXNz +YXJpbHkgbmVlZCBhIGhvbmtpbmcgU0FTL1NBVEEgY29udHJvbGxlciB3aGljaCBjYW4gaGFybmVz +cyB0aGUgZnVsbCAxMDY2TUIvc2VjIG9mIHlvdXIgUENJLVggYnVzLCBvciBtb3JlIGZvciBQQ0ll +LiZuYnNwOyBPZiBjb3Vyc2UsIG9uY2UgeW91IGhhdmUgYSBidW5jaCBvZiBPTFRQIGRhdGEsIHBl +b3BsZSB3aWxsIGlubmV2aXRhYmx5IHdhbnQgcmVwb3J0cyBvbiB0aGF0IHN0dWZmLCBhbmQgd2hh +dCB3YXMgbWFpbmx5IGFuIE9MVFAgZGF0YWJhc2Ugc3VkZGVubHkgYmVjb21lcyBhIGRhdGEgd2Fy +ZWhvdXNlIGluIGEgbWF0dGVyIG9mIG1vbnRocywgc28gZG9uJ3QgbmVnbGVjdCB0byBjb25zaWRl +ciB0aGF0IHByb2JsZW0gYWxzby4KPGJyPjxicj5BbHNvIG1vcmUgUkFNIG9uIHRoZSBSQUlEIGNh +cmQgd2lsbCBzZXJpb3VzbHkgaGVscCBib2xzdGVyIHlvdXIgdHJhbnNhY3Rpb24gcmF0ZSwgYXMg +eW91ciBjb250cm9sbGVyIGNhbiBxdWV1ZSB1cCBhIHdob2xlIGJ1bmNoIG9mIHRhYmxlIHdyaXRl +cyBhbmQgYnVyc3QgdGhlbSBhbGwgYXQgb25jZSBpbiBhIHNpbmdsZSBzZWVrLCB3aGljaCB3aWxs +IGluY3JlYXNlIHlvdXIgb3ZlcmFsbCB0aHJvdWdocHV0IGJ5IGFzIG11Y2ggYXMgYW4gb3JkZXIg +b2YgbWFnbml0dWRlIChhbmQgeW91IHdvdWxkIGhhdmUgdG8gaW5jcmVhc2UgV0FMIGFjY29yZGlu +Z2x5IHRoZXJlZm9yZSkuCjxicj48YnI+QnV0IGZpbmFsbHkgLSBpZiB5b3VyIGNhcmQvY2FiIGlz +bid0IHBlcmZvcm1pbmcgUk1BIGl0LiZuYnNwOyBTZW5kIHRoZSBkYW1uIHRoaW5nIGJhY2sgYW5k +IGdldCBzb21ldGhpbmcgdGhhdCBhY3R1YWx5IGNhbiBkbyB3aGF0IGl0IHNob3VsZC4mbmJzcDsg +RG9uJ3QgdG9sZXJhdGUgbWFudWZhY3R1cmVycyBCUyEhPGJyPjxicj5BbGV4PGJyPjwvZGl2Pjwv +ZGl2Pgo= +------=_Part_23008_6780422.1153196511311-- + +From pgsql-performance-owner@postgresql.org Tue Jul 18 08:40:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CE1509FA1E2 + for ; + Tue, 18 Jul 2006 08:40:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22042-04-6 + for ; + Tue, 18 Jul 2006 08:40:24 -0300 (ADT) +X-Greylist: delayed 00:26:27.885392 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 1D7169FB2D5 + for ; + Tue, 18 Jul 2006 04:09:32 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from mail.infogears.com (mail.infogears.com [69.51.90.143]) + by svr4.postgresql.org (Postfix) with ESMTP id 057315AF038 + for ; + Tue, 18 Jul 2006 06:43:03 +0000 (GMT) +Received: from mail.infogears.com (localhost.localdomain [127.0.0.1]) + by mail.infogears.com (Postfix) with ESMTP id B9503309807C + for ; + Tue, 18 Jul 2006 00:43:01 -0600 (MDT) +Received: from (HELO [69.51.88.30]) () + (smtp-auth username rconover, mechanism plain) + by mail.infogears.com (qpsmtpd/0.31-dev) with ESMTP; + Tue, 18 Jul 2006 00:43:01 -0600 +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Transfer-Encoding: 7bit +Message-Id: <891F88B2-B31D-4217-9CB9-51B23C84D89A@infogears.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Rusty Conover +Subject: Temporary table retains old contents on update eventually causing + slow temp file usage. +Date: Tue, 18 Jul 2006 00:42:58 -0600 +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/177 +X-Sequence-Number: 20037 + +Hi, + +It would seem that doing any changes on a temp table forces a copy of +the entire contents of the table to be retained in memory/disk. Is +this happening due to MVCC? Is there a way to change this behavior? +It could be very useful when you have really huge temp tables that +need to be updated a few times before they can be dropped. + +Below is an example of the problem. I'll create a temp table, insert +600 rows (just a bunch of urls, you can use anything really), then +update the table a few times without actually changing anything. Of +course this test case really doesn't show the extent of the problem, +because its such a small amount of data involved. When I have a temp +table of about 150 megs and do more then a few updates on it, it +forces postgresql to use the disk making things really slow. +Originally the entire temp table fit into RAM. + +I tried using savepoints and releasing them to see if it would make +any difference and it did not, which isn't unexpected. Could +pg_relation_size() be incorrect in this case? + +Cheers, + +Rusty +-- +Rusty Conover +InfoGears Inc. +http://www.infogears.com + + + +test=# begin; +BEGIN +test=# create temp table test_urls (u text); +CREATE TABLE +test=# insert into test_urls (u) select url from url limit 600; +INSERT 0 600 +test=# select pg_relation_size('test_urls'); +pg_relation_size +------------------ + 73728 +(1 row) + +test=# update test_urls set u = u; +UPDATE 600 +test=# select pg_relation_size('test_urls'); +pg_relation_size +------------------ + 147456 +(1 row) + +test=# update test_urls set u = u; +UPDATE 600 +test=# select pg_relation_size('test_urls'); +pg_relation_size +------------------ + 212992 +(1 row) + +test=# update test_urls set u = u; +UPDATE 600 +test=# select pg_relation_size('test_urls'); +pg_relation_size +------------------ + 286720 +(1 row) + +test=# update test_urls set u = u; +UPDATE 600 +test=# select pg_relation_size('test_urls'); +pg_relation_size +------------------ + 352256 +(1 row) + +test=# update test_urls set u = u; +UPDATE 600 +test=# select pg_relation_size('test_urls'); +pg_relation_size +------------------ + 425984 +(1 row) + + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 08:30:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 293189FB1C9 + for ; + Tue, 18 Jul 2006 08:30:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18758-03-6 + for ; + Tue, 18 Jul 2006 08:30:15 -0300 (ADT) +X-Greylist: delayed 00:13:17.255558 by SQLgrey- +Received: from mail.infogears.com (mail.infogears.com [69.51.90.143]) + by postgresql.org (Postfix) with ESMTP id BCB349FB292 + for ; + Tue, 18 Jul 2006 03:56:20 -0300 (ADT) +Received: from mail.infogears.com (localhost.localdomain [127.0.0.1]) + by mail.infogears.com (Postfix) with ESMTP id CC94B309807C + for ; + Tue, 18 Jul 2006 00:56:14 -0600 (MDT) +Received: from (HELO [69.51.88.30]) () + (smtp-auth username rconover, mechanism plain) + by mail.infogears.com (qpsmtpd/0.31-dev) with ESMTP; + Tue, 18 Jul 2006 00:56:14 -0600 +Mime-Version: 1.0 (Apple Message framework v752.2) +In-Reply-To: <891F88B2-B31D-4217-9CB9-51B23C84D89A@infogears.com> +References: <891F88B2-B31D-4217-9CB9-51B23C84D89A@infogears.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <3D8B4645-34C7-4AAB-95C4-F41557DE6389@infogears.com> +Content-Transfer-Encoding: 7bit +From: Rusty Conover +Subject: Re: Temporary table retains old contents on update eventually causing + slow temp file usage. +Date: Tue, 18 Jul 2006 00:56:13 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/176 +X-Sequence-Number: 20036 + +Sorry for replying to my own post. + +I forgot to include my version information, I used: + +PostgreSQL 8.1.0 on powerpc-apple-darwin8.3.0, compiled by GCC +powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 (Apple Computer, Inc. +build 5026) + +and + +PostgreSQL 8.1.3 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) +4.0.1 20050727 (Red Hat 4.0.1-5) + +On both the same result happens. + +Cheers, + +Rusty +-- +Rusty Conover +InfoGears Inc. +http://www.infogears.com + + + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 08:29:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 416939FA463 + for ; + Tue, 18 Jul 2006 08:29:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19254-01-2 + for ; + Tue, 18 Jul 2006 08:29:14 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.l39a.com (host123-67.pool8288.interbusiness.it + [82.88.67.123]) by postgresql.org (Postfix) with ESMTP id A98149FB34B + for ; + Tue, 18 Jul 2006 04:53:46 -0300 (ADT) +Received: from [172.16.0.1] (unknown [151.57.246.150]) + by mail.l39a.com (Postfix) with ESMTP id EE7F325F05E; + Tue, 18 Jul 2006 09:25:41 +0200 (CEST) +Subject: Re: Big differences in plans between 8.0 and 8.1 +From: Gabriele Turchi +To: Joe Conway +Cc: pgsql-performance@postgresql.org, Marco Colombo +In-Reply-To: <44BA8087.9010007@joeconway.com> +References: <1152972852.3541.0.camel@apollo5.casa.intranet> + <20060715190210.GA76277@winnie.fuhr.org> + <1152993350.3541.22.camel@apollo5.casa.intranet> + <44B94A51.9050108@joeconway.com> + <1152994970.3541.31.camel@apollo5.casa.intranet> + <44BA8087.9010007@joeconway.com> +Content-Type: multipart/signed; micalg=sha1; + protocol="application/x-pkcs7-signature"; + boundary="=-PXfyne6Da8wGlTjYuCnZ" +Organization: L39A S.r.l. +Date: Tue, 18 Jul 2006 09:25:40 +0200 +Message-Id: <1153207541.3323.10.camel@apollo5.casa.intranet> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.2 (2.6.2-1.fc5.5) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/175 +X-Sequence-Number: 20035 + + +--=-PXfyne6Da8wGlTjYuCnZ +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Il giorno dom, 16/07/2006 alle 11.08 -0700, Joe Conway ha scritto: +> Gabriele Turchi wrote: +> > Il giorno sab, 15/07/2006 alle 13.04 -0700, Joe Conway ha scritto: +> >>Why not just periodically (once an hour?) run "ANALYZE registrazioni;"=20 +> >>during the day. This will only update the statistics, and should be ver= +y=20 +> >>low impact. +> >=20 +> > This is my "solution" too... but: is enough? Or else: there is a better +> > way to do this? If the performance in the better case is 50 times faste= +r +> > than the worse case, during an hour (50/100 record inserted in +> > "registrazioni") how much the performance can fall before the new +> > "ANALYZE" is run? Otherwise, running ANALYZE more frequently can badly +> > affect the overall performance? +>=20 +> One thing I noticed is that in both plans there is a seq scan on=20 +> registrazioni. Given that performance degrades so quickly as records are=20 +> inserted into registrazioni, I'm wondering if you're missing an index.=20 +> What indexes do you have on registrazioni? +>=20 +> Joe + +No one. The application was not fine-tuned, because the original +performance (under 8.0) was "more than enough". I thought that creating +an index on a table with no more than some hundred of records was not +useful... + +My biggest doubt is anyway related to the very big difference between +the plans in 8.0 and 8.1 under the same conditions.=20 + +Thank you, +Gabriele + +--=-PXfyne6Da8wGlTjYuCnZ +Content-Type: application/x-pkcs7-signature; name=smime.p7s +Content-Disposition: attachment; filename=smime.p7s +Content-Transfer-Encoding: base64 + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIITwDCCBhsw +ggQDoAMCAQICAQUwDQYJKoZIhvcNAQEFBQAwgaExCzAJBgNVBAYTAklUMQ8wDQYDVQQIEwZNaWxh +bm8xDzANBgNVBAcTBk1pbGFubzEUMBIGA1UEChMLTDM5QSBTLnIubC4xGTAXBgNVBAsTEE5ldHdv +cmsgU2VydmljZXMxIzAhBgNVBAMTGkwzOUEgQ0EgLSBOZXR3b3JrIFNlcnZpY2VzMRowGAYJKoZI +hvcNAQkBFgtjYUBsMzlhLmNvbTAeFw0wNjA2MTYyMDA3NDNaFw0wNzA2MTYyMDA3NDNaMIGIMQsw +CQYDVQQGEwJJVDEPMA0GA1UECBMGTWlsYW5vMQ8wDQYDVQQHEwZNaWxhbm8xFDASBgNVBAoTC0wz +OUEgUy5yLmwuMRgwFgYDVQQDEw9HYWJyaWVsZSBUdXJjaGkxJzAlBgkqhkiG9w0BCQEWGGdhYnJp +ZWxlLnR1cmNoaUBsMzlhLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALxyBPhE +N4pw/mC4rmStsbJRu94X7u4Me/D5Mw7mRbo7Q/d6HI8+NjPnr+SHf0Q6PSD1qnd8z3QpTBuT6OYg +Hxw5AoUHtF2HQTL+lVxfPzDWfG/KQPLdkRz8RGeRWC4rwnjV4qVqWwzXpfiTFqDly/0MoE/YyZkY +mz9aHyao6SX+2fWm5nA7xA8c1dHtAoeBzZAkxzusV1M7xJzRqh7QMLUmLxXfKOrTGwfgLkgifuPG +lQ3DHtYAWh5wm8hk8APuJBL6E+TXNwko6cFTYO1gJJLeXkBCFtAJ5PehDUvx2DLb7JRFpLrMkI0b +NVUCAP8A328DtG/2bZNa1sTCv/Z0KocCAwEAAaOCAXMwggFvMAkGA1UdEwQCMAAwEQYJYIZIAYb4 +QgEBBAQDAgSwMCsGCWCGSAGG+EIBDQQeFhxUaW55Q0EgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0G +A1UdDgQWBBTi7lQV2CuA9AlbEF+Ey0r7v/6kIDCBtQYDVR0jBIGtMIGqgBS0j92r9jZFDtjQ2Bbi +W+oNAWS2faGBjqSBizCBiDELMAkGA1UEBhMCSVQxDzANBgNVBAgTBk1pbGFubzEPMA0GA1UEBxMG +TWlsYW5vMRQwEgYDVQQKEwtMMzlBIFMuci5sLjElMCMGA1UEAxMcTDM5QSBDZXJ0aWZpY2F0aW9u +IEF1dGhvcml0eTEaMBgGCSqGSIb3DQEJARYLY2FAbDM5YS5jb22CAQEwFgYDVR0SBA8wDYELY2FA +bDM5YS5jb20wIwYDVR0RBBwwGoEYZ2FicmllbGUudHVyY2hpQGwzOWEuY29tMA4GA1UdDwEB/wQE +AwIFoDANBgkqhkiG9w0BAQUFAAOCAgEAMTOj9fYhh/Gqr08Xt5eAaTldPCwPwS2uzGpQrAby5/vZ +7AgRZQ/ZW7juJYV/vFmzP7B5RaJJ212gXzS8pd//98obILEVe872e0G6QRNtQYOLmkSxtCPmoMO3 +sabxQt/zyfCtC+1P2S9SHWCfrw3s/y9pvBxnBumgTStJjmLPtYPsh02ANN6OgAjxyQndwoiuMKp+ +4VBILxsCTylh/ivhIhvGIYga6A61WN1tDEVLOf6I4vbzgZajS/mHeGTD0ldEQVTJrkZp4iF4DMfP +zvJzAF01BUPe8Y7WgDuwldSJgokTnKUSIv64jJ21IJzHXtcxP38Op6qzG9N2I2zGFIqmgLfOkDL4 +d1kv55iINueydrNOSv/59TmdMVI/xe1B7usg8sa/r2vjjey0gibQUHmr2LAJ12jNOZPTd/AxvDHJ +UbYZJ2C4tW0aVfC0fo0i+DAcjHVRofRFpf6l0SIBFFSm0AeODr8jtSxvdroDc5JWkVMgewRDEIZV +KL5UiYR2/xiSQWqhq0d8+e8RZ5KNG60fRksyoNu3oIstNuGeLj5ILSPFsGqYCl/6Wp9ftiIcmZUz +dWWNotjUwjggltqHnFA8mXwHmLCNT74XDHuZx6MtWDS7JXkj5hqkRY5zsn0mUpJ7DmrAdcE0UVy2 +kaplPQEXGkiF0mFVfKV+yvTkWMeVoa0wggYbMIIEA6ADAgECAgEFMA0GCSqGSIb3DQEBBQUAMIGh +MQswCQYDVQQGEwJJVDEPMA0GA1UECBMGTWlsYW5vMQ8wDQYDVQQHEwZNaWxhbm8xFDASBgNVBAoT +C0wzOUEgUy5yLmwuMRkwFwYDVQQLExBOZXR3b3JrIFNlcnZpY2VzMSMwIQYDVQQDExpMMzlBIENB +IC0gTmV0d29yayBTZXJ2aWNlczEaMBgGCSqGSIb3DQEJARYLY2FAbDM5YS5jb20wHhcNMDYwNjE2 +MjAwNzQzWhcNMDcwNjE2MjAwNzQzWjCBiDELMAkGA1UEBhMCSVQxDzANBgNVBAgTBk1pbGFubzEP +MA0GA1UEBxMGTWlsYW5vMRQwEgYDVQQKEwtMMzlBIFMuci5sLjEYMBYGA1UEAxMPR2FicmllbGUg +VHVyY2hpMScwJQYJKoZIhvcNAQkBFhhnYWJyaWVsZS50dXJjaGlAbDM5YS5jb20wggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8cgT4RDeKcP5guK5krbGyUbveF+7uDHvw+TMO5kW6O0P3 +ehyPPjYz56/kh39EOj0g9ap3fM90KUwbk+jmIB8cOQKFB7Rdh0Ey/pVcXz8w1nxvykDy3ZEc/ERn +kVguK8J41eKlalsM16X4kxag5cv9DKBP2MmZGJs/Wh8mqOkl/tn1puZwO8QPHNXR7QKHgc2QJMc7 +rFdTO8Sc0aoe0DC1Ji8V3yjq0xsH4C5IIn7jxpUNwx7WAFoecJvIZPAD7iQS+hPk1zcJKOnBU2Dt +YCSS3l5AQhbQCeT3oQ1L8dgy2+yURaS6zJCNGzVVAgD/AN9vA7Rv9m2TWtbEwr/2dCqHAgMBAAGj +ggFzMIIBbzAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIEsDArBglghkgBhvhCAQ0EHhYcVGlu +eUNBIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQU4u5UFdgrgPQJWxBfhMtK+7/+pCAw +gbUGA1UdIwSBrTCBqoAUtI/dq/Y2RQ7Y0NgW4lvqDQFktn2hgY6kgYswgYgxCzAJBgNVBAYTAklU +MQ8wDQYDVQQIEwZNaWxhbm8xDzANBgNVBAcTBk1pbGFubzEUMBIGA1UEChMLTDM5QSBTLnIubC4x +JTAjBgNVBAMTHEwzOUEgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxGjAYBgkqhkiG9w0BCQEWC2Nh +QGwzOWEuY29tggEBMBYGA1UdEgQPMA2BC2NhQGwzOWEuY29tMCMGA1UdEQQcMBqBGGdhYnJpZWxl +LnR1cmNoaUBsMzlhLmNvbTAOBgNVHQ8BAf8EBAMCBaAwDQYJKoZIhvcNAQEFBQADggIBADEzo/X2 +IYfxqq9PF7eXgGk5XTwsD8EtrsxqUKwG8uf72ewIEWUP2Vu47iWFf7xZsz+weUWiSdtdoF80vKXf +//fKGyCxFXvO9ntBukETbUGDi5pEsbQj5qDDt7Gm8ULf88nwrQvtT9kvUh1gn68N7P8vabwcZwbp +oE0rSY5iz7WD7IdNgDTejoAI8ckJ3cKIrjCqfuFQSC8bAk8pYf4r4SIbxiGIGugOtVjdbQxFSzn+ +iOL284GWo0v5h3hkw9JXREFUya5GaeIheAzHz87ycwBdNQVD3vGO1oA7sJXUiYKJE5ylEiL+uIyd +tSCcx17XMT9/DqeqsxvTdiNsxhSKpoC3zpAy+HdZL+eYiDbnsnazTkr/+fU5nTFSP8XtQe7rIPLG +v69r443stIIm0FB5q9iwCddozTmT03fwMbwxyVG2GSdguLVtGlXwtH6NIvgwHIx1UaH0RaX+pdEi +ARRUptAHjg6/I7Usb3a6A3OSVpFTIHsEQxCGVSi+VImEdv8YkkFqoatHfPnvEWeSjRutH0ZLMqDb +t6CLLTbhni4+SC0jxbBqmApf+lqfX7YiHJmVM3VljaLY1MI4IJbah5xQPJl8B5iwjU++Fwx7mcej +LVg0uyV5I+YapEWOc7J9JlKSew5qwHXBNFFctpGqZT0BFxpIhdJhVXylfsr05FjHlaGtMIIHfjCC +BWagAwIBAgIBATANBgkqhkiG9w0BAQUFADCBiDELMAkGA1UEBhMCSVQxDzANBgNVBAgTBk1pbGFu +bzEPMA0GA1UEBxMGTWlsYW5vMRQwEgYDVQQKEwtMMzlBIFMuci5sLjElMCMGA1UEAxMcTDM5QSBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEaMBgGCSqGSIb3DQEJARYLY2FAbDM5YS5jb20wHhcNMDYw +NjE2MTk1NzQ5WhcNMTYwNjEzMTk1NzQ5WjCBoTELMAkGA1UEBhMCSVQxDzANBgNVBAgTBk1pbGFu +bzEPMA0GA1UEBxMGTWlsYW5vMRQwEgYDVQQKEwtMMzlBIFMuci5sLjEZMBcGA1UECxMQTmV0d29y +ayBTZXJ2aWNlczEjMCEGA1UEAxMaTDM5QSBDQSAtIE5ldHdvcmsgU2VydmljZXMxGjAYBgkqhkiG +9w0BCQEWC2NhQGwzOWEuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqw0RxtTA +yBcyp7+wJXAaQUrQLVnplfSkeZCNp/o9noMOkVwiZC+heihKEMGwGeHL/5fEB0LlKu0H1tEwYiD0 +Q8DxfCRnRM4eqN2JMN+j2U+beP5Jo7HLKknXWzQxJdST9N55+YNTA4DuPZ8xPyEsz9VLz9g39aOX +RKQnSN6ErY+XCzP0guR8Yg9MsrmIF6OqsZ9/FtariqpsnZwdYNhHvgImWOFcahbS2TJmq0S1KEGE +qXHLgqekg21eIdBT05DPbCBsMF8Qnf1hOZJU2gkaTlQmuAsO7FBGgwGulb3HgVcoY4OhPVQNQ9ZV +WmMIggAsW5w6qXnMe2NEbNFFnFRsUIc/XDekN/oE8yBsaDMgadm8QyQ22jYJ6pZmML+oAI3UrD81 +3XbPLO51Sx1VQ0TwFVK7yByHqRHT9Cf20LYKdZmYwqipdiHRS/WNuMrS1p4b2r+gJ3Afq/1podLH +46cYUoEyfADlmge5Ivv8KBlMnblNFtDnQg392aqwJfH61z6vo8HKw0uuXp3GYI6PscIClGeKuFQv +o+bmeX4f+d4+nsojkTJmyyBKeykY4GwY2Kd+o3qHL/7sLfGhRShh7640PhhbbLfOJwJQP5emr+Ak +RU7EKZlvy17u1rxT3+IZ1dw5zbBNRlzSJT3AyoXV0NMJourN6CB1X6TgEYKBjZ/5CHcCAwEAAaOC +AdYwggHSMB0GA1UdDgQWBBS0j92r9jZFDtjQ2BbiW+oNAWS2fTCBvQYDVR0jBIG1MIGygBRo7L5b +yARXiSJ6ymK8nDPhVmqbaKGBjqSBizCBiDELMAkGA1UEBhMCSVQxDzANBgNVBAgTBk1pbGFubzEP +MA0GA1UEBxMGTWlsYW5vMRQwEgYDVQQKEwtMMzlBIFMuci5sLjElMCMGA1UEAxMcTDM5QSBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eTEaMBgGCSqGSIb3DQEJARYLY2FAbDM5YS5jb22CCQCaZuS1ORKm +YTAPBgNVHRMBAf8EBTADAQH/MBEGCWCGSAGG+EIBAQQEAwIBBjAWBgNVHRIEDzANgQtjYUBsMzlh +LmNvbTArBglghkgBhvhCAQ0EHhYcVGlueUNBIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAtBglghkgB +hvhCAQQEIBYeaHR0cDovL3d3dy5sMzlhLmNvbS9jYS1jcmwucGVtMDEGCWCGSAGG+EIBCAQkFiJo +dHRwOi8vd3d3LmwzOWEuY29tL2NhLXBvbGljeS5odG1sMBYGA1UdEQQPMA2BC2NhQGwzOWEuY29t +MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAgEAa5lu8evYsYln13Xul8DMrv4EQqr5 +V0Cy2yPjSGjiqkrn7VaPScgc/SU1jumsLoQ7gzpMYmg2QkzQACQIIKKlPvYn0AnsuKoFg7bBpq2K +/z8PJ+13/pJSFcoUaD12viPgQW0baX751HixhNaZLcfvkQDfe+8pKpS/IpI8UjhqU24zBTakVMcL +tL84C9ZRiixLtU5CoKb6/irV+s3kDd45AZ/z+ut/n7bNaBpBuqQTly+m2AILH9ghj6d0sC0tduII +FU7hK2Cg8tJ8LtkYP4M2a7a0WcClz0H5ZMLCSyrymae1atKc7wu77+DH7xv2EGKmUhXHjCyHHGCK +12uTLQnBc/poz+iTOpMt2+xKFbhAHoWYoYDPZc9zVycJq3zT8qTVO+zxac9lpTCcChjV3fsWMiZT +7yNjxZlXDRA+/0EksL4nSsNzJxbb80Q5EEV3y0NmOQj1hMF94e+NOc/9LjIf5nbhCA9nXVA8tf3k +UC8o5ENhslCSE8pmeJh87gRzenP46ymKTkRURfpiFx07WHCoLGr4nYF/H/oUvfoCUsUSY7q7biqP +ukIcQAif7PxaqvBJaCIiIFhcnnCHb7kvlA8KtolINmyFwWWfKx0dafZeybcfftDfoYumIO+U3++J +B2S+bzMbJ+9n/2MPVPIcCLnBftWuHVoCK+JQ5Uan0KKA3b4xggOoMIIDpAIBATCBpzCBoTELMAkG +A1UEBhMCSVQxDzANBgNVBAgTBk1pbGFubzEPMA0GA1UEBxMGTWlsYW5vMRQwEgYDVQQKEwtMMzlB +IFMuci5sLjEZMBcGA1UECxMQTmV0d29yayBTZXJ2aWNlczEjMCEGA1UEAxMaTDM5QSBDQSAtIE5l +dHdvcmsgU2VydmljZXMxGjAYBgkqhkiG9w0BCQEWC2NhQGwzOWEuY29tAgEFMAkGBSsOAwIaBQCg +ggHVMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA2MDcxODA3MjU0 +MFowIwYJKoZIhvcNAQkEMRYEFC08I0U8FKVecELLGcv+wiqKJp1BMIG4BgkrBgEEAYI3EAQxgaow +gacwgaExCzAJBgNVBAYTAklUMQ8wDQYDVQQIEwZNaWxhbm8xDzANBgNVBAcTBk1pbGFubzEUMBIG +A1UEChMLTDM5QSBTLnIubC4xGTAXBgNVBAsTEE5ldHdvcmsgU2VydmljZXMxIzAhBgNVBAMTGkwz +OUEgQ0EgLSBOZXR3b3JrIFNlcnZpY2VzMRowGAYJKoZIhvcNAQkBFgtjYUBsMzlhLmNvbQIBBTCB +ugYLKoZIhvcNAQkQAgsxgaqggacwgaExCzAJBgNVBAYTAklUMQ8wDQYDVQQIEwZNaWxhbm8xDzAN +BgNVBAcTBk1pbGFubzEUMBIGA1UEChMLTDM5QSBTLnIubC4xGTAXBgNVBAsTEE5ldHdvcmsgU2Vy +dmljZXMxIzAhBgNVBAMTGkwzOUEgQ0EgLSBOZXR3b3JrIFNlcnZpY2VzMRowGAYJKoZIhvcNAQkB +FgtjYUBsMzlhLmNvbQIBBTANBgkqhkiG9w0BAQEFAASCAQA7ZbkGGFC9EmFg8vmKqoin+LYiaXuY +IJrU63t1+cjQdxDB2GzHeqXzRQyQ1R9f5kpJy6X3THrYabeZCW5BQ1FPEBMG6iTuR45YO3/AfmLS +Drp+n5lLn94CMbP/CiYSWD4jeBo+79BExop9SLVwDtAQBR2NBZcGbM4hSkOoF0aTKIVyYq7vV0KD +1b6IOZ7DgV8kka8fWV9D8NfaMSQgkAj6g8RY7HtScE1qZxmc7EqsbxxGAFbR5C+jiX2cNQhQg0uo +V1kobHZkw/vDLE/p5LMjV+045yHLYNW19B+EJJblfJe7L3hzZo3Zk2rRRq9mWr6SWgIOvntNZqGC +IPvIc8UtAAAAAAAA + + +--=-PXfyne6Da8wGlTjYuCnZ-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 08:19:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CD5109FB1CD + for ; + Tue, 18 Jul 2006 08:19:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 15856-01-4 + for ; + Tue, 18 Jul 2006 08:19:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 900769FB4A1 + for ; + Tue, 18 Jul 2006 06:27:27 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from tenar.csd.uoc.gr (tenar.csd.uoc.gr [147.52.16.3]) + by svr4.postgresql.org (Postfix) with ESMTP id 721C15AFB16 + for ; + Tue, 18 Jul 2006 09:27:25 +0000 (GMT) +Received: from oneiro.csd.uoc.gr (oneiro.csd.uoc.gr [147.52.19.79]) + by tenar.csd.uoc.gr (8.12.11.20060308/8.12.10) with ESMTP id + k6I9PN67013914; Tue, 18 Jul 2006 12:25:23 +0300 (EEST) +Organization: +Received: from localhost (jkapad@localhost) + by oneiro.csd.uoc.gr (8.9.3/8.9.3) with ESMTP id MAA11322; + Tue, 18 Jul 2006 12:25:44 +0300 (EEST) +X-Authentication-Warning: oneiro.csd.uoc.gr: jkapad owned process doing -bs +Date: Tue, 18 Jul 2006 12:25:44 +0300 (EEST) +From: Kapadaidakis Yannis +To: Tom Lane +Cc: pgsql-performance@postgresql.org +Subject: Re: Problem with bitmap-index-scan plan +In-Reply-To: <21981.1152829978@sss.pgh.pa.us> +Message-ID: +References: <1152078884.44ab542441450@ermis.edu.uoc.gr> + <21981.1152829978@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Scanned-By: MIMEDefang 2.56 on 147.52.16.3 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/174 +X-Sequence-Number: 20034 + + +Yes that was the problem! Thank you very much + +On Thu, 13 Jul 2006, Tom Lane wrote: + +> jkapad@csd.uoc.gr writes: +>> ... is quite reasonable.The table has 1.000.000 rows (17.242 pages). From +>> pg_stat_get_blocks_fetched I can see that there were 102 page requests for +>> table. So all things seem to work great here! +> +>> But if I multiply the size of the table ten-times (10.000.000 rows - 172.414 +>> pages) and run the same query I get: +>> ... +>> which is slower even than a seq scan. Now I get that there were 131.398 page +>> requests for table in order to retrieve almost 1250 tuples!Can someone explain +>> why this is happening? All memory parameters are set to default. +> +> You probably need to increase work_mem so that the bitmaps don't become +> lossy ... +> +> regards, tom lane +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> + +From pgsql-performance-owner@postgresql.org Tue Jul 18 12:41:38 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C5D769FA61D + for ; + Tue, 18 Jul 2006 12:41:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 39971-01-3 + for ; + Tue, 18 Jul 2006 12:41:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linuxworld.com.au (unknown [203.34.46.50]) + by postgresql.org (Postfix) with ESMTP id 01C2C9FB1E3 + for ; + Tue, 18 Jul 2006 09:23:10 -0300 (ADT) +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 k6ICMvJQ011583; + Tue, 18 Jul 2006 22:22:57 +1000 +Received: from localhost (swm@localhost) + by linuxworld.com.au (8.13.2/8.13.2/Submit) with ESMTP id + k6ICMvMb011580; Tue, 18 Jul 2006 22:22:57 +1000 +X-Authentication-Warning: linuxworld.com.au: swm owned process doing -bs +Date: Tue, 18 Jul 2006 22:22:57 +1000 (EST) +From: Gavin Sherry +X-X-Sender: swm@linuxworld.com.au +To: Rusty Conover +cc: pgsql-performance@postgresql.org +Subject: Re: Temporary table retains old contents on update eventually +In-Reply-To: <891F88B2-B31D-4217-9CB9-51B23C84D89A@infogears.com> +Message-ID: +References: <891F88B2-B31D-4217-9CB9-51B23C84D89A@infogears.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/178 +X-Sequence-Number: 20038 + +On Tue, 18 Jul 2006, Rusty Conover wrote: + +> Hi, +> +> It would seem that doing any changes on a temp table forces a copy of +> the entire contents of the table to be retained in memory/disk. Is +> this happening due to MVCC? Is there a way to change this behavior? +> It could be very useful when you have really huge temp tables that +> need to be updated a few times before they can be dropped. + +This is caused by our MVCC implementation. It cannot be easily changed. We +rely on MVCC for two things: concurrency and rolling back of aborted +commands. Without the latter, we couldn't support the following trivially: + +template1=# create temp table bar (i int); +CREATE TABLE +template1=# begin; +BEGIN +template1=# insert into bar values(1); +INSERT 0 1 +template1=# abort; +ROLLBACK +template1=# select * from bar; + i +--- +(0 rows) + +It would be nice if we could special case temp tables because of the fact +that concurrency does not come into the equation but I cannot see it +happening without a generalised overwriting MVCC system. + +The only alternative in the mean time is to vacuum your temporary table(s) +as part of your interaction with them. + +Thanks, + +Gavin + +From pgsql-performance-owner@postgresql.org Tue Jul 18 13:15:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3E2A29FB249 + for ; + Tue, 18 Jul 2006 13:15:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44816-01-7 + for ; + Tue, 18 Jul 2006 13:15:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtpauth04.mail.atl.earthlink.net + (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) + by postgresql.org (Postfix) with ESMTP id 686DC9FB21A + for ; + Tue, 18 Jul 2006 09:32:37 -0300 (ADT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; + d=earthlink.net; + b=EP99ktNHx6NUJfQY8IgN/8/vplTSw9MJqwzHvdDb8JpmCIjGKvyvzW7bVBfDhh2G; + h=Message-ID:Date:From:Reply-To:To:Subject:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; +Received: from [209.86.224.35] (helo=elwamui-huard.atl.sa.earthlink.net) + by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) + id 1G2okd-0000je-Rz; Tue, 18 Jul 2006 08:32:35 -0400 +Received: from 71.243.31.238 by webmail.pas.earthlink.net with HTTP; + Tue, 18 Jul 2006 08:32:35 -0400 +Message-ID: + <12877326.1153225955854.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +Date: Tue, 18 Jul 2006 08:32:35 -0400 (EDT) +From: Ron Peacetree +Reply-To: Ron Peacetree +To: Mikael Carneholm , + pgsql-performance@postgresql.org +Subject: Re: RAID stripe size question +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: EarthLink Zoo Mail 1.0 +X-ELNK-Trace: + acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bccafe51998b0bc1017993074cbdbbed5e350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c +X-Originating-IP: 209.86.224.35 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.201 tagged_above=0 required=5 tests=BAYES_50, + DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200607/179 +X-Sequence-Number: 20039 + +>From: Alex Turner +>Sent: Jul 18, 2006 12:21 AM +>To: Ron Peacetree +>Cc: Mikael Carneholm , pgsql-performance@postgresql.org +>Subject: Re: [PERFORM] RAID stripe size question +> +>On 7/17/06, Ron Peacetree wrote: +>> +>> -----Original Message----- +>> >From: Mikael Carneholm +>> >Sent: Jul 17, 2006 5:16 PM +>> >To: Ron Peacetree , +>> pgsql-performance@postgresql.org +>> >Subject: RE: [PERFORM] RAID stripe size question +>> > +>> >I use 90% of the raid cache for writes, don't think I could go higher +>> >than that. +>> >Too bad the emulex only has 256Mb though :/ +>> > +>> If your RAID cache hit rates are in the 90+% range, you probably would +>> find it profitable to make it greater. I've definitely seen access patterns +>> that benefitted from increased RAID cache for any size I could actually +>> install. For those access patterns, no amount of RAID cache commercially +>> available was enough to find the "flattening" point of the cache percentage +>> curve. 256MB of BB RAID cache per HBA is just not that much for many IO +>> patterns. +> +>90% as in 90% of the RAM, not 90% hit rate I'm imagining. +> +Either way, =particularly= for OLTP-like I/O patterns, the more RAID cache the better unless the IO pattern is completely random. In which case the best you can do is cache the entire sector map of the RAID set and use as many spindles as possible for the tables involved. I've seen high end set ups in Fortune 2000 organizations that look like some of the things you read about on tpc.org: =hundreds= of HDs are used. + +Clearly, completely random IO patterns are to be avoided whenever and however possible. + +Thankfully, most things can be designed to not have completely random IO and stuff like WAL IO are definitely not random. + +The important point here about cache size is that unless you make cache large enough that you see a flattening in the cache behavior, you probably can still use more cache. Working sets are often very large for DB applications. + + +>>The controller is a FC2143 ( +>> http://h71016.www7.hp.com/dstore/MiddleFrame.asp?page=config&ProductLineId=450&FamilyId=1449&BaseId=17621&oi=E9CED&BEID=19701&SBLID=), +>> which uses PCI-E. Don't know how it compares to other controllers, haven't +>> had the time to search for / read any reviews yet. +>> > +>> This is a relatively low end HBA with 1 4Gb FC on it. Max sustained IO on +>> it is going to be ~320MBps. Or ~ enough for an 8 HD RAID 10 set made of +>> 75MBps ASTR HD's. +>> +>> 28 such HDs are =definitely= IO choked on this HBA. +> +>Not they aren't. This is OLTP, not data warehousing. I already posted math +>for OLTP throughput, which is in the order of 8-80MB/second actual data +>throughput based on maximum theoretical seeks/second. +> +WAL IO patterns are not OLTP-like. Neither are most support or decision support IO patterns. Even in an OLTP system, there are usually only a few scenarios and tables where the IO pattern is pessimal. +Alex is quite correct that those few will be the bottleneck on overall system performance if the system's primary function is OLTP-like. + +For those few, you dedicate as many spindles and RAID cache as you can afford and as show any performance benefit. I've seen an entire HBA maxed out with cache and as many HDs as would saturate the attainable IO rate dedicated to =1= table (unfortunately SSD was not a viable option in this case). + + +>>The arithmetic suggests you need a better HBA or more HBAs or both. +>> +>> +>> >>WAL's are basically appends that are written in bursts of your chosen +>> log chunk size and that are almost never read afterwards. Big DB pages and +>> big RAID stripes makes sense for WALs. +> +> +>unless of course you are running OLTP, in which case a big stripe isn't +>necessary, spend the disks on your data parition, because your WAL activity +>is going to be small compared with your random IO. +> +Or to put it another way, the scenarios and tables that have the most random looking IO patterns are going to be the performance bottleneck on the whole system. In an OLTP-like system, WAL IO is unlikely to be your biggest performance issue. As in any other performance tuning effort, you only gain by speeding up the current bottleneck. + + +>> +>> >According to +>> http://www.pcguide.com/ref/hdd/perf/raid/concepts/perfStripe-c.html, it +>> seems to be the other way around? ("As stripe size is decreased, files are +>> broken into smaller and smaller pieces. This increases the number of drives +>> that an average file will use to hold all the blocks containing the data of +>> that file, theoretically increasing transfer performance, but decreasing +>> positioning performance.") +>> > +>> >I guess I'll have to find out which theory that holds by good ol? trial +>> and error... :) +>> > +>> IME, stripe sizes of 64, 128, or 256 are the most common found to be +>> optimal for most access patterns + SW + FS + OS + HW. +> +> +>New records will be posted at the end of a file, and will only increase the +>file by the number of blocks in the transactions posted at write time. +>Updated records are modified in place unless they have grown too big to be +>in place. If you are updated mutiple tables on each transaction, a 64kb +>stripe size or lower is probably going to be best as block sizes are just +>8kb. +> +Here's where Theory and Practice conflict. pg does not "update" and modify in place in the true DB sense. A pg UPDATE is actually an insert of a new row or rows, !not! a modify in place. +I'm sure Alex knows this and just temporily forgot some of the context of this thread :-) + +The append behavior Alex refers to is the best case scenario for pg where a) the table is unfragmented and b) the file segment of say 2GB holding that part of the pg table is not full. +VACUUM and autovacuum are your friend. + + +>How much data does your average transaction write? How many xacts per +>second, this will help determine how many writes your cache will queue up +>before it flushes, and therefore what the optimal stripe size will be. Of +>course, the fastest and most accurate way is probably just to try different +>settings and see how it works. Alas some controllers seem to handle some +>stripe sizes more effeciently in defiance of any logic. +> +>Work out how big your xacts are, how many xacts/second you can post, and you +>will figure out how fast WAL will be writting. Allocate enough disk for +>peak load plus planned expansion on WAL and then put the rest to +>tablespace. You may well find that a single RAID 1 is enough for WAL (if +>you acheive theoretical performance levels, which it's clear your controller +>isn't). +> +This is very good advice. + + +>For example, you bonnie++ benchmark shows 538 seeks/second. If on each seek +>one writes 8k of data (one block) then your total throughput to disk is +>538*8k=4304k which is just 4MB/second actual throughput for WAL, which is +>about what I estimated in my calculations earlier. A single RAID 1 will +>easily suffice to handle WAL for this kind of OLTP xact rate. Even if you +>write a full stripe on every pass at 64kb, thats still only 538*64k = 34432k +>or around 34Meg, still within the capability of a correctly running RAID 1, +>and even with your low bonnie scores, within the capability of your 4 disk +>RAID 10. +> +I'd also suggest that you figure out what the max access per sec is for HDs and make sure you are attaining it since this will set the ceiling on your overall system performance. + +Like I've said, I've seen organizations dedicate as much HW as could make any difference on a per table basis for important OLTP systems. + + +>Remember when it comes to OLTP, massive serial throughput is not gonna help +>you, it's low seek times, which is why people still buy 15k RPM drives, and +>why you don't necessarily need a honking SAS/SATA controller which can +>harness the full 1066MB/sec of your PCI-X bus, or more for PCIe. Of course, +>once you have a bunch of OLTP data, people will innevitably want reports on +>that stuff, and what was mainly an OLTP database suddenly becomes a data +>warehouse in a matter of months, so don't neglect to consider that problem +>also. +> +One Warning to expand on Alex's point here. + +DO !NOT! use the same table schema and/or DB for your reporting and OLTP. +You will end up with a DBMS that is neither good at reporting nor OLTP. + + +>Also more RAM on the RAID card will seriously help bolster your transaction +>rate, as your controller can queue up a whole bunch of table writes and +>burst them all at once in a single seek, which will increase your overall +>throughput by as much as an order of magnitude (and you would have to +>increase WAL accordingly therefore). +> +*nods* + + +>But finally - if your card/cab isn't performing RMA it. Send the damn thing +>back and get something that actualy can do what it should. Don't tolerate +>manufacturers BS!! +> +On this Alex and I are in COMPLETE agreement. + +Ron + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 13:27:04 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E89049FB2A7 + for ; + Tue, 18 Jul 2006 13:27:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 48582-01-6 + for ; + Tue, 18 Jul 2006 13:26:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id D72CF9FB2C9 + for ; + Tue, 18 Jul 2006 10:32:43 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Tue, 18 Jul 2006 15:32:33 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: RAID stripe size question +Date: Tue, 18 Jul 2006 15:34:07 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4C31@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] RAID stripe size question +Thread-Index: AcaqF5fOHF1DUDpsT6uhqF/w3/K+OgAVFNmA +From: "Mikael Carneholm" +To: "Ron Peacetree" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/180 +X-Sequence-Number: 20040 + +> This is a relatively low end HBA with 1 4Gb FC on it. Max sustained +IO on it is going to be ~320MBps. Or ~ enough for an 8 HD RAID 10 set +made of 75MBps ASTR HD's. + +Looking at = +http://h30094.www3.hp.com/product.asp?sku=3D2260908&extended=3D1, +I notice that the controller has a Ultra160 SCSI interface which implies +that the theoretical max throughput is 160Mb/s. Ouch. + +However, what's more important is the seeks/s - ~530/s on a 28 disk +array is quite lousy compared to the 1400/s on a 12 x 15Kdisk array as +mentioned by Mark here: +http://archives.postgresql.org/pgsql-performance/2006-07/msg00170.php. +Could be the disk RPM (10K vs 15K) that makes the difference here... + +I will test another stripe size (128K) for the DATA lun (28 disks) to +see what difference that makes, I think I read somewhere that linux +flushes blocks of 128K at a time, so it might be worth evaluating. + +/Mikael + + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 17:44:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 258629F9F27 + for ; + Tue, 18 Jul 2006 17:44:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04134-07 for + ; + Tue, 18 Jul 2006 17:44:43 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from web55912.mail.re3.yahoo.com (web55912.mail.re3.yahoo.com + [216.252.110.73]) + by postgresql.org (Postfix) with SMTP id E9DD19F95E3 + for ; + Tue, 18 Jul 2006 17:44:41 -0300 (ADT) +Received: (qmail 46377 invoked by uid 60001); 18 Jul 2006 16:02:53 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; + h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=zrCgVZz918rRrgX2TkNCnxN+bSTsJaKGm2nVAJVjEyMkv/s1bTxz7WFH/7OT7ayPMONV9G/AUGP1iwWfl196FPspieEMLkwjiifOVj50GZmxO17ANr0XOGb09YcXRqg6geRZFHjuItKVSFKLjESJA59ZJxlBp/VUD4oJqBoGeTw= + ; +Message-ID: <20060718160253.46375.qmail@web55912.mail.re3.yahoo.com> +Received: from [207.164.182.8] by web55912.mail.re3.yahoo.com via HTTP; + Tue, 18 Jul 2006 12:02:53 EDT +Date: Tue, 18 Jul 2006 12:02:53 -0400 (EDT) +From: Ioana Danes +Subject: Re: Query plan issue when upgrading to postgres 8.14 (from +To: Chris +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44ADBE04.9010605@gmail.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1615721589-1153238573=:32061" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/188 +X-Sequence-Number: 20048 + +--0-1615721589-1153238573=:32061 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hi Chris, + + Here are the results of my query for postgresql 8.0.3 and 8.1.4. For postgresql 8.1.4 there are 2 results, one for test table having the same indexes as in 8.0.3 and the second one for a new index on test table by (testtype,testid) that will speed up my query. This last index will fix my problem for this particular query. + + In the Test table there are 19,494,826 records and 11,090 records have testtype = 1455. The data on both servers is identical. And on both servers I run vacuum analyze prior executing this queries. + + As it can be seen the result in postgresql 8.1.4 is very slow and I am wondering why is that. Bug, missing configuration, ... + + 1. Result on Postgresql 8.0.3: + ------------------------------------- + # explain analyze select max(TESTID) from TEST where TESTTYPE = 1455; + + Aggregate (cost=391.56..391.56 rows=1 width=8) (actual time=94.707..94.711 rows=1 loops=1) + -> Index Scan using ix_test_testtype on test (cost=0.00..355.18 rows=14551 width=8) (actual time=0.036..51.089 rows=11090 loops=1) + Index Cond: (testtype = 1455) + Total runtime: 94.778 ms + (4 rows) + + # select max(TESTID) from TEST where TESTTYPE = 1455; + + max + ---------- + 18527829 + (1 row) + + Time: 13.447 ms + + + 2. Result on Postgresql 8.1.4 (with the same indexes as in 8.0.3): + ------------------------------------------------------------------------------------------ + Result (cost=32.78..32.79 rows=1 width=0) (actual time=1865.406..1865.408 rows=1 loops=1) + InitPlan + -> Limit (cost=0.00..32.78 rows=1 width=8) (actual time=1865.378..1865.381 rows=1 loops=1) + -> Index Scan Backward using pk_testid on test (cost=0.00..464069.25 rows=14155 width=8) (actual time=1865.371..1865.371 rows=1 loops=1) + Filter: ((testid IS NOT NULL) AND (testtype = 1455)) + Total runtime: 1865.522 ms + (6 rows) + + # select max(TESTID) from TEST where TESTTYPE = 1455; + + max + ---------- + 18527829 + + Time: 1858.076 ms + + + 3. Result on Postgresql 8.1.4 (after creating an index by testtype, testid ): + ----------------------------------------------------------------------------------------------------- + # explain analyze select max(TESTID) from TEST where TESTTYPE = 1455; + Result (cost=1.71..1.72 rows=1 width=0) (actual time=0.069..0.070 rows=1 loops=1) + InitPlan + -> Limit (cost=0.00..1.71 rows=1 width=8) (actual time=0.055..0.056 rows=1 loops=1) + -> Index Scan Backward using ix_test2 on test (cost=0.00..24248.92 rows=14155 width=8) (actual time=0.050..0.050 rows=1 loops=1) + Index Cond: (testtype = 1455) + Filter: (testid IS NOT NULL) + Total runtime: 0.159 ms + + # select max(TESTID) from TEST where TESTTYPE = 1455; + + max + ---------- + 18527829 + + Time: 1.029 ms + + + Thank you very much, + Ioana Danes + +Chris wrote: +You've left out the best details. Post an 'explain analyze' from both +versions, and don't cut anything out :) + +I'm guessing postgres is seeing an index on the table is faster because +it doesn't think you have many rows in the table. How many are there, +and have you done an analyze of the table after loading the data in? + +-- +Postgresql & php tutorials +http://www.designmagick.com/ + +---------------------------(end of broadcast)--------------------------- +TIP 2: Don't 'kill -9' the postmaster + + + +--------------------------------- +Now you can have a huge leap forward in email: get the new Yahoo! Mail. +--0-1615721589-1153238573=:32061 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hi Chris,

Here are the results of my query for postgresql 8.0.3 and 8.1.4. For postgresql 8.1.4 there are 2 results, one for test table having the same indexes as in 8.0.3 and the second one for a new index on test table by (testtype,testid) that will speed up my query. This last index will fix my problem for this particular query.

 In the Test table there are 19,494,826 records and 11,090 records have testtype = 1455. The data on both servers is identical. And on both servers I run vacuum analyze prior executing this queries.

As it can be seen the result in postgresql 8.1.4 is very slow and I am wondering why is that. Bug, missing configuration, ...

1. Result on Postgresql 8.0.3:
-------------------------------------
# explain analyze select max(TESTID) from TEST where TESTTYPE = 1455;

 Aggregate  (cost=391.56..391.56 rows=1 width=8) (actual time=94.707..94.711 rows=1 loops=1)
+    ->  Index Scan using ix_test_testtype on test  (cost=0.00..355.18 rows=14551 width=8) (actual time=0.036..51.089 rows=11090 loops=1)
         Index Cond: (testtype = 1455)
 Total runtime: 94.778 ms
(4 rows)

# select max(TESTID) from TEST where TESTTYPE = 1455;

   max
----------
 18527829
(1 row)

Time: 13.447 ms


2. Result on Postgresql 8.1.4 (with the same indexes as in 8.0.3):
------------------------------------------------------------------------------------------
 Result  (cost=32.78..32.79 rows=1 width=0) (actual time=1865.406..1865.408 rows=1 loops=1)
   InitPlan
     ->  Limit  (cost=0.00..32.78 rows=1 width=8) (actual time=1865.378..1865.381 rows=1 loops=1)
           + ->  Index Scan Backward using pk_testid on test  (cost=0.00..464069.25 rows=14155 width=8) (actual time=1865.371..1865.371 rows=1 loops=1)
                 Filter: ((testid IS NOT NULL) AND (testtype = 1455))
 Total runtime: 1865.522 ms
(6 rows)

# select max(TESTID) from TEST where TESTTYPE = 1455;
 
   max
----------
 18527829

Time: 1858.076 ms


3. Result on Postgresql 8.1.4 (after creating an index by testtype, testid ):
-----------------------------------------------------------------------------------------------------
# explain analyze select max(TESTID) from TEST where TESTTYPE = 1455;
 Result  (cost=1.71..1.72 rows=1 width=0) (actual time=0.069..0.070 rows=1 loops=1)
   InitPlan
     + ->  Limit  (cost=0.00..1.71 rows=1 width=8) (actual time=0.055..0.056 rows=1 loops=1)
           ->  Index Scan Backward using ix_test2 on test  (cost=0.00..24248.92 rows=14155 width=8) (actual time=0.050..0.050 rows=1 loops=1)
                 Index Cond: (testtype = 1455)
                 Filter: (testid IS NOT NULL)
 Total runtime: 0.159 ms

# select max(TESTID) from TEST where TESTTYPE = 1455;

   max
----------
 18527829

Time: 1.029 ms


Thank you very much,
Ioana Danes

Chris <dmagick@gmail.com> wrote:

You've left out the best details. Post an 'explain analyze' from both
versions, and don't cut anything out :)

I'm guessing postgres is seeing an index on the table is faster because
it doesn't think you have many rows in the table. How many are there,
and have you done an analyze of the table after loading the data in?

--
Postgresql & php tutorials
http://www.designmagick.com/

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

+


Now you can have a huge leap forward in email: get the new Yahoo! Mail. +--0-1615721589-1153238573=:32061-- + +From pgsql-performance-owner@postgresql.org Tue Jul 18 14:27:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4A89D9F95E3 + for ; + Tue, 18 Jul 2006 14:27:03 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63240-01 for + ; + Tue, 18 Jul 2006 14:26:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.infogears.com (mail.infogears.com [69.51.90.143]) + by postgresql.org (Postfix) with ESMTP id 2BACC9FB1EB + for ; + Tue, 18 Jul 2006 14:12:27 -0300 (ADT) +Received: from mail.infogears.com (localhost.localdomain [127.0.0.1]) + by mail.infogears.com (Postfix) with ESMTP id 81DF2309807B + for ; + Tue, 18 Jul 2006 11:12:25 -0600 (MDT) +Received: from (HELO [69.51.88.30]) () + (smtp-auth username rconover, mechanism plain) + by mail.infogears.com (qpsmtpd/0.31-dev) with ESMTP; + Tue, 18 Jul 2006 11:12:25 -0600 +Mime-Version: 1.0 (Apple Message framework v752.2) +In-Reply-To: +References: <891F88B2-B31D-4217-9CB9-51B23C84D89A@infogears.com> + +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: 7bit +From: Rusty Conover +Subject: Re: Temporary table retains old contents on update eventually causing + slow temp file usage. +Date: Tue, 18 Jul 2006 11:12:23 -0600 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/181 +X-Sequence-Number: 20041 + + +On Jul 18, 2006, at 6:22 AM, Gavin Sherry wrote: + +> On Tue, 18 Jul 2006, Rusty Conover wrote: +> +>> Hi, +>> +>> It would seem that doing any changes on a temp table forces a copy of +>> the entire contents of the table to be retained in memory/disk. Is +>> this happening due to MVCC? Is there a way to change this behavior? +>> It could be very useful when you have really huge temp tables that +>> need to be updated a few times before they can be dropped. +> +> This is caused by our MVCC implementation. It cannot be easily +> changed. We +> rely on MVCC for two things: concurrency and rolling back of aborted +> commands. Without the latter, we couldn't support the following +> trivially: +> +> template1=# create temp table bar (i int); +> CREATE TABLE +> template1=# begin; +> BEGIN +> template1=# insert into bar values(1); +> INSERT 0 1 +> template1=# abort; +> ROLLBACK +> template1=# select * from bar; +> i +> --- +> (0 rows) +> +> It would be nice if we could special case temp tables because of +> the fact +> that concurrency does not come into the equation but I cannot see it +> happening without a generalised overwriting MVCC system. +> +> The only alternative in the mean time is to vacuum your temporary +> table(s) +> as part of your interaction with them. + +I forgot to add in my original post that the temporary tables I'm +dealing with have the "on commit drop" flag, so really persisting +beyond the transaction isn't needed. But I don't think that makes +any difference, because of savepoints' required functionality. + +The problem with vacuuming is that you can't do it by default right +now inside of a transaction. + +Reading vacuum.c though, it leaves the door open: + +/* + * We cannot run VACUUM inside a user transaction block; if we were +inside + * a transaction, then our commit- and start-transaction-command calls + * would not have the intended effect! Furthermore, the forced +commit that + * occurs before truncating the relation's file would have the +effect of + * committing the rest of the user's transaction too, which would + * certainly not be the desired behavior. (This only applies to VACUUM + * FULL, though. We could in theory run lazy VACUUM inside a +transaction + * block, but we choose to disallow that case because we'd rather +commit + * as soon as possible after finishing the vacuum. This is +mainly so that + * we can let go the AccessExclusiveLock that we may be holding.) + * + * ANALYZE (without VACUUM) can run either way. + */ + +Since we're dealing with a temporary table we shouldn't have any +problems with the AccessExclusiveLock. Would lazy vacuuming mark the +pages as free? I assume it wouldn't release them or shrink the size +of the relation, but could they be reused on later updates in that +same transaction? + +Cheers, + +Rusty +-- +Rusty Conover +InfoGears Inc. +Web: http://www.infogears.com + + + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 15:57:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 3141E9F95E3 + for ; + Tue, 18 Jul 2006 15:57:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 57542-10 for + ; + Tue, 18 Jul 2006 18:56:55 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by postgresql.org (Postfix) with ESMTP id 460C19F94F3 + for ; + Tue, 18 Jul 2006 15:56:56 -0300 (ADT) +Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Tue, 18 Jul 2006 14:56:48 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 18 Jul + 2006 14:56:48 -0400 +Received: from 67.103.45.218 ([67.103.45.218]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.108]) with Microsoft Exchange Server HTTP-DAV ; Tue, 18 Jul + 2006 18:56:47 +0000 +User-Agent: Microsoft-Entourage/11.2.5.060620 +Date: Tue, 18 Jul 2006 11:56:45 -0700 +Subject: Re: RAID stripe size question +From: "Luke Lonergan" +To: "Mikael Carneholm" , + "Ron Peacetree" , pgsql-performance@postgresql.org +Message-ID: +Thread-Topic: [PERFORM] RAID stripe size question +Thread-Index: AcaqF5fOHF1DUDpsT6uhqF/w3/K+OgAVFNmAAAv/tqg= +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4C31@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 18 Jul 2006 18:56:48.0475 (UTC) + FILETIME=[EC1F12B0:01C6AA9B] +X-WSS-ID: 68A3F17A2YG5698144-01-01 +Content-Type: multipart/alternative; + boundary=B_3236068606_690732 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/182 +X-Sequence-Number: 20042 + +> This message is in MIME format. Since your mail reader does not understand +this format, some or all of this message may not be legible. + +--B_3236068606_690732 +Content-Type: text/plain; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + +Mikael, + +On 7/18/06 6:34 AM, "Mikael Carneholm" +wrote: + +> However, what's more important is the seeks/s - ~530/s on a 28 disk +> array is quite lousy compared to the 1400/s on a 12 x 15Kdisk array + +I'm getting 2500 seeks/second on a 36 disk SATA software RAID (ZFS, Solaris +10) on a Sun X4500: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Single Stream =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +With a very recent update to the zfs module that improves I/O scheduling an= +d +prefetching, I get the following bonnie++ 1.03a results with a 36 drive +RAID10, Solaris 10 U2 on an X4500 with 500GB Hitachi drives (zfs +checksumming is off): + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +thumperdw-i-1 32G 120453 99 467814 98 290391 58 109371 99 993344 94 +1801 4 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec +%CP + 16 +++++ +++ +++++ +++ +++++ +++ 30850 99 +++++ +++ +++++ ++++ + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Two Streams =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Bumping up the number of concurrent processes to 2, we get about 1.5x speed +reads of RAID10 with a concurrent workload (you have to add the rates +together):=20 + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +thumperdw-i-1 32G 111441 95 212536 54 171798 51 106184 98 719472 88 +1233 2 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec +%CP + 16 26085 90 +++++ +++ 5700 98 21448 97 +++++ +++ 4381 +97 + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +thumperdw-i-1 32G 116355 99 212509 54 171647 50 106112 98 715030 87 +1274 3 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec +%CP + 16 26082 99 +++++ +++ 5588 98 21399 88 +++++ +++ 4272 +97 + +So that=B9s 2500 seeks per second, 1440MB/s sequential block read, 212MB/s pe= +r +character sequential read. +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +- Luke + +--B_3236068606_690732 +Content-Type: text/html; + charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + + + +Re: [PERFORM] RAID stripe size question + + +Mikae= +l,
+
+On 7/18/06 6:34 AM, "Mikael Carneholm" <Mikael.Carneholm@Wirel= +essCar.com> wrote:
+
+> However, what's more important is the seeks/s - = +~530/s on a 28 disk
+> array is quite lousy compared to the 1400/s on a 12 x 15Kdisk array +

+I'm getting 2500 seeks/second on a 36 disk SATA software RAID (ZFS, Solaris= + 10) on a Sun X4500:
+
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Single Stream =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+With a very recent update to the zfs module that improves I/O scheduling an= +d prefetching, I get the following bonnie++ 1.03a results with a 36 drive RA= +ID10, Solaris 10 U2 on an X4500 with 500GB Hitachi drives (zfs checksumming = +is off):
+
+
Versi= +on  1.03       ------Sequential Output---= +---    --Sequential Input-   --Random-
+            &nb= +sp;       -Per Chr-  --Block--  = +;-Rewrite-  -Per Chr-  --Block--  --Seeks--
+Machine        Size K/sec  %CP K/se= +c  %CP K/sec  %CP K/sec  %CP K/sec  %CP /sec %CP
+thumperdw-i-1   32G 120453  99 467814  98 290391  = +58 109371  99 993344  94 1801   4
+            &nb= +sp;       ------Sequential Create------ -= +-------Random Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- -= +Create-- --Read--- -Delete--
+            &nb= +sp; files  /sec %CP  /sec %CP  /sec %CP  /sec %CP &= +nbsp;/sec %CP  /sec %CP
+            &nb= +sp;    16 +++++ +++ +++++ +++ +++++ +++ 30850  99 += +++++ +++ +++++ +++
+

+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Two Streams =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+Bumping up the number of concurrent processes to 2, we get about 1.5x speed= + reads of RAID10 with a concurrent workload (you have to add the rates toget= +her):
+
+
Version  1.03     = +  ------Sequential Output------   --Sequential Input- &n= +bsp;   --Random-
+            &nb= +sp;       -Per Chr- --Block--  -Rewr= +ite-  -Per Chr-  --Block--    --Seeks--
+Machine        Size K/sec  %CP K/se= +c  %CP K/sec  %CP K/sec  %CP K/sec  %CP  /sec %CP +thumperdw-i-1   32G 111441  95 212536  54 171798  = +51 106184  98 719472  88  1233   2
+            &nb= +sp;       ------Sequential Create------ -= +-------Random Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- -= +Create-- --Read--- -Delete--
+            &nb= +sp; files  /sec %CP  /sec %CP  /sec %CP  /sec %CP &= +nbsp;/sec %CP  /sec %CP
+            &nb= +sp;    16 26085  90 +++++ +++  5700  98 2= +1448  97 +++++ +++  4381  97
+
+Version  1.03       ------Sequential Out= +put------   --Sequential Input-     --Random-<= +BR> +            &nb= +sp;       -Per Chr-  --Block--  = +;-Rewrite-  -Per Chr-  --Block--   --Seeks--
+Machine        Size K/sec  %CP K/se= +c  %CP K/sec  %CP K/sec  %CP K/sec  %CP  /sec %CP +thumperdw-i-1   32G 116355  99 212509  54 171647  = +50 106112  98 715030  87  1274   3
+            &nb= +sp;       ------Sequential Create------ -= +-------Random Create--------
+            &nb= +sp;       -Create-- --Read--- -Delete-- -= +Create-- --Read--- -Delete--
+            &nb= +sp; files  /sec %CP  /sec %CP  /sec %CP  /sec %CP &= +nbsp;/sec %CP  /sec %CP
+            &nb= +sp;    16 26082  99 +++++ +++  5588  98 2= +1399  88 +++++ +++  4272  97
+
+
So that’s 2500 seeks pe= +r second, 1440MB/s sequential block read, 212MB/s per character sequential r= +ead.
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+- Luke
+ + + + +--B_3236068606_690732-- + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 16:27:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5E5CF9F95E3 + for ; + Tue, 18 Jul 2006 16:27:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90651-01 for + ; + Tue, 18 Jul 2006 16:27:45 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.190]) + by postgresql.org (Postfix) with ESMTP id 0DD139F94F3 + for ; + Tue, 18 Jul 2006 16:27:44 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id c29so7761nfb + for ; + Tue, 18 Jul 2006 12:27:43 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=QlRTA+Ih57mJwVW7FM5raf+u9fmMxuM6/+5waZFRfKgWJ3PFs8UinYGmU+85qQivW1CRdbHDDJUCEdxALUyLu213Ug3M0Q62LbWKGhegtl4pK7TEr4/YKD3jJ1Cs4XhsJxlFx+p+6kN11f1SwOiNOpZHwuHL3NxZ3ifTzNPvwCg= +Received: by 10.78.177.3 with SMTP id z3mr1715460hue; + Tue, 18 Jul 2006 12:27:42 -0700 (PDT) +Received: by 10.78.140.7 with HTTP; Tue, 18 Jul 2006 12:27:42 -0700 (PDT) +Message-ID: <33c6269f0607181227g7c6eea1av5b8dbd9787bfd1c7@mail.gmail.com> +Date: Tue, 18 Jul 2006 15:27:42 -0400 +From: "Alex Turner" +To: "Luke Lonergan" +Subject: Re: RAID stripe size question +Cc: "Mikael Carneholm" , + "Ron Peacetree" , pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_43597_9259578.1153250862698" +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4C31@sesrv12.wirelesscar.com> + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/183 +X-Sequence-Number: 20043 + +------=_Part_43597_9259578.1153250862698 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +This is a great testament to the fact that very often software RAID will +seriously outperform hardware RAID because the OS guys who implemented it +took the time to do it right, as compared with some controller manufacturers +who seem to think it's okay to provided sub-standard performance. + +Based on the bonnie++ numbers comming back from your array, I would also +encourage you to evaluate software RAID, as you might see significantly +better performance as a result. RAID 10 is also a good candidate as it's +not so heavy on the cache and CPU as RAID 5. + +Alex. + +On 7/18/06, Luke Lonergan wrote: +> +> Mikael, +> +> +> On 7/18/06 6:34 AM, "Mikael Carneholm" +> wrote: +> +> > However, what's more important is the seeks/s - ~530/s on a 28 disk +> > array is quite lousy compared to the 1400/s on a 12 x 15Kdisk array +> +> I'm getting 2500 seeks/second on a 36 disk SATA software RAID (ZFS, +> Solaris 10) on a Sun X4500: +> +> =========== Single Stream ============ +> +> With a very recent update to the zfs module that improves I/O scheduling +> and prefetching, I get the following bonnie++ 1.03a results with a 36 +> drive RAID10, Solaris 10 U2 on an X4500 with 500GB Hitachi drives (zfs +> checksumming is off): +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> thumperdw-i-1 32G 120453 99 467814 98 290391 58 109371 99 993344 94 +> 1801 4 +> +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 +++++ +++ +++++ +++ +++++ +++ 30850 99 +++++ +++ +> +++++ +++ +> +> =========== Two Streams ============ +> +> Bumping up the number of concurrent processes to 2, we get about 1.5xspeed reads of RAID10 with a concurrent workload (you have to add the rates +> together): +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> thumperdw-i-1 32G 111441 95 212536 54 171798 51 106184 98 719472 88 +> 1233 2 +> +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 26085 90 +++++ +++ 5700 98 21448 97 +++++ +++ +> 4381 97 +> +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +> /sec %CP +> thumperdw-i-1 32G 116355 99 212509 54 171647 50 106112 98 715030 87 +> 1274 3 +> +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 26082 99 +++++ +++ 5588 98 21399 88 +++++ +++ +> 4272 97 +> +> So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s +> per character sequential read. +> ======================= +> +> - Luke +> + +------=_Part_43597_9259578.1153250862698 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +This is a great testament to the fact that very often software RAID will seriously outperform hardware RAID because the OS guys who implemented it took the time to do it right, as compared with some controller manufacturers who seem to think it's okay to provided sub-standard performance. +

Based on the bonnie++ numbers comming back from your array, I would also encourage you to evaluate software RAID, as you might see significantly better performance as a result.  RAID 10 is also a good candidate as it's not so heavy on the cache and CPU as RAID 5. +

Alex.

On 7/18/06, Luke Lonergan <llonergan@greenplum.com> wrote:
+
+ + + +
+Mikael,

+
+On 7/18/06 6:34 AM, "Mikael Carneholm" < +Mikael.Carneholm@WirelessCar.com> wrote:
+
+> However, what's more important is the seeks/s - ~530/s on a 28 disk
+> array is quite lousy compared to the 1400/s on a 12 x 15Kdisk array
+

+I'm getting 2500 seeks/second on a 36 disk SATA software RAID (ZFS, Solaris 10) on a Sun X4500:
+
+=========== Single Stream ============
+
+With a very recent update to the zfs module that improves I/O scheduling and prefetching, I get the following bonnie++ 1.03a results with a 36 drive RAID10, Solaris 10 U2 on an X4500 with 500GB Hitachi drives (zfs checksumming is off): +
+
+
Version  1.03       ------Sequential Output------    --Sequential Input-   --Random- +
+                    -Per Chr-  --Block--  -Rewrite-  -Per Chr-  --Block--  --Seeks--
+Machine        Size K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP /sec %CP
+thumperdw-i-1   32G 120453  99 467814  98 290391  58 109371  99 993344  94 1801   4

+                    ------Sequential Create------ --------Random Create--------
+                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
+              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
+                 16 +++++ +++ +++++ +++ +++++ +++ 30850  99 +++++ +++ +++++ +++
+

+=========== Two Streams ============
+
+Bumping up the number of concurrent processes to 2, we get about 1.5x speed reads of RAID10 with a concurrent workload (you have to add the rates together):
+
+
Version  1.03       ------Sequential Output------   --Sequential Input-     --Random-
+                    -Per Chr- --Block--  -Rewrite-  -Per Chr-  --Block--    --Seeks--
+Machine        Size K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP  /sec %CP
+thumperdw-i-1   32G 111441  95 212536  54 171798  51 106184  98 719472  88  1233   2

+                    ------Sequential Create------ --------Random Create--------
+                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
+              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
+                 16 26085  90 +++++ +++  5700  98 21448  97 +++++ +++  4381  97

+
+Version  1.03       ------Sequential Output------   --Sequential Input-     --Random-
+                    -Per Chr-  --Block--  -Rewrite-  -Per Chr-  --Block--   --Seeks--
+Machine        Size K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP  /sec %CP
+thumperdw-i-1   32G 116355  99 212509  54 171647  50 106112  98 715030  87  1274   3

+                    ------Sequential Create------ --------Random Create--------
+                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
+              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
+                 16 26082  99 +++++ +++  5588  98 21399  88 +++++ +++  4272  97
+
+
So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s per character sequential read.
+=======================
+
+- Luke
+
+ + + +

+ +------=_Part_43597_9259578.1153250862698-- + +From pgsql-performance-owner@postgresql.org Tue Jul 18 16:37:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 950C09F95E3 + for ; + Tue, 18 Jul 2006 16:37:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 72600-10 for + ; + Tue, 18 Jul 2006 19:37:36 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id BC08A9F94F3 + for ; + Tue, 18 Jul 2006 16:37:36 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 18 Jul 2006 19:37:27 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 18 Jul 2006 14:37:27 -0500 +Subject: Re: RAID stripe size question +From: Scott Marlowe +To: Alex Turner +Cc: Luke Lonergan , + Mikael Carneholm , + Ron Peacetree , pgsql-performance@postgresql.org +In-Reply-To: <33c6269f0607181227g7c6eea1av5b8dbd9787bfd1c7@mail.gmail.com> +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4C31@sesrv12.wirelesscar.com> + + <33c6269f0607181227g7c6eea1av5b8dbd9787bfd1c7@mail.gmail.com> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1153251447.2744.73.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 18 Jul 2006 14:37:27 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/184 +X-Sequence-Number: 20044 + +On Tue, 2006-07-18 at 14:27, Alex Turner wrote: +> This is a great testament to the fact that very often software RAID +> will seriously outperform hardware RAID because the OS guys who +> implemented it took the time to do it right, as compared with some +> controller manufacturers who seem to think it's okay to provided +> sub-standard performance. +> +> Based on the bonnie++ numbers comming back from your array, I would +> also encourage you to evaluate software RAID, as you might see +> significantly better performance as a result. RAID 10 is also a good +> candidate as it's not so heavy on the cache and CPU as RAID 5. + +Also, consider testing a mix, where your hardware RAID controller does +the mirroring and the OS stripes ((R)AID 0) over the top of it. I've +gotten good performance from mediocre hardware cards doing this. It has +the advantage of still being able to use the battery backed cache and +its instant fsync while not relying on some cards that have issues +layering RAID layers one atop the other. + +From pgsql-performance-owner@postgresql.org Tue Jul 18 16:43:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DA1CA9F95E3 + for ; + Tue, 18 Jul 2006 16:43:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92624-06 for + ; + Tue, 18 Jul 2006 16:43:30 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtpauth04.mail.atl.earthlink.net + (smtpauth04.mail.atl.earthlink.net [209.86.89.64]) + by postgresql.org (Postfix) with ESMTP id 0A37B9F94F3 + for ; + Tue, 18 Jul 2006 16:43:30 -0300 (ADT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; + d=earthlink.net; + b=YAL7F9o9TWNd+zMdBftB8x+Yh6G/aow/hildbnfxeBEYwmKCZuV5+xftABnQuBAh; + h=Message-ID:Date:From:Reply-To:To:Subject:Cc:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Mailer:X-ELNK-Trace:X-Originating-IP; +Received: from [209.86.224.35] (helo=elwamui-huard.atl.sa.earthlink.net) + by smtpauth04.mail.atl.earthlink.net with asmtp (Exim 4.34) + id 1G2vTd-0005jy-NR; Tue, 18 Jul 2006 15:43:29 -0400 +Received: from 71.243.31.238 by webmail.pas.earthlink.net with HTTP; + Tue, 18 Jul 2006 15:43:29 -0400 +Message-ID: + <3595533.1153251809718.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +Date: Tue, 18 Jul 2006 15:43:29 -0400 (GMT-04:00) +From: Ron Peacetree +Reply-To: Ron Peacetree +To: Scott Marlowe +Subject: Re: RAID stripe size question +Cc: PG Performance +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Mailer: EarthLink Zoo Mail 1.0 +X-ELNK-Trace: + acd68a6551193be5d780f4a490ca69563f9fea00a6dd62bcda3217fa91bdf0f81547bf2425c3b174350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c +X-Originating-IP: 209.86.224.35 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/185 +X-Sequence-Number: 20045 + +Have you done any experiments implementing RAID 50 this way (HBA does RAID 5, OS does RAID 0)? If so, what were the results? + +Ron + +-----Original Message----- +>From: Scott Marlowe +>Sent: Jul 18, 2006 3:37 PM +>To: Alex Turner +>Cc: Luke Lonergan , Mikael Carneholm , Ron Peacetree , pgsql-performance@postgresql.org +>Subject: Re: [PERFORM] RAID stripe size question +> +>On Tue, 2006-07-18 at 14:27, Alex Turner wrote: +>> This is a great testament to the fact that very often software RAID +>> will seriously outperform hardware RAID because the OS guys who +>> implemented it took the time to do it right, as compared with some +>> controller manufacturers who seem to think it's okay to provided +>> sub-standard performance. +>> +>> Based on the bonnie++ numbers comming back from your array, I would +>> also encourage you to evaluate software RAID, as you might see +>> significantly better performance as a result. RAID 10 is also a good +>> candidate as it's not so heavy on the cache and CPU as RAID 5. +> +>Also, consider testing a mix, where your hardware RAID controller does +>the mirroring and the OS stripes ((R)AID 0) over the top of it. I've +>gotten good performance from mediocre hardware cards doing this. It has +>the advantage of still being able to use the battery backed cache and +>its instant fsync while not relying on some cards that have issues +>layering RAID layers one atop the other. + + +From pgsql-performance-owner@postgresql.org Tue Jul 18 16:48:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0C6B79F95E3 + for ; + Tue, 18 Jul 2006 16:48:53 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 91716-09 for + ; + Tue, 18 Jul 2006 16:48:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 94A959F94F3 + for ; + Tue, 18 Jul 2006 16:48:47 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Tue, 18 Jul 2006 19:48:46 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 18 Jul 2006 14:48:46 -0500 +Subject: Re: RAID stripe size question +From: Scott Marlowe +To: Ron Peacetree +Cc: PG Performance +In-Reply-To: + <3595533.1153251809718.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +References: + <3595533.1153251809718.JavaMail.root@elwamui-huard.atl.sa.earthlink.net> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1153252126.2744.78.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Tue, 18 Jul 2006 14:48:46 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/186 +X-Sequence-Number: 20046 + +Nope, haven't tried that. At the time I was testing this I didn't even +think of trying it. I'm not even sure I'd heard of RAID 50 at the +time... :) + +I basically had an old MegaRAID 4xx series card in a dual PPro 200 and a +stack of 6 9 gig hard drives. Spare parts. And even though the RAID +1+0 was relatively much faster on this hardware, the Dual P IV 2800 with +a pair of 15k USCSI drives and a much later model MegaRAID at it for +lunch with a single mirror set, and was plenty fast for our use at the +time, so I never really had call to test it in production. + +But it definitely made our test server, the aforementioned PPro200 +machine, more livable. + +On Tue, 2006-07-18 at 14:43, Ron Peacetree wrote: +> Have you done any experiments implementing RAID 50 this way (HBA does RAID 5, OS does RAID 0)? If so, what were the results? +> +> Ron +> +> -----Original Message----- +> >From: Scott Marlowe +> >Sent: Jul 18, 2006 3:37 PM +> >To: Alex Turner +> >Cc: Luke Lonergan , Mikael Carneholm , Ron Peacetree , pgsql-performance@postgresql.org +> >Subject: Re: [PERFORM] RAID stripe size question +> > +> >On Tue, 2006-07-18 at 14:27, Alex Turner wrote: +> >> This is a great testament to the fact that very often software RAID +> >> will seriously outperform hardware RAID because the OS guys who +> >> implemented it took the time to do it right, as compared with some +> >> controller manufacturers who seem to think it's okay to provided +> >> sub-standard performance. +> >> +> >> Based on the bonnie++ numbers comming back from your array, I would +> >> also encourage you to evaluate software RAID, as you might see +> >> significantly better performance as a result. RAID 10 is also a good +> >> candidate as it's not so heavy on the cache and CPU as RAID 5. +> > +> >Also, consider testing a mix, where your hardware RAID controller does +> >the mirroring and the OS stripes ((R)AID 0) over the top of it. I've +> >gotten good performance from mediocre hardware cards doing this. It has +> >the advantage of still being able to use the battery backed cache and +> >its instant fsync while not relying on some cards that have issues +> >layering RAID layers one atop the other. +> + +From pgsql-performance-owner@postgresql.org Tue Jul 18 17:01:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3C9879F95E3 + for ; + Tue, 18 Jul 2006 17:01:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 94805-09 for + ; + Tue, 18 Jul 2006 17:01:33 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from mail.gmx.net (mail.gmx.de [213.165.64.21]) + by postgresql.org (Postfix) with SMTP id 53B569F94F3 + for ; + Tue, 18 Jul 2006 17:01:33 -0300 (ADT) +Received: (qmail invoked by alias); 18 Jul 2006 20:01:28 -0000 +Received: from dslb-084-057-037-077.pools.arcor-ip.net (EHLO ltmku) + [84.57.37.77] + by mail.gmx.net (mp011) with SMTP; 18 Jul 2006 22:01:28 +0200 +X-Authenticated: #23352258 +From: "Milen Kulev" +To: "'Mikael Carneholm'" , + +Subject: Re: RAID stripe size question +Date: Tue, 18 Jul 2006 22:01:27 +0200 +Message-ID: <001a01c6aaa4$f45aaee0$0a00a8c0@trivadis.com> +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 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4BFA@sesrv12.wirelesscar.com> +X-Y-GMX-Trusted: 0 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/187 +X-Sequence-Number: 20047 + +According to = +http://www.pcguide.com/ref/hdd/perf/raid/concepts/perfStripe-c.html, it = +seems to be the other way around? +("As stripe size is decreased, files are broken into smaller and smaller = +pieces. This increases the number of drives +that an average file will use to hold all the blocks containing the data = +of that file,=20 + +->>>>theoretically increasing transfer performance, but decreasing = +positioning performance.") + +Mikael, +In OLTP you utterly need best possible latency. If you decompose the = +response time if you physical request you will +see positioning performance plays the dominant role in the response time = +(ignore for a moment caches and their effects). + +So, if you need really good response times of your SQL queries, choose = +15 rpm disks(and add as much cache as possible +to magnify the effect ;) ) + +Best Regards.=20 +Milen=20 + + +From pgsql-performance-owner@postgresql.org Wed Jul 19 02:40:21 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id E6B7E9FA434 + for ; + Wed, 19 Jul 2006 02:40:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 86809-04 for + ; + Wed, 19 Jul 2006 05:40:12 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 921CF9FA430 + for ; + Wed, 19 Jul 2006 02:40:10 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from ns2.nec.com.au (ns2.nec.com.au [147.76.180.2]) + by svr4.postgresql.org (Postfix) with ESMTP id C2A6C5AF02A + for ; + Wed, 19 Jul 2006 05:40:09 +0000 (GMT) +Received: from smtp1.nec.com.au (unknown [172.31.8.18]) + by ns2.nec.com.au (Postfix) with ESMTP id 45D173B6A2 + for ; + Wed, 19 Jul 2006 15:40:04 +1000 (EST) +Received: from eddy (eddy.ssd.neca.nec.com.au [147.76.48.116]) + by warp.ssd.neca.nec.com.au (8.12.10+Sun/8.12.10) with SMTP id + k6J5e3uP023962; Wed, 19 Jul 2006 15:40:03 +1000 (EST) +Reply-To: +From: "Guoping Zhang" +To: +Cc: "Guoping Zhang (E-mail)" +Subject: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +Date: Wed, 19 Jul 2006 15:40:02 +1000 +Message-ID: <003401c6aaf5$c8c2d900$74304c93@eddy> +MIME-Version: 1.0 +Content-Type: text/plain; + charset="hz-gb-2312" +Content-Transfer-Encoding: 7bit +X-Priority: 3 (Normal) +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.199 tagged_above=0 required=5 tests=BAYES_40, + SPF_SOFTFAIL +X-Spam-Level: * +X-Archive-Number: 200607/189 +X-Sequence-Number: 20049 + +Hello, + +I am seeking advice/comment/experience you may have had for the performance +cost for remote access to postgresql 8.1.X? + +I have two servers, one is Sun V240 (say server A) and the other is dual +intel Xeon (say Server B) and both installed Solaris 10. + +With Server A, there is postgresql 8.1.3 installed with pgpool +(pgpool-3.0.2), with server B, there is a pgpool (v3.0.2) installed. + +The test program is installed on both A and B, where the test application on +server B is accessing to DBMS on A through pgpool. + +Note that the test code is not fancy but can insert a large number of record +(say 100k rows) with configurable transaction size. + +Following are the results (repeated many times with the mean value and shall +be accurate) for various setting by fixed 100k insertion operation with a +transaction size as 100 rows): +------------------------------------------ +1. Test program running on server A directly access to LOCAL postgresql: +24.03 seconds +2. Test progam running on server A access to LOCAL postgresql through +pgpool: 30.05 seconds +3. Test progam running on server A access REMOTE postgresql through local +pgpool: 74.06 seconds +------------------------------------------ +I have to say both machines are very light load and interconnected with +local LAN. + + From 1 and 2, pgpool add 20% overhead, it sounds reasonable but any way to +reduce it??? + + From 2 and 3, it suggests the remote access is much slower than local +access. + +My question is: + a) Anyone has the similar experience? How do you deal with it? + b) Why TCP stack imposes such big delay? any tuning point I shall do? + + +The time call reports + for test 2 is + real 0m32.71s + user 0m2.42s + sys 0m2.65s + + for test 3 is + real 1:14.0 + user 2.5 + sys 3.2 + + c) Obviously, CPU time for (user + sys) for both tests are very similar, +but the overall time is quite different. I assume the time used on TCP stack +makes the difference. + + +Many thanks, +Regards, +Guoping Zhang + + +From pgsql-performance-owner@postgresql.org Wed Jul 19 03:30:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 772FF9FA5C3 + for ; + Wed, 19 Jul 2006 03:30:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75858-07 for + ; + Wed, 19 Jul 2006 03:30:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.ext.bfk.de (mx00.ext.bfk.de [217.29.46.125]) + by postgresql.org (Postfix) with ESMTP id 903EA9FA430 + for ; + Wed, 19 Jul 2006 03:30:22 -0300 (ADT) +Received: from fweimer by bfk.de with local id 1G35ZW-0001gr-3Y; + Wed, 19 Jul 2006 08:30:14 +0200 +To: +Cc: , + "Guoping Zhang (E-mail)" +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +References: <003401c6aaf5$c8c2d900$74304c93@eddy> +From: Florian Weimer +Date: Wed, 19 Jul 2006 08:30:14 +0200 +In-Reply-To: <003401c6aaf5$c8c2d900$74304c93@eddy> (Guoping Zhang's message of + "Wed, 19 Jul 2006 15:40:02 +1000") +Message-ID: <82irlu2jk9.fsf@mid.bfk.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/190 +X-Sequence-Number: 20050 + +* Guoping Zhang: + +> a) Anyone has the similar experience? How do you deal with it? +> b) Why TCP stack imposes such big delay? any tuning point I shall do? + +If you use INSERT, you'll incur a network round-trip delay for each +record. Try using COPY FROM instead, possibly to a temporary table if +you need more complex calculations. If you do this, there won't be a +huge difference between local and remote access as long as the +bandwidth is sufficient. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + +From pgsql-performance-owner@postgresql.org Wed Jul 19 04:33:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id A74DF9FA434 + for ; + Wed, 19 Jul 2006 04:33:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 04943-05 for + ; + Wed, 19 Jul 2006 07:33:39 +0000 (UTC) +X-Greylist: delayed 01:53:29.505065 by SQLgrey- +Received: from ns2.nec.com.au (ns2.nec.com.au [147.76.180.2]) + by postgresql.org (Postfix) with ESMTP id B07A89FA430 + for ; + Wed, 19 Jul 2006 04:33:38 -0300 (ADT) +Received: from smtp1.nec.com.au (unknown [172.31.8.18]) + by ns2.nec.com.au (Postfix) with ESMTP id 6473D3B6AC + for ; + Wed, 19 Jul 2006 17:33:36 +1000 (EST) +Received: from eddy (eddy.ssd.neca.nec.com.au [147.76.48.116]) + by warp.ssd.neca.nec.com.au (8.12.10+Sun/8.12.10) with SMTP id + k6J7XZuP026197; Wed, 19 Jul 2006 17:33:35 +1000 (EST) +Reply-To: +From: "Guoping Zhang" +To: "'Florian Weimer'" +Cc: +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +Date: Wed, 19 Jul 2006 17:33:34 +1000 +Message-ID: <003501c6ab05$a4978f20$74304c93@eddy> +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 CWS, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: <82irlu2jk9.fsf@mid.bfk.de> +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/191 +X-Sequence-Number: 20051 + +Hi, Florian + +Thanks for pointing me the cause, but we simply cannot use the COPY FROM +solution. + +Currently, our application service is running with its own dedicated local +database, IF Feasible, we want to separate the application services out of +database server and run SEVERAL instances of applation serivice on its own +server (one per server), and make them all shall one database server. This +helps to the scalability and also reduce the device cost as only database +server would need mirror/backup/UPS etc. + +Obviously, if there is no better solution, the TCP round trip penalty will +stop us doing so as we do have performance requirement. + +I guess there shall be quite number of people out there facing the similar +problem, right? No alternative solution? + +Regards, +Guoping Zhang + + + + + + +-----Original Message----- +From: Florian Weimer [mailto:fweimer@bfk.de] +Sent: 2006Ae7OA19EO 16:30 +To: guoping.zhang@nec.com.au +Cc: pgsql-performance@postgresql.org; Guoping Zhang (E-mail) +Subject: Re: [PERFORM] Performance penalty for remote access of +postgresql (8.1.3)? any experiance? + + +* Guoping Zhang: + +> a) Anyone has the similar experience? How do you deal with it? +> b) Why TCP stack imposes such big delay? any tuning point I shall do? + +If you use INSERT, you'll incur a network round-trip delay for each +record. Try using COPY FROM instead, possibly to a temporary table if +you need more complex calculations. If you do this, there won't be a +huge difference between local and remote access as long as the +bandwidth is sufficient. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + + +From pgsql-performance-owner@postgresql.org Wed Jul 19 04:38:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 902DF9FA434 + for ; + Wed, 19 Jul 2006 04:38:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82983-03 for + ; + Wed, 19 Jul 2006 04:38:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.ext.bfk.de (mx00.ext.bfk.de [217.29.46.125]) + by postgresql.org (Postfix) with ESMTP id B4E1A9FA430 + for ; + Wed, 19 Jul 2006 04:38:13 -0300 (ADT) +Received: from fweimer by bfk.de with local id 1G36dH-0006D5-08; + Wed, 19 Jul 2006 09:38:11 +0200 +To: +Cc: +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +References: <003501c6ab05$a4978f20$74304c93@eddy> +From: Florian Weimer +Date: Wed, 19 Jul 2006 09:38:10 +0200 +In-Reply-To: <003501c6ab05$a4978f20$74304c93@eddy> (Guoping Zhang's message of + "Wed, 19 Jul 2006 17:33:34 +1000") +Message-ID: <828xmq2gf1.fsf@mid.bfk.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/192 +X-Sequence-Number: 20052 + +* Guoping Zhang: + +> Thanks for pointing me the cause, but we simply cannot use the COPY FROM +> solution. + +Why not? Just do something like this: + +CREATE TEMPORARY TABLE tmp (col1 TEXT NOT NULL, col2 INTEGER NOT NULL); +COPY tmp FROM STDIN; +row1 1 +row2 2 +... +\. +INSERT INTO target SELECT * FROM tmp; + +If you need some kind of SELECT/INSERT/UPDATE cycle, it's far more +complex, of course, and I'm not quite happy with what I'm using right +now. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + +From pgsql-performance-owner@postgresql.org Wed Jul 19 11:01:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 627879FA4A7 + for ; + Wed, 19 Jul 2006 11:01:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 67789-05 for + ; + Wed, 19 Jul 2006 14:01:36 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id E8BF79FA47F + for ; + Wed, 19 Jul 2006 11:01:36 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id C397A5805A; Wed, 19 Jul 2006 09:01:35 -0500 (CDT) +Date: Wed, 19 Jul 2006 10:01:35 -0400 +From: Stephen Frost +To: Guoping Zhang +Cc: 'Florian Weimer' , pgsql-performance@postgresql.org +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +Message-ID: <20060719140135.GE20016@kenobi.snowman.net> +Mail-Followup-To: Guoping Zhang , + 'Florian Weimer' , pgsql-performance@postgresql.org +References: <82irlu2jk9.fsf@mid.bfk.de> <003501c6ab05$a4978f20$74304c93@eddy> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="veXX9dWIonWZEC6h" +Content-Disposition: inline +In-Reply-To: <003501c6ab05$a4978f20$74304c93@eddy> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-2-vserver-686 (i686) +X-Uptime: 09:54:26 up 24 days, 3:50, 17 users, load average: 1.58, 1.43, 1.29 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/193 +X-Sequence-Number: 20053 + + +--veXX9dWIonWZEC6h +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +* Guoping Zhang (guoping.zhang@nec.com.au) wrote: +> Obviously, if there is no better solution, the TCP round trip penalty will +> stop us doing so as we do have performance requirement. + +Actually, can't you stick multiple inserts into a given 'statement'? +ie: insert into abc (123); insert into abc (234); + +I'm not 100% sure if that solves the round-trip issue, but it might.. +Also, it looks like we might have multi-value insert support in 8.2 (I +truely hope so anyway), so you could do something like this: +insert into abc (123),(234); + +> I guess there shall be quite number of people out there facing the similar +> problem, right? No alternative solution? + +Havn't run into it myself... Quite often you either have large inserts +being done using COPY commands (data warehousing and analysis work) or you +have a relatively small number of one-off inserts (OLTP) per transaction. + + Enjoy, + + Stephen + +--veXX9dWIonWZEC6h +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFEvjs/rzgMPqB3kigRAoTfAJ9gz6DbG5CKbADtatBCduayoVDYigCfYeFy +nUjjCrdg4f7x7VcR92eFnJE= +=AYQR +-----END PGP SIGNATURE----- + +--veXX9dWIonWZEC6h-- + +From pgsql-performance-owner@postgresql.org Wed Jul 19 11:18:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 74DEE9FA65C + for ; + Wed, 19 Jul 2006 11:18:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 71592-03-2 + for ; + Wed, 19 Jul 2006 14:18:08 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.ext.bfk.de (mx00.ext.bfk.de [217.29.46.125]) + by postgresql.org (Postfix) with ESMTP id 02A6F9FA621 + for ; + Wed, 19 Jul 2006 11:18:07 -0300 (ADT) +Received: from fweimer by bfk.de with local id 1G3CsF-0006eR-Mq; + Wed, 19 Jul 2006 16:18:03 +0200 +To: Guoping Zhang +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +References: <82irlu2jk9.fsf@mid.bfk.de> <003501c6ab05$a4978f20$74304c93@eddy> + <20060719140135.GE20016@kenobi.snowman.net> +From: Florian Weimer +Date: Wed, 19 Jul 2006 16:18:03 +0200 +In-Reply-To: <20060719140135.GE20016@kenobi.snowman.net> (Stephen Frost's + message of "Wed, 19 Jul 2006 10:01:35 -0400") +Message-ID: <82bqrl1xwk.fsf@mid.bfk.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/194 +X-Sequence-Number: 20054 + +* Stephen Frost: + +> Actually, can't you stick multiple inserts into a given 'statement'? +> ie: insert into abc (123); insert into abc (234); + +IIRC, this breaks with PQexecParams, which is the recommended method +for executing SQL statements nowadays. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + +From pgsql-performance-owner@postgresql.org Wed Jul 19 11:26:57 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9DDA59FA47F + for ; + Wed, 19 Jul 2006 11:26:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 12459-03 for + ; + Wed, 19 Jul 2006 11:26:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from kenobi.snowman.net (kenobi.snowman.net [70.84.9.186]) + by postgresql.org (Postfix) with ESMTP id D5BD99FA4A8 + for ; + Wed, 19 Jul 2006 11:26:44 -0300 (ADT) +Received: by kenobi.snowman.net (Postfix, from userid 1000) + id AAEA75805A; Wed, 19 Jul 2006 09:26:43 -0500 (CDT) +Date: Wed, 19 Jul 2006 10:26:43 -0400 +From: Stephen Frost +To: Florian Weimer +Cc: Guoping Zhang , pgsql-performance@postgresql.org +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +Message-ID: <20060719142643.GF20016@kenobi.snowman.net> +Mail-Followup-To: Florian Weimer , + Guoping Zhang , + pgsql-performance@postgresql.org +References: <82irlu2jk9.fsf@mid.bfk.de> <003501c6ab05$a4978f20$74304c93@eddy> + <20060719140135.GE20016@kenobi.snowman.net> + <82bqrl1xwk.fsf@mid.bfk.de> +MIME-Version: 1.0 +Content-Type: multipart/signed; micalg=pgp-sha1; + protocol="application/pgp-signature"; boundary="+JUInw4efm7IfTNU" +Content-Disposition: inline +In-Reply-To: <82bqrl1xwk.fsf@mid.bfk.de> +X-Editor: Vim http://www.vim.org/ +X-Info: http://www.snowman.net +X-Operating-System: Linux/2.6.16-2-vserver-686 (i686) +X-Uptime: 10:22:34 up 24 days, 4:18, 18 users, load average: 0.50, 0.69, 0.88 +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/195 +X-Sequence-Number: 20055 + + +--+JUInw4efm7IfTNU +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +Content-Transfer-Encoding: quoted-printable + +* Florian Weimer (fweimer@bfk.de) wrote: +> * Stephen Frost: +> > Actually, can't you stick multiple inserts into a given 'statement'? +> > ie: insert into abc (123); insert into abc (234); +>=20 +> IIRC, this breaks with PQexecParams, which is the recommended method +> for executing SQL statements nowadays. + +For prepared queries you're absolutely correct. It's also true that +it's the recommended approach for large numbers of inserts. If the +network delay is more of a problem than the processing speed then it +might make sense. + +It does seem to me that with multi-value insert we might consider +changes to libpq to be able to use multi-value prepared inserts... Or +it might be interesting to see the performance of non-prepared +multi-value inserts vs. prepared statements. + + Thanks, + + Stephen + +--+JUInw4efm7IfTNU +Content-Type: application/pgp-signature; name="signature.asc" +Content-Description: Digital signature +Content-Disposition: inline + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.3 (GNU/Linux) + +iD8DBQFEvkEjrzgMPqB3kigRAjGJAJ4ikvFz2X6ik80r5ttSxhiHSsDc5ACcCmC4 +mrVwDmIQffWIQ56GXK9Fmt4= +=1DrR +-----END PGP SIGNATURE----- + +--+JUInw4efm7IfTNU-- + +From pgsql-performance-owner@postgresql.org Wed Jul 19 11:42:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6D9BB9FA4A7 + for ; + Wed, 19 Jul 2006 11:42:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 14803-04 for + ; + Wed, 19 Jul 2006 11:41:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.pub.collaborativefusion.com + (mx00.pub.collaborativefusion.com [206.210.89.199]) + by postgresql.org (Postfix) with ESMTP id AE51D9FA47F + for ; + Wed, 19 Jul 2006 11:41:52 -0300 (ADT) +Received: from collaborativefusion.com (mx01.pub.collaborativefusion.com + [206.210.89.201]) (TLS: TLSv1/SSLv3,256bits,AES256-SHA) + by wingspan with esmtp; Wed, 19 Jul 2006 10:41:50 -0400 + id 00056420.44BE44AE.0000929E +Received: from Internal Mail-Server (206.210.89.202) by mx01 (envelope-from + wmoran@collaborativefusion.com) + with AES256-SHA encrypted SMTP; 19 Jul 2006 10:40:10 -0400 +Date: Wed, 19 Jul 2006 10:41:49 -0400 +From: Bill Moran +To: guoping.zhang@nec.com.au +Cc: pgsql-performance@postgresql.org +Subject: Re: Performance penalty for remote access of postgresql +Message-Id: <20060719104149.784d00e1.wmoran@collaborativefusion.com> +In-Reply-To: <003501c6ab05$a4978f20$74304c93@eddy> +References: <82irlu2jk9.fsf@mid.bfk.de> <003501c6ab05$a4978f20$74304c93@eddy> +Organization: Collaborative Fusion +X-Mailer: Sylpheed version 2.2.6 (GTK+ 2.8.20; i386-portbld-freebsd6.1) +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/196 +X-Sequence-Number: 20056 + +In response to "Guoping Zhang" : +> +> Thanks for pointing me the cause, but we simply cannot use the COPY FROM +> solution. +> +> Currently, our application service is running with its own dedicated local +> database, IF Feasible, we want to separate the application services out of +> database server and run SEVERAL instances of applation serivice on its own +> server (one per server), and make them all shall one database server. This +> helps to the scalability and also reduce the device cost as only database +> server would need mirror/backup/UPS etc. +> +> Obviously, if there is no better solution, the TCP round trip penalty will +> stop us doing so as we do have performance requirement. +> +> I guess there shall be quite number of people out there facing the similar +> problem, right? No alternative solution? + +I suppose I'm a little confused on two points: +1) What did you expect. +2) What is your network? + +On #1: networking adds overhead. Period. Always. I believe you earlier +said you estimated around %20 perf hit. For small transactions, I wouldn't +expect much better. TCP adds a good bit of header to each packet, plus +the time in the kernel, and the RTT. 20% sounds about average to me. + +#2 falls into a number of different categories. For example: +a) What is your topology? If you absolutely need blazing speed, you should + have a dedicated gigabit switched network between the machines. +b) Not all network hardware is created equal. Cheap switches seldom + perform at their advertised speed. Stick with high-end stuff. NICs + are the same way. +On #2, you'll want to ensure that the problem is not in the hardware before +you start complaining about PostgreSQL, or even TCP. If you've got a cheap, +laggy switch, not amount of TCP or PostgreSQL tuning is going to overcome +it. + +Hope some of this is helpful. + +-- +Bill Moran +Collaborative Fusion Inc. + +From pgsql-performance-owner@postgresql.org Wed Jul 19 12:49:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AC5909FA666 + for ; + Wed, 19 Jul 2006 12:49:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30754-04 for + ; + Wed, 19 Jul 2006 12:49:18 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from joeconway.com (wsip-68-15-9-201.sd.sd.cox.net [68.15.9.201]) + by postgresql.org (Postfix) with ESMTP id 8B1859FA47F + for ; + Wed, 19 Jul 2006 12:49:18 -0300 (ADT) +Received: from [206.190.70.130] (account jconway HELO [172.16.1.115]) + by joeconway.com (CommuniGate Pro SMTP 4.1.8) + with ESMTP-TLS id 4055890; Wed, 19 Jul 2006 08:49:17 -0700 +Message-ID: <44BE547D.1000602@joeconway.com> +Date: Wed, 19 Jul 2006 08:49:17 -0700 +From: Joe Conway +User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; + rv:1.7.13) Gecko/20060501 Fedora/1.7.13-1.1.fc5 +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Stephen Frost +CC: Guoping Zhang , + 'Florian Weimer' , pgsql-performance@postgresql.org +Subject: Re: Performance penalty for remote access of postgresql +References: <82irlu2jk9.fsf@mid.bfk.de> <003501c6ab05$a4978f20$74304c93@eddy> + <20060719140135.GE20016@kenobi.snowman.net> +In-Reply-To: <20060719140135.GE20016@kenobi.snowman.net> +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/197 +X-Sequence-Number: 20057 + +Stephen Frost wrote: +> * Guoping Zhang (guoping.zhang@nec.com.au) wrote: +> +>>Obviously, if there is no better solution, the TCP round trip penalty will +>>stop us doing so as we do have performance requirement. +> +> Actually, can't you stick multiple inserts into a given 'statement'? +> ie: insert into abc (123); insert into abc (234); +> +> I'm not 100% sure if that solves the round-trip issue, but it might.. +> Also, it looks like we might have multi-value insert support in 8.2 (I +> truely hope so anyway), so you could do something like this: +> insert into abc (123),(234); + +Yeah, see my post from last night on PATCHES. Something like "insert +into abc (123); insert into abc (234); ..." actually seems to work +pretty well as long as you don't drive the machine into swapping. If +you're doing a very large number of INSERTs, break it up into bite-sized +chunks and you should be fine. + +Joe + +From pgsql-performance-owner@postgresql.org Thu Jul 20 03:33:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 345299FA5CD + for ; + Thu, 20 Jul 2006 03:33:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41233-05 for + ; + Thu, 20 Jul 2006 03:32:53 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from ns2.nec.com.au (ns2.nec.com.au [147.76.180.2]) + by postgresql.org (Postfix) with ESMTP id B6BA29FA502 + for ; + Thu, 20 Jul 2006 03:32:52 -0300 (ADT) +Received: from smtp1.nec.com.au (unknown [172.31.8.18]) + by ns2.nec.com.au (Postfix) with ESMTP id A78F73B6A2 + for ; + Thu, 20 Jul 2006 16:32:48 +1000 (EST) +Received: from eddy (eddy.ssd.neca.nec.com.au [147.76.48.116]) + by warp.ssd.neca.nec.com.au (8.12.10+Sun/8.12.10) with SMTP id + k6K6WkuP012461; Thu, 20 Jul 2006 16:32:47 +1000 (EST) +Reply-To: +From: "Guoping Zhang" +To: "'Florian Weimer'" +Cc: +Subject: Re: Performance penalty for remote access of postgresql (8.1.3)? any + experiance? +Date: Thu, 20 Jul 2006 16:32:45 +1000 +Message-ID: <003d01c6abc6$5039aff0$74304c93@eddy> +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 CWS, Build 9.0.2416 (9.0.2911.0) +In-Reply-To: <82bqrl1xwk.fsf@mid.bfk.de> +Importance: Normal +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/198 +X-Sequence-Number: 20058 + +Thanks for all the replies from different ppl. + +As you pointed out, each INSERT/UPDATE operation will result in a TCP +round-trip delay for postgresql (may well true for all DBMS), this is the +big problem to challenge our requirements, as extensively modify the +(legacy) applicatioin is not a preferable choice. + +I measured the round-trip (UDP) delay as below: + +a) SERVER A to SERVER B: 0.35ms + SERVER A to itself (Local host): 0.022ms + +That is, in the tests I did yesterday, it is about 100k insert operations, +which means added around 35 seconds of delay..... + +b) Also, using Iperf shows that + TCP bandwidth between Server A and B is about 92.3 Mbits/sec + TCP bandwidth between two ports at same Server A can reach 10.9Gbits/sec + +That indicates the performance impact for the networking.... + +There might be parameter in Solaris to tune the 'ack response delay', but I +didn't try now. + +Thanks for all the answers... + +Regards, +Guoping Zhang + + + +-----Original Message----- +From: Florian Weimer [mailto:fweimer@bfk.de] +Sent: 2006Ae7OA20EO 0:18 +To: Guoping Zhang +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Performance penalty for remote access of +postgresql (8.1.3)? any experiance? + + +* Stephen Frost: + +> Actually, can't you stick multiple inserts into a given 'statement'? +> ie: insert into abc (123); insert into abc (234); + +IIRC, this breaks with PQexecParams, which is the recommended method +for executing SQL statements nowadays. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + + +From pgsql-performance-owner@postgresql.org Thu Jul 20 16:55:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 089979FB47C + for ; + Thu, 20 Jul 2006 16:54:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 21260-01-4 + for ; + Thu, 20 Jul 2006 19:54:42 +0000 (UTC) +X-Greylist: delayed 00:30:02.395199 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 635659FB224 + for ; + Thu, 20 Jul 2006 11:26:13 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from skunk.mtbrook.bozemanpass.com (unknown [69.145.82.195]) + by svr4.postgresql.org (Postfix) with ESMTP id 3D4B15AF042 + for ; + Thu, 20 Jul 2006 13:55:43 +0000 (GMT) +Received: from [69.145.82.254] (unknown [69.145.82.254]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by skunk.mtbrook.bozemanpass.com (Postfix) with ESMTP id CEE9C738006 + for ; + Thu, 20 Jul 2006 06:55:06 -0700 (PDT) +Message-ID: <44BF8B32.8020507@boreham.org> +Date: Thu, 20 Jul 2006 07:54:58 -0600 +From: David Boreham +User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Performance penalty for remote access of postgresql +References: <003d01c6abc6$5039aff0$74304c93@eddy> +In-Reply-To: <003d01c6abc6$5039aff0$74304c93@eddy> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Archive-Number: 200607/199 +X-Sequence-Number: 20059 + +Guoping Zhang wrote: + +> +>a) SERVER A to SERVER B: 0.35ms +> SERVER A to itself (Local host): 0.022ms +> +> +> +0.35ms seems rather slow. You might try investigating what's in the path. +For comparison, between two machines here (three GigE switches in the +path), I see 0.10ms RTT. Between two machines on the same switch I +get 0.08ms. + + + + + +From pgsql-performance-owner@postgresql.org Thu Jul 20 16:55:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id E63FA9FB4B3; + Thu, 20 Jul 2006 16:54:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 21673-01-4; Thu, 20 Jul 2006 19:54:54 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 65C039FB564; + Thu, 20 Jul 2006 16:02:00 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6KJ1wAw008670; + Thu, 20 Jul 2006 15:01:59 -0400 (EDT) +To: Tatsuo Ishii +cc: Robert.Lor@Sun.COM, pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <20060713.180234.45872055.t-ishii@sraoss.co.jp> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> +Comments: In-reply-to Tatsuo Ishii + message dated "Thu, 13 Jul 2006 18:02:34 +0900" +Date: Thu, 20 Jul 2006 15:01:58 -0400 +Message-ID: <8669.1153422118@sss.pgh.pa.us> +From: Tom Lane +X-Archive-Number: 200607/200 +X-Sequence-Number: 20060 + +Tatsuo Ishii writes: +>>> 18% in s_lock is definitely bad :-(. Were you able to determine which +>>> LWLock(s) are accounting for the contention? + +> Sorry for the delay. Finally I got the oprofile data. It's +> huge(34MB). If you are interested, I can put somewhere. Please let me +> know. + +I finally got a chance to look at this, and it seems clear that all the +traffic is on the BufMappingLock. This is essentially the same problem +we were discussing with respect to Gavin Hamill's report of poor +performance on an 8-way IBM PPC64 box (see hackers archives around +2006-04-21). If your database is fully cached in shared buffers, then +you can do a whole lot of buffer accesses per unit time, and even though +all the BufMappingLock acquisitions are in shared-LWLock mode, the +LWLock's spinlock ends up being heavily contended on an SMP box. + +It's likely that CVS HEAD would show somewhat better performance because +of the btree change to cache local copies of index metapages (which +eliminates a fair fraction of buffer accesses, at least in Gavin's test +case). Getting much further than that seems to require partitioning +the buffer mapping table. The last discussion stalled on my concerns +about unpredictable shared memory usage, but I have some ideas on that +which I'll post separately. In the meantime, thanks for sending along +the oprofile data! + + regards, tom lane + +From pgsql-bugs-owner@postgresql.org Fri Jul 21 12:27:30 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 0E5819FA42F + for ; + Fri, 21 Jul 2006 04:41:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 52081-02 for ; + Fri, 21 Jul 2006 07:41:04 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org + [65.19.161.25]) by postgresql.org (Postfix) with ESMTP id 289329FA425 + for ; Fri, 21 Jul 2006 04:41:03 -0300 (ADT) +Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org + [65.19.161.25]) + by wwwmaster.postgresql.org (8.13.3/8.13.3) with ESMTP id + k6L7f2h9074358 + for ; Fri, 21 Jul 2006 07:41:02 GMT + (envelope-from www@wwwmaster.postgresql.org) +Received: (from www@localhost) + by wwwmaster.postgresql.org (8.13.3/8.13.3/Submit) id k6L7f2VL074357; + Fri, 21 Jul 2006 07:41:02 GMT (envelope-from www) +Date: Fri, 21 Jul 2006 07:41:02 GMT +Message-Id: <200607210741.k6L7f2VL074357@wwwmaster.postgresql.org> +To: pgsql-bugs@postgresql.org +Subject: BUG #2543: Performance delay acrros the same day +From: "Alaa El Gohary" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.2 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE +X-Spam-Level: +X-Archive-Number: 200607/94 +X-Sequence-Number: 15439 + + +The following bug has been logged online: + +Bug reference: 2543 +Logged by: Alaa El Gohary +Email address: alaaelgohary@bftech.com.eg +PostgreSQL version: 7.4.12 +Operating system: FreeBSD 6.0 +Description: Performance delay acrros the same day +Details: + +A query on the postgresql DB takes about 5 seconds and then it starts to +take more time till it reaches about 60 seconds by the end of the same day. +I tried vacuum but nothing changed the only thing that works is to dump the +DB ,drop and create a new one with the dump taken. +i need to know if there is any way to restore the performance back without +the need for drop and create +cause i can't do this accross the day + +From pgsql-performance-owner@postgresql.org Fri Jul 21 04:57:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 72CA69FA4A8; + Fri, 21 Jul 2006 04:57:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 55856-01; Fri, 21 Jul 2006 07:57:31 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by postgresql.org (Postfix) with ESMTP id 2BD709FA47F; + Fri, 21 Jul 2006 04:57:30 -0300 (ADT) +Received: from d1-sfbay-01.sun.com ([192.18.39.111]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6L7vULr011825; + Fri, 21 Jul 2006 00:57:30 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-01.sun.com by d1-sfbay-01.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J2Q00C01TY7BM00@d1-sfbay-01.sun.com> + (original mail from Robert.Lor@Sun.COM); + Fri, 21 Jul 2006 00:57:29 -0700 (PDT) +Received: from [129.150.12.121] by d1-sfbay-01.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + with ESMTPSA id <0J2Q00BUMU3T8610@d1-sfbay-01.sun.com>; Fri, + 21 Jul 2006 00:57:29 -0700 (PDT) +Date: Fri, 21 Jul 2006 00:56:56 -0700 +From: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <8669.1153422118@sss.pgh.pa.us> +To: Tom Lane +Cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Message-id: <44C088C8.9050303@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, + hits=0.001 tagged_above=0 required=5 tests=UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/201 +X-Sequence-Number: 20061 + +Tom Lane wrote: + +>Tatsuo Ishii writes: +> +> +>>>>18% in s_lock is definitely bad :-(. Were you able to determine which +>>>>LWLock(s) are accounting for the contention? +>>>> +>>>> +> +> +> +>>Sorry for the delay. Finally I got the oprofile data. It's +>>huge(34MB). If you are interested, I can put somewhere. Please let me +>>know. +>> +>> +> +>I finally got a chance to look at this, and it seems clear that all the +>traffic is on the BufMappingLock. This is essentially the same problem +>we were discussing with respect to Gavin Hamill's report of poor +>performance on an 8-way IBM PPC64 box (see hackers archives around +>2006-04-21). If your database is fully cached in shared buffers, then +>you can do a whole lot of buffer accesses per unit time, and even though +>all the BufMappingLock acquisitions are in shared-LWLock mode, the +>LWLock's spinlock ends up being heavily contended on an SMP box. +> +>It's likely that CVS HEAD would show somewhat better performance because +>of the btree change to cache local copies of index metapages (which +>eliminates a fair fraction of buffer accesses, at least in Gavin's test +>case). Getting much further than that seems to require partitioning +>the buffer mapping table. The last discussion stalled on my concerns +>about unpredictable shared memory usage, but I have some ideas on that +>which I'll post separately. In the meantime, thanks for sending along +>the oprofile data! +> +> regards, tom lane +> +> +I ran pgbench and fired up a DTrace script using the lwlock probes we've +added, and it looks like BufMappingLock is the most contended lock, but +CheckpointStartLocks are held for longer duration! + + Lock Id Mode Count + ControlFileLock Exclusive 1 + SubtransControlLock Exclusive 1 + BgWriterCommLock Exclusive 6 + FreeSpaceLock Exclusive 6 + FirstLockMgrLock Exclusive 48 + BufFreelistLock Exclusive 74 + BufMappingLock Exclusive 74 + CLogControlLock Exclusive 184 + XidGenLock Exclusive 184 + CheckpointStartLock Shared 185 + WALWriteLock Exclusive 185 + ProcArrayLock Exclusive 368 + CLogControlLock Shared 552 + SubtransControlLock Shared 1273 + WALInsertLock Exclusive 1476 + XidGenLock Shared 1842 + ProcArrayLock Shared 3160 + SInvalLock Shared 3684 + BufMappingLock Shared 14578 + + Lock Id Combined Time (ns) + ControlFileLock 7915 + BgWriterCommLock 43438 + FreeSpaceLock 111139 + BufFreelistLock 448530 + FirstLockMgrLock 2879957 + CLogControlLock 4237750 + SubtransControlLock 6378042 + XidGenLock 9500422 + WALInsertLock 16372040 + SInvalLock 23284554 + ProcArrayLock 32188638 + BufMappingLock 113128512 + WALWriteLock 142391501 + CheckpointStartLock 4171106665 + + +Regards, +-Robert + + + +From pgsql-performance-owner@postgresql.org Fri Jul 21 07:40:48 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 7768A9FA42F + for ; + Fri, 21 Jul 2006 07:40:47 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 99421-03 for + ; + Fri, 21 Jul 2006 10:40:39 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id BD5909FA418 + for ; + Fri, 21 Jul 2006 07:40:38 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from smtp2.smtp.bt.com (smtp2.smtp.bt.com [217.32.164.150]) + by svr4.postgresql.org (Postfix) with ESMTP id 84F5B5AFB38 + for ; + Fri, 21 Jul 2006 10:40:37 +0000 (GMT) +Received: from i2kc06-ukbr.domain1.systemhost.net ([193.113.197.70]) by + smtp2.smtp.bt.com with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 21 Jul 2006 11:40:34 +0100 +Received: from E03MVZ3-UKDY.domain1.systemhost.net ([193.113.30.64]) by + i2kc06-ukbr.domain1.systemhost.net with Microsoft + SMTPSVC(6.0.3790.211); Fri, 21 Jul 2006 11:40:34 +0100 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----_=_NextPart_001_01C6ACB2.188884E7" +Subject: Forcing using index instead of sequential scan? +Date: Fri, 21 Jul 2006 11:40:33 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: Forcing using index instead of sequential scan? +Thread-Index: Acasshg1Jzyd9TFcQZKDTj2TSv52mQ== +From: +To: +X-OriginalArrivalTime: 21 Jul 2006 10:40:34.0457 (UTC) + FILETIME=[18A9B890:01C6ACB2] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.551 tagged_above=0 required=5 tests=HTML_MESSAGE, + NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200607/202 +X-Sequence-Number: 20062 + +This is a multi-part message in MIME format. + +------_=_NextPart_001_01C6ACB2.188884E7 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +I have been testing the performance of PostgreSQL using the simple tool +found at http://benchw.sourceforge.net however I have found that all the +queries it run execute with sequential scans. The website where the code +runs has examples of the execution plan using indexes. + +When I disable the sequential plan query 0 and query 1 run faster ( +http://benchw.sourceforge.net/benchw_results_postgres_history.html ) by +using the indexes as suggested by the website. + +I have tried increasing the effective_cache_size and reducing the +random_page_cost to try and force the optimiser to use the index but it +always uses the sequential scan. + +What is the best way to force the use of indexes in these queries? +Currently testing with version 8.1.4. + +Regards + +Robin Smith + +British Telecommunications plc Registered office: 81 Newgate Street +London EC1A 7AJ + +Registered in England no. 1800000 + +This electronic message contains information from British +Telecommunications plc which may be privileged and confidential. The +information is intended to be for the use of the individual(s) or entity +named above. If you are not the intended recipient, be aware that any +disclosure, copying, distribution or use of the contents of this +information is prohibited. If you have received this electronic message +in error, please notify us by telephone or e-mail (to the number or +address above) immediately. + + + +------_=_NextPart_001_01C6ACB2.188884E7 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + + + + + + +Forcing using index instead of sequential scan? + + + + +

I have been testing the performance of = +PostgreSQL using the simple tool found at http://benchw.sourceforge.net however I have found that all the queries it = +run execute with sequential scans. The website where the code runs has = +examples of the execution plan using indexes.

+ +

When I disable the sequential plan = +query 0 and query 1 run faster ( http://benchw.sourceforge.net/benchw_results_postgres_hist= +ory.html ) by using the = +indexes as suggested by the website.

+ +

I have tried increasing the = +effective_cache_size and reducing the random_page_cost to try and force = +the optimiser to use the index but it always uses the sequential = +scan.

+ +

What is the best way to force the use = +of indexes in these queries? Currently testing with version = +8.1.4. +

+ +

Regards +

+ +

Robin Smith +

+ +

British Telecommunications = +plc     Registered office: 81 Newgate Street London = +EC1A 7AJ +

+ +

Registered in England no. = +1800000 +

+ +

This electronic message contains = +information from British Telecommunications plc which may be privileged = +and confidential. The information is intended to be for the use of the = +individual(s) or entity named above. If you are not the intended = +recipient, be aware that any disclosure, copying, distribution or use of = +the contents of this information is prohibited. If you have received = +this electronic message in error, please notify us by telephone or = +e-mail (to the number or address above) immediately.

+
+ + + +------_=_NextPart_001_01C6ACB2.188884E7-- + +From pgsql-performance-owner@postgresql.org Fri Jul 21 09:16:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 700289FA4A8 + for ; + Fri, 21 Jul 2006 09:16:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 50918-07 for + ; + Fri, 21 Jul 2006 09:15:57 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from mail.gmx.net (mail.gmx.de [213.165.64.21]) + by postgresql.org (Postfix) with SMTP id 361899FA60C + for ; + Fri, 21 Jul 2006 08:45:45 -0300 (ADT) +Received: (qmail invoked by alias); 21 Jul 2006 11:45:43 -0000 +Received: from dslb-084-063-100-008.pools.arcor-ip.net (EHLO colt.pezone.net) + [84.63.100.8] + by mail.gmx.net (mp023) with SMTP; 21 Jul 2006 13:45:43 +0200 +X-Authenticated: #495269 +From: Peter Eisentraut +To: pgsql-performance@postgresql.org +Subject: Re: Forcing using index instead of sequential scan? +Date: Fri, 21 Jul 2006 13:45:41 +0200 +User-Agent: KMail/1.9.1 +Cc: robin.c.smith@bt.com +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: <200607211345.41573.peter_e@gmx.net> +X-Y-GMX-Trusted: 0 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.134 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/205 +X-Sequence-Number: 20065 + +robin.c.smith@bt.com wrote: +> What is the best way to force the use of indexes in these queries? + +Well, the brute-force method is to use SET enable_seqscan TO off, but if +you want to get to the bottom of this, you should look at or post the +EXPLAIN ANALYZE output of the offending queries. + +-- +Peter Eisentraut +http://developer.postgresql.org/~petere/ + +From pgsql-performance-owner@postgresql.org Fri Jul 21 09:02:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 53A989FA6B2 + for ; + Fri, 21 Jul 2006 09:02:17 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 49555-10 for + ; + Fri, 21 Jul 2006 09:02:13 -0300 (ADT) +X-Greylist: delayed 01:21:34.968083 by SQLgrey- +Received: from smtp5.smtp.bt.com (smtp5.smtp.bt.com [217.32.164.139]) + by postgresql.org (Postfix) with ESMTP id 055FD9FA50D + for ; + Fri, 21 Jul 2006 09:02:12 -0300 (ADT) +Received: from i2kc08-ukbr.domain1.systemhost.net ([193.113.197.71]) by + smtp5.smtp.bt.com with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 21 Jul 2006 13:02:08 +0100 +Received: from E03MVZ3-UKDY.domain1.systemhost.net ([193.113.30.64]) by + i2kc08-ukbr.domain1.systemhost.net with Microsoft + SMTPSVC(6.0.3790.211); Fri, 21 Jul 2006 13:02:07 +0100 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Forcing using index instead of sequential scan? +Date: Fri, 21 Jul 2006 13:02:06 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Forcing using index instead of sequential scan? +Thread-Index: AcasuzOOLvVHp5RXS9y3qHkd84X9pwAAPVRQ +From: +To: +X-OriginalArrivalTime: 21 Jul 2006 12:02:07.0687 (UTC) + FILETIME=[7D415D70:01C6ACBD] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.004 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, + NO_REAL_NAME +X-Spam-Level: *** +X-Archive-Number: 200607/203 +X-Sequence-Number: 20063 + +More information from the query:- + +explain analyze +SELECT + d0.dmth, + count(f.fval ) +FROM + dim0 AS d0, + fact0 AS f +WHERE d0.d0key =3D f.d0key +AND d0.ddate BETWEEN '2010-01-01' AND '2010-12-28' +GROUP BY + d0.dmth +; + + QUERY PLAN + +------------------------------------------------------------------------ +------------------------------------------------------------- + HashAggregate (cost=3D336998.83..336998.84 rows=3D1 width=3D8) (actual +time=3D33823.124..33823.134 rows=3D12 loops=3D1) + -> Hash Join (cost=3D214.83..335343.83 rows=3D331000 width=3D8) = +(actual +time=3D61.065..33605.343 rows=3D336000 loops=3D1) + Hash Cond: ("outer".d0key =3D "inner".d0key) + -> Seq Scan on fact0 f (cost=3D0.00..281819.00 = +rows=3D10000000 +width=3D8) (actual time=3D12.766..28945.036 rows=3D10000000 loops=3D1) + -> Hash (cost=3D214.00..214.00 rows=3D331 width=3D8) (actual +time=3D31.120..31.120 rows=3D336 loops=3D1) + -> Seq Scan on dim0 d0 (cost=3D0.00..214.00 rows=3D331 +width=3D8) (actual time=3D26.362..30.895 rows=3D336 loops=3D1) + Filter: ((ddate >=3D '2010-01-01'::date) AND (ddate +<=3D '2010-12-28'::date)) + Total runtime: 33823.220 ms +(8 rows) + + +benchw=3D# \d fact0 + Table "public.fact0" + Column | Type | Modifiers +--------+------------------------+----------- + d0key | integer | not null + d1key | integer | not null + d2key | integer | not null + fval | integer | not null + ffill | character varying(100) | not null +Indexes: + "fact0_d0key" btree (d0key) + "fact0_d1key" btree (d1key) + "fact0_d2key" btree (d2key) + +benchw=3D# \d dim0 + Table "public.dim0" + Column | Type | Modifiers +--------+---------+----------- + d0key | integer | not null + ddate | date | not null + dyr | integer | not null + dmth | integer | not null + dday | integer | not null +Indexes: + "dim0_d0key" UNIQUE, btree (d0key) + +The example on the web site has the following execution plan:- + + QUERY PLAN + +------------------------------------------------------------------------ +-------------------- + HashAggregate (cost=3D286953.94..286953.94 rows=3D1 width=3D8) + -> Nested Loop (cost=3D0.00..285268.93 rows=3D337002 width=3D8) + -> Seq Scan on dim0 d0 (cost=3D0.00..219.00 rows=3D337 = +width=3D8) + Filter: ((ddate >=3D '2010-01-01'::date) AND (ddate <=3D +'2010-12-28'::date)) + -> Index Scan using fact0_d0key on fact0 f = +(cost=3D0.00..833.07 +rows=3D1022 width=3D8) + Index Cond: ("outer".d0key =3D f.d0key) + +It uses the index on the join condition. + +When I disable the sequential scan with:- + +SET enable_seqscan TO off; + +The execution plan looks like:- + + QUERY +PLAN =20 +------------------------------------------------------------------------ +---------------------------------------------------------------- + HashAggregate (cost=3D648831.52..648831.53 rows=3D1 width=3D8) (actual +time=3D19155.060..19155.071 rows=3D12 loops=3D1) + -> Nested Loop (cost=3D7.51..647176.52 rows=3D331000 width=3D8) = +(actual +time=3D97.878..18943.155 rows=3D336000 loops=3D1) + -> Index Scan using dim0_d0key on dim0 d0 = +(cost=3D0.00..248.00 +rows=3D331 width=3D8) (actual time=3D40.467..55.780 rows=3D336 = +loops=3D1) + Filter: ((ddate >=3D '2010-01-01'::date) AND (ddate <=3D +'2010-12-28'::date)) + -> Bitmap Heap Scan on fact0 f (cost=3D7.51..1941.94 = +rows=3D1002 +width=3D8) (actual time=3D0.991..55.391 rows=3D1000 loops=3D336) + Recheck Cond: ("outer".d0key =3D f.d0key) + -> Bitmap Index Scan on fact0_d0key (cost=3D0.00..7.51 +rows=3D1002 width=3D0) (actual time=3D0.583..0.583 rows=3D1000 = +loops=3D336) + Index Cond: ("outer".d0key =3D f.d0key) + Total runtime: 19155.176 ms +(9 rows) + +The query is 19 seconds long now; down from 34 seconds although the +execution plan doesn't match the example from the website. + +Regards + +Robin +-----Original Message----- +From: Peter Eisentraut [mailto:peter_e@gmx.net]=20 +Sent: 21 July 2006 12:46 +To: pgsql-performance@postgresql.org +Cc: Smith,R,Robin,XJE4JA C +Subject: Re: [PERFORM] Forcing using index instead of sequential scan? + + +robin.c.smith@bt.com wrote: +> What is the best way to force the use of indexes in these queries? + +Well, the brute-force method is to use SET enable_seqscan TO off, but if + +you want to get to the bottom of this, you should look at or post the=20 +EXPLAIN ANALYZE output of the offending queries. + +--=20 +Peter Eisentraut +http://developer.postgresql.org/~petere/ + +From pgsql-performance-owner@postgresql.org Fri Jul 21 09:10:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id EAF099FA6B2 + for ; + Fri, 21 Jul 2006 09:10:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 23095-05 for + ; + Fri, 21 Jul 2006 12:10:32 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from smtp4.smtp.bt.com (smtp4.smtp.bt.com [217.32.164.151]) + by postgresql.org (Postfix) with ESMTP id 7D0CA9FA50D + for ; + Fri, 21 Jul 2006 09:10:32 -0300 (ADT) +Received: from i2kc06-ukbr.domain1.systemhost.net ([193.113.197.70]) by + smtp4.smtp.bt.com with Microsoft SMTPSVC(6.0.3790.1830); + Fri, 21 Jul 2006 13:10:31 +0100 +Received: from E03MVZ3-UKDY.domain1.systemhost.net ([193.113.30.64]) by + i2kc06-ukbr.domain1.systemhost.net with Microsoft + SMTPSVC(6.0.3790.211); Fri, 21 Jul 2006 13:10:30 +0100 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +Subject: Re: Forcing using index instead of sequential scan? +Date: Fri, 21 Jul 2006 13:10:29 +0100 +Message-ID: + +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Forcing using index instead of sequential scan? +Thread-Index: AcasvFvX/JodJIWrRyWNp1PvHCXgEwAAfzfQ +From: +To: +X-OriginalArrivalTime: 21 Jul 2006 12:10:30.0742 (UTC) + FILETIME=[A9197760:01C6ACBE] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.004 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, + NO_REAL_NAME +X-Spam-Level: *** +X-Archive-Number: 200607/204 +X-Sequence-Number: 20064 + +The tables have all been analysed. + +I set the work_mem to 500000 and it still doesn't use the index :-( + +Regards + +Robin + +-----Original Message----- +From: Richard Huxton [mailto:dev@archonet.com]=20 +Sent: 21 July 2006 12:54 +To: Smith,R,Robin,XJE4JA C +Subject: Re: [PERFORM] Forcing using index instead of sequential scan? + + +robin.c.smith@bt.com wrote: +> I have been testing the performance of PostgreSQL using the simple=20 +> tool found at http://benchw.sourceforge.net however I have found that=20 +> all the queries it run execute with sequential scans. The website=20 +> where the code runs has examples of the execution plan using indexes. +>=20 +> When I disable the sequential plan query 0 and query 1 run faster (=20 +> http://benchw.sourceforge.net/benchw_results_postgres_history.html )=20 +> by using the indexes as suggested by the website. +>=20 +> I have tried increasing the effective_cache_size and reducing the=20 +> random_page_cost to try and force the optimiser to use the index but=20 +> it always uses the sequential scan. +>=20 +> What is the best way to force the use of indexes in these queries?=20 +> Currently testing with version 8.1.4. + +Well, you don't want to be forcing it if possible. Ideally, PG should be + +able to figure out what to use itself. + +In the case of query0 and query1 as shown on your web-page I'd expect a=20 +sequential scan of dim0 then access via the index on fact0. Reasons why=20 +this might not be happening include: +1. Inaccurate stats - ANALYSE your tables +2. Insufficient memory for sorting etc - issue SET work_mem=3DXXX before = + +the query and try increased values. +3. Other parameters are out-of-whack. For example, effective_cache_size=20 +doesn't change how much cache PG uses, it tells PG how much the O.S.=20 +will cache. You might find http://www.powerpostgresql.com/PerfList is a=20 +good quick introduction. + + +So - ANALYSE your tables +http://www.postgresql.org/docs/8.1/static/sql-analyze.html + +Then post EXPLAIN ANALYSE for the queries and we'll see what they're +doing. +--=20 + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Fri Jul 21 10:35:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E88819FA6AF + for ; + Fri, 21 Jul 2006 10:35:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 56822-05 for + ; + Fri, 21 Jul 2006 10:35:34 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) + by postgresql.org (Postfix) with ESMTP id 7AB709FAA6E + for ; + Fri, 21 Jul 2006 10:35:34 -0300 (ADT) +Received: by ug-out-1314.google.com with SMTP id m3so1273876ugc + for ; + Fri, 21 Jul 2006 06:35:32 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; + b=OiCtLXIq+kbOE2w31qP21Obx8Rm1h372w6r/hE8ELvh5ZoBGuCeYBqiJDqRxejMT6bHsxb9xwOB+//c9crEc9gXCAw2yZ8Yrkgx3VomztDhVGFkk/4hCe2gtvpCGwRFy2W6hJcD1Hb2TtIDagJQ4BLc99h2Ap7tssv31WNFDhfs= +Received: by 10.67.19.13 with SMTP id w13mr712513ugi; + Fri, 21 Jul 2006 06:35:32 -0700 (PDT) +Received: from ?192.168.0.2? ( [213.184.244.182]) + by mx.gmail.com with ESMTP id j3sm913649ugd.2006.07.21.06.35.29; + Fri, 21 Jul 2006 06:35:30 -0700 (PDT) +Message-ID: <44C0D822.60604@gmail.com> +Date: Fri, 21 Jul 2006 16:35:30 +0300 +From: "Petronenko D.S." +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: postgres benchmarks +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.199 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/206 +X-Sequence-Number: 20066 + +Hello, + +does anybody use OSDB benchmarks for postgres? +if not, which kind of bechmarks are used for postgres? + +Thanks, +Denis. + +From pgsql-performance-owner@postgresql.org Fri Jul 21 10:42:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 8C9A49FA50D; + Fri, 21 Jul 2006 10:42:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 42004-10; Fri, 21 Jul 2006 13:42:47 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id C95FC9FA4A8; + Fri, 21 Jul 2006 10:42:47 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6LDgjGA021890; + Fri, 21 Jul 2006 09:42:46 -0400 (EDT) +To: Robert Lor +cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <44C088C8.9050303@sun.com> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> +Comments: In-reply-to Robert Lor + message dated "Fri, 21 Jul 2006 00:56:56 -0700" +Date: Fri, 21 Jul 2006 09:42:45 -0400 +Message-ID: <21889.1153489365@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/207 +X-Sequence-Number: 20067 + +Robert Lor writes: +> I ran pgbench and fired up a DTrace script using the lwlock probes we've +> added, and it looks like BufMappingLock is the most contended lock, but +> CheckpointStartLocks are held for longer duration! + +Those numbers look a bit suspicious --- I'd expect to see some of the +LWLocks being taken in both shared and exclusive modes, but you don't +show any such cases. You sure your script is counting correctly? +Also, it'd be interesting to count time spent holding shared lock +separately from time spent holding exclusive. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 21 10:57:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id E2EEF9FA47F; + Fri, 21 Jul 2006 10:57:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 48046-01; Fri, 21 Jul 2006 13:56:57 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) + by postgresql.org (Postfix) with ESMTP id 61A159FA42F; + Fri, 21 Jul 2006 10:56:57 -0300 (ADT) +Received: by noel.decibel.org (Postfix, from userid 1001) + id A77CA56442; Fri, 21 Jul 2006 08:56:55 -0500 (CDT) +Received: (hashcash-sendmail, from uid 1001); Fri, 21 Jul 2006 08:56:53 -0500 +Date: Fri, 21 Jul 2006 08:56:53 -0500 +From: "Jim C. Nasby" +To: Robert Lor +Cc: Tom Lane , Tatsuo Ishii , + pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +Message-ID: <20060721135653.GC83250@pervasive.com> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44C088C8.9050303@sun.com> +X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 +X-Distributed: Join the Effort! http://www.distributed.net +User-Agent: Mutt/1.5.11 +X-Hashcash: + 1:20:060721:robert.lor@sun.com::RmmqtR1/hadFr7x6:0000000000000000000 + 0000000000000000000000006SsD +X-Hashcash: + 1:20:060721:tgl@sss.pgh.pa.us::yiT5BXP2TxNu6GHX:00000000000000000000 + 0000000000000000000000001zdk +X-Hashcash: + 1:20:060721:ishii@sraoss.co.jp::ENpbCfbgvkycw+dt:0000000000000000000 + 0000000000000000000000001G2y +X-Hashcash: + 1:20:060721:pgsql-hackers@postgresql.org::qeFxjM7zcA9+Okgh:000000000 + 0000000000000000000000003tHY +X-Hashcash: + 1:20:060721:pgsql-performance@postgresql.org::mDDPQyhP/oQ4bhwD:00000 + 0000000000000000000000003A8O +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/208 +X-Sequence-Number: 20068 + +On Fri, Jul 21, 2006 at 12:56:56AM -0700, Robert Lor wrote: +> I ran pgbench and fired up a DTrace script using the lwlock probes we've +> added, and it looks like BufMappingLock is the most contended lock, but +> CheckpointStartLocks are held for longer duration! + +Not terribly surprising given that that lock can generate a substantial +amount of IO (though looking at the numbers, you might want to make +bgwriter more aggressive). Also, that's a shared lock, so it won't have +nearly the impact that BufMappingLock does. + +> Lock Id Mode Count +> ControlFileLock Exclusive 1 +> SubtransControlLock Exclusive 1 +> BgWriterCommLock Exclusive 6 +> FreeSpaceLock Exclusive 6 +> FirstLockMgrLock Exclusive 48 +> BufFreelistLock Exclusive 74 +> BufMappingLock Exclusive 74 +> CLogControlLock Exclusive 184 +> XidGenLock Exclusive 184 +> CheckpointStartLock Shared 185 +> WALWriteLock Exclusive 185 +> ProcArrayLock Exclusive 368 +> CLogControlLock Shared 552 +> SubtransControlLock Shared 1273 +> WALInsertLock Exclusive 1476 +> XidGenLock Shared 1842 +> ProcArrayLock Shared 3160 +> SInvalLock Shared 3684 +> BufMappingLock Shared 14578 +> +> Lock Id Combined Time (ns) +> ControlFileLock 7915 +> BgWriterCommLock 43438 +> FreeSpaceLock 111139 +> BufFreelistLock 448530 +> FirstLockMgrLock 2879957 +> CLogControlLock 4237750 +> SubtransControlLock 6378042 +> XidGenLock 9500422 +> WALInsertLock 16372040 +> SInvalLock 23284554 +> ProcArrayLock 32188638 +> BufMappingLock 113128512 +> WALWriteLock 142391501 +> CheckpointStartLock 4171106665 +> +> +> Regards, +> -Robert +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org +> + +-- +Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com +Pervasive Software http://pervasive.com work: 512-231-6117 +vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 + +From pgsql-performance-owner@postgresql.org Fri Jul 21 12:00:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DBA5C9FA6B5; + Fri, 21 Jul 2006 12:00:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 63880-09; Fri, 21 Jul 2006 11:59:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 22E6F9FA50D; + Fri, 21 Jul 2006 11:59:54 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id B05711C98B; + Fri, 21 Jul 2006 16:59:53 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 31910-03-11; Fri, 21 Jul 2006 16:59:52 +0200 (CEST) +Received: from [192.168.2.140] (andes.core.aeccom.com [192.168.2.140]) + by mail.aeccom.com (Postfix) with ESMTP id B471E1C885; + Fri, 21 Jul 2006 16:59:52 +0200 (CEST) +Message-ID: <44C0EBE5.8010508@aeccom.com> +Date: Fri, 21 Jul 2006 16:59:49 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: Tom Lane +CC: Robert Lor , Tatsuo Ishii , + pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: [HACKERS] Sun Donated a Sun Fire T2000 to the PostgreSQL +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> +In-Reply-To: <21889.1153489365@sss.pgh.pa.us> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/209 +X-Sequence-Number: 20069 + +Hi, + +Tom Lane schrieb: +> Robert Lor writes: +>> I ran pgbench and fired up a DTrace script using the lwlock probes we've +>> added, and it looks like BufMappingLock is the most contended lock, but +>> CheckpointStartLocks are held for longer duration! +> +> Those numbers look a bit suspicious --- I'd expect to see some of the +> LWLocks being taken in both shared and exclusive modes, but you don't +> show any such cases. You sure your script is counting correctly? +> Also, it'd be interesting to count time spent holding shared lock +> separately from time spent holding exclusive. + +Is there a test case which shows the contention for this full cached +tables? It would be nice to have measurable numbers like context +switches and queries per second. + +Sven. + +From pgsql-performance-owner@postgresql.org Fri Jul 21 12:12:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5A1029FA6B0; + Fri, 21 Jul 2006 12:12:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66389-02; Fri, 21 Jul 2006 12:12:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by postgresql.org (Postfix) with ESMTP id DDF3A9FA50D; + Fri, 21 Jul 2006 12:12:33 -0300 (ADT) +Received: from d1-sfbay-10.sun.com ([192.18.39.120]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6LFCW5v005094; + Fri, 21 Jul 2006 08:12:32 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-10.sun.com by d1-sfbay-10.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J2R00L01E789G00@d1-sfbay-10.sun.com> + (original mail from Robert.Lor@Sun.COM); + Fri, 21 Jul 2006 08:12:32 -0700 (PDT) +Received: from [129.150.12.121] by d1-sfbay-10.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + with ESMTPSA id <0J2R00A0BE8V5670@d1-sfbay-10.sun.com>; Fri, + 21 Jul 2006 08:12:32 -0700 (PDT) +Date: Fri, 21 Jul 2006 08:11:58 -0700 +From: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <21889.1153489365@sss.pgh.pa.us> +To: Tom Lane +Cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Message-id: <44C0EEBE.3030707@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=us-ascii +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.787 tagged_above=0 required=5 tests=AWL, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/210 +X-Sequence-Number: 20070 + +Tom Lane wrote: + +>Those numbers look a bit suspicious --- I'd expect to see some of the +>LWLocks being taken in both shared and exclusive modes, but you don't +>show any such cases. You sure your script is counting correctly? +> +> +I'll double check to make sure no stupid mistakes were made! + +>Also, it'd be interesting to count time spent holding shared lock +>separately from time spent holding exclusive. +> +> +Will provide that data later today. + +Regards, +-Robert + + +From pgsql-performance-owner@postgresql.org Fri Jul 21 15:46:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6C6519FA4A8 + for ; + Fri, 21 Jul 2006 15:46:24 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05555-10 for + ; + Fri, 21 Jul 2006 15:46:15 -0300 (ADT) +X-Greylist: delayed 00:30:38.973785 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 6C8A59FA68D + for ; + Fri, 21 Jul 2006 15:46:14 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from stormtide.ca (stormtide.ca [69.61.78.222]) + by svr4.postgresql.org (Postfix) with ESMTP id 0D7B65AF06C + for ; + Fri, 21 Jul 2006 18:15:34 +0000 (GMT) +Received: by stormtide.ca (Postfix, from userid 55) + id 61274B9506; Fri, 21 Jul 2006 12:15:31 -0600 (MDT) +Received: from kdesktop (S010600131042729b.ed.shawcable.net [68.148.109.102]) + by stormtide.ca (Postfix) with ESMTP id F11B4B80AC + for ; + Fri, 21 Jul 2006 12:15:24 -0600 (MDT) +Message-ID: <003b01c6acf1$a66d8910$0701a8c0@kdesktop> +From: "Kevin McArthur" +To: +Subject: Bad Planner Statistics for Uneven distribution. +Date: Fri, 21 Jul 2006 12:15:28 -0600 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0038_01C6ACBF.5A5F3DC0" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2670 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=HTML_50_60, + HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200607/212 +X-Sequence-Number: 20072 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0038_01C6ACBF.5A5F3DC0 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +I discussed this with a few members of #postgresql freenode this = +morning. I'll keep it breif; [note: i have cleaned out columns not = +relevant] + +I have two tables, brands and models_brands. The first has about 300 = +records, the later about 350,000 records. The number of distinct brands = +in the models_brands table is < 10. + + + +=3D# \d models_brands + Table "public.models_brands" + Column | Type | Modifiers +--------+-----------------------+----------- + model | integer | not null + brand | integer | not null +Indexes: + "models_brands_brand" btree (brand) +Foreign-key constraints: + "models_brands_brand_fkey" FOREIGN KEY (brand) REFERENCES = +brands(brand_id) ON UPDATE CASCADE ON DELETE CASCADE + "models_brands_model_fkey" FOREIGN KEY (model) REFERENCES = +models(model_id) ON UPDATE CASCADE ON DELETE CASCADE + +a=3D# \d brands; + Table "public.brands" + Column | Type | Modifiers +------------+------------------------+-----------------------------------= +------------------------ + brand_id | integer | not null default = +nextval('brands_brand_id_seq'::regclass) + brand_name | character varying(255) | not null +Indexes: + "brands_pkey" PRIMARY KEY, btree (brand_id) + + +Now the plans/problems.. + +=3D# set enable_seqscan to on; +SET +=3D# explain analyze select distinct brand from models_brands; + QUERY PLAN +-------------------------------------------------------------------------= +---------------------------------------------------------- + Unique (cost=3D46300.70..48148.15 rows=3D4 width=3D4) (actual = +time=3D3699.691..6215.216 rows=3D4 loops=3D1) + -> Sort (cost=3D46300.70..47224.43 rows=3D369489 width=3D4) (actual = +time=3D3699.681..5027.069 rows=3D369489 loops=3D1) + Sort Key: brand + -> Seq Scan on models_brands (cost=3D0.00..6411.89 = +rows=3D369489 width=3D4) (actual time=3D0.040..1352.997 rows=3D369489 = +loops=3D1) + Total runtime: 6223.666 ms +(5 rows) + +=3D# set enable_seqscan to off; +SET +=3D# explain analyze select distinct brand from models_brands; + = +QUERY PLAN +-------------------------------------------------------------------------= +-------------------------------------------------------------------------= +--------- + Unique (cost=3D0.00..863160.68 rows=3D4 width=3D4) (actual = +time=3D0.131..2584.779 rows=3D4 loops=3D1) + -> Index Scan using models_brands_brand on models_brands = +(cost=3D0.00..862236.96 rows=3D369489 width=3D4) (actual = +time=3D0.122..1440.809 rows=3D369489 loops=3D1) + Total runtime: 2584.871 ms +(3 rows) + + +Picks the wrong plan here. Should pick the index with seqscanning = +enabled. + + +More (as a different wording/query)... (as suggested by others on irc) + + +=3D# set enable_seqscan to on; +SET +=3D# explain analyze select brand_id from brands where exists (select 1 = +from models_brands where brand =3D brands.brand_id); + QUERY PLAN +-------------------------------------------------------------------------= +--------------------------------------------------- + Seq Scan on brands (cost=3D0.00..30.09 rows=3D152 width=3D4) (actual = +time=3D7742.460..62567.543 rows=3D4 loops=3D1) + Filter: (subplan) + SubPlan + -> Seq Scan on models_brands (cost=3D0.00..7335.61 rows=3D92372 = +width=3D0) (actual time=3D206.467..206.467 rows=3D0 loops=3D303) + Filter: (brand =3D $0) + Total runtime: 62567.626 ms + +a=3D# set enable_seqscan to off; +SET +=3D# explain analyze select brand_id from brands where exists (select 1 = +from models_brands where brand =3D brands.brand_id); + = +QUERY PLAN +-------------------------------------------------------------------------= +-------------------------------------------------------------------------= +---- + Seq Scan on brands (cost=3D100000000.00..100000715.90 rows=3D152 = +width=3D4) (actual time=3D0.615..3.710 rows=3D4 loops=3D1) + Filter: (subplan) + SubPlan + -> Index Scan using models_brands_brand on models_brands = +(cost=3D0.00..216410.97 rows=3D92372 width=3D0) (actual = +time=3D0.008..0.008 rows=3D0 loops=3D303) + Index Cond: (brand =3D $0) + Total runtime: 3.790 ms + + +It was also tried to similar results with a LIMIT 1 in the subquery for = +exist. + +More... + +Seqscan still off.. + + +=3D# explain analyze select distinct brand_id from brands inner join = +models_brands on (brand_id =3D brand); + = + QUERY PLAN = + =20 +-------------------------------------------------------------------------= +-------------------------------------------------------------------------= +--------------- + Unique (cost=3D0.00..867782.58 rows=3D303 width=3D4) (actual = +time=3D0.391..4898.579 rows=3D4 loops=3D1) + -> Merge Join (cost=3D0.00..866858.85 rows=3D369489 width=3D4) = +(actual time=3D0.383..3749.771 rows=3D369489 loops=3D1) + Merge Cond: ("outer".brand_id =3D "inner".brand) + -> Index Scan using brands_pkey on brands (cost=3D0.00..15.53 = +rows=3D303 width=3D4) (actual time=3D0.080..0.299 rows=3D60 loops=3D1) + -> Index Scan using models_brands_brand on models_brands = +(cost=3D0.00..862236.96 rows=3D369489 width=3D4) (actual = +time=3D0.013..1403.175 rows=3D369489 loops=3D1) + Total runtime: 4898.697 ms + +=3D# set enable_seqscan to on; +SET +=3D# explain analyze select distinct brand_id from brands inner join = +models_brands on (brand_id =3D brand); + QUERY = +PLAN +-------------------------------------------------------------------------= +---------------------------------------------------------------- + Unique (cost=3D46300.70..52770.04 rows=3D303 width=3D4) (actual = +time=3D3742.046..8560.833 rows=3D4 loops=3D1) + -> Merge Join (cost=3D46300.70..51846.32 rows=3D369489 width=3D4) = +(actual time=3D3742.035..7406.677 rows=3D369489 loops=3D1) + Merge Cond: ("outer".brand_id =3D "inner".brand) + -> Index Scan using brands_pkey on brands (cost=3D0.00..15.53 = +rows=3D303 width=3D4) (actual time=3D0.077..0.407 rows=3D60 loops=3D1) + -> Sort (cost=3D46300.70..47224.43 rows=3D369489 width=3D4) = +(actual time=3D3741.584..5051.348 rows=3D369489 loops=3D1) + Sort Key: models_brands.brand + -> Seq Scan on models_brands (cost=3D0.00..6411.89 = +rows=3D369489 width=3D4) (actual time=3D0.027..1346.178 rows=3D369489 = +loops=3D1) + Total runtime: 8589.502 ms +(8 rows) + + +Hope that helps + +Kevin McArthur + + + + + + + + + +------=_NextPart_000_0038_01C6ACBF.5A5F3DC0 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
I discussed this with a few members of = +#postgresql=20 +freenode this morning. I'll keep it breif; [note: i have cleaned out = +columns not=20 +relevant]
+
 
+
I have two tables, brands and = +models_brands. The=20 +first has about 300 records, the later about 350,000 records. The number = +of=20 +distinct brands in the models_brands table is < 10.
+
 
+
 
+
 
+
=3D# \d=20 +models_brands
        Table=20 +"public.models_brands"
 Column=20 +|        =20 +Type          |=20 +Modifiers
--------+-----------------------+-----------
 model&= +nbsp; |=20 +integer           = +   =20 +| not null
 brand  |=20 +integer           = +   =20 +| not null
Indexes:
    "models_brands_brand" btree = + +(brand)
Foreign-key constraints:
   =20 +"models_brands_brand_fkey" FOREIGN KEY (brand) REFERENCES = +brands(brand_id) ON=20 +UPDATE CASCADE ON DELETE CASCADE
   =20 +"models_brands_model_fkey" FOREIGN KEY (model) REFERENCES = +models(model_id) ON=20 +UPDATE CASCADE ON DELETE CASCADE
+
 
+
a=3D# \d=20 +brands;
          &n= +bsp;           &nb= +sp;           &nbs= +p;  =20 +Table "public.brands"
   Column  =20 +|         =20 +Type         =20 +|            = +             = + +Modifiers
------------+------------------------+----------------------= +-------------------------------------
 brand_id  =20 +|=20 +integer           = +    =20 +| not null default = +nextval('brands_brand_id_seq'::regclass)
 brand_name=20 +| character varying(255) | not null
Indexes:
   =20 +"brands_pkey" PRIMARY KEY, btree (brand_id)
+
 
+
Now the plans/problems..
+
 
+
=3D# set enable_seqscan to = +on;
SET
=3D# explain=20 +analyze select distinct brand from=20 +models_brands;
         &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;            = +; =20 +QUERY=20 +PLAN
-----------------------------------------------------------------= +------------------------------------------------------------------
&nb= +sp;Unique =20 +(cost=3D46300.70..48148.15 rows=3D4 width=3D4) (actual = +time=3D3699.691..6215.216 rows=3D4=20 +loops=3D1)
   ->  Sort  = +(cost=3D46300.70..47224.43=20 +rows=3D369489 width=3D4) (actual time=3D3699.681..5027.069 rows=3D369489 = + +loops=3D1)
         Sort Key: = + +brand
         ->  = +Seq Scan=20 +on models_brands  (cost=3D0.00..6411.89 rows=3D369489 width=3D4) = +(actual=20 +time=3D0.040..1352.997 rows=3D369489 loops=3D1)
 Total runtime: = +6223.666=20 +ms
(5 rows)
+
 
+
=3D# set enable_seqscan to = +off;
SET
=3D# explain=20 +analyze select distinct brand from=20 +models_brands;
         &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;            = +;            = + =20 +QUERY=20 +PLAN
-----------------------------------------------------------------= +-------------------------------------------------------------------------= +-----------------
 Unique =20 +(cost=3D0.00..863160.68 rows=3D4 width=3D4) (actual = +time=3D0.131..2584.779 rows=3D4=20 +loops=3D1)
   ->  Index Scan using = +models_brands_brand on=20 +models_brands  (cost=3D0.00..862236.96 rows=3D369489 width=3D4) = +(actual=20 +time=3D0.122..1440.809 rows=3D369489 loops=3D1)
 Total runtime: = +2584.871=20 +ms
(3 rows)
+
 
+
 
+
Picks the wrong plan here. Should pick = +the index=20 +with seqscanning enabled.
+
 
+
 
+
More (as a different wording/query)... = +(as=20 +suggested by others on irc)
+
 
+
 
+
=3D# set enable_seqscan to = +on;
SET
=3D# explain=20 +analyze select brand_id from brands where exists (select 1 from = +models_brands=20 +where brand =3D=20 +brands.brand_id);
        &nbs= +p;            = +;            = +            &= +nbsp;          =20 +QUERY=20 +PLAN
-----------------------------------------------------------------= +-----------------------------------------------------------
 Seq = + +Scan on brands  (cost=3D0.00..30.09 rows=3D152 width=3D4) (actual=20 +time=3D7742.460..62567.543 rows=3D4 loops=3D1)
   Filter:=20 +(subplan)
   SubPlan
     = +->  Seq=20 +Scan on models_brands  (cost=3D0.00..7335.61 rows=3D92372 = +width=3D0) (actual=20 +time=3D206.467..206.467 rows=3D0=20 +loops=3D303)
         &nb= +sp;=20 +Filter: (brand =3D $0)
 Total runtime: 62567.626 ms
+
 
+
a=3D# set enable_seqscan to = +off;
SET
+
=3D# explain analyze select brand_id = +from brands=20 +where exists (select 1 from models_brands where brand =3D=20 +brands.brand_id);
        &nbs= +p;            = +;            = +            &= +nbsp;           &n= +bsp;           =20 +QUERY=20 +PLAN
-----------------------------------------------------------------= +-------------------------------------------------------------------------= +------------
 Seq=20 +Scan on brands  (cost=3D100000000.00..100000715.90 rows=3D152 = +width=3D4) (actual=20 +time=3D0.615..3.710 rows=3D4 loops=3D1)
   Filter:=20 +(subplan)
   SubPlan
     = +->  Index=20 +Scan using models_brands_brand on models_brands  = +(cost=3D0.00..216410.97=20 +rows=3D92372 width=3D0) (actual time=3D0.008..0.008 rows=3D0=20 +loops=3D303)
         &nb= +sp; Index=20 +Cond: (brand =3D $0)
 Total runtime: 3.790 ms
+
 
+
 
+
It was also tried to similar results = +with a LIMIT 1=20 +in the subquery for exist.
+
 
+
More...
+
 
+
Seqscan still off..
+
 
+
 
+
=3D# explain analyze select distinct = +brand_id from=20 +brands inner join models_brands on (brand_id =3D=20 +brand);
          &n= +bsp;           &nb= +sp;           &nbs= +p;            = +;            = +            &= +nbsp;  =20 +QUERY=20 +PLAN           &nb= +sp;           &nbs= +p;            = +;            = +            &= +nbsp;          =20 +
---------------------------------------------------------------------= +-------------------------------------------------------------------------= +-------------------
 Unique =20 +(cost=3D0.00..867782.58 rows=3D303 width=3D4) (actual = +time=3D0.391..4898.579 rows=3D4=20 +loops=3D1)
   ->  Merge Join  = +(cost=3D0.00..866858.85=20 +rows=3D369489 width=3D4) (actual time=3D0.383..3749.771 rows=3D369489=20 +loops=3D1)
         Merge = +Cond:=20 +("outer".brand_id =3D=20 +"inner".brand)
         = +-> =20 +Index Scan using brands_pkey on brands  (cost=3D0.00..15.53 = +rows=3D303 width=3D4)=20 +(actual time=3D0.080..0.299 rows=3D60=20 +loops=3D1)
         = +->  Index=20 +Scan using models_brands_brand on models_brands  = +(cost=3D0.00..862236.96=20 +rows=3D369489 width=3D4) (actual time=3D0.013..1403.175 rows=3D369489=20 +loops=3D1)
 Total runtime: 4898.697 ms
+
 
+
=3D# set enable_seqscan to = +on;
SET
=3D# explain=20 +analyze select distinct brand_id from brands inner join models_brands on = + +(brand_id =3D=20 +brand);
          &n= +bsp;           &nb= +sp;           &nbs= +p;            = +;            = +   =20 +QUERY=20 +PLAN
-----------------------------------------------------------------= +------------------------------------------------------------------------<= +BR> Unique =20 +(cost=3D46300.70..52770.04 rows=3D303 width=3D4) (actual = +time=3D3742.046..8560.833=20 +rows=3D4 loops=3D1)
   ->  Merge Join =20 +(cost=3D46300.70..51846.32 rows=3D369489 width=3D4) (actual = +time=3D3742.035..7406.677=20 +rows=3D369489 = +loops=3D1)
         Merge=20 +Cond: ("outer".brand_id =3D=20 +"inner".brand)
         = +-> =20 +Index Scan using brands_pkey on brands  (cost=3D0.00..15.53 = +rows=3D303 width=3D4)=20 +(actual time=3D0.077..0.407 rows=3D60=20 +loops=3D1)
         = +-> =20 +Sort  (cost=3D46300.70..47224.43 rows=3D369489 width=3D4) (actual=20 +time=3D3741.584..5051.348 rows=3D369489=20 +loops=3D1)
          = +;    =20 +Sort Key:=20 +models_brands.brand
        &n= +bsp;     =20 +->  Seq Scan on models_brands  (cost=3D0.00..6411.89 = +rows=3D369489=20 +width=3D4) (actual time=3D0.027..1346.178 rows=3D369489 = +loops=3D1)
 Total=20 +runtime: 8589.502 ms
(8 rows)
+
 
+
 
+
Hope that helps
+
 
+
Kevin McArthur
+
 
+
 
+
 
+
 
+
 
+

+
 
+
 
+ +------=_NextPart_000_0038_01C6ACBF.5A5F3DC0-- + + +From pgsql-bugs-owner@postgresql.org Fri Jul 21 15:28:17 2006 +X-Original-To: pgsql-bugs-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A44F79FA4A8 + for ; + Fri, 21 Jul 2006 15:28:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04445-01 for ; + Fri, 21 Jul 2006 15:28:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from wolff.to (wolff.to [66.93.197.194]) + by postgresql.org (Postfix) with SMTP id 3C6C39FA5CD + for ; Fri, 21 Jul 2006 15:28:06 -0300 (ADT) +Received: (qmail 26646 invoked by uid 500); 21 Jul 2006 18:33:43 -0000 +Date: Fri, 21 Jul 2006 13:33:43 -0500 +From: Bruno Wolff III +To: Alaa El Gohary +Cc: pgsql-bugs@postgresql.org, pgsql-performance@postgresql.org +Subject: Re: BUG #2543: Performance delay acrros the same day +Message-ID: <20060721183343.GA21995@wolff.to> +Mail-Followup-To: pgsql-performance@postgresql.org, + Alaa El Gohary , bruno@wolff.to +References: <200607210741.k6L7f2VL074357@wwwmaster.postgresql.org> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <200607210741.k6L7f2VL074357@wwwmaster.postgresql.org> +User-Agent: Mutt/1.4.2.1i +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/96 +X-Sequence-Number: 15441 + +On Fri, Jul 21, 2006 at 07:41:02 +0000, + Alaa El Gohary wrote: +> +> The following bug has been logged online: + +The report below isn't a bug, its a performance question and should have +been sent to pgsql-performance@postgresql.org. I am redirecting replies there. + +> A query on the postgresql DB takes about 5 seconds and then it starts to +> take more time till it reaches about 60 seconds by the end of the same day. +> I tried vacuum but nothing changed the only thing that works is to dump the +> DB ,drop and create a new one with the dump taken. +> i need to know if there is any way to restore the performance back without +> the need for drop and create +> cause i can't do this accross the day + +You most likely aren't vacuuming often enough and/or don't have your FSM +setting high enough. + +From pgsql-performance-owner@postgresql.org Fri Jul 21 16:17:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 8C27E9FA50D + for ; + Fri, 21 Jul 2006 16:17:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 68782-03 for + ; + Fri, 21 Jul 2006 19:17:41 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.borderware.com (mail.borderware.com [207.236.65.231]) + by postgresql.org (Postfix) with ESMTP id 12B5F9FA43C + for ; + Fri, 21 Jul 2006 16:17:40 -0300 (ADT) +Message-ID: <44C12852.1040909@borderware.com> +Date: Fri, 21 Jul 2006 15:17:38 -0400 +From: Kevin Keith +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Partitioned tables in queries +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/213 +X-Sequence-Number: 20073 + +I have a case where I am partitioning tables based on a date range in +version 8.1.4. For example: + +table_with_millions_of_records +interaction_id char(16) primary key +start_date timestamp (without timezone) - indexed +.. other columns + +child_1 start_date >= 2006-07-21 00:00:00 +child_2 start_date >= 2006-07-20 00:00:00 and start_date < 2006-07-21 +00:00:00 +... +child_5 start_date >= 2006-07-17 00:00:00 and start_date < 2006-07-18 +00:00:00 + +with rules on the parent and child tables that redirect the data to the +appropriate child table based on the start_date. + +Because this table is going to grow very large (very quickly), and will +need to be purged daily, I created partitions, or child tables to hold +data for each day. I have done the same thing in Oracle in the past, and +the PostgreSQL solution works great. The archival process is very simple +- drop the expired child table. I am having one problem. + +If I run a query on the full table (there are 5 child tables with data +for the last 5 days), and my where clause contains data for the current +day only: +where start_date > date_trunc('day', now()) +all 5 child tables are scanned when I look at the output from explain +analyze. + +My question is - can I force the planner to only scan the relevant child +table - when the key related to the partitioned data it part of the +where clause? + +Thanks, + +Kevin + + +... + +From pgsql-performance-owner@postgresql.org Fri Jul 21 16:35:26 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4776F9FA4A8 + for ; + Fri, 21 Jul 2006 16:35:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 24646-02 for + ; + Fri, 21 Jul 2006 16:35:15 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from m.wordtothewise.com (goliath.word-to-the-wise.com + [208.187.80.130]) + by postgresql.org (Postfix) with ESMTP id D2D689FA42F + for ; + Fri, 21 Jul 2006 16:35:15 -0300 (ADT) +Received: from [10.3.2.25] (184.word-to-the-wise.com [208.187.80.184]) + (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by m.wordtothewise.com (Postfix) with ESMTP id 4202AFF94 + for ; + Fri, 21 Jul 2006 12:35:14 -0700 (PDT) +Mime-Version: 1.0 (Apple Message framework v752.2) +In-Reply-To: <44C12852.1040909@borderware.com> +References: <44C12852.1040909@borderware.com> +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <76447686-0EB2-4482-B6A5-C7003BCF8DCE@blighty.com> +Content-Transfer-Encoding: 7bit +From: Steve Atkins +Subject: Re: Partitioned tables in queries +Date: Fri, 21 Jul 2006 12:34:34 -0700 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/214 +X-Sequence-Number: 20074 + + +On Jul 21, 2006, at 12:17 PM, Kevin Keith wrote: + +> I have a case where I am partitioning tables based on a date range +> in version 8.1.4. For example: +> +> table_with_millions_of_records +> interaction_id char(16) primary key +> start_date timestamp (without timezone) - indexed +> .. other columns +> +> child_1 start_date >= 2006-07-21 00:00:00 +> child_2 start_date >= 2006-07-20 00:00:00 and start_date < +> 2006-07-21 00:00:00 +> ... +> child_5 start_date >= 2006-07-17 00:00:00 and start_date < +> 2006-07-18 00:00:00 +> +> with rules on the parent and child tables that redirect the data to +> the appropriate child table based on the start_date. +> +> Because this table is going to grow very large (very quickly), and +> will need to be purged daily, I created partitions, or child tables +> to hold data for each day. I have done the same thing in Oracle in +> the past, and the PostgreSQL solution works great. The archival +> process is very simple - drop the expired child table. I am having +> one problem. +> +> If I run a query on the full table (there are 5 child tables with +> data for the last 5 days), and my where clause contains data for +> the current day only: +> where start_date > date_trunc('day', now()) +> all 5 child tables are scanned when I look at the output from +> explain analyze. +> +> My question is - can I force the planner to only scan the relevant +> child table - when the key related to the partitioned data it part +> of the where clause? + +Yes. You'll need non-overlapping check constraints in each child +table and to set constraint_exclusion to "on" in postgresql.conf. + +See http://www.postgresql.org/docs/8.1/static/ddl-partitioning.html +for the gory details. + +Cheers, + Steve + +From pgsql-performance-owner@postgresql.org Fri Jul 21 17:52:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 9FB0D9FA42F + for ; + Fri, 21 Jul 2006 17:52:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 42565-01 for + ; + Fri, 21 Jul 2006 20:52:38 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.borderware.com (mail.borderware.com [207.236.65.231]) + by postgresql.org (Postfix) with ESMTP id 47E2C9FA6B0 + for ; + Fri, 21 Jul 2006 17:28:59 -0300 (ADT) +Message-ID: <44C13909.9050900@borderware.com> +Date: Fri, 21 Jul 2006 16:28:57 -0400 +From: Kevin Keith +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Re: Partitioned tables in queries +References: <44C12852.1040909@borderware.com> +In-Reply-To: <44C12852.1040909@borderware.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/215 +X-Sequence-Number: 20075 + +My post might have been a little premature - and I apologize for that. + +I have figured out what was causing the problem: +1. Constraint exclusion was disabled. I re-enabled. +2. I found that using the now() function - and arbitrary interval will +produce a different execution plan that using a specific date. For example: + assuming the current time is 16:00: + a) where start_date > now() - interval '4 hours' scans all child tables. + b) where start_date > '2006-07-21 12:00:00' only scans the child +table with today's data. + +So am I to assume that the value in the query must be a constant, and +cannot be a result of a built-in function in order for +constraint_exclusion to work correctly? + +Thanks, + +Kevin + + +Kevin Keith wrote: +> I have a case where I am partitioning tables based on a date range in +> version 8.1.4. For example: +> +> table_with_millions_of_records +> interaction_id char(16) primary key +> start_date timestamp (without timezone) - indexed +> .. other columns +> +> child_1 start_date >= 2006-07-21 00:00:00 +> child_2 start_date >= 2006-07-20 00:00:00 and start_date < +> 2006-07-21 00:00:00 +> ... +> child_5 start_date >= 2006-07-17 00:00:00 and start_date < +> 2006-07-18 00:00:00 +> +> with rules on the parent and child tables that redirect the data to +> the appropriate child table based on the start_date. +> +> Because this table is going to grow very large (very quickly), and +> will need to be purged daily, I created partitions, or child tables to +> hold data for each day. I have done the same thing in Oracle in the +> past, and the PostgreSQL solution works great. The archival process is +> very simple - drop the expired child table. I am having one problem. +> +> If I run a query on the full table (there are 5 child tables with data +> for the last 5 days), and my where clause contains data for the +> current day only: +> where start_date > date_trunc('day', now()) +> all 5 child tables are scanned when I look at the output from explain +> analyze. +> +> My question is - can I force the planner to only scan the relevant +> child table - when the key related to the partitioned data it part of +> the where clause? +> +> Thanks, +> +> Kevin +> +> +> ... +> + + +From pgsql-performance-owner@postgresql.org Fri Jul 21 18:29:59 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 202929FA4A8 + for ; + Fri, 21 Jul 2006 18:29:59 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 71213-01 for + ; + Fri, 21 Jul 2006 21:29:55 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 034C99FA43C + for ; + Fri, 21 Jul 2006 18:29:54 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6LLTrE5008074; + Fri, 21 Jul 2006 17:29:53 -0400 (EDT) +To: "Kevin McArthur" +cc: pgsql-performance@postgresql.org +Subject: Re: Bad Planner Statistics for Uneven distribution. +In-reply-to: <003b01c6acf1$a66d8910$0701a8c0@kdesktop> +References: <003b01c6acf1$a66d8910$0701a8c0@kdesktop> +Comments: In-reply-to "Kevin McArthur" + message dated "Fri, 21 Jul 2006 12:15:28 -0600" +Date: Fri, 21 Jul 2006 17:29:53 -0400 +Message-ID: <8073.1153517393@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/216 +X-Sequence-Number: 20076 + +"Kevin McArthur" writes: +> -> Seq Scan on models_brands (cost=0.00..6411.89 rows=369489 width=4) (actual time=0.040..1352.997 rows=369489 loops=1) +> ... +> -> Index Scan using models_brands_brand on models_brands (cost=0.00..862236.96 rows=369489 width=4) (actual time=0.122..1440.809 rows=369489 loops=1) + +> Picks the wrong plan here. Should pick the index with seqscanning enabled. + +It's really not possible for a full-table indexscan to be faster than a +seqscan, and not very credible for it even to be approximately as fast. +I suspect your second query here is the beneficiary of the first query +having fetched all the pages into cache. In general, if you want to +optimize for a mostly-cached database, you need to reduce +random_page_cost below its default value ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Fri Jul 21 19:00:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id E3D589FA65C + for ; + Fri, 21 Jul 2006 19:00:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 77851-01 for + ; + Fri, 21 Jul 2006 22:00:03 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.181]) + by postgresql.org (Postfix) with ESMTP id BD8A79FA50D + for ; + Fri, 21 Jul 2006 19:00:02 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id b36so1354728pyb + for ; + Fri, 21 Jul 2006 15:00:01 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=skd80xfRCopj5HDRwNcVUrQ0QGvHXYXErvMQkDhzvzDDC11UNb2oUVc7PDTTmfZbFIDBQhTyZMhZbIp6PTZ3dC4O06rXgK6ZJ6x1VuAtmK1S2XkXarRi7jtqMQB4Uymjcs/7xL+llrwTxKxixbiJv7r+9KFt3GSl0U/gL92eeN0= +Received: by 10.35.76.5 with SMTP id d5mr1988540pyl; + Fri, 21 Jul 2006 15:00:01 -0700 (PDT) +Received: by 10.35.53.5 with HTTP; Fri, 21 Jul 2006 15:00:01 -0700 (PDT) +Message-ID: <1d4e0c10607211500t62be09f2v8284ceb5176b01bc@mail.gmail.com> +Date: Sat, 22 Jul 2006 00:00:01 +0200 +From: "Guillaume Smet" +To: "Tom Lane" +Subject: Re: Bad Planner Statistics for Uneven distribution. +Cc: "Kevin McArthur" , pgsql-performance@postgresql.org +In-Reply-To: <8073.1153517393@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <003b01c6acf1$a66d8910$0701a8c0@kdesktop> + <8073.1153517393@sss.pgh.pa.us> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.478 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/217 +X-Sequence-Number: 20077 + +Tom, + +On 7/21/06, Tom Lane wrote: +> It's really not possible for a full-table indexscan to be faster than a +> seqscan, and not very credible for it even to be approximately as fast. +> I suspect your second query here is the beneficiary of the first query +> having fetched all the pages into cache. In general, if you want to +> optimize for a mostly-cached database, you need to reduce +> random_page_cost below its default value ... + +We discussed this case on IRC and the problem was not the first set of +queries but the second one: +select brand_id from brands where exists (select 1 from models_brands +where brand = brands.brand_id);). + +Isn't there any way to make PostgreSQL have a better estimation here: +-> Index Scan using models_brands_brand on models_brands +(cost=0.00..216410.97 rows=92372 width=0) (actual time=0.008..0.008 +rows=0 loops=303) + Index Cond: (brand = $0) + +I suppose it's because the planner estimates that there will be 92372 +result rows that it chooses the seqscan instead of the index scan. +ALTER STATISTICS didn't change anything. +IIRC, there were already a few threads about the same sort of +estimation problem and there wasn't any solution to solve this +problem. Do you have any hint/ideas? + +-- +Guillaume + +From pgsql-performance-owner@postgresql.org Sat Jul 22 00:06:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id BD2849FA2FB; + Sat, 22 Jul 2006 00:06:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 03772-04; Sat, 22 Jul 2006 03:06:08 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by postgresql.org (Postfix) with ESMTP id E0A2C9FA2DF; + Sat, 22 Jul 2006 00:06:08 -0300 (ADT) +Received: from d1-sfbay-02.sun.com ([192.18.39.112]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6M362oT004002; + Fri, 21 Jul 2006 20:06:02 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-02.sun.com by d1-sfbay-02.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J2S000018LPX400@d1-sfbay-02.sun.com> + (original mail from Robert.Lor@Sun.COM); + Fri, 21 Jul 2006 20:06:02 -0700 (PDT) +Received: from [129.150.12.121] by d1-sfbay-02.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + with ESMTPSA id <0J2S0008RBA1BB30@d1-sfbay-02.sun.com>; Fri, + 21 Jul 2006 20:06:02 -0700 (PDT) +Date: Fri, 21 Jul 2006 20:05:28 -0700 +From: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <21889.1153489365@sss.pgh.pa.us> +To: Tom Lane +Cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Message-id: <44C195F8.9010409@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, + hits=0.001 tagged_above=0 required=5 tests=UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/218 +X-Sequence-Number: 20078 + +Tom Lane wrote: + +>Also, it'd be interesting to count time spent holding shared lock +>separately from time spent holding exclusive. +> +> +> +Tom, + +Here is the break down between exclusive & shared LWLocks. Do the +numbers look reasonable to you? + +Regards, +-Robert + +bash-3.00# time ./Tom_lwlock_acquire.d `pgrep -n postgres` +********** LWLock Count: Exclusive ********** + Lock Id Mode Count + ControlFileLock Exclusive 1 + FreeSpaceLock Exclusive 9 + XidGenLock Exclusive 202 + CLogControlLock Exclusive 203 + WALWriteLock Exclusive 203 + BgWriterCommLock Exclusive 222 + BufFreelistLock Exclusive 305 + BufMappingLock Exclusive 305 + ProcArrayLock Exclusive 405 + FirstLockMgrLock Exclusive 670 + WALInsertLock Exclusive 1616 + +********** LWLock Count: Shared ********** + Lock Id Mode Count + CheckpointStartLock Shared 202 + CLogControlLock Shared 450 + SubtransControlLock Shared 776 + XidGenLock Shared 2020 + ProcArrayLock Shared 3778 + SInvalLock Shared 4040 + BufMappingLock Shared 40838 + +********** LWLock Time: Exclusive ********** + Lock Id Combined Time (ns) + ControlFileLock 8301 + FreeSpaceLock 80590 + CLogControlLock 1603557 + BgWriterCommLock 1607122 + BufFreelistLock 1997406 + XidGenLock 2312442 + BufMappingLock 3161683 + FirstLockMgrLock 5392575 + ProcArrayLock 6034396 + WALInsertLock 12277693 + WALWriteLock 324869744 + +********** LWLock Time: Shared ********** + Lock Id Combined Time (ns) + CLogControlLock 3183788 + SubtransControlLock 6956229 + XidGenLock 12012576 + SInvalLock 35567976 + ProcArrayLock 45400779 + BufMappingLock 300669441 + CheckpointStartLock 4056134243 + + +real 0m24.718s +user 0m0.382s +sys 0m0.181s + + + +From pgsql-performance-owner@postgresql.org Sat Jul 22 13:52:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 98D3D9FA502 + for ; + Sat, 22 Jul 2006 13:52:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 80464-09 for + ; + Sat, 22 Jul 2006 16:52:35 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 3F7099FA26D + for ; + Sat, 22 Jul 2006 13:22:26 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6MGMLoV026828; + Sat, 22 Jul 2006 12:22:21 -0400 (EDT) +To: robin.c.smith@bt.com +cc: pgsql-performance@postgresql.org +Subject: Re: Forcing using index instead of sequential scan? +In-reply-to: + +References: + +Comments: In-reply-to + message dated "Fri, 21 Jul 2006 11:40:33 +0100" +Date: Sat, 22 Jul 2006 12:22:21 -0400 +Message-ID: <26827.1153585341@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/219 +X-Sequence-Number: 20079 + + writes: +> I have been testing the performance of PostgreSQL using the simple tool +> found at http://benchw.sourceforge.net however I have found that all the +> queries it run execute with sequential scans. The website where the code +> runs has examples of the execution plan using indexes. + +The reason the website gets indexscans is that he's fooled with the +planner cost parameters. In particular I see that benchw's +documentation suggests + effective_cache_size = 48000 + random_page_cost = 0.8 +The latter is physically silly but it's a pretty effective thumb on the +scales if you want to force indexscan usage. + +The real issue here is caching across successive queries, an effect that +Postgres doesn't deal with very well at the moment. If you run these +queries from a standing start (freshly booted machine) you'll likely +find that the indexscan plan is indeed slower than the seqscan/hash +plan, just like the planner thinks. I get about 52 sec for query0 +with an indexscan vs about 35 sec for the seqscan. However, successive +executions of the seqscan plan stay at about 35 sec, whereas the +indexscan plan drops to 2 sec(!). This is because the fraction of the +table touched by the indexscan plan is small enough to fit in my +machine's RAM --- I can see by das blinkenlights (and also vmstat) that +there's no I/O going on at all during re-executions of the indexscan. +If I run the seqscan and then the indexscan, the indexscan takes about +28 sec, so there's still some useful cached data even though the seqscan +read more stuff than fits in RAM. (Note: this is with Fedora Core 5, +YMMV depending on your kernel's cache algorithms.) + +In a real-world situation it's unlikely you'd just re-execute the same +query over and over, so this benchmark is really too simplistic to trust +very far as an indicator of what to do in practice. + +I find that CVS tip will choose the indexscan for query0 if I set +effective_cache_size to 62500 (ie, half a gigabyte, or half of this +machine's RAM) and set random_page_cost to 1.5 or less. + +If you want the planner to work on the assumption that everything's +cached, set effective_cache_size to a large value and set +random_page_cost to 1.0 --- you might also want to increase the CPU +cost settings, reflecting the fact that I/O is cheaper relative to +CPU effort than the default settings assume. However, if your database +is too large to fit in RAM then these are likely to be pretty bad +settings. Many people compromise with a random_page_cost around 2 +or so. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jul 22 14:04:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id C9C7A9FB1BF + for ; + Sat, 22 Jul 2006 14:04:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 85788-03 for + ; + Sat, 22 Jul 2006 17:04:00 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id A20669FB1BE + for ; + Sat, 22 Jul 2006 14:04:01 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6MH3wje027059; + Sat, 22 Jul 2006 13:03:58 -0400 (EDT) +To: "Guillaume Smet" +cc: "Kevin McArthur" , pgsql-performance@postgresql.org +Subject: Re: Bad Planner Statistics for Uneven distribution. +In-reply-to: <1d4e0c10607211500t62be09f2v8284ceb5176b01bc@mail.gmail.com> +References: <003b01c6acf1$a66d8910$0701a8c0@kdesktop> + <8073.1153517393@sss.pgh.pa.us> + <1d4e0c10607211500t62be09f2v8284ceb5176b01bc@mail.gmail.com> +Comments: In-reply-to "Guillaume Smet" + message dated "Sat, 22 Jul 2006 00:00:01 +0200" +Date: Sat, 22 Jul 2006 13:03:58 -0400 +Message-ID: <27058.1153587838@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/220 +X-Sequence-Number: 20080 + +"Guillaume Smet" writes: +> Isn't there any way to make PostgreSQL have a better estimation here: +> -> Index Scan using models_brands_brand on models_brands +> (cost=0.00..216410.97 rows=92372 width=0) (actual time=0.008..0.008 +> rows=0 loops=303) +> Index Cond: (brand = $0) + +Note that the above plan extract is pretty misleading, because it +doesn't account for the implicit "LIMIT 1" of an EXISTS() clause. +What the planner is *actually* imputing to this plan is 216410.97/92372 +cost units, or about 2.34. However that applies to the seqscan variant +as well. + +I think the real issue with Kevin's example is that when doing an +EXISTS() on a brand_id that doesn't actually exist in the table, the +seqscan plan has worst-case behavior (ie, scan the whole table) while +the indexscan plan still manages to be cheap. Because his brands table +has so many brand_ids that aren't in the table, that case dominates the +results. Not sure how we could factor that risk into the cost +estimates. The EXISTS code could probably special-case it reasonably +well for the simplest seqscan and indexscan subplans, but I don't see +what to do with more general subqueries (like joins). + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jul 22 15:27:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 9A11E9FB1BC + for ; + Sat, 22 Jul 2006 15:27:22 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 13368-09 for + ; + Sat, 22 Jul 2006 18:27:17 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 2D5EF9FA6B0 + for ; + Sat, 22 Jul 2006 15:27:17 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6MIR6n1004878; Sat, 22 Jul 2006 11:27:06 -0700 +Message-ID: <44C25FDD.8070003@modgraph-usa.com> +Date: Sat, 22 Jul 2006 10:26:53 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Tom Lane +CC: robin.c.smith@bt.com, pgsql-performance@postgresql.org +Subject: Re: Forcing using index instead of sequential scan? +References: + + <26827.1153585341@sss.pgh.pa.us> +In-Reply-To: <26827.1153585341@sss.pgh.pa.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/221 +X-Sequence-Number: 20081 + +> The real issue here is caching across successive queries, an effect that +> Postgres doesn't deal with very well at the moment. If you run these +> queries from a standing start (freshly booted machine) you'll likely +> find that the indexscan plan is indeed slower than the seqscan/hash +> plan, just like the planner thinks. + +Here's a little trick I learned to speed up this test. + + find / -type f -exec grep foobar {} \; + +This causes massive file-system activity and flushes all files that the kernel has cached. If you run this between each Postgres test (let it run for a couple minutes), it gives you an apples-to-apples comparison between successive benchmarks, and eliminates the effects of caching. + +If you run this as a regular user (NOT super-user or 'postgres'), you won't have permission to access your Postgres files, so you're guaranteed they'll be flushed from the cache. + +Craig + +From pgsql-performance-owner@postgresql.org Sat Jul 22 20:15:53 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 65B0D9FA612 + for ; + Sat, 22 Jul 2006 20:15:52 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69996-03 for + ; + Sat, 22 Jul 2006 20:15:47 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) + by postgresql.org (Postfix) with ESMTP id EAAA19F9F73 + for ; + Sat, 22 Jul 2006 20:15:48 -0300 (ADT) +Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) + by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) + id 1G4Qh2-0005cM-00; Sat, 22 Jul 2006 19:15:32 -0400 +To: "Craig A. James" +Cc: Tom Lane , robin.c.smith@bt.com, + pgsql-performance@postgresql.org +Subject: Re: Forcing using index instead of sequential scan? +References: + + <26827.1153585341@sss.pgh.pa.us> <44C25FDD.8070003@modgraph-usa.com> +In-Reply-To: <44C25FDD.8070003@modgraph-usa.com> +From: Gregory Stark +Organization: EnterpriseDB +Date: 22 Jul 2006 19:15:31 -0400 +Message-ID: <87slktteng.fsf@stark.xeocode.com> +Lines: 21 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.384 tagged_above=0 required=5 tests=SPF_SOFTFAIL +X-Spam-Level: * +X-Archive-Number: 200607/222 +X-Sequence-Number: 20082 + +"Craig A. James" writes: + +> This causes massive file-system activity and flushes all files that the +> kernel has cached. If you run this between each Postgres test (let it run +> for a couple minutes), it gives you an apples-to-apples comparison between +> successive benchmarks, and eliminates the effects of caching. + +On Linux at least the best way to flush the cache is to unmount and then mount +the filesystem. This requires putting the data files on partition that you +aren't otherwise using and shutting down postgres. + +Note that "nothing cached" isn't necessarily any more accurate a model as +"everything cached". In reality many databases *do* in fact run the same +queries over and over again, though often with some parameters different each +time. But the upper pages of most indexes and many of the common leaf pages +and heap pages will in fact be cached. + + +-- + Gregory Stark + EnterpriseDB http://www.enterprisedb.com + + +From pgsql-performance-owner@postgresql.org Sun Jul 23 00:44:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 6E97E9FB1BF + for ; + Sun, 23 Jul 2006 00:44:56 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 32675-07 for + ; + Sun, 23 Jul 2006 03:44:45 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-4.paradise.net.nz (bm-4a.paradise.net.nz + [203.96.152.183]) + by postgresql.org (Postfix) with ESMTP id 2FA5D9FAE4E + for ; + Sun, 23 Jul 2006 00:44:40 -0300 (ADT) +Received: from smtp-1.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-4.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J2U009TH7PX4T@linda-4.paradise.net.nz> for + pgsql-performance@postgresql.org; Sun, 23 Jul 2006 15:44:26 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-29-211.dsl.clear.net.nz [218.101.29.211]) by + smtp-1.paradise.net.nz (Postfix) with ESMTP id 0FD0F1675FD3; + Sun, 23 Jul 2006 15:29:05 +1200 (NZST) +Date: Sun, 23 Jul 2006 15:28:48 +1200 +From: Mark Kirkwood +Subject: Re: Forcing using index instead of sequential scan? +In-reply-to: <26827.1153585341@sss.pgh.pa.us> +To: Tom Lane , robin.c.smith@bt.com +Cc: pgsql-performance@postgresql.org +Message-id: <44C2ECF0.1040701@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: + + <26827.1153585341@sss.pgh.pa.us> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/223 +X-Sequence-Number: 20083 + +Tom Lane wrote: +> writes: +>> I have been testing the performance of PostgreSQL using the simple tool +>> found at http://benchw.sourceforge.net however I have found that all the +>> queries it run execute with sequential scans. The website where the code +>> runs has examples of the execution plan using indexes. +> +> The reason the website gets indexscans is that he's fooled with the +> planner cost parameters. In particular I see that...(snipped) +> + +Indeed I did - probably should have discussed that alteration better in +the documentation for the test suite! + +In addition I was a bit naughty in running the benchmark using size 1 +(i.e about 1G) an a box with 2G ram - as this meant that (on the machine +I was using then anyway) indexscans on query 0 and 1 were *always* +better than the sequential options. + +A better test is to use the size factor at 2 x physical ram, as then the +planners defaults make more sense! (unless or course you *want* to model +a data mart smaller than physical ram). + +Best wishes + +Mark + + + + +From pgsql-performance-owner@postgresql.org Sun Jul 23 00:51:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 044D39FB1C4 + for ; + Sun, 23 Jul 2006 00:51:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90022-05 for + ; + Sun, 23 Jul 2006 00:50:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz + [203.96.152.181]) + by postgresql.org (Postfix) with ESMTP id 9A6569FAE4E + for ; + Sun, 23 Jul 2006 00:50:55 -0300 (ADT) +Received: from smtp-3.paradise.net.nz + (tclsnelb1-src-1.paradise.net.nz [203.96.152.172]) by + linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id + <0J2U006TS80KON@linda-2.paradise.net.nz> for + pgsql-performance@postgresql.org; Sun, 23 Jul 2006 15:50:46 +1200 (NZST) +Received: from [192.168.1.11] + (218-101-29-211.dsl.clear.net.nz [218.101.29.211]) by + smtp-3.paradise.net.nz (Postfix) with ESMTP id D6B5083DB04; + Sun, 23 Jul 2006 15:39:41 +1200 (NZST) +Date: Sun, 23 Jul 2006 15:39:21 +1200 +From: Mark Kirkwood +Subject: Re: Forcing using index instead of sequential scan? +In-reply-to: + +To: robin.c.smith@bt.com +Cc: pgsql-performance@postgresql.org +Message-id: <44C2EF69.4020408@paradise.net.nz> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7bit +User-Agent: Thunderbird 1.5.0.4 (X11/20060704) +References: + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/224 +X-Sequence-Number: 20084 + +robin.c.smith@bt.com wrote: +> I have been testing the performance of PostgreSQL using the simple tool +> found at _http://benchw.sourceforge.net_ however I have found that all +> the queries it run execute with sequential scans. The website where the +> code runs has examples of the execution plan using indexes. +> +> When I disable the sequential plan query 0 and query 1 run faster ( +> _http://benchw.sourceforge.net/benchw_results_postgres_history.html_ ) +> by using the indexes as suggested by the website. +> +> I have tried increasing the effective_cache_size and reducing the +> random_page_cost to try and force the optimiser to use the index but it +> always uses the sequential scan. +> +> What is the best way to force the use of indexes in these queries? +> Currently testing with version 8.1.4. +> +> + +Hi Robin, + + +Being responsible for this piece of software, I should try to help, only +saw this now sorry (nice to see someone using this). + +Unless you really want to reproduce the numbers on the website, it is +best to test with Benchw's scale factor at least 2 x your physical ram, +as this makes the planner's defaults work more sensibly (and models +*most* real world data warehouse situations better!). + +Cheers + +Mark + +From pgsql-performance-owner@postgresql.org Sun Jul 23 08:29:24 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id EAA869FA68D + for ; + Sun, 23 Jul 2006 08:29:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 43562-01 for + ; + Sun, 23 Jul 2006 08:29:17 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by postgresql.org (Postfix) with ESMTP id 3D7A79FA6B5 + for ; + Sun, 23 Jul 2006 08:07:31 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.236]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J2U0045IS8IR9O9@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Sun, 23 Jul 2006 06:07:30 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 45CAA6E796 for + ; + Sun, 23 Jul 2006 07:07:29 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id Rlm+N4sQB+Kl for ; Sun, + 23 Jul 2006 07:07:27 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id B44026F875; Sun, 23 Jul 2006 07:07:26 -0400 (EDT) +Date: Sun, 23 Jul 2006 07:07:26 -0400 +From: Michael Stone +Subject: Re: Forcing using index instead of sequential scan? +In-reply-to: <44C25FDD.8070003@modgraph-usa.com> +To: pgsql-performance@postgresql.org +Mail-followup-to: pgsql-performance@postgresql.org +Message-id: <20060723110724.GU8069@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: + + <26827.1153585341@sss.pgh.pa.us> <44C25FDD.8070003@modgraph-usa.com> +User-Agent: Mutt/1.5.11+cvs20060403 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.134 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/225 +X-Sequence-Number: 20085 + +On Sat, Jul 22, 2006 at 10:26:53AM -0700, Craig A. James wrote: +>This causes massive file-system activity and flushes all files that the +>kernel has cached. If you run this between each Postgres test (let it run +>for a couple minutes), it gives you an apples-to-apples comparison between +>successive benchmarks, and eliminates the effects of caching. + +Assuming a system with small ram or an unusually large system +installation. Unmounting is a much more realiable mechanism. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Sun Jul 23 12:04:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5A32C9FA463 + for ; + Sun, 23 Jul 2006 12:04:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92927-03 for + ; + Sun, 23 Jul 2006 12:04:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from moonunit2.moonview.localnet (wsip-70-167-125-69.sd.sd.cox.net + [70.167.125.69]) + by postgresql.org (Postfix) with ESMTP id 81EF79FA425 + for ; + Sun, 23 Jul 2006 12:04:25 -0300 (ADT) +Received: from [192.168.0.3] (moonunit3.moonview.localnet [192.168.0.3]) + by moonunit2.moonview.localnet (8.13.1/8.13.1) with ESMTP id + k6NF4Kio027136; Sun, 23 Jul 2006 08:04:21 -0700 +Message-ID: <44C381CF.4050800@modgraph-usa.com> +Date: Sun, 23 Jul 2006 07:03:59 -0700 +From: "Craig A. James" +User-Agent: Thunderbird 1.5.0.4 (X11/20060516) +MIME-Version: 1.0 +To: Michael Stone , + pgsql-performance@postgresql.org +Subject: Re: Forcing using index instead of sequential scan? +References: + + <26827.1153585341@sss.pgh.pa.us> + <44C25FDD.8070003@modgraph-usa.com> + <20060723110724.GU8069@mathom.us> +In-Reply-To: <20060723110724.GU8069@mathom.us> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/226 +X-Sequence-Number: 20086 + +Michael Stone wrote: +> On Sat, Jul 22, 2006 at 10:26:53AM -0700, Craig A. James wrote: +>> This causes massive file-system activity and flushes all files that +>> the kernel has cached. If you run this between each Postgres test +>> (let it run for a couple minutes), it gives you an apples-to-apples +>> comparison between successive benchmarks, and eliminates the effects +>> of caching. +> +> Assuming a system with small ram or an unusually large system +> installation. Unmounting is a much more realiable mechanism. + +Indeed, but it only works if you can. For example, in my small-ish installation, my WAL and system tables are mounted on the root disk. Or someone might not have super-user access. + +Craig + +From pgsql-performance-owner@postgresql.org Sun Jul 23 15:10:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id D55009FA65C; + Sun, 23 Jul 2006 15:10:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 01947-01; Sun, 23 Jul 2006 18:10:28 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id CF3339FA64B; + Sun, 23 Jul 2006 15:10:27 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6NIAQ24003707; + Sun, 23 Jul 2006 14:10:26 -0400 (EDT) +To: Robert Lor +cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <44C195F8.9010409@sun.com> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> <44C195F8.9010409@sun.com> +Comments: In-reply-to Robert Lor + message dated "Fri, 21 Jul 2006 20:05:28 -0700" +Date: Sun, 23 Jul 2006 14:10:26 -0400 +Message-ID: <3706.1153678226@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/227 +X-Sequence-Number: 20087 + +Robert Lor writes: +> Here is the break down between exclusive & shared LWLocks. Do the +> numbers look reasonable to you? + +Yeah, those seem plausible, although the hold time for +CheckpointStartLock seems awfully high --- about 20 msec +per transaction. Are you using a nonzero commit_delay? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Jul 23 20:47:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id 964A89FA508 + for ; + Sun, 23 Jul 2006 20:47:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 06512-01 for + ; + Sun, 23 Jul 2006 23:47:27 +0000 (UTC) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.200]) + by postgresql.org (Postfix) with ESMTP id 5676B9FA48B + for ; + Sun, 23 Jul 2006 20:47:27 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id z3so342291nzf + for ; + Sun, 23 Jul 2006 16:47:25 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=th5N0VuKBOuKTV6r5ApsW4qLAHorc9F52/JI1+s7TDYYS/fNexap9ke2GtqkBYmsnD/63Y36V8R7kCSmJm64J9xKDEONThvA0XRNEm708oc+ZI3AXFozu5orzJT0QdiBryEfMbwBCl09MGVIqCOwQN1neYva1Yp03YUYxeCc3Fk= +Received: by 10.65.116.7 with SMTP id t7mr2678213qbm; + Sun, 23 Jul 2006 16:47:25 -0700 (PDT) +Received: by 10.64.179.18 with HTTP; Sun, 23 Jul 2006 16:47:25 -0700 (PDT) +Message-ID: <5f820f750607231647u466597d9g25ec5cf5157e2cbf@mail.gmail.com> +Date: Sun, 23 Jul 2006 19:47:25 -0400 +From: "Denis Lussier" +To: "Petronenko D.S." +Subject: Re: postgres benchmarks +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44C0D822.60604@gmail.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_69253_20699650.1153698445764" +References: <44C0D822.60604@gmail.com> +X-Google-Sender-Auth: d7d93db4d8c86a06 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.696 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/228 +X-Sequence-Number: 20088 + +------=_Part_69253_20699650.1153698445764 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +At EnterpriseDB we make extensive use of the OSDB's OLTP Benchmark. We +also use the Java based benchamrk called BenchmarkSQL from SourceForge. +Both of these benchmarks are update intensive OLTP tests that closely mimic +the Traqnsaction Processing COuncil's TPC-C benchmark. + +Postgres also ships with pg_bench, which is a simpler OLTP benchmark that I +believe is similar to a TPC-B. + +--Denis Lussier + CTO + http://www.enterprisedb.com + + +On 7/21/06, Petronenko D.S. wrote: +> +> Hello, +> +> does anybody use OSDB benchmarks for postgres? +> if not, which kind of bechmarks are used for postgres? +> +> Thanks, +> Denis. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly +> + +------=_Part_69253_20699650.1153698445764 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
At EnterpriseDB we make extensive use of the OSDB's OLTP Benchmark.   We also use the Java based benchamrk called BenchmarkSQL from SourceForge.  Both of these benchmarks are update intensive OLTP tests that closely mimic the Traqnsaction Processing COuncil's TPC-C benchmark. +
+
 
+
Postgres also ships with pg_bench, which is a simpler OLTP benchmark that I believe is similar to a TPC-B.
+
 
+
--Denis Lussier
+
  CTO
+ +
On 7/21/06, Petronenko D.S. <petronenko@gmail.com> wrote: +
Hello,

does anybody use OSDB benchmarks for postgres?
if not, which kind of bechmarks are used for postgres? +

Thanks,
Denis.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to +majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

+ +------=_Part_69253_20699650.1153698445764-- + +From pgsql-performance-owner@postgresql.org Sun Jul 23 20:52:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id D5F409FA508; + Sun, 23 Jul 2006 20:52:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 01005-06; Sun, 23 Jul 2006 23:52:18 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 02E6E9FA48B; + Sun, 23 Jul 2006 20:52:17 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6NNqG5S028597; + Sun, 23 Jul 2006 19:52:16 -0400 (EDT) +To: Tatsuo Ishii +cc: Robert.Lor@Sun.COM, pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <20060617.111838.39487910.t-ishii@sraoss.co.jp> +References: <4492CBE2.3090509@sun.com> + <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> +Comments: In-reply-to Tatsuo Ishii + message dated "Sat, 17 Jun 2006 11:18:38 +0900" +Date: Sun, 23 Jul 2006 19:52:16 -0400 +Message-ID: <28596.1153698736@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/229 +X-Sequence-Number: 20089 + +Tatsuo Ishii writes: +>>> Interesting. We (some Japanese companies including SRA OSS, +>>> Inc. Japan) did some PG scalability testing using a Unisys's big 16 +>>> (physical) CPU machine and found PG scales up to 8 CPUs. However +>>> beyond 8 CPU PG does not scale anymore. The result can be viewed at +>>> "OSS iPedia" web site (http://ossipedia.ipa.go.jp). Our conclusion was +>>> PG has a serious lock contention problem in the environment by +>>> analyzing the oprofile result. + +Can you retry this test case using CVS tip? I'm curious to see if +having partitioned the BufMappingLock helps ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Jul 23 21:53:12 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id B7B259FA508; + Sun, 23 Jul 2006 21:53:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 24195-01; Mon, 24 Jul 2006 00:53:07 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by postgresql.org (Postfix) with ESMTP id 8055C9FA48B; + Sun, 23 Jul 2006 21:53:07 -0300 (ADT) +Received: from d1-sfbay-03.sun.com ([192.18.39.113]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6O0r0Nm011060; + Sun, 23 Jul 2006 17:53:00 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-03.sun.com by d1-sfbay-03.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J2V00401PLD4R00@d1-sfbay-03.sun.com> + (original mail from Robert.Lor@Sun.COM); + Sun, 23 Jul 2006 17:53:00 -0700 (PDT) +Received: from [129.150.12.121] by d1-sfbay-03.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + with ESMTPSA id <0J2V004TGUG0CO20@d1-sfbay-03.sun.com>; Sun, + 23 Jul 2006 17:53:00 -0700 (PDT) +Date: Sun, 23 Jul 2006 17:52:12 -0700 +From: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <3706.1153678226@sss.pgh.pa.us> +To: Tom Lane +Cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Message-id: <44C419BC.1050503@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=us-ascii +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> <44C195F8.9010409@sun.com> + <3706.1153678226@sss.pgh.pa.us> +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, + hits=0.001 tagged_above=0 required=5 tests=UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/230 +X-Sequence-Number: 20090 + +Tom Lane wrote: + +>Yeah, those seem plausible, although the hold time for +>CheckpointStartLock seems awfully high --- about 20 msec +>per transaction. Are you using a nonzero commit_delay? +> +> +> +> +I didn't change commit_delay which defaults to zero. + + +Regards, +-Robert + + +From pgsql-performance-owner@postgresql.org Sun Jul 23 22:29:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (wm.hub.org [200.46.204.128]) + by postgresql.org (Postfix) with ESMTP id DAF5E9FA48B; + Sun, 23 Jul 2006 22:29:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) + with ESMTP id 28727-07; Mon, 24 Jul 2006 01:29:41 +0000 (UTC) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id E46249FB1BE; + Sun, 23 Jul 2006 22:29:40 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6O1Tdln029921; + Sun, 23 Jul 2006 21:29:39 -0400 (EDT) +To: Robert Lor +cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <44C419BC.1050503@sun.com> +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> <44C195F8.9010409@sun.com> + <3706.1153678226@sss.pgh.pa.us> <44C419BC.1050503@sun.com> +Comments: In-reply-to Robert Lor + message dated "Sun, 23 Jul 2006 17:52:12 -0700" +Date: Sun, 23 Jul 2006 21:29:39 -0400 +Message-ID: <29920.1153704579@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/231 +X-Sequence-Number: 20091 + +Robert Lor writes: +> Tom Lane wrote: +>> Yeah, those seem plausible, although the hold time for +>> CheckpointStartLock seems awfully high --- about 20 msec +>> per transaction. Are you using a nonzero commit_delay? +>> +> I didn't change commit_delay which defaults to zero. + +Hmmm ... AFAICS this must mean that flushing the WAL data to disk +at transaction commit time takes (most of) 20 msec on your hardware. +Which still seems high --- on most modern disks that'd be at least two +disk revolutions, maybe more. What's the disk hardware you're testing +on, particularly its RPM spec? + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 24 00:35:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 78D6F9FA508; + Mon, 24 Jul 2006 00:35:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 71216-05; Mon, 24 Jul 2006 00:35:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from nwkea-pix-1.sun.com (nwkea-pix-1.sun.com [192.18.42.249]) + by postgresql.org (Postfix) with ESMTP id 9DD579FA48B; + Mon, 24 Jul 2006 00:35:04 -0300 (ADT) +Received: from d1-sfbay-04.sun.com ([192.18.39.114]) + by nwkea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k6O3Z3n0017356; + Sun, 23 Jul 2006 20:35:03 -0700 (PDT) +Received: from conversion-daemon.d1-sfbay-04.sun.com by d1-sfbay-04.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J2V00A01YC5VR00@d1-sfbay-04.sun.com> + (original mail from Robert.Lor@Sun.COM); + Sun, 23 Jul 2006 20:35:02 -0700 (PDT) +Received: from [192.168.1.67] ([71.142.94.24]) + by d1-sfbay-04.sun.com (Sun Java System Messaging Server 6.2-4.02 + (built Sep 9 + 2005)) with ESMTPSA id <0J2W00AFD1YDEH30@d1-sfbay-04.sun.com>; Sun, + 23 Jul 2006 20:35:02 -0700 (PDT) +Date: Sun, 23 Jul 2006 20:34:25 -0700 +From: Robert Lor +Subject: Re: Sun Donated a Sun Fire T2000 to the PostgreSQL +In-reply-to: <29920.1153704579@sss.pgh.pa.us> +To: Tom Lane +Cc: Tatsuo Ishii , pgsql-hackers@postgresql.org, + pgsql-performance@postgresql.org +Message-id: <44C43FC1.4050002@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=us-ascii +Content-transfer-encoding: 7BIT +X-Accept-Language: en-us, en +References: <20060617.101521.95879771.t-ishii@sraoss.co.jp> + <10226.1150511655@sss.pgh.pa.us> + <20060617.111838.39487910.t-ishii@sraoss.co.jp> + <20060713.180234.45872055.t-ishii@sraoss.co.jp> + <8669.1153422118@sss.pgh.pa.us> <44C088C8.9050303@sun.com> + <21889.1153489365@sss.pgh.pa.us> <44C195F8.9010409@sun.com> + <3706.1153678226@sss.pgh.pa.us> <44C419BC.1050503@sun.com> + <29920.1153704579@sss.pgh.pa.us> +User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.7) Gecko/20060307 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.699 tagged_above=0 required=5 tests=AWL, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/232 +X-Sequence-Number: 20092 + +Tom Lane wrote: + +>Hmmm ... AFAICS this must mean that flushing the WAL data to disk +>at transaction commit time takes (most of) 20 msec on your hardware. +>Which still seems high --- on most modern disks that'd be at least two +>disk revolutions, maybe more. What's the disk hardware you're testing +>on, particularly its RPM spec? +> +> +I actually ran the test on my laptop. It has an Ultra ATA/100 drive +(5400 rpm). The test was just a quickie to show some data from the +probes. I'll collect and share data from the T2000 server later. + +Regards, +-Robert + +From pgsql-performance-owner@postgresql.org Mon Jul 24 04:54:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2B6D49FB1C2 + for ; + Mon, 24 Jul 2006 04:54:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 90963-10 for + ; + Mon, 24 Jul 2006 04:54:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id 7C0919FB1B9 + for ; + Mon, 24 Jul 2006 04:54:12 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D1A17.dip0.t-ipconnect.de + [84.157.26.23]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id 0268265874; + Mon, 24 Jul 2006 09:55:57 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 043C718148BC2; + Mon, 24 Jul 2006 09:54:30 +0200 (CEST) +Message-ID: <44C47CB5.6080806@logix-tt.com> +Date: Mon, 24 Jul 2006 09:54:29 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.2 (X11/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org, + Alaa El Gohary , bruno@wolff.to +Subject: Re: BUG #2543: Performance delay acrros the same day +References: <200607210741.k6L7f2VL074357@wwwmaster.postgresql.org> + <20060721183343.GA21995@wolff.to> +In-Reply-To: <20060721183343.GA21995@wolff.to> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/233 +X-Sequence-Number: 20093 + +Hi, Bruno, + +Bruno Wolff III wrote: +> On Fri, Jul 21, 2006 at 07:41:02 +0000, +> Alaa El Gohary wrote: +>> The following bug has been logged online: +> +> The report below isn't a bug, its a performance question and should have +> been sent to pgsql-performance@postgresql.org. I am redirecting replies there. +> +>> A query on the postgresql DB takes about 5 seconds and then it starts to +>> take more time till it reaches about 60 seconds by the end of the same day. +>> I tried vacuum but nothing changed the only thing that works is to dump the +>> DB ,drop and create a new one with the dump taken. +>> i need to know if there is any way to restore the performance back without +>> the need for drop and create +>> cause i can't do this accross the day +> +> You most likely aren't vacuuming often enough and/or don't have your FSM +> setting high enough. + +Depending on the PostgreSQL version, it might also be that he suffers +from index bloat. He might look into the manual pages about REINDEX for +a description. + + +HTH, +Markus +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Tue Jul 25 17:48:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7993D9FA65C + for ; + Tue, 25 Jul 2006 17:48:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92736-09 for + ; + Tue, 25 Jul 2006 17:48:36 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) + by postgresql.org (Postfix) with ESMTP id 7B6639FA682 + for ; + Tue, 25 Jul 2006 17:48:36 -0300 (ADT) +Received: by floppy.pyrenet.fr (Postfix, from userid 106) + id 5915930E11; Tue, 25 Jul 2006 22:48:35 +0200 (MET DST) +From: "Andrew Hammond" +X-Newsgroups: pgsql.performance +Subject: Re: Partitioned tables in queries +Date: 25 Jul 2006 13:48:28 -0700 +Organization: http://groups.google.com +Lines: 15 +Message-ID: <1153860508.907395.248520@h48g2000cwc.googlegroups.com> +References: <44C12852.1040909@borderware.com><44C13909.9050900@borderware.com> +Mime-Version: 1.0 +Content-Type: text/plain; charset="iso-8859-1" +X-Complaints-To: groups-abuse@google.com +In-Reply-To: <44C13909.9050900@borderware.com> +User-Agent: G2/0.2 +X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; + rv:1.8.0.4) Gecko/20060608 Ubuntu/dapper-security + Firefox/1.5.0.4,gzip(gfe),gzip(gfe) +Complaints-To: groups-abuse@google.com +Injection-Info: h48g2000cwc.googlegroups.com; posting-host=207.219.45.62; + posting-account=cSUlcA0AAABWACaPjo2Z9C0GBLTio512 +To: pgsql-performance@postgresql.org +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.025 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200607/234 +X-Sequence-Number: 20094 + +> 2. I found that using the now() function - and arbitrary interval will +> produce a different execution plan that using a specific date. For example: +> assuming the current time is 16:00: +> a) where start_date > now() - interval '4 hours' scans all child tables. +> b) where start_date > '2006-07-21 12:00:00' only scans the child +> table with today's data. +> +> So am I to assume that the value in the query must be a constant, and +> cannot be a result of a built-in function in order for +> constraint_exclusion to work correctly? + +Have you tried WHERE start_date > (SELECT now() - interval '4 hours')? +Certainly using the constant will allow CBE to work. I think that a +subquery might too. + + +From pgsql-performance-owner@postgresql.org Wed Jul 26 12:21:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AA3369FA506 + for ; + Wed, 26 Jul 2006 12:21:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 80203-09 for + ; + Wed, 26 Jul 2006 12:21:00 -0300 (ADT) +X-Greylist: whitelisted by SQLgrey- +Received: from smtp1-g19.free.fr (smtp1-g19.free.fr [212.27.42.27]) + by postgresql.org (Postfix) with ESMTP id 0896A9FA4E0 + for ; + Wed, 26 Jul 2006 12:21:01 -0300 (ADT) +Received: from imp3-g19.free.fr (imp3-g19.free.fr [212.27.42.3]) + by smtp1-g19.free.fr (Postfix) with ESMTP id 3ADC1908F7 + for ; + Wed, 26 Jul 2006 17:20:59 +0200 (CEST) +Received: by imp3-g19.free.fr (Postfix, from userid 33) + id 7347481FB; Wed, 26 Jul 2006 17:34:47 +0200 (CEST) +Received: from gatei2.nameshield.net (gatei2.nameshield.net [82.245.54.114]) + by imp3-g19.free.fr (IMP) with HTTP + for ; Wed, 26 Jul 2006 17:34:47 +0200 +Message-ID: <1153928087.44c78b975f3a7@imp3-g19.free.fr> +Date: Wed, 26 Jul 2006 17:34:47 +0200 +From: nuggets72@free.fr +To: pgsql-performance@postgresql.org +Subject: loading increase into huge table with 50.000.000 records +MIME-Version: 1.0 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +User-Agent: Internet Messaging Program (IMP) 3.2.5 +X-Originating-IP: 82.245.54.114 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.961 tagged_above=0 required=5 tests=NO_REAL_NAME +X-Spam-Level: +X-Archive-Number: 200607/235 +X-Sequence-Number: 20095 + +Hello, +Sorry for my poor english, + +My problem : + +I meet some performance problem during load increase. + +massive update of 50.000.000 records and 2.000.000 insert with a weekly +frequency in a huge table (+50.000.000 records, ten fields, 12 Go on hard disk) + +current performance obtained : 120 records / s +At the beginning, I got a better speed : 1400 records/s + + +CPU : bi xeon 2.40GHz (cache de 512KB) +postgresql version : 8.1.4 +OS : debian Linux sa 2.6.17-mm2 +Hard disk scsi U320 with scsi card U160 on software RAID 1 +Memory : only 1 Go at this time. + + +My database contains less than ten tables. But the main table takes more than 12 +Go on harddisk. This table has got ten text records and two date records. + +I use few connection on this database. + +I try many ideas : +- put severals thousands operations into transaction (with BEGIN and COMMIT) +- modify parameters in postgres.conf like + shared_buffers (several tests with 30000 50000 75000) + fsync = off + checkpoint_segments = 10 (several tests with 20 - 30) + checkpoint_timeout = 1000 (30-1800) + stats_start_collector = off + + unfortunately, I can't use another disk for pg_xlog file. + + +But I did not obtain a convincing result + + + +My program does some resquest quite simple. +It does some +UPDATE table set dat_update=current_date where id=XXXX ; +And if not found +id does some +insert into table + + +My sysadmin tells me write/read on hard disk aren't the pb (see with iostat) + + +Have you got some idea to increase performance for my problem ? + +Thanks. + +Larry. + +From pgsql-performance-owner@postgresql.org Wed Jul 26 13:02:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0DD929FA4E0 + for ; + Wed, 26 Jul 2006 13:02:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99448-01 for + ; + Wed, 26 Jul 2006 13:02:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.aeccom.com (port-83-236-156-26.static.qsc.de + [83.236.156.26]) + by postgresql.org (Postfix) with ESMTP id 8D72B9FA508 + for ; + Wed, 26 Jul 2006 13:02:33 -0300 (ADT) +Received: from localhost (localhost.localdomain [127.0.0.1]) + by mail.aeccom.com (Postfix) with ESMTP id 0240F1C65F; + Wed, 26 Jul 2006 18:02:31 +0200 (CEST) +Received: from mail.aeccom.com ([127.0.0.1]) + by localhost (gate6.aeccom.com [127.0.0.1]) (amavisd-new, port 10024) + with LMTP id 00444-01-12; Wed, 26 Jul 2006 18:02:29 +0200 (CEST) +Received: from [192.168.2.140] (andes.core.aeccom.com [192.168.2.140]) + by mail.aeccom.com (Postfix) with ESMTP id CE2181C57E; + Wed, 26 Jul 2006 18:02:29 +0200 (CEST) +Message-ID: <44C79213.6050308@aeccom.com> +Date: Wed, 26 Jul 2006 18:02:27 +0200 +From: Sven Geisler +Organization: AEC/communications GmbH +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: nuggets72@free.fr +CC: pgsql-performance@postgresql.org +Subject: Re: loading increase into huge table with 50.000.000 records +References: <1153928087.44c78b975f3a7@imp3-g19.free.fr> +In-Reply-To: <1153928087.44c78b975f3a7@imp3-g19.free.fr> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: amavisd-new at aeccom.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.185 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/236 +X-Sequence-Number: 20096 + +Hi Larry, + +Do you run vacuum and analyze frequently? +Did you check PowerPostgresql.com for hints about PostgreSQL tuning? + + +You can increase wal_buffers, checkpoint_segments and checkpoint_timeout +much higher. + +Here is a sample which works for me. +wal_buffers = 128 +checkpoint_segments = 256 +checkpoint_timeout = 3600 + +Cheers +Sven. + + +nuggets72@free.fr schrieb: +> Hello, +> Sorry for my poor english, +> +> My problem : +> +> I meet some performance problem during load increase. +> +> massive update of 50.000.000 records and 2.000.000 insert with a weekly +> frequency in a huge table (+50.000.000 records, ten fields, 12 Go on hard disk) +> +> current performance obtained : 120 records / s +> At the beginning, I got a better speed : 1400 records/s +> +> +> CPU : bi xeon 2.40GHz (cache de 512KB) +> postgresql version : 8.1.4 +> OS : debian Linux sa 2.6.17-mm2 +> Hard disk scsi U320 with scsi card U160 on software RAID 1 +> Memory : only 1 Go at this time. +> +> +> My database contains less than ten tables. But the main table takes more than 12 +> Go on harddisk. This table has got ten text records and two date records. +> +> I use few connection on this database. +> +> I try many ideas : +> - put severals thousands operations into transaction (with BEGIN and COMMIT) +> - modify parameters in postgres.conf like +> shared_buffers (several tests with 30000 50000 75000) +> fsync = off +> checkpoint_segments = 10 (several tests with 20 - 30) +> checkpoint_timeout = 1000 (30-1800) +> stats_start_collector = off +> +> unfortunately, I can't use another disk for pg_xlog file. +> +> +> But I did not obtain a convincing result +> +> +> +> My program does some resquest quite simple. +> It does some +> UPDATE table set dat_update=current_date where id=XXXX ; +> And if not found +> id does some +> insert into table +> +> +> My sysadmin tells me write/read on hard disk aren't the pb (see with iostat) +> +> +> Have you got some idea to increase performance for my problem ? +> +> Thanks. +> +> Larry. +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster + +-- +/This email and any files transmitted with it are confidential and +intended solely for the use of the individual or entity to whom they +are addressed. If you are not the intended recipient, you should not +copy it, re-transmit it, use it or disclose its contents, but should +return it to the sender immediately and delete your copy from your +system. Thank you for your cooperation./ + +Sven Geisler Tel +49.30.5362.1627 Fax .1638 +Senior Developer, AEC/communications GmbH Berlin, Germany + +From pgsql-performance-owner@postgresql.org Wed Jul 26 13:40:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A28669FA6B5 + for ; + Wed, 26 Jul 2006 13:40:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10931-04 for + ; + Wed, 26 Jul 2006 13:39:51 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.logix-tt.com (mail.logix-tt.com [212.211.145.186]) + by postgresql.org (Postfix) with ESMTP id F34809FA64B + for ; + Wed, 26 Jul 2006 13:39:19 -0300 (ADT) +Received: from kingfisher.intern.logix-tt.com (p549D1AB4.dip0.t-ipconnect.de + [84.157.26.180]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.logix-tt.com (Postfix) with ESMTP id A9D31656BE; + Wed, 26 Jul 2006 18:41:06 +0200 (CEST) +Received: from [127.0.0.1] (localhost [127.0.0.1]) + by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 4D5F1181C0BC8; + Wed, 26 Jul 2006 18:39:39 +0200 (CEST) +Message-ID: <44C79ACB.5010507@logix-tt.com> +Date: Wed, 26 Jul 2006 18:39:39 +0200 +From: Markus Schaber +Organization: Logical Tracking and Tracing International AG, Switzerland +User-Agent: Thunderbird 1.5.0.4 (X11/20060713) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Cc: nuggets72@free.fr +Subject: Re: loading increase into huge table with 50.000.000 records +References: <1153928087.44c78b975f3a7@imp3-g19.free.fr> + <44C79213.6050308@aeccom.com> +In-Reply-To: <44C79213.6050308@aeccom.com> +X-Enigmail-Version: 0.94.0.0 +Content-Type: text/plain; charset=ISO-8859-15 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.185 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/237 +X-Sequence-Number: 20097 + +Hi, Larry, +Hi, Sven, + +Sven Geisler wrote: + +> You can increase wal_buffers, checkpoint_segments and checkpoint_timeout +> much higher. + +You also should increase the free space map settings, it must be large +enough to cope with your weekly bunch. + + +Markus + + +-- +Markus Schaber | Logical Tracking&Tracing International AG +Dipl. Inf. | Software Development GIS + +Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org + +From pgsql-performance-owner@postgresql.org Wed Jul 26 13:56:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AFF6C9FA5FB + for ; + Wed, 26 Jul 2006 13:56:35 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18412-05 for + ; + Wed, 26 Jul 2006 13:56:23 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.204]) + by postgresql.org (Postfix) with ESMTP id C6EE59FAD5A + for ; + Wed, 26 Jul 2006 13:56:23 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id z31so49212nzd + for ; + Wed, 26 Jul 2006 09:56:21 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=p294+GA+jWEk1/zNfLWEWqxgcXQ7u+rUo8Jh4MOrDuMcr6uSf06Mw2JNNcz0J/2xWUKn1zimEjqSvOuiXUlyzXQrCAKFK/8RviJyBSwRsaTIhmAQDaLUauMl9/QjxAgEEJLZdRSDwDWqEf0p5X208IRtvvqMfvmKbkmmttqJZC0= +Received: by 10.65.177.18 with SMTP id e18mr7421675qbp; + Wed, 26 Jul 2006 09:56:21 -0700 (PDT) +Received: by 10.65.139.10 with HTTP; Wed, 26 Jul 2006 09:56:21 -0700 (PDT) +Message-ID: +Date: Wed, 26 Jul 2006 12:56:21 -0400 +From: "Merlin Moncure" +To: "nuggets72@free.fr" +Subject: Re: loading increase into huge table with 50.000.000 records +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1153928087.44c78b975f3a7@imp3-g19.free.fr> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <1153928087.44c78b975f3a7@imp3-g19.free.fr> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.216 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/238 +X-Sequence-Number: 20098 + +On 7/26/06, nuggets72@free.fr wrote: +> Hello, +> Sorry for my poor english, +> +> My problem : +> +> I meet some performance problem during load increase. + +> +> massive update of 50.000.000 records and 2.000.000 insert with a weekly +> frequency in a huge table (+50.000.000 records, ten fields, 12 Go on hard disk) +> +> current performance obtained : 120 records / s +> At the beginning, I got a better speed : 1400 records/s +> +> +> CPU : bi xeon 2.40GHz (cache de 512KB) +> postgresql version : 8.1.4 +> OS : debian Linux sa 2.6.17-mm2 +> Hard disk scsi U320 with scsi card U160 on software RAID 1 +> Memory : only 1 Go at this time. +> +> +> My database contains less than ten tables. But the main table takes more than 12 +> Go on harddisk. This table has got ten text records and two date records. +> +> I use few connection on this database. +> +> I try many ideas : +> - put severals thousands operations into transaction (with BEGIN and COMMIT) +> - modify parameters in postgres.conf like +> shared_buffers (several tests with 30000 50000 75000) +> fsync = off +> checkpoint_segments = 10 (several tests with 20 - 30) +> checkpoint_timeout = 1000 (30-1800) +> stats_start_collector = off +> +> unfortunately, I can't use another disk for pg_xlog file. +> +> +> But I did not obtain a convincing result +> +> +> +> My program does some resquest quite simple. +> It does some +> UPDATE table set dat_update=current_date where id=XXXX ; +> And if not found +> id does some +> insert into table +> +> +> My sysadmin tells me write/read on hard disk aren't the pb (see with iostat) + +your sysadmin is probably wrong. random query across 50m table on +machine with 1gb memory is going to cause alot of seeking. take a +look at your pg data folder and you will see it is much larger than +1gb. a lookup of a cached tuple via a cached index might take 0.2ms, +and might take 200ms if it has to completely to disk on a 50m table. +normal reality is somehwere in between depending on various factors. +my guess is that as you add more memory, the time will drift from the +slow case (120/sec) to the fast case (1400/sec). + +you may consider the following alternative: +1. bulk load your 2m update set into scratch table via copy interface +2. update table set dat_update=current_date where table.id=scratch.id +3. insert into table select [...], current_date where not exists +(select id from table where table.id = scratch.id); + +you may experiment with boolean form of #3, using 'except' also. +while running these monster queries definately crank up work mem in +expesnse of shared buffers. + +merlin + + +im am guessing you are bottlenecked at the lookup, not the update. so, if + +From pgsql-performance-owner@postgresql.org Wed Jul 26 14:23:11 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AEBE69FB1BD + for ; + Wed, 26 Jul 2006 14:23:11 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19004-10 for + ; + Wed, 26 Jul 2006 14:23:02 -0300 (ADT) +X-Greylist: delayed 00:21:22.335716 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id C803A9FB0D1 + for ; + Wed, 26 Jul 2006 14:23:02 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from fafnir.androme.com (fafnir.androme.com [62.58.96.158]) + by svr4.postgresql.org (Postfix) with ESMTP id 9A88A5AFB1A + for ; + Wed, 26 Jul 2006 17:01:38 +0000 (GMT) +Received: by fafnir.androme.com (Postfix, from userid 1003) + id 2C76FB91BB8; Wed, 26 Jul 2006 19:02:59 +0200 (CEST) +Message-ID: <44C79FED.5080702@andromeiberica.com> +Date: Wed, 26 Jul 2006 19:01:33 +0200 +From: Arnau +Reply-To: arnaulist@andromeiberica.com +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Is it possible to speed this query up? +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.384 tagged_above=0 required=5 tests=SPF_SOFTFAIL +X-Spam-Level: * +X-Archive-Number: 200607/239 +X-Sequence-Number: 20099 + +Hi all, + + I execute the following query on postgresql 8.1.0: + +SELECT + u.telephone_number + , u.telecom_operator_id + , u.name +FROM + campanas_subcampaign AS sub + , agenda_users AS u + , agenda_users_groups ug +WHERE + sub.customer_app_config_id = 19362 + AND sub.subcampaign_id = 9723 + AND ug.agenda_user_group_id >= sub.ini_user_group_id + AND ug.user_id=u.user_id + AND ug.group_id IN ( SELECT group_id FROM campanas_groups WHERE +customer_app_config_id = 19362 ) + ORDER BY ug.agenda_user_group_id ASC LIMIT 150 + +the explain analyze shouts the following: + + + + Limit (cost=1.20..4600.56 rows=150 width=74) (actual +time=76516.312..76853.191 rows=150 loops=1) + -> Nested Loop (cost=1.20..333424.31 rows=10874 width=74) (actual +time=76516.307..76852.896 rows=150 loops=1) + -> Nested Loop (cost=1.20..299653.89 rows=10874 width=20) +(actual time=76506.926..76512.608 rows=150 loops=1) + Join Filter: ("outer".agenda_user_group_id >= +"inner".ini_user_group_id) + -> Nested Loop IN Join (cost=1.20..189802.77 +rows=32623 width=20) (actual time=75938.659..76353.748 rows=16200 loops=1) + Join Filter: ("outer".group_id = "inner".group_id) + -> Index Scan using pk_agndusrgrp_usergroup on +agenda_users_groups ug (cost=0.00..123740.26 rows=2936058 width=30) +(actual time=0.101..61921.260 rows=2836638 loops=1) + -> Materialize (cost=1.20..1.21 rows=1 width=10) +(actual time=0.001..0.002 rows=1 loops=2836638) + -> Seq Scan on campanas_groups +(cost=0.00..1.20 rows=1 width=10) (actual time=0.052..0.053 rows=1 loops=1) + Filter: (customer_app_config_id = +19362::numeric) + -> Index Scan using pk_cmpnssubc_subcmpnid on +campanas_subcampaign sub (cost=0.00..3.35 rows=1 width=8) (actual +time=0.005..0.006 rows=1 loops=16200) + Index Cond: (subcampaign_id = 9723) + Filter: (customer_app_config_id = 19362::numeric) + -> Index Scan using pk_agenda_uid on agenda_users u +(cost=0.00..3.09 rows=1 width=78) (actual time=2.262..2.264 rows=1 +loops=150) + Index Cond: ("outer".user_id = u.user_id) + Total runtime: 76853.504 ms +(16 rows) + + + +Do you think I could do anything to speed it up? + + +Cheers!! +-- +Arnau + +From pgsql-performance-owner@postgresql.org Wed Jul 26 17:25:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B600C9FA4E0 + for ; + Wed, 26 Jul 2006 17:25:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 81058-01 for + ; + Wed, 26 Jul 2006 17:25:20 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 140859FA004 + for ; + Wed, 26 Jul 2006 17:24:50 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6QKOlVR017742; + Wed, 26 Jul 2006 16:24:47 -0400 (EDT) +To: arnaulist@andromeiberica.com +cc: pgsql-performance@postgresql.org +Subject: Re: Is it possible to speed this query up? +In-reply-to: <44C79FED.5080702@andromeiberica.com> +References: <44C79FED.5080702@andromeiberica.com> +Comments: In-reply-to Arnau + message dated "Wed, 26 Jul 2006 19:01:33 +0200" +Date: Wed, 26 Jul 2006 16:24:47 -0400 +Message-ID: <17741.1153945487@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, + SPF_HELO_PASS, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/240 +X-Sequence-Number: 20100 + +Arnau writes: +> the explain analyze shouts the following: + +The expensive part appears to be this indexscan: + +> -> Index Scan using pk_agndusrgrp_usergroup on +> agenda_users_groups ug (cost=0.00..123740.26 rows=2936058 width=30) +> (actual time=0.101..61921.260 rows=2836638 loops=1) + +Since there's no index condition, the planner is evidently using this +scan just to obtain sort order. I think ordinarily it would use a +seqscan and then sort the final result, which'd be a lot faster if the +whole result were being selected. But you have a LIMIT and it's +mistakenly guessing that only a small part of the table will need to be +scanned before the LIMIT is satisfied. + +Bottom line: try dropping the LIMIT. If you really need the limit to be +enforced on the SQL side, you could try declaring the query as a cursor +and only fetching 150 rows from it. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 27 11:23:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3A0B59FB1FD + for ; + Thu, 27 Jul 2006 11:23:40 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02898-10 for + ; + Thu, 27 Jul 2006 11:23:30 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.198]) + by postgresql.org (Postfix) with ESMTP id B66BE9FA68D + for ; + Thu, 27 Jul 2006 11:23:30 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id t14so1449232wxc + for ; + Thu, 27 Jul 2006 07:23:29 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:mime-version:content-type; + b=kBweBLqqNv++QQaAouAiERU8GYRuiKmBQxN2MiJ6irQrsW1oJvz7AcP8bEF/8wBhF4VhcFqwNV4rUhz9qNcdpGWrgholUNttOKAsNyyHvA9X2A5iS3xKeq9BJqQhIkJ40P7snYufiMcD7mpTQkSi9orxrG+Ww1nIFPSKLyiuDs4= +Received: by 10.70.62.6 with SMTP id k6mr250939wxa; + Thu, 27 Jul 2006 07:23:28 -0700 (PDT) +Received: by 10.70.33.19 with HTTP; Thu, 27 Jul 2006 07:23:28 -0700 (PDT) +Message-ID: +Date: Thu, 27 Jul 2006 16:23:28 +0200 +From: Eliott +To: pgsql-performance@postgresql.org +Subject: performance issue with a specific query +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_30322_5938724.1154010208582" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.696 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, HTML_40_50, HTML_MESSAGE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/241 +X-Sequence-Number: 20101 + +------=_Part_30322_5938724.1154010208582 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi! + +I hope I'm sending my question to the right list, please don't flame if it's +the wrong one. + +I have noticed that while a query runs in about 1.5seconds on a 8.xx version +postgresql server on our 7.4.13 it takes around 15-20 minutes. Since we are +using RHEL4 on our server we are stuck with 7.4.13. The enormous time +difference between the different builds drives me crazy. Can you please help +me identifying the bottleneck or suggest anything to improve the dismal +performance. +The query is the following: + +Select + car_license_plate.license_plate, + substr(date_trunc('day', car_km_fuel.transaction_time), 1, 10), + substr(date_trunc('second', car_km_fuel.transaction_time), 12, 8), + vehicle_make.make, + vehicle_type.model, + engine_size, + vehicle_fuel_type.fuel_type, + v_org_person_displayname.displayname_lastfirst, + car_km_fuel.ammount, + car_km_fuel.unit_price, + car_km_fuel.total_ammount, + currency.currency AS, + car_km_fuel.km AS, + vehicle_specific.fuel_capacity, + CASE WHEN (car_km_fuel.ammount > vehicle_specific.fuel_capacity) THEN +CAST(ROUND(CAST(car_km_fuel.ammount - vehicle_specific.fuel_capacity AS +NUMERIC), 2) AS varchar) ELSE '---' END AS "over", + car_km_fuel.notes, +CASE WHEN (prev_car_km_fuel.km IS NOT NULL AND car_km_fuel.km IS NOT NULL +AND (car_km_fuel.km - prev_car_km_fuel.km <> 0)) THEN + CAST(Round(CAST(((car_km_fuel.ammount / (car_km_fuel.km - +prev_car_km_fuel.km)) * 100) AS Numeric), 2) AS VARCHAR) + WHEN (prev_car_km_fuel.km IS NULL) THEN 'xxxx' + WHEN (car_km_fuel.km IS NULL) THEN 'error' END AS "average", + vehicle_specific.consumption_town, + org_person.email_address + +FROM + car_km_fuel + +LEFT JOIN + car ON car.id = car_km_fuel.car_id + +LEFT JOIN + car_license_plate ON car_license_plate.car_id = car.id AND + (car_license_plate.license_plate_end_date < date_trunc('day', +car_km_fuel.transaction_time) OR car_license_plate.license_plate_end_date IS +NULL) +LEFT JOIN + vehicle_specific ON vehicle_specific.id = car.vehicle_specific_id + +LEFT JOIN + vehicle_variant ON vehicle_variant.id = +vehicle_specific.vehicle_variant_id + +LEFT JOIN + vehicle_type ON vehicle_type.id = vehicle_variant.vehicle_type_id + +LEFT JOIN + vehicle_make ON vehicle_make.id = vehicle_type.vehicle_make_id + +LEFT JOIN + vehicle_fuel_type ON vehicle_fuel_type.id = vehicle_specific.fuel_type_id + +LEFT JOIN + car_driver ON car_driver.car_id = car.id AND + car_driver.allocation_date <= date_trunc('day', +car_km_fuel.transaction_time) AND + (car_driver.end_date >= date_trunc('day', +car_km_fuel.transaction_time) OR car_driver.end_date IS NULL) + +LEFT JOIN + v_org_person_displayname ON v_org_person_displayname.id = +car_driver.car_driver_id + +LEFT JOIN + org_person ON org_person.id = v_org_person_displayname.id + +LEFT JOIN + currency ON currency.id = car_km_fuel.currency_id + +LEFT JOIN + car_km_fuel AS prev_car_km_fuel ON + prev_car_km_fuel.transaction_time = (SELECT MAX(transaction_time) FROM +car_km_fuel as car_km_fuel2 WHERE car_km_fuel2.car_id = car.id AND +car_km_fuel2.transaction_time < car_km_fuel.transaction_time) + +LEFT JOIN + org_company ON org_company.id = org_person.company_id + +WHERE + (lower(org_company.name) LIKE lower(:param3) || '%') AND + (car_km_fuel.transaction_time >= :param1 OR :param1 IS NULL) AND + (car_km_fuel.transaction_time <= :param2 OR :param2 IS NULL) + +ORDER BY + 1, 2, 3; + + The output of explain if the following under 7.4.13: + + + + QUERY PLAN +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Sort (cost=66.66..66.66 rows=1 width=917) + Sort Key: car_license_plate.license_plate, +substr((date_trunc('day'::text, car_km_fuel.transaction_time))::text, +1, 10), substr((date_trunc('second'::text, +car_km_fuel.transaction_time))::text, 12, 8) + -> Nested Loop (cost=44.93..66.65 rows=1 width=917) + -> Nested Loop Left Join (cost=44.93..62.23 rows=1 width=921) + Join Filter: ("inner".transaction_time = (subplan)) + -> Nested Loop Left Join (cost=44.93..62.21 rows=1 width=917) + Join Filter: ("inner".id = "outer".currency_id) + -> Nested Loop (cost=44.93..60.92 rows=1 width=828) + -> Hash Join (cost=44.93..58.32 rows=1 width=805) + Hash Cond: ("outer".id = +"inner".car_driver_id) + -> Subquery Scan +v_org_person_displayname (cost=16.42..28.82 rows=196 width=520) + -> Merge Right Join +(cost=16.42..26.86 rows=196 width=51) + Merge Cond: ("outer".id += "inner".company_id) + -> Index Scan using +pk_org_company on org_company co (cost=0.00..29.82 rows=47 width=27) + -> Sort +(cost=16.42..16.91 rows=196 width=28) + Sort Key: pers.company_id + -> Seq Scan on +org_person pers (cost=0.00..8.96 rows=196 width=28) + -> Hash (cost=28.51..28.51 rows=1 width=285) + -> Hash Join +(cost=19.81..28.51 rows=1 width=285) + Hash Cond: +("outer".car_id = "inner".car_id) + Join Filter: +((("outer".allocation_date)::timestamp without time zone <= +date_trunc('day'::text, "inner".transaction_time)) AND +((("outer".end_date)::timestamp without time zone >= +date_trunc('day'::text, "inner".transaction_time)) OR +("outer".end_date IS NULL))) + -> Seq Scan on +car_driver (cost=0.00..7.73 rows=173 width=16) + -> Hash +(cost=19.80..19.80 rows=4 width=285) + -> Hash Left Join +(cost=19.53..19.80 rows=4 width=285) + Hash Cond: +("outer".fuel_type_id = "inner".id) + -> Hash Left +Join (cost=18.50..18.72 rows=4 width=279) + Hash +Cond: ("outer".vehicle_make_id = "inner".id) + -> +Merge Left Join (cost=17.38..17.53 rows=3 width=274) + +Merge Cond: ("outer".vehicle_type_id = "inner".id) + +-> Sort (cost=15.67..15.67 rows=2 width=265) + + Sort Key: vehicle_variant.vehicle_type_id + + -> Nested Loop Left Join (cost=0.00..15.66 rows=2 width=265) + + Join Filter: ("inner".id = "outer".vehicle_variant_id) + + -> Nested Loop Left Join (cost=0.00..13.83 rows=1 +width=265) + + Join Filter: ("inner".id = +"outer".vehicle_specific_id) + + -> Nested Loop Left Join (cost=0.00..10.50 rows=1 +width=234) + + Join Filter: +((("inner".license_plate_end_date)::timestamp without time zone < +date_trunc('day'::text, "outer".transaction_time)) OR +("inner".license_plate_end_date IS NULL)) + + -> Nested Loop (cost=0.00..4.83 rows=1 +width=224) + + -> Seq Scan on car_km_fuel +(cost=0.00..0.00 rows=1 width=216) + + Filter: (((transaction_time >= +'2005-01-01 00:00:00'::timestamp without time zone) OR (now() IS +NULL)) AND (((transaction_time)::timestamp with time zone <= now()) OR +(now() IS NULL))) + + -> Index Scan using pk_car on car +(cost=0.00..4.82 rows=1 width=8) + + Index Cond: (car.id = +"outer".car_id) + + -> Index Scan using +ix_car_license_plate__car_id on car_license_plate (cost=0.00..5.65 +rows=1 width=18) + + Index Cond: (car_license_plate.car_id = +"outer".id) + + -> Seq Scan on vehicle_specific (cost=0.00..2.59 +rows=59 width=39) + + -> Seq Scan on vehicle_variant (cost=0.00..1.37 rows=37 +width=8) + +-> Sort (cost=1.71..1.77 rows=22 width=17) + + Sort Key: vehicle_type.id + + -> Seq Scan on vehicle_type (cost=0.00..1.22 rows=22 width=17) + -> +Hash (cost=1.10..1.10 rows=10 width=13) + +-> Seq Scan on vehicle_make (cost=0.00..1.10 rows=10 width=13) + -> Hash +(cost=1.02..1.02 rows=2 width=14) + -> Seq +Scan on vehicle_fuel_type (cost=0.00..1.02 rows=2 width=14) + -> Index Scan using pk_org_person on +org_person (cost=0.00..2.59 rows=1 width=35) + Index Cond: (org_person.id = +"outer".car_driver_id) + -> Seq Scan on currency (cost=0.00..1.13 +rows=13 width=97) + -> Seq Scan on car_km_fuel prev_car_km_fuel +(cost=0.00..0.00 rows=1 width=16) + SubPlan + -> Aggregate (cost=0.01..0.01 rows=1 width=8) + -> Seq Scan on car_km_fuel car_km_fuel2 +(cost=0.00..0.00 rows=1 width=8) + Filter: ((car_id = $0) AND (transaction_time < $1)) + -> Index Scan using pk_org_company on org_company +(cost=0.00..4.36 rows=1 width=4) + Index Cond: (org_company.id = "outer".company_id) + Filter: (lower((name)::text) ~~ '%'::text) + +(64 rows) + + +If I leave off the where clause or run it on just a couple of recods, the +result is fine. Any ideas? + +Regards +eliott + +------=_Part_30322_5938724.1154010208582 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi!

I hope I'm sending my question to the right list, please don't flame if it's the wrong one.

I have noticed that while a query runs in about 1.5seconds on a 8.xx version postgresql server on our 7.4.13 it takes around 15-20 minutes. Since we are using RHEL4 on our server we are stuck with +7.4.13. The enormous time difference between the different builds drives me crazy. Can you please help me identifying the bottleneck or suggest anything to improve the dismal performance.
The query is the following:
+
Select
  car_license_plate.license_plate,
  substr(date_trunc('day', car_km_fuel.transaction_time), 1, 10),
  substr(date_trunc('second', car_km_fuel.transaction_time), 12, 8),
  vehicle_make.make,
  vehicle_type.model, +
  engine_size,
  vehicle_fuel_type.fuel_type,
  v_org_person_displayname.displayname_lastfirst,
  car_km_fuel.ammount,
  car_km_fuel.unit_price,
  car_km_fuel.total_ammount,
  currency.currency AS,
+  car_km_fuel.km AS,
  vehicle_specific.fuel_capacity,
  CASE WHEN (car_km_fuel.ammount > vehicle_specific.fuel_capacity) THEN CAST(ROUND(CAST(car_km_fuel.ammount - vehicle_specific.fuel_capacity AS NUMERIC), 2) AS varchar) ELSE '---' END AS "over", +
  car_km_fuel.notes,
CASE WHEN (prev_car_km_fuel.km IS NOT NULL AND car_km_fuel.km IS NOT NULL AND (car_km_fuel.km - prev_car_km_fuel.km <> 0)) THEN
 CAST(Round(CAST(((car_km_fuel.ammount / (car_km_fuel.km - prev_car_km_fuel.km)) * 100) AS Numeric), 2) AS VARCHAR) +
       WHEN (prev_car_km_fuel.km IS NULL) THEN 'xxxx'
       WHEN (car_km_fuel.km IS NULL) THEN 'error' END AS "average",
  vehicle_specific.consumption_town,
  org_person.email_address

FROM +
  car_km_fuel

LEFT JOIN
  car ON car.id = car_km_fuel.car_id

LEFT JOIN
  car_license_plate ON  car_license_plate.car_id = car.id AND
   (car_license_plate.license_plate_end_date < date_trunc('day', car_km_fuel.transaction_time) OR car_license_plate.license_plate_end_date IS NULL) +
LEFT JOIN
  vehicle_specific ON vehicle_specific.id = car.vehicle_specific_id

LEFT JOIN
  vehicle_variant ON vehicle_variant.id = vehicle_specific.vehicle_variant_id

LEFT JOIN
  vehicle_type ON vehicle_type.id = vehicle_variant.vehicle_type_id +

LEFT JOIN
  vehicle_make ON vehicle_make.id = vehicle_type.vehicle_make_id

LEFT JOIN
  vehicle_fuel_type ON vehicle_fuel_type.id = vehicle_specific.fuel_type_id

LEFT JOIN
  car_driver ON car_driver.car_id = +car.id AND
  car_driver.allocation_date <= date_trunc('day', car_km_fuel.transaction_time) AND
                (car_driver.end_date >= date_trunc('day', car_km_fuel.transaction_time) OR car_driver.end_date IS NULL) +

LEFT JOIN
  v_org_person_displayname ON v_org_person_displayname.id = car_driver.car_driver_id

LEFT JOIN
  org_person ON org_person.id = v_org_person_displayname.id

LEFT JOIN
  currency ON +currency.id = car_km_fuel.currency_id

LEFT JOIN
  car_km_fuel AS prev_car_km_fuel ON
  prev_car_km_fuel.transaction_time = (SELECT MAX(transaction_time) FROM car_km_fuel as car_km_fuel2 WHERE car_km_fuel2.car_id = +car.id AND car_km_fuel2.transaction_time < car_km_fuel.transaction_time)

LEFT JOIN  
  org_company ON org_company.id = org_person.company_id

WHERE
  (lower(org_company.name) LIKE lower(:param3) || '%') AND +
  (car_km_fuel.transaction_time >= :param1 OR :param1 IS NULL) AND
  (car_km_fuel.transaction_time <= :param2 OR :param2 IS NULL)
 
ORDER BY
  1, 2, 3;

 The output of explain if the following under +7.4.13:

                                                                                                                                                    QUERY PLAN                                                                                                                                                      
+
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +
Sort (cost=66.66..66.66 rows=1 width=917)
Sort Key: car_license_plate.license_plate, substr((date_trunc('day'::text, car_km_fuel.transaction_time))::text, 1, 10), substr((date_trunc('second'::text, car_km_fuel.transaction_time))::text, 12, 8) +
-> Nested Loop (cost=44.93..66.65 rows=1 width=917)
-> Nested Loop Left Join (cost=44.93..62.23 rows=1 width=921)
Join Filter: ("inner".transaction_time = (subplan)) +
-> Nested Loop Left Join (cost=44.93..62.21 rows=1 width=917)
Join Filter: ("inner".id = "outer".currency_id)
-> Nested Loop (cost= +44.93..60.92 rows=1 width=828)
-> Hash Join (cost=44.93..58.32 rows=1 width=805)
Hash Cond: ("outer".id = "inner".car_driver_id)
+ -> Subquery Scan v_org_person_displayname (cost=16.42..28.82 rows=196 width=520)
-> Merge Right Join (cost=16.42..26.86 rows=196 width=51) +
Merge Cond: ("outer".id = "inner".company_id)
-> Index Scan using pk_org_company on org_company co (cost= +0.00..29.82 rows=47 width=27)
-> Sort (cost=16.42..16.91 rows=196 width=28)
Sort Key: pers.company_id
-> Seq Scan on org_person pers (cost= +0.00..8.96 rows=196 width=28)
-> Hash (cost=28.51..28.51 rows=1 width=285)
-> Hash Join (cost=19.81..28.51 rows=1 width=285)
Hash Cond: ("outer".car_id = "inner".car_id) +
Join Filter: ((("outer".allocation_date)::timestamp without time zone <= date_trunc('day'::text, "inner".transaction_time)) AND ((("outer".end_date)::timestamp without time zone >= date_trunc('day'::text, "inner".transaction_time)) OR ("outer".end_date IS NULL))) +
-> Seq Scan on car_driver (cost=0.00..7.73 rows=173 width=16)
-> Hash (cost=19.80..19.80 rows=4 width=285)
-> Hash Left Join (cost= +19.53..19.80 rows=4 width=285)
Hash Cond: ("outer".fuel_type_id = "inner".id)
-> Hash Left Join (cost= +18.50..18.72 rows=4 width=279)
Hash Cond: ("outer".vehicle_make_id = "inner".id)
-> Merge Left Join (cost= +17.38..17.53 rows=3 width=274)
Merge Cond: ("outer".vehicle_type_id = "inner".id)
-> Sort (cost= +15.67..15.67 rows=2 width=265)
Sort Key: vehicle_variant.vehicle_type_id
-> Nested Loop Left Join (cost= +0.00..15.66 rows=2 width=265)
Join Filter: ("inner".id = "outer".vehicle_variant_id)
-> Nested Loop Left Join (cost= +0.00..13.83 rows=1 width=265)
Join Filter: ("inner".id = "outer".vehicle_specific_id)
-> Nested Loop Left Join (cost= +0.00..10.50 rows=1 width=234)
Join Filter: ((("inner".license_plate_end_date)::timestamp without time zone < date_trunc('day'::text, "outer".transaction_time)) OR ("inner".license_plate_end_date IS NULL)) +
-> Nested Loop (cost=0.00..4.83 rows=1 width=224)
-> Seq Scan on car_km_fuel (cost= +0.00..0.00 rows=1 width=216)
Filter: (((transaction_time >= '2005-01-01 00:00:00'::timestamp without time zone) OR (now() IS NULL)) AND (((transaction_time)::timestamp with time zone <= now()) OR (now() IS NULL))) +
-> Index Scan using pk_car on car (cost=0.00..4.82 rows=1 width=8)
Index Cond: ( +car.id = "outer".car_id)
-> Index Scan using ix_car_license_plate__car_id on car_license_plate (cost= +0.00..5.65 rows=1 width=18)
Index Cond: (car_license_plate.car_id = "outer".id)
-> Seq Scan on vehicle_specific (cost= +0.00..2.59 rows=59 width=39)
-> Seq Scan on vehicle_variant (cost=0.00..1.37 rows=37 width=8)
-> Sort (cost= +1.71..1.77 rows=22 width=17)
Sort Key: vehicle_type.id
-> Seq Scan on vehicle_type (cost= +0.00..1.22 rows=22 width=17)
-> Hash (cost=1.10..1.10 rows=10 width=13)
-> Seq Scan on vehicle_make (cost= +0.00..1.10 rows=10 width=13)
-> Hash (cost=1.02..1.02 rows=2 width=14)
-> Seq Scan on vehicle_fuel_type (cost= +0.00..1.02 rows=2 width=14)
-> Index Scan using pk_org_person on org_person (cost=0.00..2.59 rows=1 width=35)
Index Cond: (org_person.id = "outer".car_driver_id) +
-> Seq Scan on currency (cost=0.00..1.13 rows=13 width=97)
-> Seq Scan on car_km_fuel prev_car_km_fuel (cost=0.00..0.00 rows=1 width=16)
SubPlan
-> Aggregate (cost= +0.01..0.01 rows=1 width=8)
-> Seq Scan on car_km_fuel car_km_fuel2 (cost=0.00..0.00 rows=1 width=8)
Filter: ((car_id = $0) AND (transaction_time < $1))
+ -> Index Scan using pk_org_company on org_company (cost=0.00..4.36 rows=1 width=4)
Index Cond: (org_company.id = "outer".company_id)
Filter: (lower((name)::text) ~~ '%'::text) +

(64 rows)

If I leave off the where clause or run it on just a couple of recods, the result is fine. Any ideas?

Regards
eliott
+ +------=_Part_30322_5938724.1154010208582-- + +From pgsql-performance-owner@postgresql.org Thu Jul 27 11:47:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 812329FB203 + for ; + Thu, 27 Jul 2006 11:47:04 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 05400-07 for + ; + Thu, 27 Jul 2006 11:46:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id AF0459FB202 + for ; + Thu, 27 Jul 2006 11:46:28 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Thu, 27 Jul 2006 14:46:26 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 27 Jul 2006 09:46:26 -0500 +Subject: Re: performance issue with a specific query +From: Scott Marlowe +To: Eliott +Cc: pgsql-performance@postgresql.org +In-Reply-To: +References: +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1154011586.31664.85.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Thu, 27 Jul 2006 09:46:26 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, SPF_PASS, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/242 +X-Sequence-Number: 20102 + +On Thu, 2006-07-27 at 09:23, Eliott wrote: +> Hi! +> +> I hope I'm sending my question to the right list, please don't flame +> if it's the wrong one. +> +> I have noticed that while a query runs in about 1.5seconds on a 8.xx +> version postgresql server on our 7.4.13 it takes around 15-20 minutes. +> Since we are using RHEL4 on our server we are stuck with 7.4.13. The +> enormous time difference between the different builds drives me crazy. +> Can you please help me identifying the bottleneck or suggest anything +> to improve the dismal performance. + +You are absolutely on the right list. A couple of points. + +1: Which 8.xx? 8.0.x or 8.1.x? 8.1.x is literally light years ahead +of 7.4 in terms of performance. 8.0 is somewhere between them. The +performance difference you're seeing is pretty common. + +2: Looking at your query, there are places where you're joining on +things like date_trunc(...). In 7.4 the database will not, and cannot +use a normal index on the date field for those kinds of things. It can, +however, use a funtional index on some of them. Try creating an index +on date_trunc('day',yourfieldhere) and see if that helps. + +3: You are NOT Stuck on 7.4.13. I have a RHEL server that will be +running 8.1.4 or so pretty soon as a dataware house. It may get updated +to RHEL4, may not. You can either compile from the .tar.[gz|bz2] files +or download the PGDG rpms for your distro. + +4: You are fighting an uphill battle. There were a LOT of improvements +made all over in the march from 7.4 to 8.1. Not all of them were simple +planner tweaks and shortcuts, but honest to goodness changes to the way +things happen. No amount of tuning can make 7.4 run as fast as 8.1. + +From pgsql-performance-owner@postgresql.org Thu Jul 27 11:52:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A0F249FB202 + for ; + Thu, 27 Jul 2006 11:52:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 06593-05 for + ; + Thu, 27 Jul 2006 11:52:33 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.199]) + by postgresql.org (Postfix) with ESMTP id 7784F9FA68D + for ; + Thu, 27 Jul 2006 11:52:33 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id n29so63989nzf + for ; + Thu, 27 Jul 2006 07:52:31 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=inuBPcp0U9JyZu5RCghRkithovGZW+Suf+VSDKx+LEmTNpgD65p8Sdb1mySMiqJQ0sHyFWmX4LsYRYvHhjpBjwO05VZpejT4K8/EDEtneOVO668X1z/HXoc8xfOOlSLV+kZxQrLp6+7q/VR3xug5G/+VRl8EBNuy26yWhfDJeio= +Received: by 10.65.138.4 with SMTP id q4mr9052678qbn; + Thu, 27 Jul 2006 07:52:31 -0700 (PDT) +Received: by 10.65.139.10 with HTTP; Thu, 27 Jul 2006 07:52:31 -0700 (PDT) +Message-ID: +Date: Thu, 27 Jul 2006 10:52:31 -0400 +From: "Merlin Moncure" +To: Eliott +Subject: Re: performance issue with a specific query +Cc: pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.209 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/243 +X-Sequence-Number: 20103 + +On 7/27/06, Eliott wrote: +> Hi! +> +> I hope I'm sending my question to the right list, please don't flame if it's +> the wrong one. +> +> I have noticed that while a query runs in about 1.5seconds on a 8.xx version +> postgresql server on our 7.4.13 it takes around 15-20 minutes. Since we are +> using RHEL4 on our server we are stuck with 7.4.13. The enormous time +> difference between the different builds drives me crazy. Can you please help +> me identifying the bottleneck or suggest anything to improve the dismal +> performance. +> The query is the following: +> + +try turning off genetic query optimization. regarding the rhel4 +issue...does rhel not come with a c compiler? :) + +merlin + +From pgsql-performance-owner@postgresql.org Thu Jul 27 12:39:56 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7055C9FB203 + for ; + Thu, 27 Jul 2006 12:39:55 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10855-04 for + ; + Thu, 27 Jul 2006 12:39:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from lists.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 6B7D09FB1FB + for ; + Thu, 27 Jul 2006 12:39:44 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by lists.commandprompt.com (8.13.6/8.13.6) with ESMTP id k6RFdfat002577; + Thu, 27 Jul 2006 08:39:41 -0700 +Message-ID: <44C8DE3E.4060208@commandprompt.com> +Date: Thu, 27 Jul 2006 08:39:42 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.4 (X11/20060615) +MIME-Version: 1.0 +To: Merlin Moncure +CC: Eliott , pgsql-performance@postgresql.org +Subject: Re: performance issue with a specific query +References: + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: ClamAV version 0.88.2, + clamav-milter version 0.88.2 on projects.commandprompt.com +X-Virus-Status: Clean +X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by + milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); + Thu, 27 Jul 2006 08:39:42 -0700 (PDT) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.154 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/244 +X-Sequence-Number: 20104 + +>> +> +> try turning off genetic query optimization. regarding the rhel4 +> issue...does rhel not come with a c compiler? :) + +Enterprises are not going to compile. They are going to accept the +latest support by vendor release. + +Redhat has a tendency to be incredibly stupid about this particular +area of their packaging. + +Joshua D. Drake + + +> +> merlin +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq +> + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Sun Jul 30 23:52:40 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 76EE89FB1E3 + for ; + Thu, 27 Jul 2006 13:29:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 16918-03 for + ; + Thu, 27 Jul 2006 13:29:31 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from web51712.mail.yahoo.com (web51712.mail.yahoo.com + [206.190.39.77]) by postgresql.org (Postfix) with SMTP id 00F1B9FA506 + for ; + Thu, 27 Jul 2006 13:29:30 -0300 (ADT) +Received: (qmail 56179 invoked by uid 60001); 27 Jul 2006 16:29:29 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=xIxAVcrC4a4Yd1Yryosur2OWx/og18o774keeSxNyVSFF/vdTvHNO5HLTTJpg2NUaQ+nPo3zEHYTnrRAzE+SOUOlwKO/ZCDzOuY2w1nR5pliGHfe8bJlM+gaE2NBcB8/ltW9+bbDUGYtjeTTykbjL6/0G6q71jOZy8itC7RbsIw= + ; +Message-ID: <20060727162929.56177.qmail@web51712.mail.yahoo.com> +Received: from [84.43.136.53] by web51712.mail.yahoo.com via HTTP; + Thu, 27 Jul 2006 09:29:29 PDT +Date: Thu, 27 Jul 2006 09:29:29 -0700 (PDT) +From: Hristo Markov +Subject: How to increase performance? +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-693910167-1154017769=:54607" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.73 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, + HTML_30_40, HTML_MESSAGE +X-Spam-Level: *** +X-Archive-Number: 200607/292 +X-Sequence-Number: 20152 + +--0-693910167-1154017769=:54607 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hello, + + My name is Hristo Markov. I am software developer. + + I am developing software systems (with C/C++ program language) that work on Windows operation system and uses ODBC driver and ACCESS database. I want to change database with PostgreSQL. + + The systems working without problems with PostgreSQL and ODBC, but the performance and speed of updating and reading of data are very low. + + I run the test program working on one single computer under Windows XP operating system and working with equal data (I use around 10 tables at the same time). The difference is only databases and ODBC drivers. + + + The results from speed and performance of the test program are: + + Around 10 seconds under Access database. +Around 40 seconds under PostgreSQL database. + +Please help me to increase speed and performance of PostgreSQL. + + /I am freshman in PostgreSQL and I thing that may be must set some settings / + + Thank you in advance, + + Sincerely, +Hristo Markov + + + +--------------------------------- +Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1�/min. +--0-693910167-1154017769=:54607 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +
Hello,
 
My name is Hristo Markov. I am software developer.
 
I am developing software systems (with C/C++ program language) that work on Windows operation system and uses ODBC driver and ACCESS database. I want to change database with PostgreSQL.
 
The systems working without problems with PostgreSQL and ODBC, but the performance and speed of updating and reading of data are very low.
 
I run the test program working on one single computer under Windows XP operating system and working with equal data (I use around 10 tables at the same time). The difference is only databases and ODBC drivers.

 
The results from speed and performance of the test program are:
 
Around 10 seconds under Access database.
Around 40 seconds under PostgreSQL database.

Please help me to + increase speed and performance of PostgreSQL.
 
/I am freshman in PostgreSQL and I thing that may be must set some settings /
 
Thank you in advance,
 
Sincerely,
Hristo Markov
 

+


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1�/min. +--0-693910167-1154017769=:54607-- + +From pgsql-performance-owner@postgresql.org Sun Jul 30 23:52:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E877A9FB20A + for ; + Thu, 27 Jul 2006 13:45:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 17468-08 for + ; + Thu, 27 Jul 2006 13:45:42 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from bay0-omc3-s39.bay0.hotmail.com (bay0-omc3-s39.bay0.hotmail.com + [65.54.246.239]) + by postgresql.org (Postfix) with ESMTP id 03BAD9FA682 + for ; + Thu, 27 Jul 2006 13:45:11 -0300 (ADT) +Received: from hotmail.com ([207.46.11.17]) by bay0-omc3-s39.bay0.hotmail.com + with Microsoft SMTPSVC(6.0.3790.1830); + Thu, 27 Jul 2006 09:45:10 -0700 +Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; + Thu, 27 Jul 2006 09:45:07 -0700 +Message-ID: +Received: from 84.193.85.191 by BAY123-DAV7.phx.gbl with DAV; + Thu, 27 Jul 2006 16:45:06 +0000 +X-Originating-IP: [84.193.85.191] +X-Originating-Email: [nbforyou@hotmail.com] +X-Sender: nbforyou@hotmail.com +From: "NbForYou" +To: +Subject: Query 200x slower on server [PART 2] +Date: Thu, 27 Jul 2006 18:45:03 +0200 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0063_01C6B1AC.C56FAF40" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2900.2869 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 +X-OriginalArrivalTime: 27 Jul 2006 16:45:07.0587 (UTC) + FILETIME=[048AFD30:01C6B19C] +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.954 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_MESSAGE, + MSGID_FROM_MTA_HEADER, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/293 +X-Sequence-Number: 20153 + +This is a multi-part message in MIME format. + +------=_NextPart_000_0063_01C6B1AC.C56FAF40 +Content-Type: text/plain; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + +See Query 200x slower on server [PART 1] before reading any further + +QUERY PLAN ON MY HOME SERVER +Sort (cost=3D1516.55..1516.59 rows=3D15 width=3D640) (actual = +time=3D123.008..123.435 rows=3D1103 loops=3D1) + Sort Key: aanmaakdatum + -> Subquery Scan producttabel (cost=3D1515.39..1516.26 rows=3D15 = +width=3D640) (actual time=3D112.890..119.067 rows=3D1103 loops=3D1) + -> Unique (cost=3D1515.39..1516.11 rows=3D15 width=3D834) = +(actual time=3D112.886..117.950 rows=3D1103 loops=3D1) + InitPlan + -> Index Scan using geg_winkel_pkey on geg_winkel = +(cost=3D0.00..5.44 rows=3D1 width=3D4) (actual time=3D0.022..0.023 = +rows=3D1 loops=3D1) + Index Cond: (winkelid =3D 0) + -> Index Scan using geg_winkel_pkey on geg_winkel = +(cost=3D0.00..5.44 rows=3D1 width=3D4) (actual time=3D0.004..0.005 = +rows=3D1 loops=3D1) + Index Cond: (winkelid =3D 0) + -> Group (cost=3D1504.51..1505.18 rows=3D15 width=3D834) = +(actual time=3D112.880..115.682 rows=3D1136 loops=3D1) + -> Sort (cost=3D1504.51..1504.55 rows=3D15 = +width=3D834) (actual time=3D112.874..113.255 rows=3D1137 loops=3D1) + Sort Key: p.productid, p.serienummer, = +p.artikelnaam, p.inkoopprijs, p.vasteverkoopprijs, gegw.winkelid, = +gegw.winkelnaam, gegw.winkelnaamnl, gegw.winkelnaamenkelvoud, = +gegw.winkelnaamenkelvoudnl, defg.genrenaam, defg.genrenaamnl, p. (..) + -> Hash Join (cost=3D925.74..1504.22 = +rows=3D15 width=3D834) (actual time=3D34.143..107.937 rows=3D1137 = +loops=3D1) + Hash Cond: ("outer".leverancierid =3D = +"inner".leverancierid) + -> Nested Loop (cost=3D924.29..1502.54 = +rows=3D15 width=3D829) (actual time=3D34.041..105.706 rows=3D1137 = +loops=3D1) + -> Hash Join = +(cost=3D924.29..1399.67 rows=3D20 width=3D829) (actual = +time=3D32.698..71.780 rows=3D3852 loops=3D1) + Hash Cond: ("outer".winkelid = +=3D "inner".winkelid) + -> Hash Left Join = +(cost=3D918.33..1373.61 rows=3D3981 width=3D249) (actual = +time=3D31.997..64.938 rows=3D3852 loops=3D1) + Hash Cond: = +("outer".genreid =3D "inner".genreid) + -> Hash Left Join = +(cost=3D917.14..1312.71 rows=3D3981 width=3D117) (actual = +time=3D31.946..60.961 rows=3D3852 loops=3D1) + Hash Cond: = +("outer".onderwerpid =3D "inner".onderwerpid) + -> Hash Left = +Join (cost=3D904.72..1240.57 rows=3D3981 width=3D117) (actual = +time=3D31.104..56.264 rows=3D3852 loops=3D1) + Hash Cond: = +("outer".onderwerpid =3D "inner".onderwerpid) + -> Merge = +Right Join (cost=3D890.28..1166.42 rows=3D3981 width=3D101) (actual = +time=3D29.938..50.406 rows=3D3852 loops=3D1) + = +Merge Cond: ("outer".productid =3D "inner".productid) + -> = +Index Scan using koppel_product_onderwerp_pkey on = +koppel_product_onderwerp kpo (cost=3D0.00..216.34 rows=3D5983 = +width=3D8) (actual time=3D0.011..8.537 rows=3D5965 loops=3D1) + -> = +Sort (cost=3D890.28..900.23 rows=3D3981 width=3D97) (actual = +time=3D29.918..31.509 rows=3D3852 loops=3D1) + = + Sort Key: p.productid + = + -> Seq Scan on product p (cost=3D0.00..652.24 rows=3D3981 width=3D97) = +(actual time=3D0.012..18.012 rows=3D3819 loops=3D1) + = + Filter: (afdelingid =3D 1) + -> Hash = +(cost=3D12.75..12.75 rows=3D675 width=3D20) (actual time=3D1.119..1.119 = +rows=3D675 loops=3D1) + -> = +Seq Scan on geg_onderwerp gego (cost=3D0.00..12.75 rows=3D675 = +width=3D20) (actual time=3D0.010..0.598 rows=3D675 loops=3D1) + -> Hash = +(cost=3D10.74..10.74 rows=3D674 width=3D8) (actual time=3D0.822..0.822 = +rows=3D674 loops=3D1) + -> Seq = +Scan on koppel_onderwerp_genre kog (cost=3D0.00..10.74 rows=3D674 = +width=3D8) (actual time=3D0.010..0.423 rows=3D674 loops=3D1) + -> Hash = +(cost=3D1.15..1.15 rows=3D15 width=3D140) (actual time=3D0.033..0.033 = +rows=3D15 loops=3D1) + -> Seq Scan on = +geg_genre defg (cost=3D0.00..1.15 rows=3D15 width=3D140) (actual = +time=3D0.004..0.017 rows=3D15 loops=3D1) + -> Hash (cost=3D5.96..5.96 = +rows=3D1 width=3D584) (actual time=3D0.682..0.682 rows=3D197 loops=3D1) + -> Seq Scan on = +geg_winkel gegw (cost=3D0.00..5.96 rows=3D1 width=3D584) (actual = +time=3D0.042..0.390 rows=3D197 loops=3D1) + Filter: ((lft = +>=3D $0) AND (lft <=3D $1)) + -> Index Scan using = +product_eigenschap_key on product_eigenschap pe (cost=3D0.00..5.13 = +rows=3D1 width=3D4) (actual time=3D0.006..0.007 rows=3D0 loops=3D3852) + Index Cond: = +("outer".productid =3D pe.productid) + Filter: (stocktypeid < 3) + -> Hash (cost=3D1.36..1.36 rows=3D36 = +width=3D13) (actual time=3D0.081..0.081 rows=3D36 loops=3D1) + -> Seq Scan on geg_leverancier dl = + (cost=3D0.00..1.36 rows=3D36 width=3D13) (actual time=3D0.010..0.042 = +rows=3D36 loops=3D1) +Total runtime: 125.432 ms + + +This means that the Query is 200 times slower on the webhost! + +How can I resolve this? +------=_NextPart_000_0063_01C6B1AC.C56FAF40 +Content-Type: text/html; + charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable + + + + + + + + +
See Query 200x slower on server [PART 1] before = +reading any=20 +further
+
 
+
QUERY PLAN ON MY HOME SERVER
+
Sort  (cost=3D1516.55..1516.59 rows=3D15 = +width=3D640) (actual=20 +time=3D123.008..123.435 rows=3D1103 loops=3D1)
  Sort Key:=20 +aanmaakdatum
  ->  Subquery Scan producttabel =20 +(cost=3D1515.39..1516.26 rows=3D15 width=3D640) (actual = +time=3D112.890..119.067=20 +rows=3D1103 loops=3D1)
        = +-> =20 +Unique  (cost=3D1515.39..1516.11 rows=3D15 width=3D834) (actual=20 +time=3D112.886..117.950 rows=3D1103=20 +loops=3D1)
          = +;   =20 +InitPlan
          &= +nbsp;    =20 +->  Index Scan using geg_winkel_pkey on geg_winkel =20 +(cost=3D0.00..5.44 rows=3D1 width=3D4) (actual time=3D0.022..0.023 = +rows=3D1=20 +loops=3D1)
          = +;           =20 +Index Cond: (winkelid =3D=20 +0)
           &= +nbsp;   =20 +->  Index Scan using geg_winkel_pkey on geg_winkel =20 +(cost=3D0.00..5.44 rows=3D1 width=3D4) (actual time=3D0.004..0.005 = +rows=3D1=20 +loops=3D1)
          = +;           =20 +Index Cond: (winkelid =3D=20 +0)
           &= +nbsp; =20 +->  Group  (cost=3D1504.51..1505.18 rows=3D15 width=3D834) = +(actual=20 +time=3D112.880..115.682 rows=3D1136=20 +loops=3D1)
          = +;         =20 +->  Sort  (cost=3D1504.51..1504.55 rows=3D15 width=3D834) = +(actual=20 +time=3D112.874..113.255 rows=3D1137=20 +loops=3D1)
          = +;            = +   =20 +Sort Key: p.productid, p.serienummer, p.artikelnaam, p.inkoopprijs,=20 +p.vasteverkoopprijs, gegw.winkelid, gegw.winkelnaam, gegw.winkelnaamnl,=20 +gegw.winkelnaamenkelvoud, gegw.winkelnaamenkelvoudnl, defg.genrenaam,=20 +defg.genrenaamnl, p.=20 +(..)
           = +;            = +  =20 +->  Hash Join  (cost=3D925.74..1504.22 rows=3D15 = +width=3D834) (actual=20 +time=3D34.143..107.937 rows=3D1137=20 +loops=3D1)
          = +;            = +         =20 +Hash Cond: ("outer".leverancierid =3D=20 +"inner".leverancierid)
        = +;            = +           =20 +->  Nested Loop  (cost=3D924.29..1502.54 rows=3D15 = +width=3D829) (actual=20 +time=3D34.041..105.706 rows=3D1137=20 +loops=3D1)
          = +;            = +            &= +nbsp;  =20 +->  Hash Join  (cost=3D924.29..1399.67 rows=3D20 = +width=3D829) (actual=20 +time=3D32.698..71.780 rows=3D3852=20 +loops=3D1)
          = +;            = +            &= +nbsp;        =20 +Hash Cond: ("outer".winkelid =3D=20 +"inner".winkelid)
        &nbs= +p;            = +;            = +          =20 +->  Hash Left Join  (cost=3D918.33..1373.61 rows=3D3981 = +width=3D249)=20 +(actual time=3D31.997..64.938 rows=3D3852=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;  =20 +Hash Cond: ("outer".genreid =3D=20 +"inner".genreid)
         = +;            = +            &= +nbsp;           &n= +bsp;   =20 +->  Hash Left Join  (cost=3D917.14..1312.71 rows=3D3981 = +width=3D117)=20 +(actual time=3D31.946..60.961 rows=3D3852=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;        =20 +Hash Cond: ("outer".onderwerpid =3D=20 +"inner".onderwerpid)
        &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;          =20 +->  Hash Left Join  (cost=3D904.72..1240.57 rows=3D3981 = +width=3D117)=20 +(actual time=3D31.104..56.264 rows=3D3852=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;  =20 +Hash Cond: ("outer".onderwerpid =3D=20 +"inner".onderwerpid)
        &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;            = +;    =20 +->  Merge Right Join  (cost=3D890.28..1166.42 rows=3D3981 = +width=3D101)=20 +(actual time=3D29.938..50.406 rows=3D3852=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;        =20 +Merge Cond: ("outer".productid =3D=20 +"inner".productid)
        &nb= +sp;           &nbs= +p;            = +;            = +            &= +nbsp;         =20 +->  Index Scan using koppel_product_onderwerp_pkey on=20 +koppel_product_onderwerp kpo  (cost=3D0.00..216.34 rows=3D5983 = +width=3D8) (actual=20 +time=3D0.011..8.537 rows=3D5965=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;        =20 +->  Sort  (cost=3D890.28..900.23 rows=3D3981 width=3D97) = +(actual=20 +time=3D29.918..31.509 rows=3D3852=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;  =20 +Sort Key:=20 +p.productid
         &nbs= +p;            = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;  =20 +->  Seq Scan on product p  (cost=3D0.00..652.24 rows=3D3981 = +width=3D97)=20 +(actual time=3D0.012..18.012 rows=3D3819=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;        =20 +Filter: (afdelingid =3D=20 +1)
           &= +nbsp;           &n= +bsp;           &nb= +sp;           &nbs= +p;            = +; =20 +->  Hash  (cost=3D12.75..12.75 rows=3D675 width=3D20) = +(actual=20 +time=3D1.119..1.119 rows=3D675=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;        =20 +->  Seq Scan on geg_onderwerp gego  (cost=3D0.00..12.75 = +rows=3D675=20 +width=3D20) (actual time=3D0.010..0.598 rows=3D675=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;        =20 +->  Hash  (cost=3D10.74..10.74 rows=3D674 width=3D8) = +(actual=20 +time=3D0.822..0.822 rows=3D674=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;           &nb= +sp;  =20 +->  Seq Scan on koppel_onderwerp_genre kog  = +(cost=3D0.00..10.74=20 +rows=3D674 width=3D8) (actual time=3D0.010..0.423 rows=3D674=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;  =20 +->  Hash  (cost=3D1.15..1.15 rows=3D15 width=3D140) (actual = + +time=3D0.033..0.033 rows=3D15=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;        =20 +->  Seq Scan on geg_genre defg  (cost=3D0.00..1.15 = +rows=3D15 width=3D140)=20 +(actual time=3D0.004..0.017 rows=3D15=20 +loops=3D1)
          = +;            = +            &= +nbsp;        =20 +->  Hash  (cost=3D5.96..5.96 rows=3D1 width=3D584) (actual=20 +time=3D0.682..0.682 rows=3D197=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;  =20 +->  Seq Scan on geg_winkel gegw  (cost=3D0.00..5.96 = +rows=3D1 width=3D584)=20 +(actual time=3D0.042..0.390 rows=3D197=20 +loops=3D1)
          = +;            = +            &= +nbsp;           &n= +bsp;        =20 +Filter: ((lft >=3D $0) AND (lft <=3D=20 +$1))
           = +;            = +            &= +nbsp; =20 +->  Index Scan using product_eigenschap_key on = +product_eigenschap=20 +pe  (cost=3D0.00..5.13 rows=3D1 width=3D4) (actual = +time=3D0.006..0.007 rows=3D0=20 +loops=3D3852)
         &n= +bsp;           &nb= +sp;           &nbs= +p;         =20 +Index Cond: ("outer".productid =3D=20 +pe.productid)
         &n= +bsp;           &nb= +sp;           &nbs= +p;         =20 +Filter: (stocktypeid <=20 +3)
           &= +nbsp;           &n= +bsp;       =20 +->  Hash  (cost=3D1.36..1.36 rows=3D36 width=3D13) (actual=20 +time=3D0.081..0.081 rows=3D36=20 +loops=3D1)
          = +;            = +            &= +nbsp;  =20 +->  Seq Scan on geg_leverancier dl  (cost=3D0.00..1.36 = +rows=3D36=20 +width=3D13) (actual time=3D0.010..0.042 rows=3D36 loops=3D1)
Total = +runtime: 125.432=20 +ms
+
 
+
This means that the Query is 200 times slower on the = + +webhost!
+
 
+
How can I resolve this?
+ +------=_NextPart_000_0063_01C6B1AC.C56FAF40-- + +From pgsql-performance-owner@postgresql.org Thu Jul 27 15:41:05 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3380C9FA5FC + for ; + Thu, 27 Jul 2006 15:41:05 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37921-09-2 + for ; + Thu, 27 Jul 2006 15:40:54 -0300 (ADT) +X-Greylist: delayed 01:09:03.037097 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 4FD149FB233 + for ; + Thu, 27 Jul 2006 15:40:16 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by svr4.postgresql.org (Postfix) with ESMTP id D792B5AF035 + for ; + Thu, 27 Jul 2006 17:30:11 +0000 (GMT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 27 Jul 2006 10:19:15 -0700 +Subject: Savepoint performance +From: Mark Lewis +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Thu, 27 Jul 2006 10:19:15 -0700 +Message-Id: <1154020755.1634.509.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.24 tagged_above=0 required=5 tests=AWL, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/246 +X-Sequence-Number: 20106 + +All, + +I support a system that runs on several databases including PostgreSQL. +I've noticed that the other DB's always put an implicit savepoint before +each statement executed, and roll back to that savepoint if the +statement fails for some reason. PG does not, so unless you manually +specify a savepoint you lose all previous work in the transaction. + +So my question is, how expensive is setting a savepoint in PG? If it's +not too expensive, I'm wondering if it would be feasible to add a config +parameter to psql or other client interfaces (thinking specifically of +jdbc here) to do it automatically. Doing so would make it a little +easier to work with PG in a multi-db environment. + +My main reason for wanting this is so that I can more easily import, +say, 50 new 'objects' (related rows stored across several tables) in a +transaction instead of only one at a time without fear that an error in +one object would invalidate the whole batch. I could do this now by +manually setting savepoints, but if it's not a big deal performance-wise +to modify the JDBC driver to start an anonymous savepoint with each +statement, then I'd prefer that approach as it seems that it would make +life easier for other folks too. + +Thanks in advance for any feedback :) + +-- Mark Lewis + +From pgsql-performance-owner@postgresql.org Thu Jul 27 15:24:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 206899FB21A + for ; + Thu, 27 Jul 2006 15:24:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 37038-04-2 + for ; + Thu, 27 Jul 2006 15:23:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id B525C9FB20B + for ; + Thu, 27 Jul 2006 15:23:37 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from alvh.no-ip.org (200-126-100-4.bk7-dsl.surnet.cl + [200.126.100.4]) + by svr4.postgresql.org (Postfix) with ESMTP id 4FF335AFB4E + for ; + Thu, 27 Jul 2006 17:27:42 +0000 (GMT) +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 62995C2F85A; Thu, 27 Jul 2006 13:25:48 -0400 (CLT) +Date: Thu, 27 Jul 2006 13:25:48 -0400 +From: Alvaro Herrera +To: "Joshua D. Drake" +Cc: Merlin Moncure , + Eliott , pgsql-performance@postgresql.org +Subject: Re: performance issue with a specific query +Message-ID: <20060727172548.GD18774@surnet.cl> +Mail-Followup-To: "Joshua D. Drake" , + Merlin Moncure , Eliott , + pgsql-performance@postgresql.org +References: + + <44C8DE3E.4060208@commandprompt.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <44C8DE3E.4060208@commandprompt.com> +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.903 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/245 +X-Sequence-Number: 20105 + +Joshua D. Drake wrote: +> >> +> > +> >try turning off genetic query optimization. regarding the rhel4 +> >issue...does rhel not come with a c compiler? :) +> +> Enterprises are not going to compile. They are going to accept the +> latest support by vendor release. +> +> Redhat has a tendency to be incredibly stupid about this particular +> area of their packaging. + +Stupid how? + +-- +Alvaro Herrera http://www.CommandPrompt.com/ +PostgreSQL Replication, Consulting, Custom Development, 24x7 support + +From pgsql-performance-owner@postgresql.org Thu Jul 27 16:19:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 90E8E9FB206 + for ; + Thu, 27 Jul 2006 16:19:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 42909-03 for + ; + Thu, 27 Jul 2006 16:19:38 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from web55902.mail.re3.yahoo.com (web55902.mail.re3.yahoo.com + [216.252.110.63]) + by postgresql.org (Postfix) with SMTP id 966819FA5FC + for ; + Thu, 27 Jul 2006 16:19:06 -0300 (ADT) +Received: (qmail 9613 invoked by uid 60001); 27 Jul 2006 18:55:08 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; + h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=DSpzySxpsd/y/hpCyUBadko4X5fwuf7TWvD2ITgrZRqCYFyJpUpLf/jEVaVHqMN2uh4s19LLUhTgSEhcF4hQ8Y/ZPc2VkDpelH0whxY2zNUIAKWwHyjxM2jSRiolIie09kkCLOQXKOM0ImJO/G2E66YeLUOEBbuLa8oUi+IuWJM= + ; +Message-ID: <20060727185507.9604.qmail@web55902.mail.re3.yahoo.com> +Received: from [207.164.182.8] by web55902.mail.re3.yahoo.com via HTTP; + Thu, 27 Jul 2006 14:55:06 EDT +Date: Thu, 27 Jul 2006 14:55:06 -0400 (EDT) +From: Ioana Danes +Subject: Re: Query plan issue when upgrading to postgres 8.14 (from +To: Ioana Danes +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060718160253.46375.qmail@web55912.mail.re3.yahoo.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1884499080-1154026506=:99742" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.201 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, HTML_MESSAGE +X-Spam-Level: +X-Archive-Number: 200607/247 +X-Sequence-Number: 20107 + +--0-1884499080-1154026506=:99742 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hi everyone, + + I posted this question some time ago and I did not get any answer so here I am again. + Does anyone now what the problem is with the following select when upgrading to postgresql 8.1.4 the query plan does not use the indexes as in postgresql 8.0.3. + + Here are the results of my query for postgresql 8.0.3 and 8.1.4. For postgresql 8.1.4 there are 2 results, one for test table having the same indexes as in 8.0.3 and the second one for a new index on test table by (testtype,testid) that will speed up my query. This last index will fix my problem for this particular query. + + In the Test table there are 19,494,826 records and 11,090 records have testtype = 1455. The data on both servers is identical. And on both servers I run vacuum analyze prior executing this queries. + + As it can be seen the result in postgresql 8.1.4 is very slow and I am wondering why is that. Bug, missing configuration, ... + + 1. Result on Postgresql 8.0.3: + ------------------------------------- + # explain analyze select max(TESTID) from TEST where TESTTYPE = 1455; + + Aggregate (cost=391.56..391.56 rows=1 width=8) (actual time=94.707..94.711 rows=1 loops=1) + -> Index Scan using ix_test_testtype on test (cost=0.00..355.18 rows=14551 width=8) (actual time=0.036..51.089 rows=11090 loops=1) + Index Cond: (testtype = 1455) + Total runtime: 94.778 ms + (4 rows) + + # select max(TESTID) from TEST where TESTTYPE = 1455; + + max + ---------- + 18527829 + (1 row) + + Time: 13.447 ms + + + 2. Result on Postgresql 8.1.4 (with the same indexes as in 8.0.3): + ------------------------------------------------------------------------------------------ + Result (cost=32.78..32.79 rows=1 width=0) (actual time=1865.406..1865.408 rows=1 loops=1) + InitPlan + -> Limit (cost=0.00..32.78 rows=1 width=8) (actual time=1865.378..1865.381 rows=1 loops=1) + -> Index Scan Backward using pk_testid on test (cost=0.00..464069.25 rows=14155 width=8) (actual time=1865.371..1865.371 rows=1 loops=1) + Filter: ((testid IS NOT NULL) AND (testtype = 1455)) + Total runtime: 1865.522 ms + (6 rows) + + # select max(TESTID) from TEST where TESTTYPE = 1455; + + max + ---------- + 18527829 + + Time: 1858.076 ms + + + 3. Result on Postgresql 8.1.4 (after creating an index by testtype, testid ): + ----------------------------------------------------------------------------------------------------- + # explain analyze select max(TESTID) from TEST where TESTTYPE = 1455; + Result (cost=1.71..1.72 rows=1 width=0) (actual time=0.069..0.070 rows=1 loops=1) + InitPlan + -> Limit (cost=0.00..1.71 rows=1 width=8) (actual time=0.055..0.056 rows=1 loops=1) + -> Index Scan Backward using ix_test2 on test (cost=0.00..24248.92 rows=14155 width=8) (actual time=0.050..0.050 rows=1 loops=1) + Index Cond: (testtype = 1455) + Filter: (testid IS NOT NULL) + Total runtime: 0.159 ms + + # select max(TESTID) from TEST where TESTTYPE = 1455; + + max + ---------- + 18527829 + + Time: 1.029 ms + + Thank you in advance, + Ioana + + +--------------------------------- +Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail +--0-1884499080-1154026506=:99742 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Hi everyone,

I posted this question some time ago and I did not get any answer so here I am again.
Does anyone now what the problem is with the following select when upgrading to postgresql 8.1.4 the query plan does not use the indexes as in postgresql 8.0.3.

Here are the results of my query for postgresql 8.0.3 and 8.1.4. For postgresql 8.1.4 there are 2 results, one for test table having the same indexes as in 8.0.3 and the second one for a new index on test table by (testtype,testid) that will speed up my query. This last index will fix my problem for this particular query.

In the Test table there are 19,494,826 records and 11,090 records have testtype = 1455. The data on both servers is identical. And on both servers I run vacuum analyze prior executing this queries.

As it can be seen the result in postgresql 8.1.4 is very slow and I am wondering why is that. Bug, missing configuration, ...

1. Result + on Postgresql 8.0.3:
-------------------------------------
# explain analyze select max(TESTID) from TEST where TESTTYPE = 1455;

 Aggregate  (cost=391.56..391.56 rows=1 width=8) (actual time=94.707..94.711 rows=1 loops=1)
   ->  Index Scan using ix_test_testtype on test  (cost=0.00..355.18 rows=14551 width=8) (actual time=0.036..51.089 rows=11090 loops=1)
         Index Cond: (testtype = 1455)
 Total runtime: 94.778 ms
(4 rows)

# select max(TESTID) from TEST where TESTTYPE = 1455;

   max
----------
 18527829
(1 row)

Time: 13.447 ms


2. Result on Postgresql 8.1.4 (with the same indexes as in 8.0.3):
------------------------------------------------------------------------------------------
 Result  (cost=32.78..32.79 rows=1 width=0) (actual + time=1865.406..1865.408 rows=1 loops=1)
   InitPlan
     ->  Limit  (cost=0.00..32.78 rows=1 width=8) (actual time=1865.378..1865.381 rows=1 loops=1)
           ->  Index Scan Backward using pk_testid on test  (cost=0.00..464069.25 rows=14155 width=8) (actual time=1865.371..1865.371 rows=1 loops=1)
                 Filter: ((testid IS NOT NULL) AND (testtype = 1455))
 Total runtime: 1865.522 ms
(6 rows)

# select max(TESTID) from TEST where TESTTYPE = 1455;
 
   max
----------
 18527829

Time: 1858.076 ms


3. Result on Postgresql 8.1.4 (after creating an index by testtype, testid ):
+ -----------------------------------------------------------------------------------------------------
# explain analyze select max(TESTID) from TEST where TESTTYPE = 1455;
 Result  (cost=1.71..1.72 rows=1 width=0) (actual time=0.069..0.070 rows=1 loops=1)
   InitPlan
     ->  Limit  (cost=0.00..1.71 rows=1 width=8) (actual time=0.055..0.056 rows=1 loops=1)
           ->  Index Scan Backward using ix_test2 on test  (cost=0.00..24248.92 rows=14155 width=8) (actual time=0.050..0.050 rows=1 loops=1)
                 Index Cond: (testtype = 1455)
                 Filter: (testid IS NOT NULL)
 Total runtime: 0.159 ms

# select max(TESTID) from TEST + where TESTTYPE = 1455;

   max
----------
 18527829

Time: 1.029 ms

Thank you in advance,
Ioana

+


Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the
All-new Yahoo! Mail + +--0-1884499080-1154026506=:99742-- + +From pgsql-performance-owner@postgresql.org Thu Jul 27 16:36:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A63A19FB20D + for ; + Thu, 27 Jul 2006 16:35:58 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 44221-04 for + ; + Thu, 27 Jul 2006 16:35:52 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from alvh.no-ip.org (200-126-100-4.bk7-dsl.surnet.cl + [200.126.100.4]) + by postgresql.org (Postfix) with ESMTP id 0717B9FA5FC + for ; + Thu, 27 Jul 2006 16:35:21 -0300 (ADT) +Received: by alvh.no-ip.org (Postfix, from userid 1000) + id 4211FC2F85A; Thu, 27 Jul 2006 15:35:20 -0400 (CLT) +Date: Thu, 27 Jul 2006 15:35:20 -0400 +From: Alvaro Herrera +To: Mark Lewis +Cc: pgsql-performance@postgresql.org +Subject: Re: Savepoint performance +Message-ID: <20060727193520.GG18774@surnet.cl> +Mail-Followup-To: Mark Lewis , + pgsql-performance@postgresql.org +References: <1154020755.1634.509.camel@archimedes> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1154020755.1634.509.camel@archimedes> +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=4.784 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, FORGED_RCVD_HELO, + RCVD_IN_SORBS_DUL, RCVD_IN_XBL +X-Spam-Level: **** +X-Archive-Number: 200607/248 +X-Sequence-Number: 20108 + +Mark Lewis wrote: + +> So my question is, how expensive is setting a savepoint in PG? If it's +> not too expensive, I'm wondering if it would be feasible to add a config +> parameter to psql or other client interfaces (thinking specifically of +> jdbc here) to do it automatically. Doing so would make it a little +> easier to work with PG in a multi-db environment. + +It is moderately expensive. It's cheaper than starting/committing a +transaction, but certainly much more expensive than not setting a +savepoint. + +In psql you can do what you want using \set ON_ERROR_ROLLBACK on. This +is clearly a client-only issue, so the server does not provide any +special support for it (just like autocommit mode). + +-- +Alvaro Herrera http://www.CommandPrompt.com/ +PostgreSQL Replication, Consulting, Custom Development, 24x7 support + +From pgsql-performance-owner@postgresql.org Thu Jul 27 17:18:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CDBA49FB209 + for ; + Thu, 27 Jul 2006 17:18:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 51105-05-4 + for ; + Thu, 27 Jul 2006 17:18:12 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 149ED9FA5DC + for ; + Thu, 27 Jul 2006 17:18:11 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6RKI7bX003305; + Thu, 27 Jul 2006 16:18:07 -0400 (EDT) +To: Alvaro Herrera +cc: "Joshua D. Drake" , + Merlin Moncure , Eliott , + pgsql-performance@postgresql.org +Subject: Re: performance issue with a specific query +In-reply-to: <20060727172548.GD18774@surnet.cl> +References: + + <44C8DE3E.4060208@commandprompt.com> + <20060727172548.GD18774@surnet.cl> +Comments: In-reply-to Alvaro Herrera + message dated "Thu, 27 Jul 2006 13:25:48 -0400" +Date: Thu, 27 Jul 2006 16:18:07 -0400 +Message-ID: <3304.1154031487@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + SPF_HELO_PASS, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/249 +X-Sequence-Number: 20109 + +Alvaro Herrera writes: +> Joshua D. Drake wrote: +>> Enterprises are not going to compile. They are going to accept the +>> latest support by vendor release. +>> +>> Redhat has a tendency to be incredibly stupid about this particular +>> area of their packaging. + +> Stupid how? + +Red Hat feels (apparently accurately, judging by their subscription +revenue ;-)) that what RHEL customers want is a platform that's stable +over multi-year application lifespans. So major incompatible changes in +the system software are not looked on with favor. That's why RHEL4 +is still shipping PG 7.4.*. You can call it a stupid policy if you +like, but it's hard to argue with success. + +However, there will be an RH-supported release of PG 8.1.* as an optional +add-on for RHEL4. Real Soon Now, I hope --- the release date has been +pushed back a couple times already. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sun Jul 30 23:52:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5FF1E9FB1C7 + for ; + Thu, 27 Jul 2006 18:59:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 58922-10 for + ; + Thu, 27 Jul 2006 18:59:40 -0300 (ADT) +X-Greylist: delayed 00:22:24.941452 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 19D719FB1DC + for ; + Thu, 27 Jul 2006 18:59:40 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from www.bowmansystems.com (ns1.bowmansystems.com [65.166.193.2]) + by svr4.postgresql.org (Postfix) with ESMTP id 0C7505AFB38 + for ; + Thu, 27 Jul 2006 21:37:04 +0000 (GMT) +Received: from [10.1.0.14] (unknown [65.166.193.11]) + by www.bowmansystems.com (Postfix) with ESMTP id 5157EE095 + for ; + Thu, 27 Jul 2006 16:37:02 -0500 (CDT) +Subject: Strange behaviour +From: Richard Rowell +To: pgsql-performance@postgresql.org +Content-Type: text/plain +Date: Thu, 27 Jul 2006 17:37:02 -0400 +Message-Id: <1154036222.22231.40.camel@meowth> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.384 tagged_above=0 required=5 tests=SPF_SOFTFAIL +X-Spam-Level: * +X-Archive-Number: 200607/294 +X-Sequence-Number: 20154 + +We are using a BI tool that generates some rather ugly queries. One of +the ugly queries is taking much longer to return thin I think it +should. + +The select expression when run alone returns in 2 seconds with 35k rows +(http://www.bowmansystems.com/~richard/explain_select.analyze) + +The "where clause" when run alone returns 5200 rows in 10 seconds +(http://www.bowmansystems.com/~richard/explain_where.analyze) + +However when I put to two together it takes much, much longer to run. +(http://www.bowmansystems.com/~richard/full.analyze) + +Can anyone shed any light on what is going on here? Why does the +optimizer choose such a slow plan in the combined query when the only +real difference between the full query and the "where only" query is the +number of rows in the result set on the "outside" of the "IN" clause? + +A few pertinent observations/facts below + +1. The query is generated by a BI tool, I know it is ugly and stupid in +many cases. However, please try to see the larger issue, that if the +select and where portions are run separately they are both fast but +together it is insanely slow. + +2. The database has vacuumdb -f -z run on it nightly. + +3. Modifications to the stock postgresql.conf: +shared_buffers = 15000 +work_mem = 131072 +default_statistics_target = 100 + +4. Dual Dual core Opterons, 4 gigs of ram, 6 disk Serial ATA hardware +RAID 10 running Postgres 8.03 compiled from source running on Debian +stable. + +5. The tables being queried are only 200 megs or so combined on disk, +the whole DB is ~ 4 gigs +SELECT sum(relpages*8/1024) AS size_M FROM pg_class; + size_m +-------- + 4178 + +Thanks! + + +From pgsql-performance-owner@postgresql.org Thu Jul 27 19:22:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3B22E9FB1FB + for ; + Thu, 27 Jul 2006 19:22:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61246-10 for + ; + Thu, 27 Jul 2006 19:22:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 48A069FB21C + for ; + Thu, 27 Jul 2006 19:22:18 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6RMM5Pm013634; + Thu, 27 Jul 2006 18:22:05 -0400 (EDT) +To: Ioana Danes +cc: pgsql-performance@postgresql.org +Subject: Re: Query plan issue when upgrading to postgres 8.14 (from +In-reply-to: <20060727185507.9604.qmail@web55902.mail.re3.yahoo.com> +References: <20060727185507.9604.qmail@web55902.mail.re3.yahoo.com> +Comments: In-reply-to Ioana Danes + message dated "Thu, 27 Jul 2006 14:55:06 -0400" +Date: Thu, 27 Jul 2006 18:22:05 -0400 +Message-ID: <13633.1154038925@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.036 tagged_above=0 required=5 tests=AWL, + SPF_HELO_PASS, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/250 +X-Sequence-Number: 20110 + +Ioana Danes writes: +> Does anyone now what the problem is with the following select when upgrading to postgresql 8.1.4 the query plan does not use the indexes as in postgresql 8.0.3. + +The planner doesn't have enough information about the correlation +between testtype and testid to guess that the index-driven max() +optimization doesn't work well in this case. But I see you've +already found the solution ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 27 21:53:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D414B9FA5F3 + for ; + Thu, 27 Jul 2006 21:53:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 75419-03 for + ; + Thu, 27 Jul 2006 21:52:56 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from py-out-1112.google.com (py-out-1112.google.com + [64.233.166.181]) + by postgresql.org (Postfix) with ESMTP id 11D0C9FACFE + for ; + Thu, 27 Jul 2006 21:52:26 -0300 (ADT) +Received: by py-out-1112.google.com with SMTP id b36so408922pyb + for ; + Thu, 27 Jul 2006 17:52:24 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=nkg4fOL4WiV//m31TvBmsOME8pTkNkXuBrwAvhwmGFrrfmzPIkOs+BeWhFEEs3xJA41YCkZVfyxZXyGAu8uBDmyuF/JhpzERi4bF7mQXge9iAfamKvgZucswgKEtzfLgdbW1cKXkKgjfxIloaUodRGYtfe0CgzQmyvaL/5/oqLQ= +Received: by 10.35.100.6 with SMTP id c6mr13828671pym; + Thu, 27 Jul 2006 17:52:24 -0700 (PDT) +Received: by 10.35.54.5 with HTTP; Thu, 27 Jul 2006 17:52:24 -0700 (PDT) +Message-ID: +Date: Thu, 27 Jul 2006 19:52:24 -0500 +From: "Jaime Casanova" +To: "Mark Lewis" +Subject: Re: Savepoint performance +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1154020755.1634.509.camel@archimedes> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <1154020755.1634.509.camel@archimedes> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.327 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_PASS +X-Spam-Level: * +X-Archive-Number: 200607/251 +X-Sequence-Number: 20111 + +On 7/27/06, Mark Lewis wrote: +> All, +> +> I support a system that runs on several databases including PostgreSQL. +> I've noticed that the other DB's always put an implicit savepoint before +> each statement executed, and roll back to that savepoint if the +> statement fails for some reason. PG does not, so unless you manually +> specify a savepoint you lose all previous work in the transaction. +> + +you're talking about transactions not savepoints (savepoints is +something more like nested transactions), i guess... + +postgres execute every single statement inside an implicit transaction +unless you put BEGIN/COMMIT between a block of statements... in that +case if an error occurs the entire block of statements must +ROLLBACK... + +if other db's doesn't do that, is a bug in their implementation of the +SQL standard + +-- +regards, +Jaime Casanova + +"Programming today is a race between software engineers striving to +build bigger and better idiot-proof programs and the universe trying +to produce bigger and better idiots. +So far, the universe is winning." + Richard Cook + +From pgsql-performance-owner@postgresql.org Thu Jul 27 22:13:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1C8009FB215 + for ; + Thu, 27 Jul 2006 22:13:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76971-03 for + ; + Thu, 27 Jul 2006 22:13:18 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wr-out-0506.google.com (wr-out-0506.google.com + [64.233.184.230]) + by postgresql.org (Postfix) with ESMTP id ACACD9FACFE + for ; + Thu, 27 Jul 2006 22:13:18 -0300 (ADT) +Received: by wr-out-0506.google.com with SMTP id 71so243503wra + for ; + Thu, 27 Jul 2006 18:13:05 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=LZ1iQrLkhxylwKTO+2RaNjnl13PgJu56AfXiUsEEs1zdZAKQuJvkFSlhsc9NjOHIJMxCD+i2+BXaaCmm/rMPdbOVIYgtwNHXhQT++YosW62H7dVh0XZi/RvKRTaeC74Ixmno2QS8GCjpmDoP3xrCkVimrmu/taF2iO6MtfuH65Y= +Received: by 10.65.185.13 with SMTP id m13mr481374qbp; + Thu, 27 Jul 2006 18:13:05 -0700 (PDT) +Received: by 10.64.179.18 with HTTP; Thu, 27 Jul 2006 18:13:05 -0700 (PDT) +Message-ID: <5f820f750607271813m454dec68rd0e985deefeaa37e@mail.gmail.com> +Date: Thu, 27 Jul 2006 21:13:05 -0400 +From: "Denis Lussier" +To: "Mark Lewis" , pgsql-performance@postgresql.org +Subject: Re: Savepoint performance +In-Reply-To: <20060727193520.GG18774@surnet.cl> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_118105_32393458.1154049185523" +References: <1154020755.1634.509.camel@archimedes> + <20060727193520.GG18774@surnet.cl> +X-Google-Sender-Auth: 6afe0c9253dfe38f +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.535 tagged_above=0 required=5 tests=AWL, HTML_30_40, + HTML_MESSAGE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/252 +X-Sequence-Number: 20112 + +------=_Part_118105_32393458.1154049185523 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +We've actually done some prelim benchmarking of this feature about six +months ago and we are actively considering adding it to our "closer to +Oracle" version of PLpgSQL. I certainly don't want to suggest that it's a +good idea to do this because it's Oracle compatible. :-) + +I'll get someone to post our performance results on this thread. As Alvaro +correctly alludes, it has an overhead impact that is measurable, but, likely +acceptable for situations where the feature is desired (as long as it +doesn't negatively affect performance in the "normal" case). I believe the +impact was something around a 12% average slowdown for the handful of +PLpgSQL functions we tested when this feature is turned on. + +Would the community be potentially interested in this feature if we created +a BSD Postgres patch of this feature for PLpgSQL (likely for 8.3)?? + +--Luss + +Denis Lussier +CTO +http://www.enterprisedb.com + + +On 7/27/06, Alvaro Herrera wrote: +> +> Mark Lewis wrote: +> +> > So my question is, how expensive is setting a savepoint in PG? If it's +> > not too expensive, I'm wondering if it would be feasible to add a config +> > parameter to psql or other client interfaces (thinking specifically of +> > jdbc here) to do it automatically. Doing so would make it a little +> > easier to work with PG in a multi-db environment. +> +> It is moderately expensive. It's cheaper than starting/committing a +> transaction, but certainly much more expensive than not setting a +> savepoint. +> +> In psql you can do what you want using \set ON_ERROR_ROLLBACK on. This +> is clearly a client-only issue, so the server does not provide any +> special support for it (just like autocommit mode). +> +> -- +> Alvaro Herrera +> http://www.CommandPrompt.com/ +> PostgreSQL Replication, Consulting, Custom Development, 24x7 support +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings +> + +------=_Part_118105_32393458.1154049185523 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
We've actually done some prelim benchmarking of this feature about six months ago and we are actively considering adding it to our "closer to Oracle" version of PLpgSQL.   I certainly don't want to suggest that it's a good idea to do this because it's Oracle compatible.  :-) +
+
 
+
I'll get someone to post our performance results on this thread.  As Alvaro correctly alludes, it has an overhead impact that is measurable, but, likely acceptable for situations where the feature is desired (as long as it doesn't negatively affect performance in the "normal" case).  I believe the impact was something around a 12% average slowdown for the handful of PLpgSQL functions we tested when this feature is turned on. +
+
 
+
Would the community be potentially interested in this feature if we created a BSD Postgres patch of this feature for PLpgSQL (likely for 8.3)??
+
 
+
--Luss
+
 
+
Denis Lussier
+
CTO
+ +
On 7/27/06, Alvaro Herrera <alvherre@commandprompt.com> wrote: +
Mark Lewis wrote:

> So my question is, how expensive is setting a savepoint in PG?  If it's
> not too expensive, I'm wondering if it would be feasible to add a config +
> parameter to psql or other client interfaces (thinking specifically of
> jdbc here) to do it automatically.  Doing so would make it a little
> easier to work with PG in a multi-db environment.

+It is moderately expensive.  It's cheaper than starting/committing a
transaction, but certainly much more expensive than not setting a
savepoint.

In psql you can do what you want using \set ON_ERROR_ROLLBACK on.  This +
is clearly a client-only issue, so the server does not provide any
special support for it (just like autocommit mode).

--
Alvaro Herrera                                 +http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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

+ +------=_Part_118105_32393458.1154049185523-- + +From pgsql-performance-owner@postgresql.org Thu Jul 27 22:26:25 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 02C0F9FACFE + for ; + Thu, 27 Jul 2006 22:26:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77375-07 for + ; + Thu, 27 Jul 2006 22:26:08 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from buraja.hst.terra.com.br (buraja.hst.terra.com.br + [200.176.10.198]) + by postgresql.org (Postfix) with ESMTP id 3B52F9FB1FB + for ; + Thu, 27 Jul 2006 22:26:07 -0300 (ADT) +Received: from calivil.hst.terra.com.br (calivil.hst.terra.com.br + [200.176.10.9]) + by buraja.hst.terra.com.br (Postfix) with ESMTP id 9A93922A4037 + for ; + Thu, 27 Jul 2006 22:25:54 -0300 (BRT) +X-Terra-Karma: 0% +X-Terra-Hash: 58af0f2dd5473de3231d582b3fa5c1c3 +Received-SPF: pass (calivil.hst.terra.com.br: domain of terra.com.br + designates 200.176.10.9 as permitted sender) + client-ip=200.176.10.9; envelope-from=carlosreimer@terra.com.br; + helo=terra.com.br; +Received: from terra.com.br (aramara.hst.terra.com.br [200.176.3.182]) + (authenticated user carlosreimer) + by calivil.hst.terra.com.br (Postfix) with ESMTP id 9261512480B3 + for ; + Thu, 27 Jul 2006 22:25:54 -0300 (BRT) +Date: Thu, 27 Jul 2006 22:25:54 -0300 +Message-Id: +Subject: Disk writes +MIME-Version: 1.0 +X-Sensitivity: 3 +Content-Type: multipart/alternative; + boundary="_=__=_XaM3_.1154049954.2A.593392.42.14742.52.42.007.1847650606" +From: "carlosreimer" +To: "pgsql-performance" +X-XaM3-API-Version: 4.1 (B115) +X-SenderIP: 200.213.105.93 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 tests=HTML_30_40, + HTML_MESSAGE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/253 +X-Sequence-Number: 20113 + + +--_=__=_XaM3_.1154049954.2A.593392.42.14742.52.42.007.1847650606 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + +Hi, + +We've a fedora core 3 box with PostgreSQL 8.0. + +There is some performance problems with the server and I discovered with = +vmstat tool that there is some process writing a lot of information in th= +e disk subsystem. + +I stopped the database and even so vmstat showed the same rates of disk w= +rites. + +I could I discover who is sending so many data to the disks? + +Thanks in advance, + +Reimer + +--_=__=_XaM3_.1154049954.2A.593392.42.14742.52.42.007.1847650606 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: quoted-printable + +
+
Hi,
+
 
+
We've a fedora core 3 box with PostgreSQL 8.0.
+
 
+
There is some performance problems with the server and I discovered = +with vmstat tool that there is some process writing a lot of information = +in the disk subsystem.
+
 
+
I stopped the database and even so vmstat showed the same rates of d= +isk writes.
+
 
+
I could I discover who is sending so many data to the disks?
+
 
+
Thanks in advance,
+
 
+
Reimer
+ +--_=__=_XaM3_.1154049954.2A.593392.42.14742.52.42.007.1847650606-- + + +From pgsql-performance-owner@postgresql.org Thu Jul 27 22:36:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CB4C39FA4E3 + for ; + Thu, 27 Jul 2006 22:36:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78662-06 for + ; + Thu, 27 Jul 2006 22:35:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id B6C459FA508 + for ; + Thu, 27 Jul 2006 22:35:22 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6S1YbZx015027; + Thu, 27 Jul 2006 21:34:37 -0400 (EDT) +To: "Denis Lussier" +cc: "Mark Lewis" , pgsql-performance@postgresql.org +Subject: Re: Savepoint performance +In-reply-to: <5f820f750607271813m454dec68rd0e985deefeaa37e@mail.gmail.com> +References: <1154020755.1634.509.camel@archimedes> + <20060727193520.GG18774@surnet.cl> + <5f820f750607271813m454dec68rd0e985deefeaa37e@mail.gmail.com> +Comments: In-reply-to "Denis Lussier" + message dated "Thu, 27 Jul 2006 21:13:05 -0400" +Date: Thu, 27 Jul 2006 21:34:37 -0400 +Message-ID: <15026.1154050477@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.037 tagged_above=0 required=5 tests=AWL, + SPF_HELO_PASS, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/254 +X-Sequence-Number: 20114 + +"Denis Lussier" writes: +> Would the community be potentially interested in this feature if we created +> a BSD Postgres patch of this feature for PLpgSQL (likely for 8.3)?? + +Based on our rather disastrous experiment in 7.3, I'd say that fooling +around with transaction start/end semantics on the server side is +unlikely to fly ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Thu Jul 27 23:35:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 3C9819FB20D + for ; + Thu, 27 Jul 2006 23:35:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82379-10 for + ; + Thu, 27 Jul 2006 23:34:49 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.196]) + by postgresql.org (Postfix) with ESMTP id 25BD59FB223 + for ; + Thu, 27 Jul 2006 23:34:16 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id 13so106149nzn + for ; + Thu, 27 Jul 2006 19:33:38 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; + b=rTPwMrx7txSsAANtYth8ia0R7ruksynihCetmx16iG3pnA7bIWjeilc+DZz8s5FbAssNmA0s47+vX/WOexjq1qeNPWOQOX+5bf3bTpWJq+38mEkdwQNVbinprsFdLYVZ9YnPgr61MsmGf4JaorYLHQYziGfB9DXHmU6JBHMuEQA= +Received: by 10.65.81.19 with SMTP id i19mr1176215qbl; + Thu, 27 Jul 2006 19:33:38 -0700 (PDT) +Received: by 10.64.179.18 with HTTP; Thu, 27 Jul 2006 19:33:38 -0700 (PDT) +Message-ID: <5f820f750607271933p5367b755ya88e41891b126983@mail.gmail.com> +Date: Thu, 27 Jul 2006 22:33:38 -0400 +From: "Denis Lussier" +To: "Tom Lane" +Subject: Re: Savepoint performance +Cc: pgsql-performance@postgresql.org +In-Reply-To: <15026.1154050477@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <1154020755.1634.509.camel@archimedes> + <20060727193520.GG18774@surnet.cl> + <5f820f750607271813m454dec68rd0e985deefeaa37e@mail.gmail.com> + <15026.1154050477@sss.pgh.pa.us> +X-Google-Sender-Auth: 568a2582a6bdd4ab +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.267 tagged_above=0 required=5 tests=AWL, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/255 +X-Sequence-Number: 20115 + +My understanding of EDB's approach is that our prototype just +implicitly does a savepoint before each INSERT, UPDATE, or DELETE +statement inside of PLpgSQL. We then rollback to that savepoint if a +sql error occurs. I don 't believe our prelim approach changes any +transaction start/end semantics on the server side and it doesn't +change any PLpgSQL syntax either (although it does allow you to +optionally code commits &/or rollbacks inside stored procs). + +Can anybody point me to a thread on the 7.3 disastrous experiment? + +I personally think that doing commit or rollbacks inside stored +procedures is usually bad coding practice AND can be avoided... It's +a backward compatibility thing for non-ansi legacy stuff and this is +why I was previously guessing that the community wouldn't be +interested in this for PLpgSQL. Actually... does anybody know +offhand if the ansi standard for stored procs allows for explicit +transaction control inside of a stored procedure? + +--Luss + +On 7/27/06, Tom Lane wrote: +> "Denis Lussier" writes: +> > Would the community be potentially interested in this feature if we created +> > a BSD Postgres patch of this feature for PLpgSQL (likely for 8.3)?? +> +> Based on our rather disastrous experiment in 7.3, I'd say that fooling +> around with transaction start/end semantics on the server side is +> unlikely to fly ... +> +> regards, tom lane +> + +From pgsql-performance-owner@postgresql.org Fri Jul 28 03:34:36 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 6C3409FB22C + for ; + Fri, 28 Jul 2006 03:34:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 10471-02 for + ; + Fri, 28 Jul 2006 03:34:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mx00.ext.bfk.de (mx00.ext.bfk.de [217.29.46.125]) + by postgresql.org (Postfix) with ESMTP id 4F1CA9FA4E3 + for ; + Fri, 28 Jul 2006 03:33:30 -0300 (ADT) +Received: from fweimer by bfk.de with local id 1G6Ltu-0007dg-VK; + Fri, 28 Jul 2006 08:32:47 +0200 +To: "carlosreimer" +Cc: "pgsql-performance" +Subject: Re: Disk writes +References: +From: Florian Weimer +Date: Fri, 28 Jul 2006 08:32:46 +0200 +In-Reply-To: + (carlosreimer@terra.com.br's message of "Thu, + 27 Jul 2006 22:25:54 -0300") +Message-ID: <82hd12fddd.fsf@mid.bfk.de> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/256 +X-Sequence-Number: 20116 + +> I could I discover who is sending so many data to the disks? + +Documentation/laptop-mode.txt in the Linux kernel tree has some +instructions how to track down unwanted disk writes. + +-- +Florian Weimer +BFK edv-consulting GmbH http://www.bfk.de/ +Durlacher Allee 47 tel: +49-721-96201-1 +D-76131 Karlsruhe fax: +49-721-96201-99 + +From pgsql-performance-owner@postgresql.org Fri Jul 28 03:38:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 04FFC9FB22C + for ; + Fri, 28 Jul 2006 03:38:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11123-02 for + ; + Fri, 28 Jul 2006 03:38:07 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.189]) + by postgresql.org (Postfix) with ESMTP id 785989FB223 + for ; + Fri, 28 Jul 2006 03:38:04 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id p77so93430nfc + for ; + Thu, 27 Jul 2006 23:37:33 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; + b=rCoFc2wQc0wFZA7afBSEwzJVYVSHWLSqr9sqjhaB7lftZ2XWkWRT4jxQ8yRZ1cTbxCSjUwVK9eCX6LHV5GudHX9r7hSwblJsySEVQ8xy7Mrkj1PXXwB9GsUU9toTxxZcs6sL94FKlXays8BKDhLK2ZCHLZS8p9ClK5W1PEC1Ajk= +Received: by 10.49.55.13 with SMTP id h13mr328932nfk; + Thu, 27 Jul 2006 23:37:33 -0700 (PDT) +Received: by 10.49.64.6 with HTTP; Thu, 27 Jul 2006 23:37:33 -0700 (PDT) +Message-ID: +Date: Fri, 28 Jul 2006 08:37:33 +0200 +From: "Kjell Tore Fossbakk" +To: pgsql-performance@postgresql.org +Subject: Performance with 2 AMD/Opteron 2.6Ghz and 8gig DDR PC3200 +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_864_18983980.1154068653060" +References: +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.822 tagged_above=0 required=5 tests=AWL, HTML_10_20, + HTML_MESSAGE, SPF_PASS +X-Spam-Level: * +X-Archive-Number: 200607/257 +X-Sequence-Number: 20117 + +------=_Part_864_18983980.1154068653060 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +---------- Forwarded message ---------- +From: Kjell Tore Fossbakk +Date: Jul 26, 2006 8:55 AM +Subject: Performance with 2 AMD/Opteron 2.6Ghz and 8gig DDR PC3200 +To: pgsql-performance-owner@postgresql.org + +Hello! + +I have upgraded my server to an HP Proliant DL585. It got two Processor +motherboards, each holding an AMD/Opteron 2.6Ghz and 4GIG of memory. + +I got 4 150GIG SCSI disks in a Smart Array 5i 1+0 RAID. + +I'v been using Postgres for a few years, and the reason for this major +hardware upgrade is to boost my performance. I have created a small web +application that pulls huge amounts of data from my database. + +The database consists of basically one table, but it's big. It got 10 +columns and a few indexes on the 3-4 most used fields (based on my queries +of course). My queries use a few aggregated functions, such as sum and +count, which makes the data moving process time-consuming. + +Now, on my older server (2gig memory and probabably some 2ghz cpu) my +queries took quite a lot of time (30sec - several minutes). Now, with a much +better hardware platform, I was hoping I could juice the process! + +As I have understood, there is alot of tuning using both postgres.conf and +analyzing queries to make the values of postgres.conf fit my needs, system +and hardware. This is where I need some help. I have looked into +postgres.conf , and seen the tunings. But I'm still not sure what I should +put into those variables (in postgres.conf) with my hardware. + +Any suggestions would be most appreciated! + +- Kjell Tore + +-- +"Be nice to people on your way up because you meet them on your way down." + + +-- +"Be nice to people on your way up because you meet them on your way down." + +------=_Part_864_18983980.1154068653060 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +

---------- Forwarded message ----------
From: Kjell Tore Fossbakk <kjelltore@gmail.com>
Date: Jul 26, 2006 8:55 AM +
Subject: Performance with 2 AMD/Opteron 2.6Ghz and 8gig DDR PC3200
To: pgsql-performance-owner@postgresql.org

Hello!

I have upgraded my server to an HP Proliant DL585. It got two Processor motherboards, each holding an AMD/Opteron +2.6Ghz and 4GIG of memory.

I got 4 150GIG SCSI disks in a Smart Array 5i 1+0 RAID.

+I'v been using Postgres for a few years, and the reason for this major hardware upgrade is to boost my performance. I have created a small web application that pulls huge amounts of data from my database.

The database consists of basically one table, but it's big. It got 10 columns and a few indexes on the 3-4 most used fields (based on my queries of course). My queries use a few aggregated functions, such as sum and count, which makes the data moving process time-consuming. +

Now, on my older server (2gig memory and probabably some 2ghz cpu) my queries took quite a lot of time (30sec - several minutes). Now, with a much better hardware platform, I was hoping I could juice the process! +
+
As I have understood, there is alot of tuning using both postgres.conf and analyzing queries to make the values of postgres.conf fit my needs, system and hardware. This is where I need some help. I have looked into postgres.conf + +, and seen the tunings. But I'm still not sure what I should put into those variables (in postgres.conf) with my hardware.

Any suggestions would be most appreciated!

- Kjell Tore
+
--
"Be nice to people on your way up because you meet them on your way down." + +


--
"Be nice to people on your way up because you meet them on your way down." + +------=_Part_864_18983980.1154068653060-- + +From pgsql-performance-owner@postgresql.org Fri Jul 28 03:54:22 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8ED559FB1F0 + for ; + Fri, 28 Jul 2006 03:54:21 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 11026-08-3 + for ; + Fri, 28 Jul 2006 03:54:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by postgresql.org (Postfix) with ESMTP id 331E19FB265 + for ; + Fri, 28 Jul 2006 03:53:47 -0300 (ADT) +Received: from 172.16.1.110 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Fri, 28 Jul 2006 02:52:47 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 28 Jul + 2006 02:52:48 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Fri, 28 Jul 2006 02:54:40 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D03E6CA3D@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig + DDR PC3200 +Thread-Index: AcayEXd8Zi1cu/lBQ8WZiVYLoP47MwAAHNZA +From: "Luke Lonergan" +To: "Kjell Tore Fossbakk" , + pgsql-performance@postgresql.org +X-OriginalArrivalTime: 28 Jul 2006 06:52:48.0014 (UTC) + FILETIME=[6FB842E0:01C6B212] +X-WSS-ID: 68D76BB50VC836807-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/258 +X-Sequence-Number: 20118 + +Kjell, + +> I got 4 150GIG SCSI disks in a Smart Array 5i 1+0 RAID. + +The Smart Array 5i is a terrible performer on Linux. I would be +surprised if you exceed the performance of a single hard drive with this +controller when doing I/O from disk. Since your database working set is +larger than memory on the machine, I would recommend you use a simple +non-RAID U320 SCSI controller, like those from LSI Logic (which HP +resells) and implement Linux software RAID. You should see a nearly 10x +increase in performance as compared to the SmartArray 5i. + +If you have a good relationship with HP, please ask them for some +documentation of RAID performance on Linux with the SmartArray 5i. I +predict they will tell you what they've told me and others: "the 5i is +only useful for booting the OS". Alternately they could say: "we have +world record performance with our RAID controllers", in which case you +should ask them if that was with the 5i on Linux or whether it was the +6-series on Windows. + +- Luke + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 05:46:23 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9943F9FB251 + for ; + Fri, 28 Jul 2006 05:46:23 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 19926-05 for + ; + Fri, 28 Jul 2006 05:46:06 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id D50FC9FA4E3 + for ; + Fri, 28 Jul 2006 05:45:31 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Fri, 28 Jul 2006 10:45:05 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Fri, 28 Jul 2006 10:46:46 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D8C@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: AcayEXd8Zi1cu/lBQ8WZiVYLoP47MwAAHNZAAAOnu8A= +From: "Mikael Carneholm" +To: "Luke Lonergan" , + "Kjell Tore Fossbakk" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/259 +X-Sequence-Number: 20119 + +I would be interested in what numbers you would get out of bonnie++ +(http://www.coker.com.au/bonnie++) and BenchmarkSQL +(http://sourceforge.net/projects/benchmarksql) on that hardware, for +comparison with our DL385 (2xOpteron 280, 16Gb ram) and MSA1500. If you +need help building benchmarksql, I can assist you with that. + +Actually, I would be interested if everyone who's reading this that has +a similar machine (2 cpu, dual core opteron) with different storage +systems could send me their bonnie + benchmarksql results!=20 + +/Mikael +=20 + +-----Original Message----- +From: pgsql-performance-owner@postgresql.org +[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Luke +Lonergan +Sent: den 28 juli 2006 08:55 +To: Kjell Tore Fossbakk; pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig + +Kjell, + +> I got 4 150GIG SCSI disks in a Smart Array 5i 1+0 RAID. + +The Smart Array 5i is a terrible performer on Linux. I would be +surprised if you exceed the performance of a single hard drive with this +controller when doing I/O from disk. Since your database working set is +larger than memory on the machine, I would recommend you use a simple +non-RAID U320 SCSI controller, like those from LSI Logic (which HP +resells) and implement Linux software RAID. You should see a nearly 10x +increase in performance as compared to the SmartArray 5i. + +If you have a good relationship with HP, please ask them for some +documentation of RAID performance on Linux with the SmartArray 5i. I +predict they will tell you what they've told me and others: "the 5i is +only useful for booting the OS". Alternately they could say: "we have +world record performance with our RAID controllers", in which case you +should ask them if that was with the 5i on Linux or whether it was the +6-series on Windows. + +- Luke + + +---------------------------(end of broadcast)--------------------------- +TIP 4: Have you searched our list archives? + + http://archives.postgresql.org + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 05:52:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E5F8F9FB24F + for ; + Fri, 28 Jul 2006 05:52:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21175-03 for + ; + Fri, 28 Jul 2006 05:52:03 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw02.mi8.com [63.240.6.46]) + by postgresql.org (Postfix) with ESMTP id DF6C89FA4E3 + for ; + Fri, 28 Jul 2006 05:51:33 -0300 (ADT) +Received: from 172.16.1.25 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D2)); Fri, 28 Jul 2006 04:51:22 -0400 +X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01HOST03.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 28 Jul + 2006 04:51:23 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Fri, 28 Jul 2006 04:53:15 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D03E6CA57@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: AcayEXd8Zi1cu/lBQ8WZiVYLoP47MwAAHNZAAAOnu8AAAIj+oA== +From: "Luke Lonergan" +To: "Mikael Carneholm" , + "Kjell Tore Fossbakk" , + pgsql-performance@postgresql.org +X-OriginalArrivalTime: 28 Jul 2006 08:51:23.0161 (UTC) + FILETIME=[00AD8890:01C6B223] +X-WSS-ID: 68D70F80378158705-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/260 +X-Sequence-Number: 20120 + +Mikael,=20 + +> -----Original Message----- +> From: Mikael Carneholm [mailto:Mikael.Carneholm@WirelessCar.com]=20 +> Sent: Friday, July 28, 2006 1:47 AM +> +> I would be interested in what numbers you would get out of bonnie++ +> (http://www.coker.com.au/bonnie++) and BenchmarkSQL +> (http://sourceforge.net/projects/benchmarksql) on that=20 +> hardware, for comparison with our DL385 (2xOpteron 280, 16Gb=20 +> ram) and MSA1500. If you need help building benchmarksql, I=20 +> can assist you with that. + +Me too. Can you post your MSA1500 results? + +The MSA500/1000 come with two SmartArray 6402 controllers, but the RAID +is done inside the MSA500/1000 chassis from what I understand. I have +heard that the performance on Linux is pretty good, but I've not seen +the benchmarks to prove it. Bonnie++ is fine - should tell us what we +need to know. + +Also, I am *very* interested in seeing what the P600 SAS controller +results look like when coupled with an MSA50 SAS chassis with 10 disks. +This is the new SAS controller that can be configured on the DL385 and +585. + +- Luke + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 06:15:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 758039FB233 + for ; + Fri, 28 Jul 2006 06:15:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 21551-09 for + ; + Fri, 28 Jul 2006 06:15:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by postgresql.org (Postfix) with ESMTP id B814B9FA5F3 + for ; + Fri, 28 Jul 2006 06:15:02 -0300 (ADT) +Received: from 172.16.1.148 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Fri, 28 Jul 2006 05:14:54 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01HOST02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 28 Jul + 2006 05:14:54 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Fri, 28 Jul 2006 05:16:47 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D03E6CA59@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: AcayEXd8Zi1cu/lBQ8WZiVYLoP47MwAAHNZAAAOnu8AAAIj+oAAAOm+wAACF3dA= +From: "Luke Lonergan" +To: "Mikael Carneholm" , + "Kjell Tore Fossbakk" , + pgsql-performance@postgresql.org +X-OriginalArrivalTime: 28 Jul 2006 09:14:54.0816 (UTC) + FILETIME=[4A16FE00:01C6B226] +X-WSS-ID: 68D70A040VC882669-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/261 +X-Sequence-Number: 20121 + +Mikael,=20 + +> -----Original Message----- +> From: Mikael Carneholm [mailto:Mikael.Carneholm@WirelessCar.com]=20 +> Sent: Friday, July 28, 2006 2:05 AM +> +> My bonnie++ results are found in this message: +> http://archives.postgresql.org/pgsql-performance/2006-07/msg00164.php +>=20 + +Apologies if I've already said this, but those bonnie++ results are very +disappointing. The sequential transfer rates between 20MB/s and 57MB/s +are slower than a single SATA disk, and your SCSI disks might even do +80MB/s sequential transfer rate each. + +Random access is also very poor, though perhaps equal to 5 disk drives +at 500/second. + +By comparison, we routinely get 950MB/s sequential transfer rate using +16 SATA disks and 3Ware 9550SX SATA RAID adapters on Linux. + +On Solaris ZFS on an X4500, we recently got this bonnie++ result on 36 +SATA disk drives in RAID10 (single thread first): + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- +--Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +%CP /sec %CP +thumperdw-i-1 32G 120453 99 467814 98 290391 58 109371 99 993344 +94 1801 4 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 +++++ +++ +++++ +++ +++++ +++ 30850 99 +++++ +++ ++++++ +++ + +Bumping up the number of concurrent processes to 2, we get about 1.5x +speed reads of RAID10 with a concurrent workload (you have to add the +rates together):=20 + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +%CP /sec %CP +thumperdw-i-1 32G 111441 95 212536 54 171798 51 106184 98 719472 +88 1233 2 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 26085 90 +++++ +++ 5700 98 21448 97 +++++ +++ +4381 97 + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- +--Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +%CP /sec %CP +thumperdw-i-1 32G 116355 99 212509 54 171647 50 106112 98 715030 +87 1274 3 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 26082 99 +++++ +++ 5588 98 21399 88 +++++ +++ +4272 97 + +So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s +per character sequential read. + +- Luke + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 06:59:49 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D9D9C9F9316 + for ; + Fri, 28 Jul 2006 06:59:48 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 25087-09 for + ; + Fri, 28 Jul 2006 06:59:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.wirelesscar.com (mail.wirelesscar.com [212.209.35.30]) + by postgresql.org (Postfix) with ESMTP id E7D4E9FB22A + for ; + Fri, 28 Jul 2006 06:55:02 -0300 (ADT) +Received: from sesrv12.wirelesscar.com ([192.168.10.17]) by + mail.wirelesscar.com with InterScan Messaging Security Suite; + Fri, 28 Jul 2006 11:53:44 +0200 +content-class: urn:content-classes:message +MIME-Version: 1.0 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable +X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Fri, 28 Jul 2006 11:55:25 +0200 +Message-ID: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D9B@sesrv12.wirelesscar.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: + AcayEXd8Zi1cu/lBQ8WZiVYLoP47MwAAHNZAAAOnu8AAAIj+oAAAOm+wAACF3dAAAYxGAA== +From: "Mikael Carneholm" +To: "Luke Lonergan" , + "Kjell Tore Fossbakk" , + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/262 +X-Sequence-Number: 20122 + +Luke, + +Yeah, I read those results, and I'm very disappointed with my results +from the MSA1500. I would however be interested in other people's +bonnie++ and benchmarksql results using a similar machine (2 cpu dual +core opteron) with other "off the shelf" storage systems +(EMC/Netapp/Xyratex/../). Could you run benchmarksql against that +machine with the 16 SATA disk and 3Ware 9550SX SATA RAID adapters? It +would be *very* interesting to see how the I/O performance correlates to +benchmarksql (postgres) transaction throughout. + +/Mikael=20 + +-----Original Message----- +From: Luke Lonergan [mailto:LLonergan@greenplum.com]=20 +Sent: den 28 juli 2006 11:17 +To: Mikael Carneholm; Kjell Tore Fossbakk; +pgsql-performance@postgresql.org +Subject: RE: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig + +Mikael,=20 + +> -----Original Message----- +> From: Mikael Carneholm [mailto:Mikael.Carneholm@WirelessCar.com] +> Sent: Friday, July 28, 2006 2:05 AM +> +> My bonnie++ results are found in this message: +> http://archives.postgresql.org/pgsql-performance/2006-07/msg00164.php +>=20 + +Apologies if I've already said this, but those bonnie++ results are very +disappointing. The sequential transfer rates between 20MB/s and 57MB/s +are slower than a single SATA disk, and your SCSI disks might even do +80MB/s sequential transfer rate each. + +Random access is also very poor, though perhaps equal to 5 disk drives +at 500/second. + +By comparison, we routinely get 950MB/s sequential transfer rate using +16 SATA disks and 3Ware 9550SX SATA RAID adapters on Linux. + +On Solaris ZFS on an X4500, we recently got this bonnie++ result on 36 +SATA disk drives in RAID10 (single thread first): + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- +--Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +%CP /sec %CP +thumperdw-i-1 32G 120453 99 467814 98 290391 58 109371 99 993344 +94 1801 4 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 +++++ +++ +++++ +++ +++++ +++ 30850 99 +++++ +++ ++++++ +++ + +Bumping up the number of concurrent processes to 2, we get about 1.5x +speed reads of RAID10 with a concurrent workload (you have to add the +rates together):=20 + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +%CP /sec %CP +thumperdw-i-1 32G 111441 95 212536 54 171798 51 106184 98 719472 +88 1233 2 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 26085 90 +++++ +++ 5700 98 21448 97 +++++ +++ +4381 97 + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- +--Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +%CP /sec %CP +thumperdw-i-1 32G 116355 99 212509 54 171647 50 106112 98 715030 +87 1274 3 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 26082 99 +++++ +++ 5588 98 21399 88 +++++ +++ +4272 97 + +So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s +per character sequential read. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 07:07:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 36BEC9FB251 + for ; + Fri, 28 Jul 2006 07:07:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 26276-09 for + ; + Fri, 28 Jul 2006 07:07:19 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.192]) + by postgresql.org (Postfix) with ESMTP id 761CD9FB1E9 + for ; + Fri, 28 Jul 2006 07:07:18 -0300 (ADT) +Received: by wx-out-0102.google.com with SMTP id t4so227309wxc + for ; + Fri, 28 Jul 2006 03:04:01 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=Z533239BSwUjEtcW4wn8Xcv7mJrsbQe7oXWaTsMJjz2xWJGx2TanEupQgNc74t1EHVBb4MlNrMZ0DIfB9BjxXVS64nqsiUmB82EmxrVnX6BZKD37z83ak4MXyGZBwy5fZidMC5hsltRduq28U4uteEeyYRmeSqHkp/1+IDeC1kg= +Received: by 10.70.125.2 with SMTP id x2mr1913456wxc; + Fri, 28 Jul 2006 03:04:01 -0700 (PDT) +Received: by 10.70.33.19 with HTTP; Fri, 28 Jul 2006 03:04:01 -0700 (PDT) +Message-ID: +Date: Fri, 28 Jul 2006 12:04:01 +0200 +From: Eliott +To: "Scott Marlowe" , mmoncure@gmail.com +Subject: Re: performance issue with a specific query +Cc: pgsql-performance@postgresql.org +In-Reply-To: <1154011586.31664.85.camel@state.g2switchworks.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_1895_2708471.1154081041470" +References: + <1154011586.31664.85.camel@state.g2switchworks.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.623 tagged_above=0 required=5 tests=AWL, HTML_30_40, + HTML_MESSAGE, NORMAL_HTTP_TO_IP, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/263 +X-Sequence-Number: 20123 + +------=_Part_1895_2708471.1154081041470 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi! + +thanks for the quick help +i managed to reduce the response time from seemingly taking infinity to a +tolerable level, which is by the way a huge improvement. +What helped was the functional index on date_trunc('day',yourfieldhere) as +Scott suggested. +I tried to disable the geqo, but it didn't make any noticeable difference. +For now, I am happy with the result, if the result set stays the same I can +live without an upgrade. + + +> 1: Which 8.xx? 8.0.x or 8.1.x? 8.1.x is literally light years ahead +> of 7.4 in terms of performance. 8.0 is somewhere between them. The +> performance difference you're seeing is pretty common. + + +The benchmark was done on a small notebook running 8.1.4.1, versus 7.4.13 on +a 2gig P4 server. The difference is astounding, even without the functional +index 8.1 is 5-10 times faster than a full fledged server. + +3: You are NOT Stuck on 7.4.13. I have a RHEL server that will be +> running 8.1.4 or so pretty soon as a dataware house. It may get updated +> to RHEL4, may not. You can either compile from the .tar.[gz|bz2] files +> or download the PGDG rpms for your distro. + + +I know, but that's was I was trying to avoid. It is not that I would use the +RHEL support provided for 7.4.13, but you know, staying official is the +whole point of subscribing to RHEL4. + +Moreover, since many of our other applications are running happily running +under 7.4, I would be afraid to upgrade the whole thing. + +So, again, thanks everybody for the help, you saved the day for me. + +Regards +Eliott + +------=_Part_1895_2708471.1154081041470 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hi!

thanks for the quick help
i managed to reduce the response time from seemingly taking infinity to a tolerable level, which is by the way a huge improvement.
What helped was the functional index on date_trunc('day',yourfieldhere) as Scott suggested. +
I tried to disable the geqo, but it didn't make any noticeable difference.  For now, I am happy with the result, if the result set stays the same I can live without an upgrade.

+
1:  Which 8.xx?  8.0.x or +8.1.x?  8.1.x is literally light years ahead
of 7.4 in terms of performance.  8.0 is somewhere between them.  The
performance difference you're seeing is pretty common.

The benchmark was done on a small notebook running +8.1.4.1, versus 7.4.13 on a 2gig P4 server. The difference is astounding, even without the functional index +8.1 is 5-10 times faster than a full fledged server.

3:  You are NOT Stuck on +7.4.13.  I have a RHEL server that will be
running 8.1.4 or so pretty soon as a dataware house.  It may get updated
to RHEL4, may not.  You can either compile from the .tar.[gz|bz2] files +
or download the PGDG rpms for your distro.

I know, but that's was I was trying to avoid. It is not that I would use the RHEL support provided for 7.4.13, but you know, staying official is the whole point of subscribing to RHEL4. +

Moreover, since many of our other applications are running happily running under +7.4, I would be afraid to upgrade the whole thing.

So, again, thanks everybody for the help, you saved the day for me.

Regards
Eliott


+ + + +------=_Part_1895_2708471.1154081041470-- + +From pgsql-performance-owner@postgresql.org Fri Jul 28 07:40:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 71C2B9FB21E + for ; + Fri, 28 Jul 2006 07:40:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30376-02 for + ; + Fri, 28 Jul 2006 07:39:46 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.191]) + by postgresql.org (Postfix) with ESMTP id C1F0C9FB24C + for ; + Fri, 28 Jul 2006 07:38:54 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id p77so136457nfc + for ; + Fri, 28 Jul 2006 03:38:47 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=rTnBcC/dR6/ozCi8ZcCNSCJyEy8HDug7PuznsjWaiKNATFmscvAUQcpA/swqJKvG4CNc8uNbJQjA7Aj//E8u9SI7a3w6ch8zjz82ls82+rN4WxcNtmGacZZ0oLqmMHqUfnGsXJ56RDMpksP21F15Lpa05li2wAaZuyV02qOd0HU= +Received: by 10.49.5.12 with SMTP id h12mr502389nfi; + Fri, 28 Jul 2006 03:38:47 -0700 (PDT) +Received: by 10.49.64.6 with HTTP; Fri, 28 Jul 2006 03:38:46 -0700 (PDT) +Message-ID: +Date: Fri, 28 Jul 2006 12:38:46 +0200 +From: "Kjell Tore Fossbakk" +To: "Mikael Carneholm" +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Cc: "Luke Lonergan" , + pgsql-performance@postgresql.org +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D9B@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_2292_23741623.1154083126827" +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D9B@sesrv12.wirelesscar.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.93 tagged_above=0 required=5 tests=AWL, HTML_40_50, + HTML_MESSAGE, SPF_SOFTFAIL +X-Spam-Level: * +X-Archive-Number: 200607/264 +X-Sequence-Number: 20124 + +------=_Part_2292_23741623.1154083126827 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello. + +Unfortunately, I'm leaving for my vacation now, gone 3 weeks. When I'm back +I'll run benchmarksql and bonnie++ and give the results here. + +The spec I will be using: + +Prolite DL585 +2 x AMD/Opteron 64-bit 2,6GHZ +8G DDR PC3200 +4 x 150G SCSI in SmartArray 5i +Running Gentoo 2006.0 AMD_64 Hardened kernel + +Then I will remove the SmartArray 5i, and use a simple nonRAID SCSI +controller and implement Linux software RAID, and re-run the tests. + +I'll give signal in 3 weeks + +- Kjell Tore. + +On 7/28/06, Mikael Carneholm wrote: +> +> Luke, +> +> Yeah, I read those results, and I'm very disappointed with my results +> from the MSA1500. I would however be interested in other people's +> bonnie++ and benchmarksql results using a similar machine (2 cpu dual +> core opteron) with other "off the shelf" storage systems +> (EMC/Netapp/Xyratex/../). Could you run benchmarksql against that +> machine with the 16 SATA disk and 3Ware 9550SX SATA RAID adapters? It +> would be *very* interesting to see how the I/O performance correlates to +> benchmarksql (postgres) transaction throughout. +> +> /Mikael +> +> -----Original Message----- +> From: Luke Lonergan [mailto:LLonergan@greenplum.com] +> Sent: den 28 juli 2006 11:17 +> To: Mikael Carneholm; Kjell Tore Fossbakk; +> pgsql-performance@postgresql.org +> Subject: RE: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +> +> Mikael, +> +> > -----Original Message----- +> > From: Mikael Carneholm [mailto:Mikael.Carneholm@WirelessCar.com] +> > Sent: Friday, July 28, 2006 2:05 AM +> > +> > My bonnie++ results are found in this message: +> > http://archives.postgresql.org/pgsql-performance/2006-07/msg00164.php +> > +> +> Apologies if I've already said this, but those bonnie++ results are very +> disappointing. The sequential transfer rates between 20MB/s and 57MB/s +> are slower than a single SATA disk, and your SCSI disks might even do +> 80MB/s sequential transfer rate each. +> +> Random access is also very poor, though perhaps equal to 5 disk drives +> at 500/second. +> +> By comparison, we routinely get 950MB/s sequential transfer rate using +> 16 SATA disks and 3Ware 9550SX SATA RAID adapters on Linux. +> +> On Solaris ZFS on an X4500, we recently got this bonnie++ result on 36 +> SATA disk drives in RAID10 (single thread first): +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- +> --Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +> %CP /sec %CP +> thumperdw-i-1 32G 120453 99 467814 98 290391 58 109371 99 993344 +> 94 1801 4 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 +++++ +++ +++++ +++ +++++ +++ 30850 99 +++++ +++ +> +++++ +++ +> +> Bumping up the number of concurrent processes to 2, we get about 1.5x +> speed reads of RAID10 with a concurrent workload (you have to add the +> rates together): +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +> %CP /sec %CP +> thumperdw-i-1 32G 111441 95 212536 54 171798 51 106184 98 719472 +> 88 1233 2 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 26085 90 +++++ +++ 5700 98 21448 97 +++++ +++ +> 4381 97 +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- +> --Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +> %CP /sec %CP +> thumperdw-i-1 32G 116355 99 212509 54 171647 50 106112 98 715030 +> 87 1274 3 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 26082 99 +++++ +++ 5588 98 21399 88 +++++ +++ +> 4272 97 +> +> So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s +> per character sequential read. +> +> - Luke +> +> +> + + +-- +"Be nice to people on your way up because you meet them on your way down." + +------=_Part_2292_23741623.1154083126827 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello.
+
+Unfortunately, I'm leaving for my vacation now, gone 3 weeks. When I'm +back I'll run benchmarksql and bonnie++ and give the results here.
+
+The spec I will be using:
+
+Prolite DL585
+2 x AMD/Opteron 64-bit 2,6GHZ
+8G DDR PC3200
+4 x 150G SCSI in SmartArray 5i
+Running Gentoo 2006.0 AMD_64 Hardened kernel
+
+Then I will remove the SmartArray 5i, and use a simple nonRAID SCSI +controller and implement Linux software RAID, and re-run the tests.
+
+I'll give signal in 3 weeks
+
+- Kjell Tore.

On 7/28/06, Mikael Carneholm <Mikael.Carneholm@wirelesscar.com> wrote: +
Luke,

Yeah, I read those results, and I'm very disappointed with my results
from the MSA1500. I would however be interested in other people's +
bonnie++ and benchmarksql results using a similar machine (2 cpu dual
core opteron) with other "off the shelf" storage systems
(EMC/Netapp/Xyratex/../). Could you run benchmarksql against that
machine with the 16 SATA disk and 3Ware 9550SX SATA RAID adapters? It +
would be *very* interesting to see how the I/O performance correlates to
benchmarksql (postgres) transaction throughout.

/Mikael

-----Original Message-----
From: Luke Lonergan [mailto: +LLonergan@greenplum.com]
Sent: den 28 juli 2006 11:17
To: Mikael Carneholm; Kjell Tore Fossbakk;
pgsql-performance@postgresql.org
Subject: RE: [PERFORM] Performance with 2 AMD/Opteron +2.6Ghz and 8gig

Mikael,

> -----Original Message-----
> From: Mikael Carneholm [mailto:Mikael.Carneholm@WirelessCar.com]
> Sent: Friday, July 28, 2006 2:05 AM +
>
> My bonnie++ results are found in this message:
> http://archives.postgresql.org/pgsql-performance/2006-07/msg00164.php +
>

Apologies if I've already said this, but those bonnie++ results are very
disappointing.  The sequential transfer rates between 20MB/s and 57MB/s
are slower than a single SATA disk, and your SCSI disks might even do +
80MB/s sequential transfer rate each.

Random access is also very poor, though perhaps equal to 5 disk drives
at 500/second.

By comparison, we routinely get 950MB/s sequential transfer rate using
16 SATA disks and 3Ware 9550SX SATA RAID adapters on Linux. +

On Solaris ZFS on an X4500, we recently got this bonnie++ result on 36
SATA disk drives in RAID10 (single thread first):

Version  1.03       ------Sequential Output------    --Sequential Input-
--Random- +
                    -Per Chr-  --Block--  -Rewrite-  -Per Chr-
--Block--  --Seeks--
Machine        Size K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP K/sec
%CP /sec %CP
thumperdw-i-1   32G 120453  99 467814  98 290391  58 109371  99 993344 +
94 1801   4
                    ------Sequential Create------ --------Random
Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read---
-Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP +
/sec %CP
                 16 +++++ +++ +++++ +++ +++++ +++ 30850  99 +++++ +++
+++++ +++

Bumping up the number of concurrent processes to 2, we get about 1.5x
speed reads of RAID10 with a concurrent workload (you have to add the +
rates together):

Version  1.03       ------Sequential Output------   --Sequential Input-
--Random-
                    -Per Chr- --Block--  -Rewrite-  -Per Chr-  --Block--
--Seeks--
Machine        Size K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP K/sec +
%CP  /sec %CP
thumperdw-i-1   32G 111441  95 212536  54 171798  51 106184  98 719472
88  1233   2
                    ------Sequential Create------ --------Random
Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read--- +
-Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
/sec %CP
                 16 26085  90 +++++ +++  5700  98 21448  97 +++++ +++
4381  97

Version  1.03       ------Sequential Output------   --Sequential Input- +
--Random-
                    -Per Chr-  --Block--  -Rewrite-  -Per Chr-
--Block--   --Seeks--
Machine        Size K/sec  %CP K/sec  %CP K/sec  %CP K/sec  %CP K/sec
%CP  /sec %CP
thumperdw-i-1   32G 116355  99 212509  54 171647  50 106112  98 715030 +
87  1274   3
                    ------Sequential Create------ --------Random
Create--------
                    -Create-- --Read--- -Delete-- -Create-- --Read---
-Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP +
/sec %CP
                 16 26082  99 +++++ +++  5588  98 21399  88 +++++ +++
4272  97

So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s
per character sequential read.

- Luke +





--
"Be nice to people on your way up because you meet them on your way down." + +------=_Part_2292_23741623.1154083126827-- + +From pgsql-performance-owner@postgresql.org Fri Jul 28 09:53:29 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CDAE39FB260 + for ; + Fri, 28 Jul 2006 09:53:28 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 41284-03 for + ; + Fri, 28 Jul 2006 09:53:10 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id C41869FB266 + for ; + Fri, 28 Jul 2006 09:52:41 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.192]) + by svr4.postgresql.org (Postfix) with ESMTP id 611205AF069 + for ; + Fri, 28 Jul 2006 12:52:12 +0000 (GMT) +Received: by wx-out-0102.google.com with SMTP id s14so308269wxc + for ; + Fri, 28 Jul 2006 05:51:11 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=WITBDLd1HlCb3mG8Yv9Srd7LYxzfW8Rznna+IpRr+vfp20PxS1zJSOunM8KUf5vLkq/PKT7N6EQPNR4g6kdC8oKDZa2ogXKsakqMcLY1vSfhlw4UVpZrNZYUdupAXPV2u63sJxKr44ISPRaebyJ9o086I1SkDcjZ0Y7gWLKnFpM= +Received: by 10.70.44.5 with SMTP id r5mr2317976wxr; + Fri, 28 Jul 2006 05:51:11 -0700 (PDT) +Received: by 10.70.22.18 with HTTP; Fri, 28 Jul 2006 05:51:11 -0700 (PDT) +Message-ID: +Date: Fri, 28 Jul 2006 14:51:11 +0200 +From: "Claus Guttesen" +To: "Kjell Tore Fossbakk" +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig DDR PC3200 +Cc: pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.069 tagged_above=0 required=5 tests=SPF_NEUTRAL +X-Spam-Level: * +X-Archive-Number: 200607/265 +X-Sequence-Number: 20125 + +> As I have understood, there is alot of tuning using both postgres.conf and +> analyzing queries to make the values of postgres.conf fit my needs, system +> and hardware. This is where I need some help. I have looked into +> postgres.conf , and seen the tunings. But I'm still not sure what I should +> put into those variables (in postgres.conf) with my hardware. +> +> Any suggestions would be most appreciated! + +What OS is it running and what version is postgresql? + +regards +Claus + +From pgsql-performance-owner@postgresql.org Fri Jul 28 14:26:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 33D4A9FB270 + for ; + Fri, 28 Jul 2006 14:26:44 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 68102-01-4 + for ; + Fri, 28 Jul 2006 14:26:39 -0300 (ADT) +X-Greylist: delayed 01:23:14.562029 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id E6BF49FB286 + for ; + Fri, 28 Jul 2006 14:26:25 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) + by svr4.postgresql.org (Postfix) with ESMTP id DF3F15AFB4C + for ; + Fri, 28 Jul 2006 14:03:35 +0000 (GMT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Fri, 28 Jul 2006 14:03:07 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 28 Jul 2006 09:03:07 -0500 +Subject: Re: Disk writes +From: Scott Marlowe +To: carlosreimer +Cc: pgsql-performance +In-Reply-To: +References: +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1154095387.31664.111.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Fri, 28 Jul 2006 09:03:07 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.739 tagged_above=0 required=5 tests=AWL, + SPF_SOFTFAIL, UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/266 +X-Sequence-Number: 20126 + +On Thu, 2006-07-27 at 20:25, carlosreimer wrote: +> Hi, +> +> We've a fedora core 3 box with PostgreSQL 8.0. +> +> There is some performance problems with the server and I discovered +> with vmstat tool that there is some process writing a lot of +> information in the disk subsystem. +> +> I stopped the database and even so vmstat showed the same rates of +> disk writes. +> +> I could I discover who is sending so many data to the disks? + +Does top show any processes running? + +On my FC4 laptop, the one that kept cranking up all the time was +prelink. I don't really care if it takes an extra couple seconds for an +app to open each time, so I disabled that. + +The other process I've seen do this, on older flavors of linux mostly, +is kswapd erroneously writing and reading the swap partition a lot. +Seems to happen when the swap partition is smaller than physical memory, +and there's a lot of other I/O going on. But I think that got fixed in +the 2.6 kernel tree. + +From pgsql-performance-owner@postgresql.org Fri Jul 28 14:44:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 673CE9FB263 + for ; + Fri, 28 Jul 2006 14:44:26 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 69675-01 for + ; + Fri, 28 Jul 2006 14:44:14 -0300 (ADT) +X-Greylist: delayed 01:23:11.820523 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 39D3D9FB296 + for ; + Fri, 28 Jul 2006 14:43:12 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from mail-ihug.icp-qv1-irony1.iinet.net.au + (ihug-mail.icp-qv1-irony1.iinet.net.au [203.59.1.195]) + by svr4.postgresql.org (Postfix) with ESMTP id 7DA515AFBAD + for ; + Fri, 28 Jul 2006 14:18:39 +0000 (GMT) +Received: from 210-84-15-19.dyn.iinet.net.au (HELO [192.168.1.21]) + ([210.84.15.19]) by mail-ihug.icp-qv1-irony1.iinet.net.au with ESMTP; + 28 Jul 2006 22:17:35 +0800 +X-BrightmailFiltered: true +X-Brightmail-Tracker: AAAAAA== +X-IronPort-AV: i="4.07,191,1151856000"; + d="scan'208"; a="582138766:sNHT3387508410" +Message-ID: <44CA1C81.8060703@eclinic.com.au> +Date: Sat, 29 Jul 2006 00:17:37 +1000 +From: Leigh Dyer +User-Agent: Thunderbird 1.5.0.4 (X11/20060615) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org, + Mikael.Carneholm@WirelessCar.com +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D8C@sesrv12.wirelesscar.com> +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D8C@sesrv12.wirelesscar.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/268 +X-Sequence-Number: 20128 + +Mikael Carneholm wrote: +> I would be interested in what numbers you would get out of bonnie++ +> (http://www.coker.com.au/bonnie++) and BenchmarkSQL +> (http://sourceforge.net/projects/benchmarksql) on that hardware, for +> comparison with our DL385 (2xOpteron 280, 16Gb ram) and MSA1500. If you +> need help building benchmarksql, I can assist you with that. +> +> Actually, I would be interested if everyone who's reading this that has +> a similar machine (2 cpu, dual core opteron) with different storage +> systems could send me their bonnie + benchmarksql results! +> + +Here's the bonnie++ results from our Sun Fire V40z (2x Opteron 250, 4GB +RAM) with 6 15krpm 73GB drives connected to an LSI MegaRAID 320-2X +controller with 512MB cache. It's running Linux, and I'm using what +seems to be a fairly typical 6-drive setup: 2 drives in RAID-1 for OS +and WAL, and 4 drives in RAID-10 for data. This is from the 4-drive +RAID-10 array: + +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +--Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP +/sec %CP +gaz 8G 56692 88 73061 12 33048 6 44994 64 132571 14 +474.0 0 + ------Sequential Create------ --------Random +Create-------- + -Create-- --Read--- -Delete-- -Create-- --Read--- +-Delete-- + files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +/sec %CP + 16 19448 88 +++++ +++ 18611 72 19952 90 +++++ +++ +15167 65 + +This system is actually in production currently, and while it's a rather +quiet time at the moment, it still wasn't _entirely_ inactive when those +numbers were run, so the real performance is probably a little higher. +I'll see if I can run some BenchmarkSQL numbers as well. + +Thanks +Leigh + +> /Mikael +> +> +> -----Original Message----- +> From: pgsql-performance-owner@postgresql.org +> [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Luke +> Lonergan +> Sent: den 28 juli 2006 08:55 +> To: Kjell Tore Fossbakk; pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +> +> Kjell, +> +>> I got 4 150GIG SCSI disks in a Smart Array 5i 1+0 RAID. +> +> The Smart Array 5i is a terrible performer on Linux. I would be +> surprised if you exceed the performance of a single hard drive with this +> controller when doing I/O from disk. Since your database working set is +> larger than memory on the machine, I would recommend you use a simple +> non-RAID U320 SCSI controller, like those from LSI Logic (which HP +> resells) and implement Linux software RAID. You should see a nearly 10x +> increase in performance as compared to the SmartArray 5i. +> +> If you have a good relationship with HP, please ask them for some +> documentation of RAID performance on Linux with the SmartArray 5i. I +> predict they will tell you what they've told me and others: "the 5i is +> only useful for booting the OS". Alternately they could say: "we have +> world record performance with our RAID controllers", in which case you +> should ask them if that was with the 5i on Linux or whether it was the +> 6-series on Windows. +> +> - Luke +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 4: Have you searched our list archives? +> +> http://archives.postgresql.org +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match +> + +From pgsql-performance-owner@postgresql.org Fri Jul 28 14:31:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E823F9FB1F2 + for ; + Fri, 28 Jul 2006 14:31:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66421-06 for + ; + Fri, 28 Jul 2006 14:31:26 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from insiderscore.com (mail01.insiderscore.com [69.84.139.233]) + by postgresql.org (Postfix) with ESMTP id 925129FA4E3 + for ; + Fri, 28 Jul 2006 14:31:26 -0300 (ADT) +Received: from [10.10.10.105] (pool-71-248-161-243.bstnma.fios.verizon.net + [71.248.161.243]) + by insiderscore.com (Postfix) with ESMTP id 355F111C39FE; + Fri, 28 Jul 2006 13:31:22 -0400 (EDT) +In-Reply-To: <3E37B936B592014B978C4415F90D662D03E6CA59@MI8NYCMAIL06.Mi8.com> +References: <3E37B936B592014B978C4415F90D662D03E6CA59@MI8NYCMAIL06.Mi8.com> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed +Message-Id: <7A073C1C-BB04-42C7-A7B9-D25A18DB27D0@torgo.978.org> +Cc: "Mikael Carneholm" , + "Kjell Tore Fossbakk" , + pgsql-performance@postgresql.org +Content-Transfer-Encoding: 7bit +From: Jeff Trout +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Fri, 28 Jul 2006 13:31:21 -0400 +To: Luke Lonergan +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/267 +X-Sequence-Number: 20127 + +I too have a DL385 with a single DC Opteron 270. +It claims to have a smart array 6i controller and over the last +couple of days I've been runnign some tests on it, which have been +yielding some suprising results. + +I've got 6 10k U320 disks in it. 2 are in a mirror set. We'll not +pay any attention to them. +The remaining 4 disks I've been toying with to see what config works +best, using hardware raid and software raid. + +system info: +dl dl385 - 1 opteron 270 - 5GB ram - smart array 6i +cciss0: HP Smart Array 6i Controller +Firmware Version: 2.58 +Linux db03 2.6.17-1.2157_FC5 #1 SMP Tue Jul 11 22:53:56 EDT 2006 +x86_64 x86_64 x86_64 GNU/Linux +using xfs + +Each drive can sustain 80MB/sec read (dd, straight off device) + +So here are the results I have so far. (averaged) + + +hardware raid 5: +dd - write 20GB file - 48MB/sec +dd - read 20GB file - 247MB/sec +[ didn't do a bonnie run on this yet ] +pretty terrible write performance. good read. + +hardware raid 10 +dd - write 20GB - 104MB/sec +dd - read 20GB - 196MB/sec +bonnie++ +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- -- +Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec % +CP /sec %CP +db03 9592M 45830 97 129501 31 62981 14 48524 99 185818 +19 949.0 1 + +software raid 5 +dd - write 20gb - 85MB/sec +dd - read 20gb - 135MB/sec + +I was very suprised at those results. I was sort of expecting it to +smoke the hardware. I repeated the test many times, and kept getting +these numbers. + +bonnie++: +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- -- +Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec % +CP /sec %CP +db03 9592M 44110 97 81481 23 34604 10 44495 95 157063 +28 919.3 1 + +software 10: +dd - write - 20GB - 108MB/sec +dd - read - 20GB - 86MB/sec(!!!! WTF? - this is repeatable!!) +bonnie++ +Version 1.03 ------Sequential Output------ --Sequential Input- +--Random- + -Per Chr- --Block-- -Rewrite- -Per Chr- -- +Block-- --Seeks-- +Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec % +CP /sec %CP +db03 9592M 44539 98 105444 20 34127 8 39830 83 100374 +10 1072 1 + + +so I'm going to be going with hw r5, which went against what I +thought going in - read perf is more important for my usage than write. + +I'm still not sure about that software 10 read number. something is +not right there... + +-- +Jeff Trout +http://www.dellsmartexitin.com/ +http://www.stuarthamm.net/ + + + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 15:04:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 985E59FB27D + for ; + Fri, 28 Jul 2006 15:04:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 70840-03 for + ; + Fri, 28 Jul 2006 15:03:49 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 77F729FB27A + for ; + Fri, 28 Jul 2006 15:03:18 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 28 Jul 2006 11:01:54 -0700 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +From: Mark Lewis +To: Jeff Trout +Cc: Luke Lonergan , + Mikael Carneholm , + Kjell Tore Fossbakk , pgsql-performance@postgresql.org +In-Reply-To: <7A073C1C-BB04-42C7-A7B9-D25A18DB27D0@torgo.978.org> +References: <3E37B936B592014B978C4415F90D662D03E6CA59@MI8NYCMAIL06.Mi8.com> + <7A073C1C-BB04-42C7-A7B9-D25A18DB27D0@torgo.978.org> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Fri, 28 Jul 2006 11:01:54 -0700 +Message-Id: <1154109714.1634.609.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.081 tagged_above=0 required=5 tests=AWL, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/269 +X-Sequence-Number: 20129 + +This isn't all that surprising. The main weaknesses of RAID-5 are poor +write performance and stupid hardware controllers that make the write +performance even worse than it needs to be. Your numbers bear that out. +Reads off RAID-5 are usually pretty good. + +Your 'dd' test is going to be a little misleading though. Most DB +access isn't usually purely sequential; while it's easy to see why HW +RAID-5 might outperform HW-RAID-10 in large sequential reads (the RAID +controller would need to be smarter than most to make RAID-10 as fast as +RAID-5), I would expect that HW RAID-5 and RAID-10 random reads would be +about equal or else maybe give a slight edge to RAID-10. + +-- Mark Lewis + + +On Fri, 2006-07-28 at 13:31 -0400, Jeff Trout wrote: +> I too have a DL385 with a single DC Opteron 270. +> It claims to have a smart array 6i controller and over the last +> couple of days I've been runnign some tests on it, which have been +> yielding some suprising results. +> +> I've got 6 10k U320 disks in it. 2 are in a mirror set. We'll not +> pay any attention to them. +> The remaining 4 disks I've been toying with to see what config works +> best, using hardware raid and software raid. +> +> system info: +> dl dl385 - 1 opteron 270 - 5GB ram - smart array 6i +> cciss0: HP Smart Array 6i Controller +> Firmware Version: 2.58 +> Linux db03 2.6.17-1.2157_FC5 #1 SMP Tue Jul 11 22:53:56 EDT 2006 +> x86_64 x86_64 x86_64 GNU/Linux +> using xfs +> +> Each drive can sustain 80MB/sec read (dd, straight off device) +> +> So here are the results I have so far. (averaged) +> +> +> hardware raid 5: +> dd - write 20GB file - 48MB/sec +> dd - read 20GB file - 247MB/sec +> [ didn't do a bonnie run on this yet ] +> pretty terrible write performance. good read. +> +> hardware raid 10 +> dd - write 20GB - 104MB/sec +> dd - read 20GB - 196MB/sec +> bonnie++ +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- -- +> Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec % +> CP /sec %CP +> db03 9592M 45830 97 129501 31 62981 14 48524 99 185818 +> 19 949.0 1 +> +> software raid 5 +> dd - write 20gb - 85MB/sec +> dd - read 20gb - 135MB/sec +> +> I was very suprised at those results. I was sort of expecting it to +> smoke the hardware. I repeated the test many times, and kept getting +> these numbers. +> +> bonnie++: +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- -- +> Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec % +> CP /sec %CP +> db03 9592M 44110 97 81481 23 34604 10 44495 95 157063 +> 28 919.3 1 +> +> software 10: +> dd - write - 20GB - 108MB/sec +> dd - read - 20GB - 86MB/sec(!!!! WTF? - this is repeatable!!) +> bonnie++ +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- -- +> Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec % +> CP /sec %CP +> db03 9592M 44539 98 105444 20 34127 8 39830 83 100374 +> 10 1072 1 +> +> +> so I'm going to be going with hw r5, which went against what I +> thought going in - read perf is more important for my usage than write. +> +> I'm still not sure about that software 10 read number. something is +> not right there... +> +> -- +> Jeff Trout +> http://www.dellsmartexitin.com/ +> http://www.stuarthamm.net/ +> +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 9: In versions below 8.0, the planner will ignore your desire to +> choose an index scan if your joining column's datatypes do not +> match + +From pgsql-performance-owner@postgresql.org Fri Jul 28 16:19:02 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D02C59FB282 + for ; + Fri, 28 Jul 2006 16:19:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77724-05-2 + for ; + Fri, 28 Jul 2006 16:18:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id E5F4A9FB278 + for ; + Fri, 28 Jul 2006 16:18:42 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from newmail.silentmedia.com (earth.silentmedia.com [216.254.19.12]) + by svr4.postgresql.org (Postfix) with ESMTP id 06C975AFB1D + for ; + Fri, 28 Jul 2006 19:18:38 +0000 (GMT) +Received: by newmail.silentmedia.com (Postfix, from userid 99) + id 42ACE72B39C; Fri, 28 Jul 2006 12:19:13 -0700 (PDT) +Received: from GRD (GRD [10.125.42.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by newmail.silentmedia.com (Postfix) with ESMTP id EE28072B398 + for ; + Fri, 28 Jul 2006 12:19:12 -0700 (PDT) +Date: Fri, 28 Jul 2006 12:21:14 -0700 (PDT) +From: Ben +X-X-Sender: bench@GRD.cube42.tai.silentmedia.com +To: pgsql-performance@postgresql.org +Subject: index usage +Message-ID: +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/270 +X-Sequence-Number: 20130 + +I have a table with 37000 rows, an integer column, and an index on that +column. I've got a function that returns an integer. When I do a select +where I restrict that column to being equal to a static number, explain +tells me the index will be used. When I do the same thing but use the +function instead of a static number, explain shows me a full scan on the +table. + +I must be missing something, because my understanding is that the function +will be evaluated once for the statement and then collapsed into a static +number for the filtering. But the results of the explain seem to imply +that's not the case....? + +From pgsql-performance-owner@postgresql.org Fri Jul 28 16:24:17 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 243149FB27F + for ; + Fri, 28 Jul 2006 16:24:16 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 77348-06 for + ; + Fri, 28 Jul 2006 16:24:05 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.Mi8.com (d01gw01.mi8.com [63.240.6.47]) + by postgresql.org (Postfix) with ESMTP id 688609FB282 + for ; + Fri, 28 Jul 2006 16:24:05 -0300 (ADT) +Received: from 172.16.1.112 by mail.Mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D1)); Fri, 28 Jul 2006 15:22:31 -0400 +X-Server-Uuid: 241911D6-425B-44B9-A073-E3FE0F8FC774 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 28 Jul + 2006 15:22:31 -0400 +Received: from 63.80.24.130 ([63.80.24.130]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.108]) with Microsoft Exchange Server HTTP-DAV ; Fri, 28 Jul + 2006 19:22:30 +0000 +User-Agent: Microsoft-Entourage/11.2.5.060620 +Date: Fri, 28 Jul 2006 12:22:28 -0700 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +From: "Luke Lonergan" +To: "Jeff Trout" +cc: "Mikael Carneholm" , + "Kjell Tore Fossbakk" , + pgsql-performance@postgresql.org +Message-ID: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: AcayeynhaJqD/x5uEdu8sgAWy4o9DA== +In-Reply-To: <7A073C1C-BB04-42C7-A7B9-D25A18DB27D0@torgo.978.org> +MIME-Version: 1.0 +X-OriginalArrivalTime: 28 Jul 2006 19:22:31.0274 (UTC) + FILETIME=[2BD504A0:01C6B27B] +X-WSS-ID: 68D4BC7F3NC161733-04-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.55 tagged_above=0 required=5 tests=AWL, + RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200607/272 +X-Sequence-Number: 20132 + +Jeff, + +On 7/28/06 10:31 AM, "Jeff Trout" wrote: + +> I'm still not sure about that software 10 read number. something is +> not right there... + +It's very consistent with what we've seen before - the hardware RAID +controller doesn't do JBOD with SCSI command queuing like a simple SCSI +controller would do. The Smart Array 6402 makes a very bad SCSI controller +for software RAID. + +The hardware results look very good - seems like the 2.6.17 linux kernel has +a drastically improved CCISS driver as compared to what I've previously +seen. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Fri Jul 28 16:23:46 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A995F9FB280 + for ; + Fri, 28 Jul 2006 16:23:45 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78707-01 for + ; + Fri, 28 Jul 2006 16:23:35 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from relay02.mdc.ubisoft.com (relay02.mdc.ubisoft.com + [216.98.56.135]) + by postgresql.org (Postfix) with ESMTP id 408549FB284 + for ; + Fri, 28 Jul 2006 16:23:05 -0300 (ADT) +Received: from UBIMAIL1.ubisoft.org (unknown [10.129.1.15]) + by smarthost.mdc.ubisoft.com (Postfix) with ESMTP + id 845C74C007; Fri, 28 Jul 2006 15:23:03 -0400 (EDT) +X-MimeOLE: Produced By Microsoft Exchange V6.5 +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: index usage +Date: Fri, 28 Jul 2006 15:23:01 -0400 +Message-ID: <1E293D3FF63A3740B10AD5AAD88535D202B655F1@UBIMAIL1.ubisoft.org> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] index usage +Thread-Index: AcayetdS8u+RjsqlSFeuT5qvCDJIKgAAEMPg +From: "Daniel Caune" +To: "Ben" , +X-Ubisoft-MailScanner-Information: Please contact administrators@ubisoft.qc.ca +X-Ubisoft-MailScanner: Found to be clean +X-Ubisoft-MailScanner-SpamCheck: +X-MailScanner-From: daniel.caune@ubisoft.com +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=AWL +X-Spam-Level: +X-Archive-Number: 200607/271 +X-Sequence-Number: 20131 + +> De=A0: pgsql-performance-owner@postgresql.org = +[mailto:pgsql-performance- +> owner@postgresql.org] De la part de Ben +> Envoy=E9=A0: vendredi, juillet 28, 2006 15:21 +> =C0=A0: pgsql-performance@postgresql.org +> Objet=A0: [PERFORM] index usage +>=20 +> I have a table with 37000 rows, an integer column, and an index on = +that +> column. I've got a function that returns an integer. When I do a = +select +> where I restrict that column to being equal to a static number, = +explain +> tells me the index will be used. When I do the same thing but use the +> function instead of a static number, explain shows me a full scan on = +the +> table. +>=20 +> I must be missing something, because my understanding is that the = +function +> will be evaluated once for the statement and then collapsed into a = +static +> number for the filtering. But the results of the explain seem to imply +> that's not the case....? +>=20 + +Is your function IMMUTABLE, STABLE or VOLATILE? + +-- +Daniel + +From pgsql-performance-owner@postgresql.org Fri Jul 28 17:57:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4904D9FB278 + for ; + Fri, 28 Jul 2006 17:57:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 86335-09 for + ; + Fri, 28 Jul 2006 17:57:22 -0300 (ADT) +X-Greylist: delayed 01:38:42.919179 by SQLgrey- +Received: from newmail.silentmedia.com (earth.silentmedia.com [216.254.19.12]) + by postgresql.org (Postfix) with ESMTP id 7DB3D9FB270 + for ; + Fri, 28 Jul 2006 17:57:22 -0300 (ADT) +Received: by newmail.silentmedia.com (Postfix, from userid 99) + id E162C72B39C; Fri, 28 Jul 2006 13:57:55 -0700 (PDT) +Received: from GRD (GRD [10.125.42.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by newmail.silentmedia.com (Postfix) with ESMTP id 9CBFC72B398; + Fri, 28 Jul 2006 13:57:55 -0700 (PDT) +Date: Fri, 28 Jul 2006 13:59:57 -0700 (PDT) +From: Ben +X-X-Sender: bench@GRD.cube42.tai.silentmedia.com +To: Daniel Caune +cc: pgsql-performance@postgresql.org +Subject: Re: index usage +In-Reply-To: <1E293D3FF63A3740B10AD5AAD88535D202B655F1@UBIMAIL1.ubisoft.org> +Message-ID: +References: <1E293D3FF63A3740B10AD5AAD88535D202B655F1@UBIMAIL1.ubisoft.org> +MIME-Version: 1.0 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed +Content-Transfer-Encoding: 8BIT +X-Archive-Number: 200607/273 +X-Sequence-Number: 20133 + +It's volatile, but it will always return an integer. + +On Fri, 28 Jul 2006, Daniel Caune wrote: + +>> De�: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- +>> owner@postgresql.org] De la part de Ben +>> Envoy�: vendredi, juillet 28, 2006 15:21 +>> ��: pgsql-performance@postgresql.org +>> Objet�: [PERFORM] index usage +>> +>> I have a table with 37000 rows, an integer column, and an index on that +>> column. I've got a function that returns an integer. When I do a select +>> where I restrict that column to being equal to a static number, explain +>> tells me the index will be used. When I do the same thing but use the +>> function instead of a static number, explain shows me a full scan on the +>> table. +>> +>> I must be missing something, because my understanding is that the function +>> will be evaluated once for the statement and then collapsed into a static +>> number for the filtering. But the results of the explain seem to imply +>> that's not the case....? +>> +> +> Is your function IMMUTABLE, STABLE or VOLATILE? +> +> -- +> Daniel +> +>From pgsql-performance-owner@postgresql.org Fri Jul 28 18:02:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 15F6A9FB270 + for ; Fri, 28 Jul 2006 18:02:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88817-04 for ; + Fri, 28 Jul 2006 18:02:02 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id BCD2D9FB27A + for ; Fri, 28 Jul 2006 18:01:21 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 28 Jul 2006 14:01:18 -0700 +Subject: Re: index usage +From: Mark Lewis +To: Ben +Cc: Daniel Caune , pgsql-performance@postgresql.org +In-Reply-To: +References: <1E293D3FF63A3740B10AD5AAD88535D202B655F1@UBIMAIL1.ubisoft.org> + +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Organization: MIR3, Inc. +Date: Fri, 28 Jul 2006 14:01:18 -0700 +Message-Id: <1154120478.1634.666.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.061 tagged_above=0 required=5 tests=AWL, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/274 +X-Sequence-Number: 20134 + +A volatile function has may return a different result for each row; +think of the random() or nextval() functions for example. You wouldn't +want them to return the same value for each row returned. + +-- Mark Lewis + +On Fri, 2006-07-28 at 13:59 -0700, Ben wrote: +> It's volatile, but it will always return an integer. +>=20 +> On Fri, 28 Jul 2006, Daniel Caune wrote: +>=20 +> >> De : pgsql-performance-owner@postgresql.org [mailto:pgsql-performance- +> >> owner@postgresql.org] De la part de Ben +> >> Envoy=C3=A9 : vendredi, juillet 28, 2006 15:21 +> >> =C3=80 : pgsql-performance@postgresql.org +> >> Objet : [PERFORM] index usage +> >> +> >> I have a table with 37000 rows, an integer column, and an index on tha= +t +> >> column. I've got a function that returns an integer. When I do a selec= +t +> >> where I restrict that column to being equal to a static number, explai= +n +> >> tells me the index will be used. When I do the same thing but use the +> >> function instead of a static number, explain shows me a full scan on t= +he +> >> table. +> >> +> >> I must be missing something, because my understanding is that the func= +tion +> >> will be evaluated once for the statement and then collapsed into a sta= +tic +> >> number for the filtering. But the results of the explain seem to imply +> >> that's not the case....? +> >> +> > +> > Is your function IMMUTABLE, STABLE or VOLATILE? +> > +> > -- +> > Daniel +> > +> ---------------------------(end of broadcast)--------------------------- +> TIP 5: don't forget to increase your free space map settings + +From pgsql-performance-owner@postgresql.org Fri Jul 28 18:07:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1B2B39FB270 + for ; + Fri, 28 Jul 2006 18:07:37 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88795-06 for + ; + Fri, 28 Jul 2006 18:07:27 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 365CD9FB277 + for ; + Fri, 28 Jul 2006 18:06:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6SL6tB3001237; + Fri, 28 Jul 2006 17:06:55 -0400 (EDT) +To: Ben +cc: Daniel Caune , pgsql-performance@postgresql.org +Subject: Re: index usage +In-reply-to: + +References: <1E293D3FF63A3740B10AD5AAD88535D202B655F1@UBIMAIL1.ubisoft.org> + +Comments: In-reply-to Ben + message dated "Fri, 28 Jul 2006 13:59:57 -0700" +Date: Fri, 28 Jul 2006 17:06:55 -0400 +Message-ID: <1236.1154120815@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.055 tagged_above=0 required=5 tests=AWL, + SPF_HELO_PASS, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/275 +X-Sequence-Number: 20135 + +Ben writes: +> It's volatile, but it will always return an integer. + +If it's volatile then it can't be used for an index condition. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Sat Jul 29 03:05:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2B8FF9FB2AA + for ; + Sat, 29 Jul 2006 03:05:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 33763-09 for + ; + Sat, 29 Jul 2006 03:04:52 -0300 (ADT) +X-Greylist: delayed 00:06:17.683288 by SQLgrey- +Received: from mail.bway.net (xena.bway.net [216.220.96.26]) + by postgresql.org (Postfix) with ESMTP id C3D6A9FB1BE + for ; + Sat, 29 Jul 2006 03:04:05 -0300 (ADT) +Received: (qmail 45791 invoked by uid 0); 29 Jul 2006 05:57:20 -0000 +Received: from unknown (HELO white.nat.fasttrackmonkey.com) + (spork@bway.net@216.220.116.154) + by smtp.bway.net with (DHE-RSA-AES256-SHA encrypted) SMTP; + 29 Jul 2006 05:57:20 -0000 +Date: Sat, 29 Jul 2006 01:57:19 -0400 (EDT) +From: Charles Sprickman +X-X-Sender: spork@white.nat.fasttrackmonkey.com +To: Mikael Carneholm +cc: Luke Lonergan , + Kjell Tore Fossbakk , + pgsql-performance@postgresql.org +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +In-Reply-To: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D9B@sesrv12.wirelesscar.com> +Message-ID: +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D9B@sesrv12.wirelesscar.com> +MIME-Version: 1.0 +Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.067 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/276 +X-Sequence-Number: 20136 + +On Fri, 28 Jul 2006, Mikael Carneholm wrote: + +> Luke, +> +> Yeah, I read those results, and I'm very disappointed with my results +> from the MSA1500. I would however be interested in other people's +> bonnie++ and benchmarksql results using a similar machine (2 cpu dual +> core opteron) with other "off the shelf" storage systems +> (EMC/Netapp/Xyratex/../). Could you run benchmarksql against that +> machine with the 16 SATA disk and 3Ware 9550SX SATA RAID adapters? It +> would be *very* interesting to see how the I/O performance correlates to +> benchmarksql (postgres) transaction throughout. + +FWIW, once our vendor gets all the pieces (having some issues with +figuring out which multilane sata cables to get), I'll have a dual-core +opteron box with a 3Ware 9500SX-12MI and 8 drives. I need to benchmark to +compare this to our xeon/adaptec/scsi build we've been using. + +I've also got a 1U with a 9500SX-4 and 4 drives. I like how the 3Ware +card scales there - started with 2 drives and got "drive speed" mirroring. +Added two more and most of the bonnie numbers doubled. This is not what +I'm used to with the Adaptec SCSI junk. + +These SATA RAID controllers 3Ware is making seem to be leaps and bounds +beyond what the "old guard" is churning out (at much higher prices). + +Charles + +> /Mikael +> +> -----Original Message----- +> From: Luke Lonergan [mailto:LLonergan@greenplum.com] +> Sent: den 28 juli 2006 11:17 +> To: Mikael Carneholm; Kjell Tore Fossbakk; +> pgsql-performance@postgresql.org +> Subject: RE: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +> +> Mikael, +> +>> -----Original Message----- +>> From: Mikael Carneholm [mailto:Mikael.Carneholm@WirelessCar.com] +>> Sent: Friday, July 28, 2006 2:05 AM +>> +>> My bonnie++ results are found in this message: +>> http://archives.postgresql.org/pgsql-performance/2006-07/msg00164.php +>> +> +> Apologies if I've already said this, but those bonnie++ results are very +> disappointing. The sequential transfer rates between 20MB/s and 57MB/s +> are slower than a single SATA disk, and your SCSI disks might even do +> 80MB/s sequential transfer rate each. +> +> Random access is also very poor, though perhaps equal to 5 disk drives +> at 500/second. +> +> By comparison, we routinely get 950MB/s sequential transfer rate using +> 16 SATA disks and 3Ware 9550SX SATA RAID adapters on Linux. +> +> On Solaris ZFS on an X4500, we recently got this bonnie++ result on 36 +> SATA disk drives in RAID10 (single thread first): +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- +> --Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +> %CP /sec %CP +> thumperdw-i-1 32G 120453 99 467814 98 290391 58 109371 99 993344 +> 94 1801 4 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 +++++ +++ +++++ +++ +++++ +++ 30850 99 +++++ +++ +> +++++ +++ +> +> Bumping up the number of concurrent processes to 2, we get about 1.5x +> speed reads of RAID10 with a concurrent workload (you have to add the +> rates together): +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- +> --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +> %CP /sec %CP +> thumperdw-i-1 32G 111441 95 212536 54 171798 51 106184 98 719472 +> 88 1233 2 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 26085 90 +++++ +++ 5700 98 21448 97 +++++ +++ +> 4381 97 +> +> Version 1.03 ------Sequential Output------ --Sequential Input- +> --Random- +> -Per Chr- --Block-- -Rewrite- -Per Chr- +> --Block-- --Seeks-- +> Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec +> %CP /sec %CP +> thumperdw-i-1 32G 116355 99 212509 54 171647 50 106112 98 715030 +> 87 1274 3 +> ------Sequential Create------ --------Random +> Create-------- +> -Create-- --Read--- -Delete-- -Create-- --Read--- +> -Delete-- +> files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP +> /sec %CP +> 16 26082 99 +++++ +++ 5588 98 21399 88 +++++ +++ +> 4272 97 +> +> So that's 2500 seeks per second, 1440MB/s sequential block read, 212MB/s +> per character sequential read. +> +> - Luke +> +> +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Sat Jul 29 03:08:32 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B33039FB2BA + for ; + Sat, 29 Jul 2006 03:08:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 32057-07-4 + for ; + Sat, 29 Jul 2006 03:08:11 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by postgresql.org (Postfix) with ESMTP id D2F2F9FB2AC + for ; + Sat, 29 Jul 2006 03:08:10 -0300 (ADT) +Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Sat, 29 Jul 2006 02:04:40 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 29 Jul + 2006 02:04:40 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Sat, 29 Jul 2006 02:06:27 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D03E6CE74@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: Acay0+TMC6adHsRWRjqW39K13hJ5twAAJSPQ +From: "Luke Lonergan" +To: "Charles Sprickman" , + "Mikael Carneholm" +cc: "Kjell Tore Fossbakk" , + pgsql-performance@postgresql.org +X-OriginalArrivalTime: 29 Jul 2006 06:04:40.0706 (UTC) + FILETIME=[E129C620:01C6B2D4] +X-WSS-ID: 68D425F22W81862946-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/277 +X-Sequence-Number: 20137 + +Charles,=20 + +> FWIW, once our vendor gets all the pieces (having some issues=20 +> with figuring out which multilane sata cables to get), I'll=20 +> have a dual-core opteron box with a 3Ware 9500SX-12MI and 8=20 +> drives. I need to benchmark to compare this to our=20 +> xeon/adaptec/scsi build we've been using. + +Cool! You mean the 9550SX, not the 9500, right? + +A trick on the 9550SX with Linux is to set the max readahead to 512KB +and no larger when using RAID10. If you use RAID5, set it to 16MB. + +Here is how you set it (put in /etc/rc.d/rc.local) for 512KB on +/dev/sda: + + /sbin/blockdev --setra 512 /dev/sda + +I was able to go from 310MB/s on 8 drives to 475MB/s that way (using +XFS). + +Also, you need to stay away from Linux Volume Manager (lvm and lvm2), +they add a lot of overhead (!!?) to the block access. It took me a long +time to figure that out! +=20 +- Luke + + +From pgsql-performance-owner@postgresql.org Sat Jul 29 12:03:45 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 7A7D89FB2A9 + for ; + Sat, 29 Jul 2006 12:03:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 70384-06 for + ; + Sat, 29 Jul 2006 12:03:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 198399FB276 + for ; + Sat, 29 Jul 2006 12:03:28 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from mailservice.tudelft.nl (mailservice.tudelft.nl [130.161.131.5]) + by svr4.postgresql.org (Postfix) with ESMTP id 8246B5AF02E + for ; + Sat, 29 Jul 2006 15:03:27 +0000 (GMT) +Received: from localhost (localhost [127.0.0.1]) + by rav.antivirus (Postfix) with ESMTP id 6C47D22354F + for ; + Sat, 29 Jul 2006 17:02:59 +0200 (CEST) +Received: from smtp-a.tudelft.nl (smtp-a.tudelft.nl [130.161.129.18]) + by mx0.tudelft.nl (Postfix) with ESMTP id 7478F2235D3 + for ; + Sat, 29 Jul 2006 17:02:50 +0200 (CEST) +Received: from [192.168.64.12] (bitbucket.office.oli.tudelft.nl + [130.161.3.209]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by smtp-a.tudelft.nl (Postfix) with ESMTP id 3D305F1B2A + for ; + Sat, 29 Jul 2006 17:02:47 +0200 (CEST) +Message-ID: <44CB7896.8030501@oli.tudelft.nl> +Date: Sat, 29 Jul 2006 17:02:46 +0200 +From: Jochem van Dieten +User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: PostgreSQL scalability on Sun UltraSparc T1 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: by amavisd-new at tudelft.nl +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/278 +X-Sequence-Number: 20138 + +Tweakers.net has done a database performance test between a Sun T2000 (8 +core T1) and a Sun X4200 (2 dual core Opteron 280). The database +benchmark is developed inhouse and represents the average query pattern +from their website. It is MySQL centric because Tweakers.net runs on +MySQL, but Arjen van der Meijden has ported it to PostgreSQL and has +done basic optimizations like adding indexes. + +Arjen wrote about some of the preliminary results previously in +http://archives.postgresql.org/pgsql-performance/2006-06/msg00358.php +but the article has now been published http://tweakers.net/reviews/633/7 +This is all the more impressive if you scroll down and look at the +behaviour of MySQL (after tweaking by both MySQL AB and Sun). + +Jochem + +From pgsql-performance-owner@postgresql.org Sat Jul 29 12:46:37 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5DA759FB1ED + for ; + Sat, 29 Jul 2006 12:46:36 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74481-04 for + ; + Sat, 29 Jul 2006 12:46:25 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from lists.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id ECFA79FB2A9 + for ; + Sat, 29 Jul 2006 12:45:54 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id k6TFhoeS003667; + Sat, 29 Jul 2006 08:43:50 -0700 +Message-ID: <44CB8235.9070903@commandprompt.com> +Date: Sat, 29 Jul 2006 08:43:49 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.4 (X11/20060615) +MIME-Version: 1.0 +To: Jochem van Dieten +CC: pgsql-performance@postgresql.org +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +References: <44CB7896.8030501@oli.tudelft.nl> +In-Reply-To: <44CB7896.8030501@oli.tudelft.nl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.151 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/279 +X-Sequence-Number: 20139 + +Jochem van Dieten wrote: +> Tweakers.net has done a database performance test between a Sun T2000 (8 +> core T1) and a Sun X4200 (2 dual core Opteron 280). The database +> benchmark is developed inhouse and represents the average query pattern +> from their website. It is MySQL centric because Tweakers.net runs on +> MySQL, but Arjen van der Meijden has ported it to PostgreSQL and has +> done basic optimizations like adding indexes. +> +> Arjen wrote about some of the preliminary results previously in +> http://archives.postgresql.org/pgsql-performance/2006-06/msg00358.php +> but the article has now been published http://tweakers.net/reviews/633/7 +> This is all the more impressive if you scroll down and look at the +> behaviour of MySQL (after tweaking by both MySQL AB and Sun). + +I would love to get my hands on that postgresql version and see how much +farther it could be optimized. + +Joshua D. Drake + + +> +> Jochem +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 1: if posting/reading through Usenet, please send an appropriate +> subscribe-nomail command to majordomo@postgresql.org so that your +> message can get through to the mailing list cleanly +> + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Sat Jul 29 13:46:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 517899FA5BF + for ; + Sat, 29 Jul 2006 13:46:30 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78964-02-2 + for ; + Sat, 29 Jul 2006 13:46:23 -0300 (ADT) +X-Greylist: delayed 00:25:53.759752 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 2D56E9FB2C3 + for ; + Sat, 29 Jul 2006 13:46:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by svr4.postgresql.org (Postfix) with ESMTP id 1A8975AF045 + for ; + Sat, 29 Jul 2006 16:20:27 +0000 (GMT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id DEDD118264; + Sat, 29 Jul 2006 18:20:22 +0200 (MEST) +Message-ID: <44CB8ACE.1020706@tweakers.net> +Date: Sat, 29 Jul 2006 18:20:30 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) +MIME-Version: 1.0 +To: Jochem van Dieten +Cc: pgsql-performance@postgresql.org +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +References: <44CB7896.8030501@oli.tudelft.nl> +In-Reply-To: <44CB7896.8030501@oli.tudelft.nl> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0630-4, 29-07-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/281 +X-Sequence-Number: 20141 + +On 29-7-2006 17:02, Jochem van Dieten wrote: +> Tweakers.net has done a database performance test between a Sun T2000 (8 +> core T1) and a Sun X4200 (2 dual core Opteron 280). The database +> benchmark is developed inhouse and represents the average query pattern +> from their website. It is MySQL centric because Tweakers.net runs on +> MySQL, but Arjen van der Meijden has ported it to PostgreSQL and has +> done basic optimizations like adding indexes. + +There were a few minor datatype changes (like enum('Y', 'N') to boolean, +but on the other hand also 'int unsigned' to 'bigint'), a few small +query changes (i.e. rewriting join orders, most turned out to be +necessary for mysql 5.0 and 5.1 as well anyway) and even fewer larger +query changes (including a subquery, instead of the results of another +query). + +The indexes also included adding partial indexes and several combined +indexes. + +All in all I think it took about a week to do the conversion and test +the specific queries. Luckily PostgreSQL allows for much clearer +information on what a specific query is doing and much faster +adding/removing of indexes (mysql rewrites the entire table). + +> Arjen wrote about some of the preliminary results previously in +> http://archives.postgresql.org/pgsql-performance/2006-06/msg00358.php +> but the article has now been published http://tweakers.net/reviews/633/7 +> This is all the more impressive if you scroll down and look at the +> behaviour of MySQL (after tweaking by both MySQL AB and Sun). + +Actually, we haven't had contact with MySQL AB. But as far as I know, +the Sun engineers have contacted them about this. +As it turns out there are some suboptimal machine codes generated from +MySQL's source for the Niagara T1 and MySQL has some issues with +InnoDB's scaling in the later 5.0-versions: +http://www.mysqlperformanceblog.com/2006/07/28/returning-to-innodb-scalability/ + +Then again, we weren't able to compile the PG8.2 dev using all +optimizations of Sun's Studio Compiler (the mlibopt-switch failed), so +there is very likely more room for improvement on that field as well. + +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Sat Jul 29 13:33:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1E78E9FB1E8 + for ; + Sat, 29 Jul 2006 13:33:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 76598-08 for + ; + Sat, 29 Jul 2006 13:33:00 -0300 (ADT) +X-Greylist: delayed 00:12:33.674738 by SQLgrey- +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by postgresql.org (Postfix) with ESMTP id A4FB89FA5BF + for ; + Sat, 29 Jul 2006 13:33:00 -0300 (ADT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id 3FA8818104; + Sat, 29 Jul 2006 18:32:57 +0200 (MEST) +Message-ID: <44CB8DC1.4040105@tweakers.net> +Date: Sat, 29 Jul 2006 18:33:05 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) +MIME-Version: 1.0 +To: "Joshua D. Drake" +CC: Jochem van Dieten , + pgsql-performance@postgresql.org +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +References: <44CB7896.8030501@oli.tudelft.nl> + <44CB8235.9070903@commandprompt.com> +In-Reply-To: <44CB8235.9070903@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0630-4, 29-07-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/280 +X-Sequence-Number: 20140 + +On 29-7-2006 17:43, Joshua D. Drake wrote: +> +> I would love to get my hands on that postgresql version and see how much +> farther it could be optimized. + +You probably mean the entire installation? As said in my reply to +Jochem, I've spent a few days testing all queries to improve their +performance. I'm not sure what kind of improvements that yielded, but if +I remember correctly its in the order of 3-5 times for the entire +benchmark, compared to the initial MySQL-layout and queries. + +If you mean the configuration and which version it was, I can look that +up for you if you'd like. Including the compilation switches used on the +T2000. + +If we get to keep the machine (which we're going to try, but that's with +worse performance than with their x4200 a bit doubtful), I'm sure we can +work something out. +Then again, we regularly have other server hardware on which the same +database is used, so even without the T2000 we could still do some +effort to further improve postgresql's performance. +It might be interesting to have some Postgres experts do some more +tuning and allowing MySQL AB to do the same... But I'm not sure if we're +willing to spent that much extra time on a benchmark (just testing one +database costs us about a day and a half...) + +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Sat Jul 29 14:03:27 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B55859FB2D5 + for ; + Sat, 29 Jul 2006 14:03:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 80529-02 for + ; + Sat, 29 Jul 2006 14:03:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from lists.commandprompt.com (host-130.commandprompt.net + [207.173.203.130]) + by postgresql.org (Postfix) with ESMTP id 84A9A9FB2CD + for ; + Sat, 29 Jul 2006 14:02:43 -0300 (ADT) +Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net + [67.76.146.141]) (authenticated bits=0) + by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id k6TH1d3P005093; + Sat, 29 Jul 2006 10:01:39 -0700 +Message-ID: <44CB9472.9060206@commandprompt.com> +Date: Sat, 29 Jul 2006 10:01:38 -0700 +From: "Joshua D. Drake" +Organization: Command Prompt, Inc. +User-Agent: Thunderbird 1.5.0.4 (X11/20060615) +MIME-Version: 1.0 +To: Arjen van der Meijden +CC: Jochem van Dieten , + pgsql-performance@postgresql.org +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +References: <44CB7896.8030501@oli.tudelft.nl> + <44CB8235.9070903@commandprompt.com> + <44CB8DC1.4040105@tweakers.net> +In-Reply-To: <44CB8DC1.4040105@tweakers.net> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.151 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO +X-Spam-Level: +X-Archive-Number: 200607/282 +X-Sequence-Number: 20142 + +Arjen van der Meijden wrote: +> On 29-7-2006 17:43, Joshua D. Drake wrote: +>> +>> I would love to get my hands on that postgresql version and see how +>> much farther it could be optimized. +> +> You probably mean the entire installation? As said in my reply to +> Jochem, I've spent a few days testing all queries to improve their +> performance. I'm not sure what kind of improvements that yielded, but if +> I remember correctly its in the order of 3-5 times for the entire +> benchmark, compared to the initial MySQL-layout and queries. +> +> If you mean the configuration and which version it was, I can look that +> up for you if you'd like. Including the compilation switches used on the +> T2000. + +Well I would be curious about the postgresql.conf and how much ram +etc... it had. + +> Then again, we regularly have other server hardware on which the same +> database is used, so even without the T2000 we could still do some +> effort to further improve postgresql's performance. +> It might be interesting to have some Postgres experts do some more +> tuning and allowing MySQL AB to do the same... But I'm not sure if we're +> willing to spent that much extra time on a benchmark (just testing one +> database costs us about a day and a half...) + +I understand, I just have a feeling that we could do even better :) I do +appreciate all your efforts. + +Sincerely, + +Joshua D. Drake + + +> +> Best regards, +> +> Arjen +> + + +-- + + === The PostgreSQL Company: Command Prompt, Inc. === +Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 + Providing the most comprehensive PostgreSQL solutions since 1997 + http://www.commandprompt.com/ + + + +From pgsql-performance-owner@postgresql.org Sat Jul 29 14:40:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0A4729FB2D3 + for ; + Sat, 29 Jul 2006 14:40:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82921-06 for + ; + Sat, 29 Jul 2006 14:39:56 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by postgresql.org (Postfix) with ESMTP id C55B79FB2D1 + for ; + Sat, 29 Jul 2006 14:39:26 -0300 (ADT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id BD2471816F; + Sat, 29 Jul 2006 19:39:22 +0200 (MEST) +Message-ID: <44CB9D52.8040409@tweakers.net> +Date: Sat, 29 Jul 2006 19:39:30 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) +MIME-Version: 1.0 +To: "Joshua D. Drake" +CC: Jochem van Dieten , + pgsql-performance@postgresql.org +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +References: <44CB7896.8030501@oli.tudelft.nl> + <44CB8235.9070903@commandprompt.com> + <44CB8DC1.4040105@tweakers.net> + <44CB9472.9060206@commandprompt.com> +In-Reply-To: <44CB9472.9060206@commandprompt.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0630-4, 29-07-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/283 +X-Sequence-Number: 20143 + +On 29-7-2006 19:01, Joshua D. Drake wrote: +> Well I would be curious about the postgresql.conf and how much ram +> etc... it had. + +It was the 8core version with 16GB memory... but actually that's just +overkill, the active portions of the database easily fits in 8GB and a +test on another machine with just 2GB didn't even show that much +improvements when going to 7GB (6x1G, 2x 512M), it was mostly in the +range of 10% improvement or less. + +Anyway, the differences to the default postgresql.conf: +shared_buffers = 30000 +Tests with 40k, 50k en 60k didn't really show improvements. + +work_mem = 2048 +This probably could've been set higher with the sheer amount of +not-really-used memory. + +maintenance_work_mem = 65535 +Not really important of course + +max_fsm_pages = 50000 +Somehow it needed to be set quite high, probably because we only cleaned +up after doing over 200k requests. + +effective_cache_size = 350000 +As said, the database fitted in 8GB of memory, so I didn't see a need to +set this higher than for the 8GB machines (x4200 and another T2000 we had). + +default_statistics_target = 200 +For a few columns on the largest tables I manually raised it to 1000 + +log_min_duration_statement = 1000 +I'm not sure if this has much overhead? Stats logging was turned/left on +as well. +Turning that off improved it a few percent. + +> I understand, I just have a feeling that we could do even better :) I do +> appreciate all your efforts. + +Well, I'll keep that in mind :) +What it makes even worse for MySQL is that it had (on another machine) +about 8M hits on the query cache for 4M inserts, i.e. half of the +queries weren't even executed on it. + +Best regards, + +Arjen + +From pgsql-performance-owner@postgresql.org Sat Jul 29 15:09:28 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E99369FB2D2 + for ; + Sat, 29 Jul 2006 15:09:27 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85176-06 for + ; + Sat, 29 Jul 2006 15:09:22 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.200]) + by postgresql.org (Postfix) with ESMTP id 7752A9FA004 + for ; + Sat, 29 Jul 2006 15:09:22 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id i11so50463nzi + for ; + Sat, 29 Jul 2006 11:09:19 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=NIDJ/hEzwESB2At5YJTxDOS61G5oQ7knO5Xse5D8VdwTJOybQNEzAjNfESv8zMsFyDmJj/sUep/vhHSjDfav+e741f0aSppqCYs48n6e5jDPs895BdClw8OrXemBBOI3d+PgBxFT01LDGhrxF7ntIMgiPOXCOdOS/L6W4VYssFk= +Received: by 10.65.250.14 with SMTP id c14mr898354qbs; + Sat, 29 Jul 2006 11:09:15 -0700 (PDT) +Received: by 10.64.179.18 with HTTP; Sat, 29 Jul 2006 11:09:15 -0700 (PDT) +Message-ID: <5f820f750607291109g6df92f86lf7d8ee7db012c3d4@mail.gmail.com> +Date: Sat, 29 Jul 2006 14:09:15 -0400 +From: "Denis Lussier" +To: "Leigh Dyer" +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Cc: pgsql-performance@postgresql.org, Mikael.Carneholm@wirelesscar.com +In-Reply-To: <44CA1C81.8060703@eclinic.com.au> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_15003_27600131.1154196555239" +References: <7F10D26ECFA1FB458B89C5B4B0D72C2B4E4D8C@sesrv12.wirelesscar.com> + <44CA1C81.8060703@eclinic.com.au> +X-Google-Sender-Auth: 77a04140f5c923f9 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.278 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_MESSAGE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/284 +X-Sequence-Number: 20144 + +------=_Part_15003_27600131.1154196555239 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +> systems could send me their bonnie + benchmarksql results! + +I am one of the authors of BenchmarkSQL, it is similar to a DBT2. But, its +very easy to use (&/or abuse). It's a multithreaded Java Swing client that +can run the exact same benchmark (uses JDBC prepared statements) against +Postgres/EnterpriseDB/Bizgres, MySQueeL, Horacle, Microsloth, etc, etc. You +can find BenchmarkSQL on pgFoundry and SourceForge. + +As expected, Postgres is good on this benchmark and is getting better all +the time. + +If you run an EnterpriseDB install right out of the box versus a PG install +right out of the box you'll notice that EnterpriseDB outperforms PG by +better than 2x. This does NOT mean that EnterpriseDB is 3x faster than +Postgres... EnterpriseDB is the same speed as Postgres. We do something +we call "Dynatune" at db startup time. The algorithm is pretty simple in +our current GA version and really only considers the amount of RAM, SHARED +Memory, and machine usage pattern. Manual tuning is required to really +optimize performance.... + +For great insight into the basics of quickly tuning PostgreSQL for a +reasonable starting point, check out the great instructions offered by Josh +Berkus and Joe Conway at http://www.powerpostgresql.com/PerfList/. + +The moral of this unreasonably verbose email is that you shouldn't abuse +BenchmarkSQL and measure runs without making sure that, at least, +quick/simple best practices have been applied to tuning the db's you are +choosing to test. + +--Denis Lussier + CTO + http://www.enterprisedb.com + + + +> > +> + +------=_Part_15003_27600131.1154196555239 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
> systems could send me their bonnie + benchmarksql results!
 
+
I am one of the authors of BenchmarkSQL, it is similar to a DBT2.   But, its very easy to use (&/or abuse).   It's a multithreaded Java Swing client that can run the exact same benchmark (uses JDBC prepared statements) against Postgres/EnterpriseDB/Bizgres, MySQueeL, Horacle, Microsloth, etc, etc.  You can find BenchmarkSQL on pgFoundry and SourceForge. +
+
 
+
As expected, Postgres is good on this benchmark and is getting better all the time.
+
 
+
If you run an EnterpriseDB install right out of the box versus a PG install right out of the box you'll notice that EnterpriseDB outperforms PG by better than 2x.    This does NOT mean that EnterpriseDB is 3x faster than Postgres...   EnterpriseDB is the same speed as Postgres.   We do something we call "Dynatune" at db startup time.  The algorithm is pretty simple in our current GA version and really only considers the amount of RAM, SHARED Memory, and machine usage pattern.  Manual tuning is required to really optimize performance.... +
+
 
+
For great insight into the basics of quickly tuning PostgreSQL for a reasonable starting point, check out the great instructions offered by Josh Berkus and Joe Conway at +http://www.powerpostgresql.com/PerfList/.
+
 
+
The moral of this unreasonably verbose email is that you shouldn't abuse BenchmarkSQL and measure runs without making sure that, at least, quick/simple best practices have been applied to tuning the db's you are choosing to test. +
+
 
+
--Denis Lussier
+
  CTO
+ +
+
>
+ +------=_Part_15003_27600131.1154196555239-- + +From pgsql-performance-owner@postgresql.org Sat Jul 29 15:40:03 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id AAC499FB2D0 + for ; + Sat, 29 Jul 2006 15:40:02 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 87857-04 for + ; + Sat, 29 Jul 2006 15:39:58 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by postgresql.org (Postfix) with ESMTP id 09A5A9FB2C3 + for ; + Sat, 29 Jul 2006 15:39:57 -0300 (ADT) +Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Sat, 29 Jul 2006 14:39:53 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 29 Jul + 2006 14:39:52 -0400 +Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sat, 29 Jul + 2006 18:39:52 +0000 +User-Agent: Microsoft-Entourage/11.2.5.060620 +Date: Sat, 29 Jul 2006 11:39:50 -0700 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +From: "Luke Lonergan" +To: "Denis Lussier" , + "Leigh Dyer" +cc: pgsql-performance@postgresql.org, + Mikael.Carneholm@wirelesscar.com +Message-ID: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Thread-Index: AcazPl+bneckfh8xEdu8sgAWy4o9DA== +In-Reply-To: <5f820f750607291109g6df92f86lf7d8ee7db012c3d4@mail.gmail.com> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2006 18:39:52.0808 (UTC) + FILETIME=[6147D680:01C6B33E] +X-WSS-ID: 68D574F32W82063657-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.635 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200607/285 +X-Sequence-Number: 20145 + +Denis, + +On 7/29/06 11:09 AM, "Denis Lussier" wrote: + +> We do something we call "Dynatune" at db startup time. + +Sounds great - where do we download it? + +- Luke + + + +From pgsql-performance-owner@postgresql.org Sat Jul 29 15:53:18 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 112FA9FB2D2 + for ; + Sat, 29 Jul 2006 15:53:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 86905-09 for + ; + Sat, 29 Jul 2006 15:53:10 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by postgresql.org (Postfix) with ESMTP id 065879FB2D0 + for ; + Sat, 29 Jul 2006 15:53:09 -0300 (ADT) +Received: from 172.16.1.110 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Sat, 29 Jul 2006 14:52:59 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP01.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 29 Jul + 2006 14:52:59 -0400 +Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( + [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( + [172.16.1.106]) with Microsoft Exchange Server HTTP-DAV ; Sat, 29 Jul + 2006 18:52:59 +0000 +User-Agent: Microsoft-Entourage/11.2.5.060620 +Date: Sat, 29 Jul 2006 11:52:56 -0700 +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +From: "Luke Lonergan" +To: "Jochem van Dieten" , + pgsql-performance@postgresql.org +Message-ID: +Thread-Topic: [PERFORM] PostgreSQL scalability on Sun UltraSparc T1 +Thread-Index: AcazQDQZcvFalB8zEdu8sgAWy4o9DA== +In-Reply-To: <44CB7896.8030501@oli.tudelft.nl> +MIME-Version: 1.0 +X-OriginalArrivalTime: 29 Jul 2006 18:52:59.0726 (UTC) + FILETIME=[3651FEE0:01C6B340] +X-WSS-ID: 68D571012W82067301-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.635 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, RCVD_NUMERIC_HELO +X-Spam-Level: * +X-Archive-Number: 200607/286 +X-Sequence-Number: 20146 + +Jochem, + +On 7/29/06 8:02 AM, "Jochem van Dieten" wrote: + +> Tweakers.net has done a database performance test between a Sun T2000 (8 +> core T1) and a Sun X4200 (2 dual core Opteron 280). The database +> benchmark is developed inhouse and represents the average query pattern +> from their website. It is MySQL centric because Tweakers.net runs on +> MySQL, but Arjen van der Meijden has ported it to PostgreSQL and has +> done basic optimizations like adding indexes. + +Excellent article/job on performance profiling - thanks! + +Back in March, Anandtech also did a Niagara article profiling web + database +performance: + http://www.anandtech.com/IT/showdoc.aspx?i=2727&p=7 + +and the results for the T2000/Niagara were also lesser to the multi-core +Opteron. Now maybe this article will help Sun to improve the processor's +performance. + +- Luke + + + +From pgsql-performance-owner@postgresql.org Sat Jul 29 17:00:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C6C019FB2DE + for ; + Sat, 29 Jul 2006 17:00:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 94992-06 for + ; + Sat, 29 Jul 2006 17:00:39 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.207]) + by postgresql.org (Postfix) with ESMTP id 151219FB2DD + for ; + Sat, 29 Jul 2006 17:00:38 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id i11so56277nzi + for ; + Sat, 29 Jul 2006 13:00:37 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; + b=Ycs2pWnRVygTK8exTnuK2x26DHZqxgmHgGHG+/UYW3kHmCr9ZZNf83bTAsk48Ns4jJ3DOkPAH0EUIYDQMUxD2ix+zBgng88wpTy1/ZTV+Tg/PAqt2+VGRMuIrMd2ogQEyAop++QQg7Kfd4lwa313Fq9jhFrs6c95y8hjcOHAG7A= +Received: by 10.65.139.9 with SMTP id r9mr1115128qbn; + Sat, 29 Jul 2006 13:00:35 -0700 (PDT) +Received: by 10.64.179.18 with HTTP; Sat, 29 Jul 2006 13:00:35 -0700 (PDT) +Message-ID: <5f820f750607291300g3ac514fcycecf9ee0918a54fe@mail.gmail.com> +Date: Sat, 29 Jul 2006 16:00:35 -0400 +From: "Denis Lussier" +To: "Luke Lonergan" +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Cc: "Leigh Dyer" , pgsql-performance@postgresql.org, + Mikael.Carneholm@wirelesscar.com +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_15616_897661.1154203235774" +References: <5f820f750607291109g6df92f86lf7d8ee7db012c3d4@mail.gmail.com> + +X-Google-Sender-Auth: b960845c62270712 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.446 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/287 +X-Sequence-Number: 20147 + +------=_Part_15616_897661.1154203235774 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Not sure that EnterpriseDB's Dynatune is the general purpose answer that the +PG community has been searching to find. Actually, I think it could be, +but... the community process will decide. + +We are presently planning to create a site that will be called +http://gforge.enterprisedb.com that will be similar in spirit to BizGres. +By this I mean that we will be open sourcing many key small "improvements" +(in the eye of the beholder) for PG that will potentially make it into PG +(likely in some modified format) depending on the reactions and desires of +the general Postgres community. + +In case anyone is wondering... NO, EnterpriseDB won't be open sourcing the +legacy Horacle stuff we've added to our product (at least not yet). This +stuff is distributed under our Commercial Open Source license (similar to +SugarCRM's). Our Commercial Open Source license simply means that if you +buy a Platinum Subscription to our product, then you can keep the source +code under your pillow and use it internally at your company however you see +fit. + +--Denis Lussier + CTO + http://www.enterprisedb.com + + +On 7/29/06, Luke Lonergan wrote: +> +> Denis, +> +> On 7/29/06 11:09 AM, "Denis Lussier" wrote: +> +> > We do something we call "Dynatune" at db startup time. +> +> Sounds great - where do we download it? +> +> - Luke +> +> +> + +------=_Part_15616_897661.1154203235774 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +
 
+
Not sure that EnterpriseDB's Dynatune is the general purpose answer that the PG community has been searching to find.   Actually, I think it could be, but...  the community process will decide.
+
 
+
We are presently planning to create a site that will be called http://gforge.enterprisedb.com that will be similar in spirit to BizGres.  By this I mean that we will be open sourcing many key small "improvements" (in the eye of the beholder) for PG that will potentially make it into PG (likely in some modified format) depending on the reactions and desires of the general Postgres community. +
+
 
+
In case anyone is wondering...  NO, EnterpriseDB won't be open sourcing the legacy Horacle stuff we've added to our product (at least not yet).   This stuff is distributed under our Commercial Open Source license (similar to SugarCRM's).   Our Commercial Open Source license simply means that if you buy a Platinum Subscription to our product, then you can keep the source code under your pillow and use it internally at your company however you see fit. +
+
 
+
--Denis Lussier
+
  CTO
+ +

 
+
On 7/29/06, Luke Lonergan <llonergan@greenplum.com> wrote: +
Denis,

On 7/29/06 11:09 AM, "Denis Lussier" < +denisl@enterprisedb.com> wrote:

> We do something we call "Dynatune" at db startup time.

Sounds great - where do we download it?

- Luke



+ +------=_Part_15616_897661.1154203235774-- + +From pgsql-performance-owner@postgresql.org Sun Jul 30 16:02:13 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 577819FB310 + for ; + Sun, 30 Jul 2006 16:02:12 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 22441-09 for + ; + Sun, 30 Jul 2006 16:02:09 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.186]) + by postgresql.org (Postfix) with ESMTP id D67129FB2C5 + for ; + Sun, 30 Jul 2006 16:01:38 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id p77so290076nfc + for ; + Sun, 30 Jul 2006 12:01:37 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=BuLyRU8qwzFS+y3efrURDcsGxCjwA35kQnZONA2uiNMuV4lc5lnPiQzL4l7PvSU++OUvvLMjsZD6y1I/t4kufO5GrMUxslTaIOlUnzNRrTj+dsjbvYZ9t0CWBBneYWhwk8SEI7E/CS6kmVqKme8iS8KHtTmTMzi7d7Af2JYAR4o= +Received: by 10.48.48.18 with SMTP id v18mr1402111nfv; + Sun, 30 Jul 2006 12:01:37 -0700 (PDT) +Received: by 10.49.64.6 with HTTP; Sun, 30 Jul 2006 12:01:37 -0700 (PDT) +Message-ID: +Date: Sun, 30 Jul 2006 21:01:37 +0200 +From: "Kjell Tore Fossbakk" +To: "Claus Guttesen" +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig DDR PC3200 +Cc: pgsql-performance@postgresql.org +In-Reply-To: +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_23208_22229041.1154286097045" +References: + + +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.077 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_MESSAGE, SPF_PASS +X-Spam-Level: * +X-Archive-Number: 200607/288 +X-Sequence-Number: 20148 + +------=_Part_23208_22229041.1154286097045 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello. + +OS: Gentoo 2006.0 with gentoo's hardened kernel +Version: I haven't checked. Im guessing 8.0.8 (latest stable on all systems) +or 8.1.4 which is the latest package. + +I'm still gonna try to run with smart array 5i. How can i find out that my +performance with that is crappy? Without ripping down my systems, and using +software raid? + +Kjell Tore + +On 7/28/06, Claus Guttesen wrote: +> +> > As I have understood, there is alot of tuning using both postgres.confand +> > analyzing queries to make the values of postgres.conf fit my needs, +> system +> > and hardware. This is where I need some help. I have looked into +> > postgres.conf , and seen the tunings. But I'm still not sure what I +> should +> > put into those variables (in postgres.conf) with my hardware. +> > +> > Any suggestions would be most appreciated! +> +> What OS is it running and what version is postgresql? +> +> regards +> Claus +> + + + +-- +"Be nice to people on your way up because you meet them on your way down." + +------=_Part_23208_22229041.1154286097045 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Hello.

OS: Gentoo 2006.0 with gentoo's hardened kernel
Version: I haven't checked. Im guessing 8.0.8 (latest stable on all systems) or 8.1.4 which is the latest package.

I'm still gonna try to run with smart array 5i. How can i find out that my performance with that is crappy? Without ripping down my systems, and using software raid? +

Kjell Tore

On 7/28/06, Claus Guttesen <kometen@gmail.com> wrote:
+> As I have understood, there is alot of tuning using both postgres.conf and
> analyzing queries to make the values of postgres.conf fit my needs, system
> and hardware. This is where I need some help. I have looked into +
> postgres.conf , and seen the tunings. But I'm still not sure what I should
> put into those variables (in postgres.conf) with my hardware.
>
> Any suggestions would be most appreciated!

What OS is it running and what version is postgresql? +

regards
Claus



--
"Be nice to people on your way up because you meet them on your way down." + +------=_Part_23208_22229041.1154286097045-- + +From pgsql-performance-owner@postgresql.org Sun Jul 30 16:14:33 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 730DD9FB312 + for ; + Sun, 30 Jul 2006 16:14:32 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 29780-04 for + ; + Sun, 30 Jul 2006 16:14:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.mi8.com (d01gw04.mi8.com [63.240.6.44]) + by postgresql.org (Postfix) with ESMTP id 372219FB2C5 + for ; + Sun, 30 Jul 2006 16:14:22 -0300 (ADT) +Received: from 172.16.1.112 by mail.mi8.com with ESMTP (- Welcome to Mi8 + Corporation www.Mi8.com (D4)); Sun, 30 Jul 2006 15:14:12 -0400 +X-Server-Uuid: C8FB4D43-1108-484A-A898-3CBCC7906230 +Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.160]) by + D01SMTP02.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 30 Jul + 2006 15:14:12 -0400 +X-MimeOLE: Produced By Microsoft Exchange V6.5 +Content-class: urn:content-classes:message +MIME-Version: 1.0 +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig +Date: Sun, 30 Jul 2006 15:14:11 -0400 +Message-ID: <3E37B936B592014B978C4415F90D662D03EA1E86@MI8NYCMAIL06.Mi8.com> +X-MS-Has-Attach: +X-MS-TNEF-Correlator: +Thread-Topic: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig + DDR PC3200 +Thread-Index: Aca0Csho8eHreXyZQzm8aeyugCbKZQAAY4y0 +From: "Luke Lonergan" +To: "Kjell Tore Fossbakk" , + "Claus Guttesen" +cc: pgsql-performance@postgresql.org +X-OriginalArrivalTime: 30 Jul 2006 19:14:12.0388 (UTC) + FILETIME=[574C8E40:01C6B40C] +X-WSS-ID: 68D3DA8E2W82371512-01-01 +Content-Type: text/plain; + charset=us-ascii +Content-Transfer-Encoding: quoted-printable +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= +X-Spam-Level: +X-Archive-Number: 200607/289 +X-Sequence-Number: 20149 + +Run bonnie++ version 1.03 and report results here. + + +- Luke + +Sent from my GoodLink synchronized handheld (www.good.com) + + + -----Original Message----- +From: Kjell Tore Fossbakk [mailto:kjelltore@gmail.com] +Sent: Sunday, July 30, 2006 03:03 PM Eastern Standard Time +To: Claus Guttesen +Cc: pgsql-performance@postgresql.org +Subject: Re: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and 8gig = +DDR PC3200 + +Hello. + +OS: Gentoo 2006.0 with gentoo's hardened kernel +Version: I haven't checked. Im guessing 8.0.8 (latest stable on all = +systems) +or 8.1.4 which is the latest package. + +I'm still gonna try to run with smart array 5i. How can i find out that = +my +performance with that is crappy? Without ripping down my systems, and = +using +software raid? + +Kjell Tore + +On 7/28/06, Claus Guttesen wrote: +> +> > As I have understood, there is alot of tuning using both = +postgres.confand +> > analyzing queries to make the values of postgres.conf fit my needs, +> system +> > and hardware. This is where I need some help. I have looked into +> > postgres.conf , and seen the tunings. But I'm still not sure what I +> should +> > put into those variables (in postgres.conf) with my hardware. +> > +> > Any suggestions would be most appreciated! +> +> What OS is it running and what version is postgresql? +> +> regards +> Claus +> + + + +--=20 +"Be nice to people on your way up because you meet them on your way = +down." + + +From pgsql-performance-owner@postgresql.org Sun Jul 30 16:18:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id C81E89FB2C5 + for ; + Sun, 30 Jul 2006 16:18:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30169-02 for + ; + Sun, 30 Jul 2006 16:18:35 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nf-out-0910.google.com (nf-out-0910.google.com + [64.233.182.186]) + by postgresql.org (Postfix) with ESMTP id 06B2A9FB312 + for ; + Sun, 30 Jul 2006 16:18:04 -0300 (ADT) +Received: by nf-out-0910.google.com with SMTP id p77so292387nfc + for ; + Sun, 30 Jul 2006 12:18:03 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; + b=EgzPKlYWLcXtECq3CMTiNWxzXAU12Z3HJc97dWSqrS/UyUJOKzeB10IwxGrRRXMafoYnpVXOKEG43KSPV6L+RqIzEsJv04xdGleofOxY+JUwKX0xrvzf1rNKAgguD08RModq6Y2NiPeJtnGwTtSMVdnVVba6Sp/jD21WLcsDwbQ= +Received: by 10.49.26.18 with SMTP id d18mr1404127nfj; + Sun, 30 Jul 2006 12:18:03 -0700 (PDT) +Received: by 10.49.64.6 with HTTP; Sun, 30 Jul 2006 12:18:03 -0700 (PDT) +Message-ID: +Date: Sun, 30 Jul 2006 21:18:03 +0200 +From: "Kjell Tore Fossbakk" +To: "Luke Lonergan" +Subject: Re: Performance with 2 AMD/Opteron 2.6Ghz and 8gig DDR PC3200 +Cc: "Claus Guttesen" , pgsql-performance@postgresql.org +In-Reply-To: <3E37B936B592014B978C4415F90D662D03EA1E86@MI8NYCMAIL06.Mi8.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_Part_23304_19133543.1154287083360" +References: <3E37B936B592014B978C4415F90D662D03EA1E86@MI8NYCMAIL06.Mi8.com> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.089 tagged_above=0 required=5 tests=AWL, + DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, SPF_PASS +X-Spam-Level: * +X-Archive-Number: 200607/290 +X-Sequence-Number: 20150 + +------=_Part_23304_19133543.1154287083360 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Okey! + +The thing is, im on vacation. So ill report in about 3 weeks time.. Sry +guys.. :-) + +Kjell Tore + +On 7/30/06, Luke Lonergan wrote: +> +> Run bonnie++ version 1.03 and report results here. +> +> +> - Luke +> +> Sent from my GoodLink synchronized handheld (www.good.com) +> +> +> -----Original Message----- +> From: Kjell Tore Fossbakk [mailto:kjelltore@gmail.com] +> Sent: Sunday, July 30, 2006 03:03 PM Eastern Standard Time +> To: Claus Guttesen +> Cc: pgsql-performance@postgresql.org +> Subject: Re: [PERFORM] Performance with 2 AMD/Opteron 2.6Ghz and +> 8gig DDR PC3200 +> +> Hello. +> +> OS: Gentoo 2006.0 with gentoo's hardened kernel +> Version: I haven't checked. Im guessing 8.0.8 (latest stable on all +> systems) +> or 8.1.4 which is the latest package. +> +> I'm still gonna try to run with smart array 5i. How can i find out that my +> performance with that is crappy? Without ripping down my systems, and +> using +> software raid? +> +> Kjell Tore +> +> On 7/28/06, Claus Guttesen wrote: +> > +> > > As I have understood, there is alot of tuning using both +> postgres.confand +> > > analyzing queries to make the values of postgres.conf fit my needs, +> > system +> > > and hardware. This is where I need some help. I have looked into +> > > postgres.conf , and seen the tunings. But I'm still not sure what I +> > should +> > > put into those variables (in postgres.conf) with my hardware. +> > > +> > > Any suggestions would be most appreciated! +> > +> > What OS is it running and what version is postgresql? +> > +> > regards +> > Claus +> > +> +> +> +> -- +> "Be nice to people on your way up because you meet them on your way down." +> +> + + +-- +"Be nice to people on your way up because you meet them on your way down." + +------=_Part_23304_19133543.1154287083360 +Content-Type: text/html; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +Content-Disposition: inline + +Okey!

The thing is, im on vacation. So ill report in about 3 weeks time.. Sry guys.. :-)

Kjell Tore

On 7/30/06, Luke Lonergan < +LLonergan@greenplum.com> wrote:
Run bonnie++ version 1.03 and report results here. +


- Luke

Sent from my GoodLink synchronized handheld (www.good.com)


-----Original Message-----
From:   Kjell Tore Fossbakk [mailto: +kjelltore@gmail.com]
Sent:   Sunday, July 30, 2006 03:03 PM Eastern Standard Time
To:     Claus Guttesen
Cc:     pgsql-performance@postgresql.org
Subject:        Re: [PERFORM] Performance with 2 AMD/Opteron +2.6Ghz and 8gig DDR PC3200

Hello.

OS: Gentoo 2006.0 with gentoo's hardened kernel
Version: I haven't checked. Im guessing 8.0.8 (latest stable on all systems)
or 8.1.4 which is the latest package.

+I'm still gonna try to run with smart array 5i. How can i find out that my
performance with that is crappy? Without ripping down my systems, and using
software raid?

Kjell Tore

On 7/28/06, Claus Guttesen < +kometen@gmail.com> wrote:
>
> > As I have understood, there is alot of tuning using both postgres.confand
> > analyzing queries to make the values of postgres.conf + fit my needs,
> system
> > and hardware. This is where I need some help. I have looked into
> > postgres.conf , and seen the tunings. But I'm still not sure what I
> should
> > put into those variables (in +postgres.conf) with my hardware.
> >
> > Any suggestions would be most appreciated!
>
> What OS is it running and what version is postgresql?
>
> regards
> Claus
>
+


--
"Be nice to people on your way up because you meet them on your way down."




--
"Be nice to people on your way up because you meet them on your way down." + +------=_Part_23304_19133543.1154287083360-- + +From pgsql-performance-owner@postgresql.org Sun Jul 30 22:57:07 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 846959FB322 + for ; + Sun, 30 Jul 2006 22:57:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23474-03 for + ; + Sun, 30 Jul 2006 22:56:57 -0300 (ADT) +X-Greylist: delayed 00:06:40.563485 by SQLgrey- +Received: from web88005.mail.re2.yahoo.com (web88005.mail.re2.yahoo.com + [206.190.37.192]) + by postgresql.org (Postfix) with SMTP id C43049FB320 + for ; + Sun, 30 Jul 2006 22:56:56 -0300 (ADT) +Received: (qmail 87912 invoked by uid 60001); 31 Jul 2006 01:50:14 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=rogers.com; + h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=3i7VFtItxUp/Y4YgtJ3AjLujN96/TxyKxLT/YfvOTHYemJR0ZbO8Y+T2KyefSWGljYt3YEmagA4M99iK1pskiYW1encbizcUHDVRpvOqGhZp4/8u0RgDNMDQgatOfLoBfw7NSOBJidYeqeUPf+2ednPtjeeGpnE3jTZCXVOA1PQ= + ; +Message-ID: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> +Received: from [72.140.115.81] by web88005.mail.re2.yahoo.com via HTTP; + Sun, 30 Jul 2006 21:50:14 EDT +Date: Sun, 30 Jul 2006 21:50:14 -0400 (EDT) +From: H Hale +Subject: sub select performance due to seq scans +To: pgsql-performance@postgresql.org +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-1210526602-1154310614=:85425" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.909 tagged_above=0 required=5 + tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, HTML_MESSAGE +X-Spam-Level: * +X-Archive-Number: 200607/291 +X-Sequence-Number: 20151 + +--0-1210526602-1154310614=:85425 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +I am testing a query what that has a sub-select. The query performance is very very poor as shown below due to the use of sequencial scans. The actual row count of both tables is also shown. It appears the row count shown by explain analyze does not match the actual count. Columns dstobj, srcobj & objectid are all indexed yet postgres insists on using seq scans. Vacuum analyze makes no difference. I am using 8.1.3 on linux. + + This is a very simple query with relatively small amount of data and the query is taking 101482 ms. Queries with sub-selects on both tables individually is very fast (8 ms). + + How do I prevent the use of seq scans? + + + + + + capsa=# explain analyze select name from capsa.flatomfilesysentry where objectid in ( select dstobj from capsa.flatommemberrelation where srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'); + + + QUERY PLAN + --------------------------------------------------------------------------------------------------------------------------------- + Nested Loop IN Join (cost=0.00..1386.45 rows=5809 width=14) (actual time=2.933..101467.463 rows=5841 loops=1) + Join Filter: ("outer".objectid = "inner".dstobj) + -> Seq Scan on flatomfilesysentry (cost=0.00..368.09 rows=5809 width=30) (actual time=0.007..23.451 rows=5844 loops=1) + -> Seq Scan on flatommemberrelation (cost=0.00..439.05 rows=5842 width=16) (actual time=0.007..11.790 rows=2922 loops=5844) + Filter: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid) + Total runtime: 101482.256 ms + (6 rows) + + capsa=# select count(*) from capsa.flatommemberrelation ; + count + ------- + 11932 + (1 row) + + capsa=# select count(*) from capsa.flatomfilesysentry ; + count + ------- + 5977 + + + + + +--0-1210526602-1154310614=:85425 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +I am testing a query what that has a sub-select. The query performance is very very poor as shown below due to the use of sequencial scans.  The actual row count of both tables is also shown. It appears the row count shown by explain analyze does not match the actual count. Columns dstobj, srcobj & objectid are all indexed yet postgres insists on using seq scans. Vacuum analyze makes no difference. I am using 8.1.3 on linux.

This is a very simple query with relatively small amount of data and  the query is taking 101482 ms.  Queries with sub-selects on both tables individually is very fast  (8 ms).

How do I prevent the use of seq scans? 





capsa=# explain analyze select name from capsa.flatomfilesysentry where objectid in ( select dstobj from capsa.flatommemberrelation where srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409');


+                                                            QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------
 Nested Loop IN Join  (cost=0.00..1386.45 rows=5809 width=14) (actual time=2.933..101467.463 rows=5841 loops=1)
   Join Filter: ("outer".objectid = "inner".dstobj)
   ->  Seq Scan on flatomfilesysentry  (cost=0.00..368.09 rows=5809 width=30) (actual time=0.007..23.451 rows=5844 loops=1)
   ->  Seq Scan on flatommemberrelation  (cost=0.00..439.05 rows=5842 width=16) (actual time=0.007..11.790 rows=2922 + loops=5844)
         Filter: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid)
 Total runtime: 101482.256 ms
(6 rows)

capsa=# select count(*) from capsa.flatommemberrelation ;
 count
-------
 11932
(1 row)

capsa=# select count(*) from capsa.flatomfilesysentry ;
 count
-------
  5977




+--0-1210526602-1154310614=:85425-- + +From pgsql-performance-owner@postgresql.org Mon Jul 31 04:07:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 39D5F9FB34E + for ; + Mon, 31 Jul 2006 04:07:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 57580-04-2 + for ; + Mon, 31 Jul 2006 04:07:01 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from brmea-mail-2.sun.com (brmea-mail-2.Sun.COM [192.18.98.43]) + by postgresql.org (Postfix) with ESMTP id BF42B9FAA6E + for ; + Mon, 31 Jul 2006 04:07:00 -0300 (ADT) +Received: from fe-amer-05.sun.com ([192.18.108.179]) + by brmea-mail-2.sun.com (8.13.6+Sun/8.12.9) with ESMTP id + k6V76x1K016257 for ; + Mon, 31 Jul 2006 01:06:59 -0600 (MDT) +Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com + (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) + id <0J3900K0195JBX00@mail-amer.sun.com> (original mail from + J.K.Shah@Sun.COM) for pgsql-performance@postgresql.org; + Mon, 31 Jul 2006 01:06:59 -0600 (MDT) +Received: from [192.168.1.64] ([82.13.40.197]) + by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built + Sep 9 + 2005)) with ESMTPSA id <0J390039HAFLFOY4@mail-amer.sun.com>; Mon, + 31 Jul 2006 01:06:59 -0600 (MDT) +Date: Mon, 31 Jul 2006 08:07:07 +0100 +From: Jignesh Shah +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +In-reply-to: <44CB9D52.8040409@tweakers.net> +To: Arjen van der Meijden +Cc: pgsql-performance@postgresql.org +Message-id: <44CDAC1B.4050109@sun.com> +MIME-version: 1.0 +Content-type: text/plain; format=flowed; charset=ISO-8859-1 +Content-transfer-encoding: 7BIT +References: <44CB7896.8030501@oli.tudelft.nl> + <44CB8235.9070903@commandprompt.com> <44CB8DC1.4040105@tweakers.net> + <44CB9472.9060206@commandprompt.com> <44CB9D52.8040409@tweakers.net> +User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, + hits=0.001 tagged_above=0 required=5 tests=UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/295 +X-Sequence-Number: 20155 + +Hi Arjen, + +I am curious about your Sun Studio compiler options also. +Can you send that too ? + +Any other tweakings that you did on Solaris? + +Thanks. + +Regards, +Jignesh + + +Arjen van der Meijden wrote: +> On 29-7-2006 19:01, Joshua D. Drake wrote: +>> Well I would be curious about the postgresql.conf and how much ram +>> etc... it had. +> +> It was the 8core version with 16GB memory... but actually that's just +> overkill, the active portions of the database easily fits in 8GB and a +> test on another machine with just 2GB didn't even show that much +> improvements when going to 7GB (6x1G, 2x 512M), it was mostly in the +> range of 10% improvement or less. +> +> Anyway, the differences to the default postgresql.conf: +> shared_buffers = 30000 +> Tests with 40k, 50k en 60k didn't really show improvements. +> +> work_mem = 2048 +> This probably could've been set higher with the sheer amount of +> not-really-used memory. +> +> maintenance_work_mem = 65535 +> Not really important of course +> +> max_fsm_pages = 50000 +> Somehow it needed to be set quite high, probably because we only +> cleaned up after doing over 200k requests. +> +> effective_cache_size = 350000 +> As said, the database fitted in 8GB of memory, so I didn't see a need +> to set this higher than for the 8GB machines (x4200 and another T2000 +> we had). +> +> default_statistics_target = 200 +> For a few columns on the largest tables I manually raised it to 1000 +> +> log_min_duration_statement = 1000 +> I'm not sure if this has much overhead? Stats logging was turned/left +> on as well. +> Turning that off improved it a few percent. +> +>> I understand, I just have a feeling that we could do even better :) I +>> do appreciate all your efforts. +> +> Well, I'll keep that in mind :) +> What it makes even worse for MySQL is that it had (on another machine) +> about 8M hits on the query cache for 4M inserts, i.e. half of the +> queries weren't even executed on it. +> +> Best regards, +> +> Arjen +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 3: Have you checked our extensive FAQ? +> +> http://www.postgresql.org/docs/faq + +From pgsql-performance-owner@postgresql.org Mon Jul 31 05:07:35 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4A8A59FB34E + for ; + Mon, 31 Jul 2006 05:07:33 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 61564-03-2 + for ; + Mon, 31 Jul 2006 05:07:12 -0300 (ADT) +X-Greylist: delayed 00:06:24.96594 by SQLgrey- +Received: from gollum.cambrium.nl (mx1.cambrium.nl [217.19.16.130]) + by postgresql.org (Postfix) with SMTP id DA39D9FB355 + for ; + Mon, 31 Jul 2006 05:06:56 -0300 (ADT) +Received: (qmail 20826 invoked from network); 31 Jul 2006 08:00:04 -0000 +Received: from office.tweakers.net (HELO ?10.0.0.157?) (84.245.2.46) + by gollum.cambrium.nl with SMTP; 31 Jul 2006 08:00:04 -0000 +Message-ID: <44CDB877.3070709@tweakers.net> +Date: Mon, 31 Jul 2006 09:59:51 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) +MIME-Version: 1.0 +To: Jignesh Shah +CC: pgsql-performance@postgresql.org +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +References: <44CB7896.8030501@oli.tudelft.nl> + <44CB8235.9070903@commandprompt.com> + <44CB8DC1.4040105@tweakers.net> + <44CB9472.9060206@commandprompt.com> + <44CB9D52.8040409@tweakers.net> <44CDAC1B.4050109@sun.com> +In-Reply-To: <44CDAC1B.4050109@sun.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.951 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/296 +X-Sequence-Number: 20156 + +Hi Jignesh, + +It was a cvs-checkout of 8.2 devel, compiled using: +CPPFLAGS="-fast -xtarget=ultraT1 -xnolibmopt" CC=/opt/SUNWspro/bin/cc +./configure --without-readline + +We'd gotten a specially adjusted Solaris version from Sun Holland for +the T2000. It was a dvd with a Solaris flar archive from 11 april 2006 +and patches from 25 april 2006. It also had the preferred Solaris System +settings already applied. If you need more details about that dvd, I +think your best option is to contact Hans Nijbacker or Bart Muijzer, +since we're no Solaris-experts :) + +Appart from that, we did no extra tuning of the OS, nor did Hans for the +MySQL-optimizations (afaik, but then again, he knows best). + +Best regards, + +Arjen van der Meijden + +Jignesh Shah wrote: +> Hi Arjen, +> +> I am curious about your Sun Studio compiler options also. +> Can you send that too ? +> +> Any other tweakings that you did on Solaris? +> +> Thanks. +> +> Regards, +> Jignesh +> +> +> Arjen van der Meijden wrote: +>> On 29-7-2006 19:01, Joshua D. Drake wrote: +>>> Well I would be curious about the postgresql.conf and how much ram +>>> etc... it had. +>> +>> It was the 8core version with 16GB memory... but actually that's just +>> overkill, the active portions of the database easily fits in 8GB and a +>> test on another machine with just 2GB didn't even show that much +>> improvements when going to 7GB (6x1G, 2x 512M), it was mostly in the +>> range of 10% improvement or less. +>> +>> Anyway, the differences to the default postgresql.conf: +>> shared_buffers = 30000 +>> Tests with 40k, 50k en 60k didn't really show improvements. +>> +>> work_mem = 2048 +>> This probably could've been set higher with the sheer amount of +>> not-really-used memory. +>> +>> maintenance_work_mem = 65535 +>> Not really important of course +>> +>> max_fsm_pages = 50000 +>> Somehow it needed to be set quite high, probably because we only +>> cleaned up after doing over 200k requests. +>> +>> effective_cache_size = 350000 +>> As said, the database fitted in 8GB of memory, so I didn't see a need +>> to set this higher than for the 8GB machines (x4200 and another T2000 +>> we had). +>> +>> default_statistics_target = 200 +>> For a few columns on the largest tables I manually raised it to 1000 +>> +>> log_min_duration_statement = 1000 +>> I'm not sure if this has much overhead? Stats logging was turned/left +>> on as well. +>> Turning that off improved it a few percent. +>> +>>> I understand, I just have a feeling that we could do even better :) I +>>> do appreciate all your efforts. +>> +>> Well, I'll keep that in mind :) +>> What it makes even worse for MySQL is that it had (on another machine) +>> about 8M hits on the query cache for 4M inserts, i.e. half of the +>> queries weren't even executed on it. +>> +>> Best regards, +>> +>> Arjen +>> +>> ---------------------------(end of broadcast)--------------------------- +>> TIP 3: Have you checked our extensive FAQ? +>> +>> http://www.postgresql.org/docs/faq +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend +> + +From pgsql-performance-owner@postgresql.org Mon Jul 31 06:23:00 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 271DF9FB357 + for ; + Mon, 31 Jul 2006 06:23:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66308-07 for + ; + Mon, 31 Jul 2006 06:22:41 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by postgresql.org (Postfix) with ESMTP id CF5599FB359 + for ; + Mon, 31 Jul 2006 06:21:56 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 6555573CDB; + Mon, 31 Jul 2006 10:20:42 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 3F4924DB39; + Mon, 31 Jul 2006 10:20:42 +0100 (BST) +Message-ID: <44CDCB69.6070809@archonet.com> +Date: Mon, 31 Jul 2006 10:20:41 +0100 +From: Richard Huxton +User-Agent: Thunderbird 1.5.0.5 (X11/20060719) +MIME-Version: 1.0 +To: H Hale +Cc: pgsql-performance@postgresql.org +Subject: Re: sub select performance due to seq scans +References: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> +In-Reply-To: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.31 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/297 +X-Sequence-Number: 20157 + +H Hale wrote: +> I am testing a query what that has a sub-select. The query performance is very very poor as shown below due to the use of sequencial scans. The actual row count of both tables is also shown. It appears the row count shown by explain analyze does not match the actual count. Columns dstobj, srcobj & objectid are all indexed yet postgres insists on using seq scans. Vacuum analyze makes no difference. I am using 8.1.3 on linux. +> +> This is a very simple query with relatively small amount of data and the query is taking 101482 ms. Queries with sub-selects on both tables individually is very fast (8 ms). +> +> How do I prevent the use of seq scans? + +Hmm - something strange here. + +> capsa=# explain analyze select name from capsa.flatomfilesysentry where objectid in ( select dstobj from capsa.flatommemberrelation where srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'); +> +> +> QUERY PLAN +> --------------------------------------------------------------------------------------------------------------------------------- +> Nested Loop IN Join (cost=0.00..1386.45 rows=5809 width=14) (actual time=2.933..101467.463 rows=5841 loops=1) +> Join Filter: ("outer".objectid = "inner".dstobj) +> -> Seq Scan on flatomfilesysentry (cost=0.00..368.09 rows=5809 width=30) (actual time=0.007..23.451 rows=5844 loops=1) +> -> Seq Scan on flatommemberrelation (cost=0.00..439.05 rows=5842 width=16) (actual time=0.007..11.790 rows=2922 loops=5844) +> Filter: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid) +> Total runtime: 101482.256 ms + +Look at that second seq-scan (on flatommemberrelation) - it's looping +5844 times (once for each row in flatmfilesysentry). I'd expect PG to +materialise the seq-scan once and then join (unless I'm missing +something, the subselect just involves the one test against a constant). + +I'm guessing something in your configuration is pushing your cost +estimates far away from reality. Could you try issuing a "set +enable_seqscan=off" and then running explain-analyse again. That will +show us alternatives. + +Also, what performance-related configuration values have you changed? +Could you post them with a brief description of your hardware? + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Mon Jul 31 06:24:44 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E1EB09FB35D + for ; + Mon, 31 Jul 2006 06:24:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66657-08 for + ; + Mon, 31 Jul 2006 06:24:28 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by postgresql.org (Postfix) with ESMTP id 6588D9FB34E + for ; + Mon, 31 Jul 2006 06:23:43 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 41A7A73C79; + Mon, 31 Jul 2006 10:23:32 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 365E14DB39; + Mon, 31 Jul 2006 10:23:32 +0100 (BST) +Message-ID: <44CDCC13.4010705@archonet.com> +Date: Mon, 31 Jul 2006 10:23:31 +0100 +From: Richard Huxton +User-Agent: Thunderbird 1.5.0.5 (X11/20060719) +MIME-Version: 1.0 +To: Hristo Markov +Cc: pgsql-performance@postgresql.org +Subject: Re: How to increase performance? +References: <20060727162929.56177.qmail@web51712.mail.yahoo.com> +In-Reply-To: <20060727162929.56177.qmail@web51712.mail.yahoo.com> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.388 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/298 +X-Sequence-Number: 20158 + +Hristo Markov wrote: +> Hello, +> +> My name is Hristo Markov. I am software developer. +> I am developing software systems (with C/C++ program language) that work on Windows operation system and uses ODBC driver and ACCESS database. I want to change database with PostgreSQL. +> The systems working without problems with PostgreSQL and ODBC, but the performance and speed of updating and reading of data are very low. +> I run the test program working on one single computer under Windows XP operating system and working with equal data (I use around 10 tables at the same time). The difference is only databases and ODBC drivers. +> +> The results from speed and performance of the test program are: +> Around 10 seconds under Access database. +> Around 40 seconds under PostgreSQL database. +> +> Please help me to increase speed and performance of PostgreSQL. +> /I am freshman in PostgreSQL and I thing that may be must set some settings / + +Are there specific queries you're having problems with? How many +transactions does this 40 seconds represent? What is the bottle-neck - +CPU/disk/memory? + +You might find this a good place to start reading about configuration +settings, and then follow that with the manuals. +http://www.powerpostgresql.com/PerfList + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Mon Jul 31 06:27:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 23A7C9FB34E + for ; + Mon, 31 Jul 2006 06:27:41 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 66909-05 for + ; + Mon, 31 Jul 2006 06:27:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) + by postgresql.org (Postfix) with ESMTP id 526E79FB356 + for ; + Mon, 31 Jul 2006 06:27:07 -0300 (ADT) +Received: from mainbox.archonet.com + (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) + by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 3A789744B4; + Mon, 31 Jul 2006 10:26:56 +0100 (BST) +Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) + by mainbox.archonet.com (Postfix) with ESMTP id 20F3C4DB39; + Mon, 31 Jul 2006 10:26:56 +0100 (BST) +Message-ID: <44CDCCDF.8000304@archonet.com> +Date: Mon, 31 Jul 2006 10:26:55 +0100 +From: Richard Huxton +User-Agent: Thunderbird 1.5.0.5 (X11/20060719) +MIME-Version: 1.0 +To: NbForYou +Cc: pgsql-performance@postgresql.org +Subject: Re: Query 200x slower on server [PART 2] +References: +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.583 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/299 +X-Sequence-Number: 20159 + +NbForYou wrote: +> See Query 200x slower on server [PART 1] before reading any further + +Cant' find it. Sorry. + +> +> QUERY PLAN ON MY HOME SERVER +[snip] +> Total runtime: 125.432 ms +> +> This means that the Query is 200 times slower on the webhost! +> +> How can I resolve this? + +First - what is different between the two plans and why? PostgreSQL will +be choosing a different plan because: +1. It's estimating different numbers of rows for one or more steps +2. It's estimating a different cost for one or more steps +3. It's triggering the genetic optimiser which means you're not +necessarily going to get the same plan each time. +4. You've got different versions of PG on the different machines. + +-- + Richard Huxton + Archonet Ltd + +From pgsql-performance-owner@postgresql.org Mon Jul 31 07:49:41 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E43BE9FB2B6 + for ; + Mon, 31 Jul 2006 07:49:39 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74559-03 for + ; + Mon, 31 Jul 2006 07:49:19 -0300 (ADT) +X-Greylist: delayed 14:25:32.834245 by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.DE [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id B50BD9FB319 + for ; + Mon, 31 Jul 2006 07:48:23 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7VJj-0003Al-6F + for pgsql-performance@postgresql.org; Mon, 31 Jul 2006 12:48:11 +0200 +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Transfer-Encoding: quoted-printable +Message-Id: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +To: pgsql-performance@postgresql.org +From: Axel Rau +Subject: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 12:48:11 +0200 +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.288 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/300 +X-Sequence-Number: 20160 + +Hi group, + +this is a directory tree query for a backup system (http://=20 +sourceforge.net/projects/bacula). +You provide a path and get back the names of the children plus a =20 +boolean telling if the child has itself children. +The "%@" stands for the initial path: +--------------------------------------------------------------- +explain analyze SELECT X.name AS name, COUNT(CH) > 1 AS children + FROM + ( SELECT RTRIM( REPLACE( NLPC.path, '%@/', ''),'/') AS name, + FN.name AS CH + FROM + ( SELECT P.path,P.pathid + FROM bacula.path P + WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC + LEFT OUTER JOIN bacula.file F + ON + NLPC.pathid =3D F.pathid + LEFT OUTER JOIN bacula.filename FN + ON + F.filenameid =3D FN.filenameid + GROUP BY NLPC.path, FN.name + UNION + SELECT FN.name AS name, FN.name AS CH + FROM + bacula.path P, bacula.file F, bacula.filename FN + WHERE + P.path =3D '%@/' AND + P.pathid =3D F.pathid AND + F.filenameid =3D FN.filenameid + ) AS X + WHERE X.name <> '' + GROUP BY X.name +--------------------------------------------------------------- +The 1st part of the union takes care of directories, the 2nd one of =20 +flat files. +Application allows user navigation in a browser (clicking on a name =20 +in one column triggers the query and fills the next browser column). +Initial path of "/Users/axel/Library/Preferences" results in: +--------------------------------------------------------------- + Sort (cost=3D1295.24..1295.47 rows=3D92 width=3D64) (actual =20 +time=3D818.987..819.871 rows=3D527 loops=3D1) + Sort Key: upper(x.name) + -> GroupAggregate (cost=3D1288.56..1292.24 rows=3D92 width=3D64) =20= + +(actual time=3D784.069..814.059 rows=3D527 loops=3D1) + -> Unique (cost=3D1288.56..1289.25 rows=3D92 width=3D112) =20= + +(actual time=3D783.931..809.708 rows=3D684 loops=3D1) + -> Sort (cost=3D1288.56..1288.79 rows=3D92 width=3D112) = +=20 +(actual time=3D783.921..793.150 rows=3D5350 loops=3D1) + Sort Key: name, ch + -> Append (cost=3D642.03..1285.55 rows=3D92 =20 +width=3D112) (actual time=3D335.134..723.917 rows=3D5350 loops=3D1) + -> Subquery Scan "*SELECT* =20 +1" (cost=3D642.03..643.18 rows=3D46 width=3D112) (actual =20 +time=3D335.130..338.564 rows=3D184 loops=3D1) + -> HashAggregate =20 +(cost=3D642.03..642.72 rows=3D46 width=3D112) (actual = +time=3D335.121..337.843 =20 +rows=3D184 loops=3D1) + -> Nested Loop Left Join =20 +(cost=3D2.00..641.80 rows=3D46 width=3D112) (actual time=3D39.293..326.831= + =20 +rows=3D1685 loops=3D1) + -> Nested Loop Left =20 +Join (cost=3D0.00..502.63 rows=3D46 width=3D97) (actual =20 +time=3D21.026..202.206 rows=3D1685 loops=3D1) + -> Index Scan =20 +using path_name_idx on path p (cost=3D0.00..3.02 rows=3D1 width=3D97) =20= + +(actual time=3D15.480..56.935 rows=3D27 loops=3D1) + Index Cond: =20= + +((path >=3D '/Users/axel/Library/Preferences/'::text) AND (path < '/=20 +Users/axel/Library/Preferences0'::text)) + Filter: =20 +((path ~ '^/Users/axel/Library/Preferences/[^/]*/$'::text) AND (rtrim=20 +("replace"(path, '/Users/axel/Library/Preferences/'::text, ''::text), =20= + +'/'::text) <> ''::text)) + -> Index Scan =20 +using file_path_idx on file f (cost=3D0.00..493.28 rows=3D506 width=3D8) = +=20 +(actual time=3D0.473..5.119 rows=3D62 loops=3D27) + Index Cond: =20= + +("outer".pathid =3D f.pathid) + -> Bitmap Heap Scan on =20= + +filename fn (cost=3D2.00..3.01 rows=3D1 width=3D23) (actual =20 +time=3D0.058..0.061 rows=3D1 loops=3D1685) + Recheck Cond: =20 +("outer".filenameid =3D fn.filenameid) + -> Bitmap Index =20 +Scan on filename_pkey (cost=3D0.00..2.00 rows=3D1 width=3D0) (actual =20= + +time=3D0.030..0.030 rows=3D1 loops=3D1685) + Index Cond: =20= + +("outer".filenameid =3D fn.filenameid) + -> Nested Loop (cost=3D2.00..641.91 =20 +rows=3D46 width=3D19) (actual time=3D3.349..377.758 rows=3D5166 loops=3D1)= + + -> Nested Loop (cost=3D0.00..502.62 =20= + +rows=3D46 width=3D4) (actual time=3D3.118..97.375 rows=3D5200 loops=3D1) + -> Index Scan using =20 +path_name_idx on path p (cost=3D0.00..3.01 rows=3D1 width=3D4) (actual =20= + +time=3D0.045..0.052 rows=3D1 loops=3D1) + Index Cond: (path =3D '/=20= + +Users/axel/Library/Preferences/'::text) + -> Index Scan using =20 +file_path_idx on file f (cost=3D0.00..493.28 rows=3D506 width=3D8) = +(actual =20 +time=3D3.058..76.014 rows=3D5200 loops=3D1) + Index Cond: =20 +("outer".pathid =3D f.pathid) + -> Bitmap Heap Scan on filename =20 +fn (cost=3D2.00..3.02 rows=3D1 width=3D23) (actual time=3D0.037..0.039 =20= + +rows=3D1 loops=3D5200) + Recheck Cond: =20 +("outer".filenameid =3D fn.filenameid) + Filter: (name <> ''::text) + -> Bitmap Index Scan on =20 +filename_pkey (cost=3D0.00..2.00 rows=3D1 width=3D0) (actual =20 +time=3D0.018..0.018 rows=3D1 loops=3D5200) + Index Cond: =20 +("outer".filenameid =3D fn.filenameid) +Total runtime: 832.458 ms +--------------------------------------------------------------- +which is ok, but initial path of "/Users/axel" results in (which is =20 +not ok): +--------------------------------------------------------------- + Sort (cost=3D125533.67..125534.17 rows=3D200 width=3D64) (actual =20 +time=3D84273.963..84274.260 rows=3D181 loops=3D1) + Sort Key: upper(x.name) + -> GroupAggregate (cost=3D123493.01..125526.03 rows=3D200 = +width=3D64) =20 +(actual time=3D84263.411..84272.427 rows=3D181 loops=3D1) + -> Unique (cost=3D123493.01..124169.51 rows=3D90201 =20 +width=3D112) (actual time=3D84263.215..84270.129 rows=3D522 loops=3D1) + -> Sort (cost=3D123493.01..123718.51 rows=3D90201 =20 +width=3D112) (actual time=3D84263.208..84265.632 rows=3D1432 loops=3D1) + Sort Key: name, ch + -> Append (cost=3D113172.83..116069.08 =20 +rows=3D90201 width=3D112) (actual time=3D83795.274..84251.660 rows=3D1432 = +=20 +loops=3D1) + -> Subquery Scan "*SELECT* =20 +1" (cost=3D113172.83..115426.71 rows=3D90155 width=3D112) (actual =20 +time=3D83795.270..83803.996 rows=3D410 loops=3D1) + -> HashAggregate =20 +(cost=3D113172.83..114525.16 rows=3D90155 width=3D112) (actual =20 +time=3D83795.258..83802.369 rows=3D410 loops=3D1) + -> Hash Left Join =20 +(cost=3D3124.38..112722.06 rows=3D90155 width=3D112) (actual =20 +time=3D56254.547..83779.903 rows=3D3648 loops=3D1) + Hash Cond: =20 +("outer".filenameid =3D "inner".filenameid) + -> Merge Left Join =20 +(cost=3D0.00..106216.87 rows=3D90155 width=3D97) (actual =20 +time=3D54926.198..82430.621 rows=3D3648 loops=3D1) + Merge Cond: =20 +("outer".pathid =3D "inner".pathid) + -> Index Scan =20 +using path_pkey on path p (cost=3D0.00..2567.57 rows=3D1941 width=3D97) = +=20 +(actual time=3D527.805..1521.911 rows=3D69 loops=3D1) + Filter: =20 +((path ~ '^/Users/axel/[^/]*/$'::text) AND (rtrim("replace"(path, '/=20 +Users/axel/'::text, ''::text), '/'::text) <> ''::text)) + -> Index Scan =20 +using file_path_idx on file f (cost=3D0.00..95191.99 rows=3D3020363 =20 +width=3D8) (actual time=3D17.561..74392.318 rows=3D2941790 loops=3D1) + -> Hash =20 +(cost=3D2723.30..2723.30 rows=3D160430 width=3D23) (actual =20 +time=3D1299.103..1299.103 rows=3D160430 loops=3D1) + -> Seq Scan on =20 +filename fn (cost=3D0.00..2723.30 rows=3D160430 width=3D23) (actual =20 +time=3D3.884..684.918 rows=3D160430 loops=3D1) + -> Nested Loop (cost=3D2.00..641.91 =20 +rows=3D46 width=3D19) (actual time=3D93.252..442.196 rows=3D1022 = +loops=3D1) + -> Nested Loop (cost=3D0.00..502.62 =20= + +rows=3D46 width=3D4) (actual time=3D49.375..209.694 rows=3D1050 loops=3D1)= + + -> Index Scan using =20 +path_name_idx on path p (cost=3D0.00..3.01 rows=3D1 width=3D4) (actual =20= + +time=3D29.455..29.462 rows=3D1 loops=3D1) + Index Cond: (path =3D '/=20= + +Users/axel/'::text) + -> Index Scan using =20 +file_path_idx on file f (cost=3D0.00..493.28 rows=3D506 width=3D8) = +(actual =20 +time=3D19.898..175.869 rows=3D1050 loops=3D1) + Index Cond: =20 +("outer".pathid =3D f.pathid) + -> Bitmap Heap Scan on filename =20 +fn (cost=3D2.00..3.02 rows=3D1 width=3D23) (actual time=3D0.206..0.208 =20= + +rows=3D1 loops=3D1050) + Recheck Cond: =20 +("outer".filenameid =3D fn.filenameid) + Filter: (name <> ''::text) + -> Bitmap Index Scan on =20 +filename_pkey (cost=3D0.00..2.00 rows=3D1 width=3D0) (actual =20 +time=3D0.087..0.087 rows=3D1 loops=3D1050) + Index Cond: =20 +("outer".filenameid =3D fn.filenameid) + Total runtime: 84295.927 ms +--------------------------------------------------------------- +It happened once that the planner resolved the 2nd query with the 1st =20= + +plan, but this is not reproducible. +How can I avoid the 2nd plan? + +This is 8.1.4 on OpenBSD 3.9 with 2x1GHz PIII and 2GB. +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 08:17:39 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id D3A529FB33B + for ; + Mon, 31 Jul 2006 08:17:38 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 74678-10 for + ; + Mon, 31 Jul 2006 08:17:22 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) + by postgresql.org (Postfix) with ESMTP id BEC799FB32C + for ; + Mon, 31 Jul 2006 08:16:27 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.236]) + by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J390066BLY950FA@vms048.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 31 Jul 2006 06:15:46 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id B7F646ED28; Mon, + 31 Jul 2006 07:15:44 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id Bu3amgHBQNhm; Mon, 31 Jul 2006 07:15:43 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id 37B076F9F5; Mon, 31 Jul 2006 07:15:43 -0400 (EDT) +Date: Mon, 31 Jul 2006 07:15:42 -0400 +From: Michael Stone +Subject: Re: directory tree query with big planner variation +In-reply-to: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> +To: Axel Rau +Cc: pgsql-performance@postgresql.org +Mail-followup-to: Axel Rau , + pgsql-performance@postgresql.org +Message-id: <20060731111540.GE2900@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.025 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/301 +X-Sequence-Number: 20161 + +On Mon, Jul 31, 2006 at 12:48:11PM +0200, Axel Rau wrote: +> WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC + +This can't be indexed. You might try something like +WHERE P.path LIKE '%@%' AND P.path ~ '^%@/[^/]*/$' + +The schema could be a lot more intelligent here. (E.g., store path +seperately from file/directory name, store type (file or directory) +seperately, etc.) Without improving the schema I don't think this will +ever be a speed demon. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jul 31 08:55:52 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8833F9FB335 + for ; + Mon, 31 Jul 2006 08:55:51 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 78168-07 for + ; + Mon, 31 Jul 2006 08:55:33 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.DE [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id 541209FB32C + for ; + Mon, 31 Jul 2006 08:54:37 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7WLq-0008Nm-4C; Mon, 31 Jul 2006 13:54:26 +0200 +In-Reply-To: <20060731111540.GE2900@mathom.us> +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +From: Axel Rau +Subject: Re: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 13:54:24 +0200 +To: Michael Stone +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.052 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/302 +X-Sequence-Number: 20162 + + +Am 31.07.2006 um 13:15 schrieb Michael Stone: + +> On Mon, Jul 31, 2006 at 12:48:11PM +0200, Axel Rau wrote: +>> WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC +> +> This can't be indexed. You might try something like WHERE P.path =20 +> LIKE '%@%' AND P.path ~ '^%@/[^/]*/$' +Why does it quite well in this case: +--------------------------------------- +-> Index Scan using path_name_idx on path p (cost=3D0.00..3.02 rows=3D1 = +=20 +width=3D97) (actual time=3D15.480..56.935 rows=3D27 loops=3D1) + Index Cond: ((path >=3D '/Users/axel/Library/=20 +Preferences/'::text) AND (path < '/Users/axel/Library/=20 +Preferences0'::text)) + Filter: ((path ~ '^/Users/axel/Library/Preferences/[^/]*/=20 +$'::text) AND (rtrim("replace"(path, '/Users/axel/Library/=20 +Preferences/'::text, ''::text), '/'::text) <> ''::text)) +--------------------------------------- +as compared to this case(ignoring the index on path): +--------------------------------------- +-> Index Scan using path_pkey on path p (cost=3D0.00..2567.57 =20 +rows=3D1941 width=3D97) (actual time=3D527.805..1521.911 rows=3D69 = +loops=3D1) + Filter: ((path ~ '^/Users/axel/[^/]*/$'::text) AND (rtrim=20 +("replace"(path, '/Users/axel/'::text, ''::text), '/'::text) <> =20 +''::text)) +--------------------------------------- +? With all longer path names, I get the above (good)result. +Should I put the rtrim/replace on the client side? +> +> The schema could be a lot more intelligent here. (E.g., store path =20 +> seperately from file/directory name, store type (file or directory) =20= + +> seperately, etc.) Without improving the schema I don't think this =20 +> will ever be a speed demon. +PATH holds complete pathnames of directories, FILENAME holds =20 +filenames and pathname components. +Currently the schema is the lowest common denominator between SQLite, =20= + +MySQL and pg and the bacula people will stay with that (-;). +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 09:40:42 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 1CAFD9FB33B + for ; + Mon, 31 Jul 2006 09:40:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82728-07 for + ; + Mon, 31 Jul 2006 09:40:28 -0300 (ADT) +X-Greylist: delayed 00:25:28.973072 by SQLgrey- +Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) + by postgresql.org (Postfix) with ESMTP id 579089FB363 + for ; + Mon, 31 Jul 2006 09:40:12 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 +Received: from keymaster.look.ca (delta1.look.ca [207.136.80.9]) + by svr4.postgresql.org (Postfix) with ESMTP id 99DB15AFB38 + for ; + Mon, 31 Jul 2006 12:14:31 +0000 (GMT) +Received: from 216-154-21-111.dsl.look.ca ([216.154.21.111]) + by keymaster.look.ca with esmtp (Exim 4.20) + id 1G7Wez-0003aC-RZ; Mon, 31 Jul 2006 12:14:13 +0000 +From: Rod Taylor +To: H Hale +Cc: pgsql-performance@postgresql.org +In-Reply-To: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> +References: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> +Date: Mon, 31 Jul 2006 08:09:42 -0400 +Message-Id: <1154347782.24186.278.camel@home> +Mime-Version: 1.0 +X-Mailer: Evolution 2.6.2 FreeBSD GNOME Team Port +X-SA-Exim-Mail-From: rbt@rbt.ca +Subject: Re: sub select performance due to seq scans +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +X-SA-Exim-Version: 3.1 (built Tue Feb 24 05:09:27 GMT 2004) +X-SA-Exim-Scanned: Yes +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.951 tagged_above=0 required=5 + tests=FORGED_RCVD_HELO, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/304 +X-Sequence-Number: 20164 + +> capsa=# explain analyze select name from capsa.flatomfilesysentry +> where objectid in ( select dstobj from capsa.flatommemberrelation +> where srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'); +> +> +> QUERY PLAN +> --------------------------------------------------------------------------------------------------------------------------------- +> Nested Loop IN Join (cost=0.00..1386.45 rows=5809 width=14) (actual +> time=2.933..101467.463 rows=5841 loops=1) +> Join Filter: ("outer".objectid = "inner".dstobj) +> -> Seq Scan on flatomfilesysentry (cost=0.00..368.09 rows=5809 +> width=30) (actual time=0.007..23.451 rows=5844 loops=1) +> -> Seq Scan on flatommemberrelation (cost=0.00..439.05 rows=5842 +> width=16) (actual time=0.007..11.790 rows=2922 loops=5844) + +A loop for an IN indicates that you are using a very old version of +PostgreSQL (7.2 or earlier). Please double check that the server is +8.1.3 as you indicated and not just the client. + +>From psql: + select version(); + +Hmm... Perhaps it is an 8.1.3 server with mergejoin and hashjoin +disabled? + show enable_mergejoin; + show enable_hashjoin; + +You can try this query syntax: + + select name from capsa.flatomfilesysentry join + capsa.flatommemberrelation on (objectid = dstobj) where srcobj = + 'c1c7304a-1fe1-11db-8af7-001143214409'; + + +> Filter: (srcobj = +> 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid) +> Total runtime: 101482.256 ms +> (6 rows) +> +> capsa=# select count(*) from capsa.flatommemberrelation ; +> count +> ------- +> 11932 +> (1 row) +> +> capsa=# select count(*) from capsa.flatomfilesysentry ; +> count +> ------- +> 5977 +> +> +> +> + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 09:25:14 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id CF93D9FB338 + for ; + Mon, 31 Jul 2006 09:25:13 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82602-01 for + ; + Mon, 31 Jul 2006 09:24:57 -0300 (ADT) +X-Greylist: delayed 00:07:20.516489 by SQLgrey- +Received: from h1.bettercom.de (h1.bettercom.de [213.239.194.41]) + by postgresql.org (Postfix) with ESMTP id 4AB5D9FB34A + for ; + Mon, 31 Jul 2006 09:24:42 -0300 (ADT) +Received: (qmail 6449 invoked by uid 208); 31 Jul 2006 12:17:08 -0000 +Received: from 213.39.204.54 by h1 (envelope-from , + uid 0) with qmail-scanner-1.23 + (clamdscan: 0.87. spamassassin: 3.04. Clear:RC:1(213.39.204.54):. + Processed in 0.021805 secs); 31 Jul 2006 12:17:08 -0000 +Received: from unknown (HELO fs-home.bettercom.de) ([213.39.204.54]) + (envelope-sender ) + by h1.bettercom.de (qmail-ldap-1.03) with SMTP + for ; 31 Jul 2006 12:17:08 -0000 +Received: (nullmailer pid 2740 invoked by uid 1000); + Mon, 31 Jul 2006 12:17:08 -0000 +From: Martin Lesser +To: pgsql-performance@postgresql.org +Subject: Partitioning / constrain exlusion not working with %-operator +X-Face: + "d[&>8')a)wbF:+L#^<_cohnX6#m5RCCeKF/6_gD(iQ9bX?xe2~Aq*!')D(1ks`?YhomOYbL3R:{4e4a]qft_]<.q/Lf4hIr,`G+LX33&TYp}XGfe~^5m$28R"$C(EwnB\n8t +Date: Mon, 31 Jul 2006 14:17:08 +0200 +Message-ID: <87ejw27yuz.fsf@fs-home.bettercom.de> +User-Agent: Gnus/5.110004 (No Gnus v0.4) XEmacs/21.4.18 (linux) +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.816 tagged_above=0 required=5 + tests=SPF_HELO_SOFTFAIL, SPF_SOFTFAIL, UPPERCASE_25_50 +X-Spam-Level: *** +X-Archive-Number: 200607/303 +X-Sequence-Number: 20163 + +I try to partition a large table (~ 120 mio. rows) into 50 smaller +tables but using the IMO immutable %-function constraint exclusion +does not work as expected: + +CREATE TABLE tt_m (id1 int, cont varchar); +CREATE TABLE tt_0 (check (id1 % 50 = 0)) INHERITS (tt_m); +CREATE TABLE tt_1 (check (id1 % 50 = 1)) INHERITS (tt_m); +.... +CREATE RULE ins_tt_0 AS ON INSERT TO tt_m WHERE id1 % 50 = 0 DO INSTEAD INSERT INTO tt_0 VALUES (new.*); +CREATE RULE ins_tt_1 AS ON INSERT TO tt_m WHERE id1 % 50 = 1 DO INSTEAD INSERT INTO tt_1 VALUES (new.*); +... +INSERT INTO tt_m (id1,cont) VALUES (0,'Test1'); +INSERT INTO tt_m (id1,cont) VALUES (1,'Test2'); +.... +EXPLAIN SELECT * FROM tt_m WHERE id1=1; + QUERY PLAN +----------------------------------------------------------------------- + Result (cost=0.00..73.50 rows=18 width=36) + -> Append (cost=0.00..73.50 rows=18 width=36) + -> Seq Scan on tt_m (cost=0.00..24.50 rows=6 width=36) + Filter: (id1 = 1) + -> Seq Scan on tt_0 tt_m (cost=0.00..24.50 rows=6 width=36) + Filter: (id1 = 1) + -> Seq Scan on tt_1 tt_m (cost=0.00..24.50 rows=6 width=36) + Filter: (id1 = 1) + ... + +Only adding an explicit %-call to the query results in the expected plan: + +EXPLAIN SELECT * FROM tt_m WHERE id1=1 AND id1 % 50 = 1; + QUERY PLAN +----------------------------------------------------------------------- + Result (cost=0.00..60.60 rows=2 width=36) + -> Append (cost=0.00..60.60 rows=2 width=36) + -> Seq Scan on tt_m (cost=0.00..30.30 rows=1 width=36) + Filter: ((id1 = 1) AND ((id1 % 50) = 1)) + -> Seq Scan on tt_1 tt_m (cost=0.00..30.30 rows=1 width=36) + Filter: ((id1 = 1) AND ((id1 % 50) = 1)) + +Did I miss something and/or how could I force the planner to use +constraint exclusion without adding the explicit second condition above? + +TIA, Martin + +From pgsql-performance-owner@postgresql.org Mon Jul 31 09:44:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 734DC9FB319 + for ; + Mon, 31 Jul 2006 09:44:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 82576-10 for + ; + Mon, 31 Jul 2006 09:44:00 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 00D679FB1E0 + for ; + Mon, 31 Jul 2006 09:43:15 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6VCgvAp013553; + Mon, 31 Jul 2006 08:42:57 -0400 (EDT) +To: Martin Lesser +cc: pgsql-performance@postgresql.org +Subject: Re: Partitioning / constrain exlusion not working with %-operator +In-reply-to: <87ejw27yuz.fsf@fs-home.bettercom.de> +References: <87ejw27yuz.fsf@fs-home.bettercom.de> +Comments: In-reply-to Martin Lesser + message dated "Mon, 31 Jul 2006 14:17:08 +0200" +Date: Mon, 31 Jul 2006 08:42:57 -0400 +Message-ID: <13552.1154349777@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.003 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/305 +X-Sequence-Number: 20165 + +Martin Lesser writes: +> I try to partition a large table (~ 120 mio. rows) into 50 smaller +> tables but using the IMO immutable %-function constraint exclusion +> does not work as expected: + +The constraint exclusion mechanism is not as bright as you think. +There are some very limited cases where it can make a deduction that +a WHERE clause implies a CHECK constraint that's not an exact textual +equivalent ... but all those cases have to do with related b-tree +operators, and % is not one. + +It's usually better to use partitioning rules that have something to +do with the WHERE-clauses you'd be using anyway. For instance, try +to partition on ranges of id1 instead of id1 % 50. That works because +the CHECK clauses will be like "id1 >= x and id1 < y" and those +operators are btree-related to the "id1 = z" clauses you'll have in +the query. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 31 09:54:10 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 356FF9FB339 + for ; + Mon, 31 Jul 2006 09:54:10 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 85683-01 for + ; + Mon, 31 Jul 2006 09:53:52 -0300 (ADT) +X-Greylist: whitelisted by SQLgrey- +Received: from smtp1-g19.free.fr (smtp1-g19.free.fr [212.27.42.27]) + by postgresql.org (Postfix) with ESMTP id 8301F9FB1E0 + for ; + Mon, 31 Jul 2006 09:53:37 -0300 (ADT) +Received: from [192.168.0.20] (pas38-4-82-233-120-60.fbx.proxad.net + [82.233.120.60]) + by smtp1-g19.free.fr (Postfix) with ESMTP id 43E8290B3C + for ; + Mon, 31 Jul 2006 14:53:25 +0200 (CEST) +Message-ID: <44CDFD44.8080307@multani.info> +Date: Mon, 31 Jul 2006 14:53:24 +0200 +From: Jonathan Ballet +User-Agent: Thunderbird 1.5.0.4 (X11/20060713) +MIME-Version: 1.0 +To: pgsql-performance@postgresql.org +Subject: Performances with new Intel Core* processors +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: 7bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.816 tagged_above=0 required=5 + tests=SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/306 +X-Sequence-Number: 20166 + +Hello, + +I've read a lot of mails here saying how good is the Opteron with PostgreSQL, +and a lot of people seems to recommend it (instead of Xeon). + +However, it seems that new Intel processors, Core Duo and Core 2 Duo, performs +very well, in desktop environment at least. + + +I wonder what can we expect with them, do anybody have done any experiments with +those processors ? + + +Regards, + Jonathan Ballet + +From pgsql-performance-owner@postgresql.org Mon Jul 31 09:54:50 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id B774F9FB339 + for ; + Mon, 31 Jul 2006 09:54:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 84994-06 for + ; + Mon, 31 Jul 2006 09:54:31 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 8F6A29FB335 + for ; + Mon, 31 Jul 2006 09:53:46 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6VCrYZN013709; + Mon, 31 Jul 2006 08:53:34 -0400 (EDT) +To: Rod Taylor +cc: H Hale , pgsql-performance@postgresql.org +Subject: Re: sub select performance due to seq scans +In-reply-to: <1154347782.24186.278.camel@home> +References: <20060731015014.87910.qmail@web88005.mail.re2.yahoo.com> + <1154347782.24186.278.camel@home> +Comments: In-reply-to Rod Taylor + message dated "Mon, 31 Jul 2006 08:09:42 -0400" +Date: Mon, 31 Jul 2006 08:53:34 -0400 +Message-ID: <13708.1154350414@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.033 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/307 +X-Sequence-Number: 20167 + +Rod Taylor writes: +>> Nested Loop IN Join (cost=0.00..1386.45 rows=5809 width=14) (actual +>> time=2.933..101467.463 rows=5841 loops=1) +>> Join Filter: ("outer".objectid = "inner".dstobj) +>> -> Seq Scan on flatomfilesysentry (cost=0.00..368.09 rows=5809 +>> width=30) (actual time=0.007..23.451 rows=5844 loops=1) +>> -> Seq Scan on flatommemberrelation (cost=0.00..439.05 rows=5842 +>> width=16) (actual time=0.007..11.790 rows=2922 loops=5844) + +> A loop for an IN indicates that you are using a very old version of +> PostgreSQL (7.2 or earlier). + +No, it's not that, because 7.2 certainly had no idea of "IN Join"s. +But there's something mighty fishy about this plan anyway. The +planner was predicting 5809 rows out from flatomfilesysentry (not +too far off), so why didn't it predict something north of +368.09 + 5809 * 439.05 as the total join cost? There's a special case +in cost_nestloop for IN joins, but it sure shouldn't have reduced the +estimate by a factor of 1800+ ... + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 31 10:32:08 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 0D6449FB319 + for ; + Mon, 31 Jul 2006 10:32:08 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 88766-03 for + ; + Mon, 31 Jul 2006 10:31:44 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) + by postgresql.org (Postfix) with ESMTP id 55A789FB33A + for ; + Mon, 31 Jul 2006 10:31:01 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.236]) + by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J390008PS76BB28@vms046.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 31 Jul 2006 08:30:43 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 6F6636E796; Mon, + 31 Jul 2006 09:30:39 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id UhlbkiTvz+0g; Mon, 31 Jul 2006 09:30:38 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id F0C6E6FA41; Mon, 31 Jul 2006 09:30:37 -0400 (EDT) +Date: Mon, 31 Jul 2006 09:30:37 -0400 +From: Michael Stone +Subject: Re: directory tree query with big planner variation +In-reply-to: +To: Axel Rau +Cc: Michael Stone , + pgsql-performance@postgresql.org +Mail-followup-to: Axel Rau , + Michael Stone , + pgsql-performance@postgresql.org +Message-id: <20060731133034.GF2900@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.921 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/308 +X-Sequence-Number: 20168 + +On Mon, Jul 31, 2006 at 01:54:24PM +0200, Axel Rau wrote: +>Am 31.07.2006 um 13:15 schrieb Michael Stone: +>>On Mon, Jul 31, 2006 at 12:48:11PM +0200, Axel Rau wrote: +>>> WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC +>> +>>This can't be indexed. You might try something like WHERE P.path +>>LIKE '%@%' AND P.path ~ '^%@/[^/]*/$' + +Ignore that, I wasn't awake yet. + +>Why does it quite well in this case: +>--------------------------------------- +>-> Index Scan using path_name_idx on path p (cost=0.00..3.02 rows=1 +>width=97) (actual time=15.480..56.935 rows=27 loops=1) +> Index Cond: ((path >= '/Users/axel/Library/ +>Preferences/'::text) AND (path < '/Users/axel/Library/ +>Preferences0'::text)) +> Filter: ((path ~ '^/Users/axel/Library/Preferences/[^/]*/ +>$'::text) AND (rtrim("replace"(path, '/Users/axel/Library/ +>Preferences/'::text, ''::text), '/'::text) <> ''::text)) +>--------------------------------------- +>as compared to this case(ignoring the index on path): +>--------------------------------------- +>-> Index Scan using path_pkey on path p (cost=0.00..2567.57 +>rows=1941 width=97) (actual time=527.805..1521.911 rows=69 loops=1) +> Filter: ((path ~ '^/Users/axel/[^/]*/$'::text) AND (rtrim +>("replace"(path, '/Users/axel/'::text, ''::text), '/'::text) <> +>''::text)) +>--------------------------------------- +>? With all longer path names, I get the above (good)result. +>Should I put the rtrim/replace on the client side? + +That's not the slow part. The slow part is retrieving every single file +for each of the subdirectories in order to determine whether there are +any files in the subdirectories. + +>>The schema could be a lot more intelligent here. (E.g., store path +>>seperately from file/directory name, store type (file or directory) +>>seperately, etc.) Without improving the schema I don't think this +>>will ever be a speed demon. + +>PATH holds complete pathnames of directories, FILENAME holds +>filenames and pathname components. +>Currently the schema is the lowest common denominator between SQLite, +>MySQL and pg and the bacula people will stay with that (-;). + +Nothing I suggested raises the bar for the "lowest common denominator". +If I understand the intend of this SQL, you're pulling all the entries +in a directory in two parts. The first part (files) is fairly +straightforward. The second part (directories) consists of pulling any +file whose parent is a subdirectory of the directory you're looking for +(this is *all* children of the directory, since you have to retrieve +every element that begins with the directory, then discard those that +have an additional / in their name), counting how many of these there +are for each subdirectory, and discarding those results except for a +binary (yes there are children or no there aren't). This is a lot of +useless work to go through, and is going to be slow if you've got a lot +of stuff in a subdirectory. An alternative approach would be, for each +directory, to store all its children (files and subdirectories) along +with a flag indicating which it is. This would allow you to create the +collapsed tree view without walking all the children of a subdirectory. + +Assuming you can't make changes to the schema, what about the query? +You've got this: + +explain analyze SELECT X.name AS name, COUNT(CH) > 1 AS children + FROM + ( SELECT RTRIM( REPLACE( NLPC.path, '%@/', ''),'/') AS name, + FN.name AS CH + FROM + ( SELECT P.path,P.pathid + FROM bacula.path P + WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC + LEFT OUTER JOIN bacula.file F + ON + NLPC.pathid = F.pathid + LEFT OUTER JOIN bacula.filename FN + ON + F.filenameid = FN.filenameid + GROUP BY NLPC.path, FN.name + UNION + SELECT FN.name AS name, FN.name AS CH + FROM + bacula.path P, bacula.file F, bacula.filename FN + WHERE + P.path = '%@/' AND + P.pathid = F.pathid AND + F.filenameid = FN.filenameid + ) AS X + WHERE X.name <> '' + GROUP BY X.name + +I'm only looking at the first part, which reduces to +SELECT X.name AS name, COUNT(CH) > 1 AS children FROM + SELECT NLPC.path AS name, FN.name as CH + FROM ( SELECT P.path,P.pathid FROM bacula.path AS NLPC + LEFT OUTER JOIN bacula.file F ON NLPC.pathid=F.pathid + LEFT OUTER JOIN bacula.filename FN ON F.filenameid=FN.filenameid + GROUP BY NLPC.path,FN.name + +Why is the filename table even accessed? Would the results be the +same if you did + SELECT NLPC.path AS name, F.fileid AS CH +and drop the LEFT OUTER JOIN bacula.filename altogether? + +And then what happens if you try something like +SELECT X.name,X.children + FROM + (SELECT [rtrim]P.path,(SELECT count(*) FROM bacula.file F + WHERE F.pathid = P.pathid + LIMIT 2) > 1 + FROM bacula.path P + WHERE P.path ~ '^%@/[^/]*/$' + UNION + SELECT FN.name,0 + FROM bacula.path P, bacula.file F, bacula.filename FN + WHERE + P.path = '%@/' AND + P.pathid = F.pathid AND + F.filenameid = FN.filenameid + ) AS X + WHERE X.name <> '' + GROUP BY X.name + +It's hard to say without knowing what's actually *in* the tables, but +the existing query definately doesn't scale well for what I think it's +trying to do. + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jul 31 10:54:06 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 2D0979FB356 + for ; + Mon, 31 Jul 2006 10:54:06 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 89613-05-2 + for ; + Mon, 31 Jul 2006 10:53:50 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) + by postgresql.org (Postfix) with ESMTP id 340B99FB361 + for ; + Mon, 31 Jul 2006 10:53:34 -0300 (ADT) +Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP + with MS-WebStorage 6.0.6249 +Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; + 31 Jul 2006 06:53:21 -0700 +Subject: Re: directory tree query with big planner variation +From: Mark Lewis +To: Michael Stone +Cc: Axel Rau , pgsql-performance@postgresql.org +In-Reply-To: <20060731133034.GF2900@mathom.us> +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Organization: MIR3, Inc. +Date: Mon, 31 Jul 2006 06:53:21 -0700 +Message-Id: <1154354001.1634.792.camel@archimedes> +Mime-Version: 1.0 +X-Mailer: Evolution 2.0.2 (2.0.2-27) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.957 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL, UNPARSEABLE_RELAY +X-Spam-Level: * +X-Archive-Number: 200607/309 +X-Sequence-Number: 20169 + +It seems like you might be able to avoid the expensive directory lookups +entirely without changing the schema by defining an immutable function +dir_depth(path), which would just count the number of forward slashes. +Then create a functional index on dir_depth(path) and in the query do a +check for directories with a given prefix and the expected dir_depth. + +In 8.1 and later, this kind of query might be able to use a bitmap index +combining thingamajigger (the actual name escapes me right now). + +This is just a hunch and I haven't looked too carefully at the +schema/query requirements to see if its feasible, but seems like a +reasonable approach. + +-- Mark Lewis + + +On Mon, 2006-07-31 at 09:30 -0400, Michael Stone wrote: +> On Mon, Jul 31, 2006 at 01:54:24PM +0200, Axel Rau wrote: +> >Am 31.07.2006 um 13:15 schrieb Michael Stone: +> >>On Mon, Jul 31, 2006 at 12:48:11PM +0200, Axel Rau wrote: +> >>> WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC +> >> +> >>This can't be indexed. You might try something like WHERE P.path +> >>LIKE '%@%' AND P.path ~ '^%@/[^/]*/$' +> +> Ignore that, I wasn't awake yet. +> +> >Why does it quite well in this case: +> >--------------------------------------- +> >-> Index Scan using path_name_idx on path p (cost=0.00..3.02 rows=1 +> >width=97) (actual time=15.480..56.935 rows=27 loops=1) +> > Index Cond: ((path >= '/Users/axel/Library/ +> >Preferences/'::text) AND (path < '/Users/axel/Library/ +> >Preferences0'::text)) +> > Filter: ((path ~ '^/Users/axel/Library/Preferences/[^/]*/ +> >$'::text) AND (rtrim("replace"(path, '/Users/axel/Library/ +> >Preferences/'::text, ''::text), '/'::text) <> ''::text)) +> >--------------------------------------- +> >as compared to this case(ignoring the index on path): +> >--------------------------------------- +> >-> Index Scan using path_pkey on path p (cost=0.00..2567.57 +> >rows=1941 width=97) (actual time=527.805..1521.911 rows=69 loops=1) +> > Filter: ((path ~ '^/Users/axel/[^/]*/$'::text) AND (rtrim +> >("replace"(path, '/Users/axel/'::text, ''::text), '/'::text) <> +> >''::text)) +> >--------------------------------------- +> >? With all longer path names, I get the above (good)result. +> >Should I put the rtrim/replace on the client side? +> +> That's not the slow part. The slow part is retrieving every single file +> for each of the subdirectories in order to determine whether there are +> any files in the subdirectories. +> +> >>The schema could be a lot more intelligent here. (E.g., store path +> >>seperately from file/directory name, store type (file or directory) +> >>seperately, etc.) Without improving the schema I don't think this +> >>will ever be a speed demon. +> +> >PATH holds complete pathnames of directories, FILENAME holds +> >filenames and pathname components. +> >Currently the schema is the lowest common denominator between SQLite, +> >MySQL and pg and the bacula people will stay with that (-;). +> +> Nothing I suggested raises the bar for the "lowest common denominator". +> If I understand the intend of this SQL, you're pulling all the entries +> in a directory in two parts. The first part (files) is fairly +> straightforward. The second part (directories) consists of pulling any +> file whose parent is a subdirectory of the directory you're looking for +> (this is *all* children of the directory, since you have to retrieve +> every element that begins with the directory, then discard those that +> have an additional / in their name), counting how many of these there +> are for each subdirectory, and discarding those results except for a +> binary (yes there are children or no there aren't). This is a lot of +> useless work to go through, and is going to be slow if you've got a lot +> of stuff in a subdirectory. An alternative approach would be, for each +> directory, to store all its children (files and subdirectories) along +> with a flag indicating which it is. This would allow you to create the +> collapsed tree view without walking all the children of a subdirectory. +> +> Assuming you can't make changes to the schema, what about the query? +> You've got this: +> +> explain analyze SELECT X.name AS name, COUNT(CH) > 1 AS children +> FROM +> ( SELECT RTRIM( REPLACE( NLPC.path, '%@/', ''),'/') AS name, +> FN.name AS CH +> FROM +> ( SELECT P.path,P.pathid +> FROM bacula.path P +> WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC +> LEFT OUTER JOIN bacula.file F +> ON +> NLPC.pathid = F.pathid +> LEFT OUTER JOIN bacula.filename FN +> ON +> F.filenameid = FN.filenameid +> GROUP BY NLPC.path, FN.name +> UNION +> SELECT FN.name AS name, FN.name AS CH +> FROM +> bacula.path P, bacula.file F, bacula.filename FN +> WHERE +> P.path = '%@/' AND +> P.pathid = F.pathid AND +> F.filenameid = FN.filenameid +> ) AS X +> WHERE X.name <> '' +> GROUP BY X.name +> +> I'm only looking at the first part, which reduces to +> SELECT X.name AS name, COUNT(CH) > 1 AS children FROM +> SELECT NLPC.path AS name, FN.name as CH +> FROM ( SELECT P.path,P.pathid FROM bacula.path AS NLPC +> LEFT OUTER JOIN bacula.file F ON NLPC.pathid=F.pathid +> LEFT OUTER JOIN bacula.filename FN ON F.filenameid=FN.filenameid +> GROUP BY NLPC.path,FN.name +> +> Why is the filename table even accessed? Would the results be the +> same if you did +> SELECT NLPC.path AS name, F.fileid AS CH +> and drop the LEFT OUTER JOIN bacula.filename altogether? +> +> And then what happens if you try something like +> SELECT X.name,X.children +> FROM +> (SELECT [rtrim]P.path,(SELECT count(*) FROM bacula.file F +> WHERE F.pathid = P.pathid +> LIMIT 2) > 1 +> FROM bacula.path P +> WHERE P.path ~ '^%@/[^/]*/$' +> UNION +> SELECT FN.name,0 +> FROM bacula.path P, bacula.file F, bacula.filename FN +> WHERE +> P.path = '%@/' AND +> P.pathid = F.pathid AND +> F.filenameid = FN.filenameid +> ) AS X +> WHERE X.name <> '' +> GROUP BY X.name +> +> It's hard to say without knowing what's actually *in* the tables, but +> the existing query definately doesn't scale well for what I think it's +> trying to do. +> +> Mike Stone +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 2: Don't 'kill -9' the postmaster + +From pgsql-performance-owner@postgresql.org Mon Jul 31 11:15:15 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id A3C6E9FB35F + for ; + Mon, 31 Jul 2006 11:15:14 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 92232-08 for + ; + Mon, 31 Jul 2006 11:14:57 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from web88002.mail.re2.yahoo.com (web88002.mail.re2.yahoo.com + [206.190.37.189]) + by postgresql.org (Postfix) with SMTP id A31FF9FB35E + for ; + Mon, 31 Jul 2006 11:14:42 -0300 (ADT) +Received: (qmail 87708 invoked by uid 60001); 31 Jul 2006 14:14:27 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=rogers.com; + h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=cqp1SlJbHhupuC2xM6bB3Zi7T4rb16F/NEMfjFrT0A+Mb11tA1H0EPlAW8YbRbde9JYSnNSgnnGJXWVNz2zScaboeNJIsM/P/k0wRToXNow3lwRs62NQe53r965AiiS8s/9/K/nwh/+fPsVMqEY2OFa9X1MQadvGr/KAmt4Bph0= + ; +Message-ID: <20060731141427.87706.qmail@web88002.mail.re2.yahoo.com> +Received: from [216.16.241.206] by web88002.mail.re2.yahoo.com via HTTP; + Mon, 31 Jul 2006 10:14:27 EDT +Date: Mon, 31 Jul 2006 10:14:27 -0400 (EDT) +From: H Hale +Subject: Re: sub select performance due to seq scans +To: pgsql-performance@postgresql.org +In-Reply-To: <44CDCB69.6070809@archonet.com> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-867864686-1154355267=:84394" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=4.191 tagged_above=0 required=5 tests=HTML_30_40, + HTML_MESSAGE, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: **** +X-Archive-Number: 200607/310 +X-Sequence-Number: 20170 + +--0-867864686-1154355267=:84394 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + + + +Look at that second seq-scan (on flatommemberrelation) - it's looping +5844 times (once for each row in flatmfilesysentry). I'd expect PG to +materialise the seq-scan once and then join (unless I'm missing +something, the subselect just involves the one test against a constant). + +I'm guessing something in your configuration is pushing your cost +estimates far away from reality. Could you try issuing a "set +enable_seqscan=off" and then running explain-analyse again. That will +show us alternatives. + +Also, what performance-related configuration values have you changed? +Could you post them with a brief description of your hardware? + +-- + Richard Huxton + Archonet Ltd + +---------------------------(end of broadcast)--------------------------- +TIP 2: Don't 'kill -9' the postmaster +The hardware is XEON 3GHZ P4 2GB Memory with 80GB SATA drive. + Kernel.SHMMAX=128MB + + The following config changes have been made from the defaults... + + shared_buffers = 8000 # min 16 or max_connections*2, 8KB each + max_fsm_pages = 50000 # min max_fsm_relations*16, 6 bytes each + vacuum_cost_delay = 10 # 0-1000 milliseconds + stats_start_collector = on + stats_row_level = on + autovacuum = on # enable autovacuum subprocess? + autovacuum_naptime = 20 # time between autovacuum runs, in secs + autovacuum_vacuum_threshold = 500 # min # of tuple updates before# vacuum + autovacuum_analyze_threshold = 250 # min # of tuple updates before + + Here is the query plan... + + capsa=# set enable_seqscan=off; + SET + Time: 0.478 ms + capsa=# explain analyze select name from capsa.flatomfilesysentry where objectid in ( select dstobj from capsa.flatommemberrelation where srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'); + QUERY PLAN + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + Nested Loop (cost=873.32..1017581.78 rows=6476 width=14) (actual time=80.402..241.881 rows=6473 loops=1) + -> Unique (cost=871.32..903.68 rows=3229 width=16) (actual time=80.315..113.282 rows=6473 loops=1) + -> Sort (cost=871.32..887.50 rows=6473 width=16) (actual time=80.310..94.279 rows=6473 loops=1) + Sort Key: flatommemberrelation.dstobj + -> Bitmap Heap Scan on flatommemberrelation (cost=56.66..461.57 rows=6473 width=16) (actual time=2.613..14.229 rows=6473 loops=1) + Recheck Cond: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid) + -> Bitmap Index Scan on capsa_flatommemberrelation_srcobj_idx (cost=0.00..56.66 rows=6473 width=0) (actual time=2.344..2.344 rows=6473 loops=1) + Index Cond: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid) + -> Bitmap Heap Scan on flatomfilesysentry (cost=2.00..274.38 rows=3238 width=30) (actual time=0.011..0.013 rows=1 loops=6473) + Recheck Cond: (flatomfilesysentry.objectid = "outer".dstobj) + -> Bitmap Index Scan on flatomfilesysentry_pkey (cost=0.00..2.00 rows=3238 width=0) (actual time=0.007..0.007 rows=1 loops=6473) + Index Cond: (flatomfilesysentry.objectid = "outer".dstobj) + Total runtime: 251.611 ms + (13 rows) + + Time: 252.825 ms + + I went back to the stock conf settings, did a vaccuum full analyze and still get the same results. + + Background... + + We have spikes of activty where both tables get rows inserted & have many updates. During this time performance drops. + I have been experimenting with auto vac settings as vaccuuming was helping although query performance + did not return to normal until after the activity spike. + In this case ( and I not sure why yet) vac made no difference. + + + + + + + +--0-867864686-1154355267=:84394 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +

Look at that second seq-scan (on flatommemberrelation) - it's looping
5844 times (once for each row in flatmfilesysentry). I'd expect PG to
materialise the seq-scan once and then join (unless I'm missing
something, the subselect just involves the one test against a constant).

I'm guessing something in your configuration is pushing your cost
estimates far away from reality. Could you try issuing a "set
enable_seqscan=off" and then running explain-analyse again. That will
show us alternatives.

Also, what performance-related configuration values have you changed?
Could you post them with a brief description of your hardware?

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the + postmaster
The hardware is XEON 3GHZ P4 2GB Memory with 80GB SATA drive.
Kernel.SHMMAX=128MB

The following config changes have been made from the defaults...

shared_buffers = 8000            # min 16 or max_connections*2, 8KB each
max_fsm_pages = 50000            # min max_fsm_relations*16, 6 bytes each
vacuum_cost_delay = 10            # 0-1000 milliseconds
stats_start_collector = on
stats_row_level = on
autovacuum = on                # enable autovacuum subprocess?
autovacuum_naptime = 20        # time between autovacuum runs, in secs
autovacuum_vacuum_threshold = 500    # min # of tuple updates before# vacuum
autovacuum_analyze_threshold = 250    # + min # of tuple updates before

Here is the query plan...

capsa=# set enable_seqscan=off;
SET
Time: 0.478 ms
capsa=# explain analyze select name from capsa.flatomfilesysentry where objectid in ( select dstobj from capsa.flatommemberrelation where srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409');
                                                                              QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
+  Nested Loop  (cost=873.32..1017581.78 rows=6476 width=14) (actual time=80.402..241.881 rows=6473 loops=1)
   ->  Unique  (cost=871.32..903.68 rows=3229 width=16) (actual time=80.315..113.282 rows=6473 loops=1)
         ->  Sort  (cost=871.32..887.50 rows=6473 width=16) (actual time=80.310..94.279 rows=6473 loops=1)
               Sort Key: flatommemberrelation.dstobj
               ->  Bitmap Heap Scan on flatommemberrelation  (cost=56.66..461.57 rows=6473 width=16) (actual time=2.613..14.229 rows=6473 loops=1)
                     Recheck Cond: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid)
+                      ->  Bitmap Index Scan on capsa_flatommemberrelation_srcobj_idx  (cost=0.00..56.66 rows=6473 width=0) (actual time=2.344..2.344 rows=6473 loops=1)
                           Index Cond: (srcobj = 'c1c7304a-1fe1-11db-8af7-001143214409'::capsa_sys.uuid)
   ->  Bitmap Heap Scan on flatomfilesysentry  (cost=2.00..274.38 rows=3238 width=30) (actual time=0.011..0.013 rows=1 loops=6473)
         Recheck Cond: (flatomfilesysentry.objectid = "outer".dstobj)
         ->  Bitmap Index Scan on flatomfilesysentry_pkey  (cost=0.00..2.00 rows=3238 width=0) (actual time=0.007..0.007 rows=1 + loops=6473)
               Index Cond: (flatomfilesysentry.objectid = "outer".dstobj)
 Total runtime: 251.611 ms
(13 rows)

Time: 252.825 ms

I went back to the stock conf settings, did a vaccuum full analyze and still get the same results.

Background...

We have spikes of activty where both tables get rows inserted & have many updates. During this time performance drops.
I have been experimenting with auto vac settings as vaccuuming was helping although query performance
did not return to normal until after the activity spike.
In this case ( and I not sure why yet) vac made no difference.






+--0-867864686-1154355267=:84394-- + +From pgsql-performance-owner@postgresql.org Mon Jul 31 11:29:31 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 8AADA9FB35E + for ; + Mon, 31 Jul 2006 11:29:31 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 94124-02 for + ; + Mon, 31 Jul 2006 11:29:13 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) + by postgresql.org (Postfix) with ESMTP id 268389FB33A + for ; + Mon, 31 Jul 2006 11:28:57 -0300 (ADT) +Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) + by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6VESkT4014464; + Mon, 31 Jul 2006 10:28:46 -0400 (EDT) +To: H Hale +cc: pgsql-performance@postgresql.org +Subject: Re: sub select performance due to seq scans +In-reply-to: <20060731141427.87706.qmail@web88002.mail.re2.yahoo.com> +References: <20060731141427.87706.qmail@web88002.mail.re2.yahoo.com> +Comments: In-reply-to H Hale + message dated "Mon, 31 Jul 2006 10:14:27 -0400" +Date: Mon, 31 Jul 2006 10:28:46 -0400 +Message-ID: <14463.1154356126@sss.pgh.pa.us> +From: Tom Lane +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.082 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/311 +X-Sequence-Number: 20171 + +H Hale writes: +> -> Bitmap Heap Scan on flatomfilesysentry (cost=2.00..274.38 rows=3238 width=30) (actual time=0.011..0.013 rows=1 loops=6473) +> Recheck Cond: (flatomfilesysentry.objectid = "outer".dstobj) +> -> Bitmap Index Scan on flatomfilesysentry_pkey (cost=0.00..2.00 rows=3238 width=0) (actual time=0.007..0.007 rows=1 loops=6473) +> Index Cond: (flatomfilesysentry.objectid = "outer".dstobj) + +Well, there's our estimation failure: 3238 rows expected, one row +actual. + +What is the data distribution of flatomfilesysentry.objectid? +It looks from this example like it is unique or nearly so, +but the planner evidently does not think that. + + regards, tom lane + +From pgsql-performance-owner@postgresql.org Mon Jul 31 12:07:09 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 19A4E9FB363 + for ; + Mon, 31 Jul 2006 12:07:09 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 97364-02-2 + for ; + Mon, 31 Jul 2006 12:06:46 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.DE [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id 9D40F9FB35E + for ; + Mon, 31 Jul 2006 12:06:20 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7ZLI-00081J-3x + for pgsql-performance@postgresql.org; Mon, 31 Jul 2006 17:06:04 +0200 +Mime-Version: 1.0 (Apple Message framework v752.2) +In-Reply-To: <20060731133034.GF2900@mathom.us> +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +Message-Id: +Content-Transfer-Encoding: quoted-printable +From: Axel Rau +Subject: Re: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 17:06:00 +0200 +To: pgsql-performance@postgresql.org +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.307 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/312 +X-Sequence-Number: 20172 + + +Am 31.07.2006 um 15:30 schrieb Michael Stone: + +> If I understand the intend of this SQL, +Let me show the tables first: + Table "bacula.path" ( 65031 rows) +Column | Type | Modifiers +--------+---------=20 ++------------------------------------------------------- +pathid | integer | not null default nextval('path_pathid_seq'::regclass) +path | text | not null ( complete pathnames of all =20 +directories ) +Indexes: + "path_pkey" PRIMARY KEY, btree (pathid) + "path_name_idx" btree (path) + + Table "bacula.file" (3021903 rows) + Column | Type | Modifiers +------------+---------=20 ++------------------------------------------------------- +fileid | integer | not null default nextval=20 +('file_fileid_seq'::regclass) +fileindex | integer | not null default 0 +jobid | integer | not null +pathid | integer | not null (FK) +filenameid | integer | not null (FK) +markid | integer | not null default 0 +lstat | text | not null +md5 | text | not null +Indexes: + "file_pkey" PRIMARY KEY, btree (fileid) + "file_fp_idx" btree (filenameid, pathid) + "file_jobid_idx" btree (jobid) + "file_path_idx" btree (pathid) + + Table "bacula.filename" ( 160559 rows) + Column | Type | Modifiers +------------+---------=20 ++--------------------------------------------------------------- +filenameid | integer | not null default nextval=20 +('filename_filenameid_seq'::regclass) +name | text | not null +Indexes: + "filename_pkey" PRIMARY KEY, btree (filenameid) + "filename_name_idx" btree (name) + +And now the query; + +Task: Return the names of subdirectories and files immediately below =20 +a given path. For each none-empty subdirectory return children=3Dtrue. +The 1st part of the union selects all subdirecories (per regex) and =20 +the flatfiles contained in them plus one entry for the subdirectory =20 +itself (left outer joins). More than one joined filename means: "The =20 +subdirectory has children". +The 2nd part of the union returns all flatfiles, contained in the =20 +given path. +The surrounding SELECT removes the given path and the trailing "/" =20 +keeping only the subdirectory names from the pathnames, so they can =20 +be merged with the flatfile names. + +> you're pulling all the entries +> in a directory in two parts. The first +(second) +> part (files) is fairly straightforward. The second +(first) +> part (directories) consists of pulling any file whose parent is a =20 +> subdirectory of the directory you're looking for (this is *all* =20 +> children of the directory, since you have to retrieve every element =20= + +> that begins with the directory, then discard those that have an =20 +> additional / in their name), counting how many of these there are =20 +> for each subdirectory, and discarding those results except for a =20 +> binary (yes there are children or no there aren't). This is a lot =20 +> of useless work to go through, and is going to be slow if you've =20 +> got a lot of stuff in a subdirectory. +I agree, but did not yet find another way. +> An alternative approach would be, for each directory, to store all =20 +> its children (files and subdirectories) along with a flag =20 +> indicating which it is. This would allow you to create the =20 +> collapsed tree view without walking all the children of a =20 +> subdirectory. +Perhaps in a temporary table? +> +> Assuming you can't make changes to the schema, what about the query? +Can be changed. +> You've got this: +Please reconsider your proposals with the above + +> It's hard to say without knowing what's actually *in* the tables, =20 +> but the existing query definately doesn't scale well for what I =20 +> think it's trying to do. +> +> Mike Stone +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 12:23:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 5D22C9FB33A + for ; + Mon, 31 Jul 2006 12:23:01 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 98458-03-2 + for ; + Mon, 31 Jul 2006 12:22:45 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) + by postgresql.org (Postfix) with ESMTP id E48A59FB365 + for ; + Mon, 31 Jul 2006 12:22:19 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.236]) + by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J39001VBXCCUDBD@vms042.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 31 Jul 2006 10:21:49 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 8D76F6E796; Mon, + 31 Jul 2006 11:21:46 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id mDcC4nLMaMB0; Mon, 31 Jul 2006 11:21:44 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id B56276FA46; Mon, 31 Jul 2006 11:21:44 -0400 (EDT) +Date: Mon, 31 Jul 2006 11:21:44 -0400 +From: Michael Stone +Subject: Re: directory tree query with big planner variation +In-reply-to: +To: Axel Rau +Cc: pgsql-performance@postgresql.org +Mail-followup-to: Axel Rau , + pgsql-performance@postgresql.org +Message-id: <20060731152141.GG2900@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> + +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.219 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/313 +X-Sequence-Number: 20173 + +On Mon, Jul 31, 2006 at 05:06:00PM +0200, Axel Rau wrote: +>Please reconsider your proposals with the above + +I'm not sure what you're getting at; could you be more specific? + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jul 31 12:53:30 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 9F96F9FB365 + for ; + Mon, 31 Jul 2006 12:53:29 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 99800-10 for + ; + Mon, 31 Jul 2006 12:53:07 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.206]) + by postgresql.org (Postfix) with ESMTP id 70B289FB336 + for ; + Mon, 31 Jul 2006 12:52:51 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id i11so221425nzi + for ; + Mon, 31 Jul 2006 08:52:40 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=isCavxHnKqDWR89sW9CJzMHX+R7EzLOCELohuQb30OsxIhx5jb40NHhr8BP7QB5GFKY/pzP64mgxJsXCKdEHGEAOYzEVyD90ADwjawE83JLWjnRsDvoVHwknCwR148SrE2YRWOqTXQ/tYQzgkGAJCDVYmsBkVSVSuudRYKt6m94= +Received: by 10.65.97.18 with SMTP id z18mr2113992qbl; + Mon, 31 Jul 2006 08:52:33 -0700 (PDT) +Received: by 10.65.139.10 with HTTP; Mon, 31 Jul 2006 08:52:31 -0700 (PDT) +Message-ID: +Date: Mon, 31 Jul 2006 11:52:31 -0400 +From: "Merlin Moncure" +To: "Jonathan Ballet" +Subject: Re: Performances with new Intel Core* processors +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44CDFD44.8080307@multani.info> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <44CDFD44.8080307@multani.info> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.773 tagged_above=0 required=5 tests=AWL, INFO_TLD, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/314 +X-Sequence-Number: 20174 + +On 7/31/06, Jonathan Ballet wrote: +> Hello, +> +> I've read a lot of mails here saying how good is the Opteron with PostgreSQL, +> and a lot of people seems to recommend it (instead of Xeon). +> + +I am a huge fan of the opteron but intel certainly seems to have a +winner for workstations. from my research on a per core basis the c2d +is a stronger chip with the 4mb cache version but it is unclear which +is a better choice for pg on 4 and 8 core platforms. I have direct +personal experience with pg on dual (4 core) and quad (8 core) opteron +and the performance is fantastic, especially on 64 bit o/s with > 2gb +memory (vs 32 bit xeon). + +also opteron is 64 bit and mature so i think is a better choice for +server platform at the moment, especially for databases. my mind +could be changed but it is too soon right now. consider how long it +took for the opteron to prove itself in the server world. + +merlin + +From pgsql-performance-owner@postgresql.org Mon Jul 31 12:56:16 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 68ADE9FB369 + for ; + Mon, 31 Jul 2006 12:56:15 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 00743-06 for + ; + Mon, 31 Jul 2006 12:55:55 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.DE [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id 4A2DD9FB336 + for ; + Mon, 31 Jul 2006 12:54:55 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7a6O-0006AO-3W; Mon, 31 Jul 2006 17:54:44 +0200 +In-Reply-To: <20060731152141.GG2900@mathom.us> +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> + + <20060731152141.GG2900@mathom.us> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +From: Axel Rau +Subject: Re: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 17:54:41 +0200 +To: Michael Stone +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=3.434 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: *** +X-Archive-Number: 200607/315 +X-Sequence-Number: 20175 + + +Am 31.07.2006 um 17:21 schrieb Michael Stone: + +> On Mon, Jul 31, 2006 at 05:06:00PM +0200, Axel Rau wrote: +>> Please reconsider your proposals with the above +> +> I'm not sure what you're getting at; could you be more specific? +Let's see... + + +Am 31.07.2006 um 15:30 schrieb Michael Stone: +> And then what happens if you try something like SELECT =20 +> X.name,X.children +> FROM (SELECT [rtrim]P.path,(SELECT count(*) FROM bacula.file F +The file table is the biggest one, because it contains one row per =20 +backup job and file (see my column description). +You need the filename table here. +> WHERE F.pathid =3D P.pathid +> LIMIT 2) > 1 +> FROM bacula.path P +> WHERE P.path ~ '^%@/[^/]*/$' +> UNION +> SELECT FN.name,0 +> FROM bacula.path P, bacula.file F, bacula.filename FN +> WHERE +> P.path =3D '%@/' AND +> P.pathid =3D F.pathid AND +> F.filenameid =3D FN.filenameid +> ) AS X +> WHERE X.name <> '' +> GROUP BY X.name + +Tweaking your query and omitting the RTRIM/REPLACE stuff, I get: +------------------------------- +SELECT X.path,X.children +FROM (SELECT P.path,(SELECT count(*) FROM bacula.file F, =20 +bacula.filename FN WHERE F.pathid =3D =20 +P.pathid AND F.filenameid =3D FN.filenameid + LIMIT 2) > 1 AS children + FROM bacula.path P + WHERE P.path ~ '^/Users/axel/ports/[^/]*/$' + UNION + SELECT FN.name,0=3D1 + FROM bacula.path P, bacula.file F, bacula.filename FN + WHERE + P.path =3D '/Users/axel/ports/' AND + P.pathid =3D F.pathid AND + F.filenameid =3D FN.filenameid + ) AS X +WHERE X.path <> '' +GROUP BY X.path, X.children ; + path | children +------------------------------+---------- +.cvsignore | f +/Users/axel/ports/CVS/ | t +/Users/axel/ports/archivers/ | t +INDEX | f +Makefile | f +README | f +(6 rows) + +Time: 35.221 ms +------------------------------- +While my version returns: +------------------------------- + name | children +------------+---------- +.cvsignore | f +archivers | t +CVS | t +INDEX | f +Makefile | f +README | f +(6 rows) + +Time: 30.263 ms +------------+---------- +How would you complete your version? + +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 13:05:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BBE6F9FB33A + for ; + Mon, 31 Jul 2006 13:05:42 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 00728-10 for + ; + Mon, 31 Jul 2006 13:05:24 -0300 (ADT) +X-Greylist: domain auto-whitelisted by SQLgrey- +Received: from nz-out-0102.google.com (nz-out-0102.google.com + [64.233.162.198]) + by postgresql.org (Postfix) with ESMTP id 094C99FB336 + for ; + Mon, 31 Jul 2006 13:04:37 -0300 (ADT) +Received: by nz-out-0102.google.com with SMTP id i11so222808nzi + for ; + Mon, 31 Jul 2006 09:04:26 -0700 (PDT) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; + b=DcqiSIweFH9faAjjfH3NWzuah/0351ZFu/vZBMrYjvk7p+Cqp+HV7Y9g4z6XSWhURVUAKKRk9eAnNI77JDXNDU8R+LyVLls7b+YmQDjW+ZccTjnR4TyFAfsi0JMWjLaKxkHTFUu/358bP/WN5A4L3keqo6BvjBPxiXSYmrCnbRY= +Received: by 10.65.139.9 with SMTP id r9mr4105016qbn; + Mon, 31 Jul 2006 09:04:26 -0700 (PDT) +Received: by 10.65.139.10 with HTTP; Mon, 31 Jul 2006 09:04:26 -0700 (PDT) +Message-ID: +Date: Mon, 31 Jul 2006 12:04:26 -0400 +From: "Merlin Moncure" +To: "Jochem van Dieten" +Subject: Re: PostgreSQL scalability on Sun UltraSparc T1 +Cc: pgsql-performance@postgresql.org +In-Reply-To: <44CB7896.8030501@oli.tudelft.nl> +MIME-Version: 1.0 +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Content-Disposition: inline +References: <44CB7896.8030501@oli.tudelft.nl> +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=2.467 tagged_above=0 required=5 tests=AWL, + SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: ** +X-Archive-Number: 200607/316 +X-Sequence-Number: 20176 + +On 7/29/06, Jochem van Dieten wrote: +> Tweakers.net has done a database performance test between a Sun T2000 (8 +> core T1) and a Sun X4200 (2 dual core Opteron 280). The database +> benchmark is developed inhouse and represents the average query pattern +> from their website. It is MySQL centric because Tweakers.net runs on +> MySQL, but Arjen van der Meijden has ported it to PostgreSQL and has +> done basic optimizations like adding indexes. + +anandtech did a comparison of opteron/xeon/sun t1 not to long ago and +published some mysql/postgresql results. however, they were careful +not to publish the quad core data for pg to compare vs. mysql, which +in my opinion would have shown a blowout victory for pg. (also was pg +8.0). + +the fact is, postgresql is often faster than mysql under real +workloads, especially when utilizing features such as stored +procedures and such. + +merlin + +From pgsql-performance-owner@postgresql.org Mon Jul 31 13:10:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 23F439FB2FB + for ; + Mon, 31 Jul 2006 13:10:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 02458-07 for + ; + Mon, 31 Jul 2006 13:10:03 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from web88007.mail.re2.yahoo.com (web88007.mail.re2.yahoo.com + [206.190.37.194]) + by postgresql.org (Postfix) with SMTP id 4CA019FA26E + for ; + Mon, 31 Jul 2006 13:09:18 -0300 (ADT) +Received: (qmail 37304 invoked by uid 60001); 31 Jul 2006 16:09:02 -0000 +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=rogers.com; + h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; + b=hRxLRCQPpDwGdMOPyziSLyaJZam4DdEKYlIItXvbJ2yjol4AXvS30Xs9G6c6vMizYIN3HvkSLmEgx7qjyYbb89SWYUb9p7JyYRWKJw8lRkm1RJwO41J6tyyux7b8qmyRWQ1QJNP7ZMuZN7jo+EbNQewmfsTn++Pq/zI+guLHwwY= + ; +Message-ID: <20060731160902.37302.qmail@web88007.mail.re2.yahoo.com> +Received: from [216.16.241.206] by web88007.mail.re2.yahoo.com via HTTP; + Mon, 31 Jul 2006 12:09:02 EDT +Date: Mon, 31 Jul 2006 12:09:02 -0400 (EDT) +From: H Hale +Subject: Re: sub select performance due to seq scans +To: pgsql-performance@postgresql.org +In-Reply-To: <14463.1154356126@sss.pgh.pa.us> +MIME-Version: 1.0 +Content-Type: multipart/alternative; boundary="0-151137922-1154362142=:34229" +Content-Transfer-Encoding: 8bit +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=4.004 tagged_above=0 required=5 tests=AWL, + HTML_MESSAGE, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL +X-Spam-Level: **** +X-Archive-Number: 200607/317 +X-Sequence-Number: 20177 + +--0-151137922-1154362142=:34229 +Content-Type: text/plain; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Tom, + + It is unique. + + Indexes: + "flatomfilesysentry_pkey" PRIMARY KEY, btree (objectid) + "capsa_flatomfilesysentry_name_idx" btree (name) + Foreign-key constraints: + "objectid" FOREIGN KEY (objectid) REFERENCES capsa_sys.master(objectid) ON DELETE CASCADE + + +Tom Lane wrote: H Hale writes: +> -> Bitmap Heap Scan on flatomfilesysentry (cost=2.00..274.38 rows=3238 width=30) (actual time=0.011..0.013 rows=1 loops=6473) +> Recheck Cond: (flatomfilesysentry.objectid = "outer".dstobj) +> -> Bitmap Index Scan on flatomfilesysentry_pkey (cost=0.00..2.00 rows=3238 width=0) (actual time=0.007..0.007 rows=1 loops=6473) +> Index Cond: (flatomfilesysentry.objectid = "outer".dstobj) + +Well, there's our estimation failure: 3238 rows expected, one row +actual. + +What is the data distribution of flatomfilesysentry.objectid? +It looks from this example like it is unique or nearly so, +but the planner evidently does not think that. + + regards, tom lane + +---------------------------(end of broadcast)--------------------------- +TIP 5: don't forget to increase your free space map settings + + +--0-151137922-1154362142=:34229 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit + +Tom,

It is unique.

Indexes:
    "flatomfilesysentry_pkey" PRIMARY KEY, btree (objectid)
    "capsa_flatomfilesysentry_name_idx" btree (name)
Foreign-key constraints:
    "objectid" FOREIGN KEY (objectid) REFERENCES capsa_sys.master(objectid) ON DELETE CASCADE


Tom Lane <tgl@sss.pgh.pa.us> wrote:
H Hale writes:
> -> Bitmap Heap Scan on flatomfilesysentry (cost=2.00..274.38 rows=3238 width=30) (actual time=0.011..0.013 rows=1 loops=6473)
> Recheck Cond: (flatomfilesysentry.objectid = "outer".dstobj)
> -> Bitmap Index Scan on flatomfilesysentry_pkey (cost=0.00..2.00 rows=3238 width=0) (actual time=0.007..0.007 rows=1 loops=6473)
> Index Cond: (flatomfilesysentry.objectid = + "outer".dstobj)

Well, there's our estimation failure: 3238 rows expected, one row
actual.

What is the data distribution of flatomfilesysentry.objectid?
It looks from this example like it is unique or nearly so,
but the planner evidently does not think that.

regards, tom lane

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

+--0-151137922-1154362142=:34229-- + +From pgsql-performance-owner@postgresql.org Mon Jul 31 13:19:20 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 188089FA26E + for ; + Mon, 31 Jul 2006 13:19:20 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03964-06 for + ; + Mon, 31 Jul 2006 13:19:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.de [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id B88D69FB2FB + for ; + Mon, 31 Jul 2006 13:19:09 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7aU0-00079j-4G; Mon, 31 Jul 2006 18:19:08 +0200 +In-Reply-To: +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> + + <20060731152141.GG2900@mathom.us> + +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +Message-Id: +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +From: Axel Rau +Subject: Re: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 18:19:06 +0200 +To: Michael Stone +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.602 tagged_above=0 required=5 tests=AWL +X-Spam-Level: * +X-Archive-Number: 200607/318 +X-Sequence-Number: 20178 + + +Am 31.07.2006 um 17:54 schrieb Axel Rau: +> +> Tweaking your query and omitting the RTRIM/REPLACE stuff, I get: +My example did not cover the case of empty subdirectories, in which =20 +case your simplified query fails: +------------------------------- + path | children +------------------------------+---------- +.DS_Store | f +/Users/axel/Projects/ADMIN/ | t +/Users/axel/Projects/DB/ | t +/Users/axel/Projects/HW/ | t +/Users/axel/Projects/JETSEC/ | t +/Users/axel/Projects/MISC/ | t +/Users/axel/Projects/NET/ | t +/Users/axel/Projects/SW/ | t +/Users/axel/Projects/TOOLS/ | t +(9 rows) +------------------------------- +Where it shoould be: +------------------------------- + name | children +-----------+---------- +.DS_Store | f +ADMIN | t +DB | t +HW | f +JETSEC | f +MISC | f +NET | t +SW | t +TOOLS | t +(9 rows) +------------------------------- +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 13:21:34 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4E2F49FB2F2 + for ; + Mon, 31 Jul 2006 13:21:34 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 03579-10 for + ; + Mon, 31 Jul 2006 13:21:29 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.de [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id D30F19FB300 + for ; + Mon, 31 Jul 2006 13:20:59 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7aVm-0002yY-3S; Mon, 31 Jul 2006 18:20:58 +0200 +In-Reply-To: <1154354001.1634.792.camel@archimedes> +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> + <1154354001.1634.792.camel@archimedes> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +Message-Id: <1D01FFCF-2C45-4D8C-A956-50320BDE5FB7@Chaos1.DE> +Cc: Michael Stone , + pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +From: Axel Rau +Subject: Re: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 18:20:56 +0200 +To: Mark Lewis +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.344 tagged_above=0 required=5 tests=AWL +X-Spam-Level: * +X-Archive-Number: 200607/319 +X-Sequence-Number: 20179 + + +Am 31.07.2006 um 15:53 schrieb Mark Lewis: + +> It seems like you might be able to avoid the expensive directory =20 +> lookups +> entirely without changing the schema by defining an immutable function +> dir_depth(path), which would just count the number of forward slashes. +> Then create a functional index on dir_depth(path) and in the query =20 +> do a +> check for directories with a given prefix and the expected dir_depth. +Still I must check for flatfiles in those subdirectories... +See my clarification here + = +http://archives.postgresql.org/pgsql-performance/2006-07/msg00311.php + +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 13:30:26 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BDD379FB34D + for ; + Mon, 31 Jul 2006 13:30:25 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 04236-07 for + ; + Mon, 31 Jul 2006 13:30:21 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from olive.qinip.net (olive.qinip.net [62.100.30.40]) + by postgresql.org (Postfix) with ESMTP id AE05C9FB343 + for ; + Mon, 31 Jul 2006 13:30:21 -0300 (ADT) +Received: from [127.0.0.1] (h8441139206.dsl.speedlinq.nl [84.41.139.206]) + by olive.qinip.net (Postfix) with ESMTP id E847A18178; + Mon, 31 Jul 2006 18:30:17 +0200 (MEST) +Message-ID: <44CE3023.3020402@tweakers.net> +Date: Mon, 31 Jul 2006 18:30:27 +0200 +From: Arjen van der Meijden +User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) +MIME-Version: 1.0 +To: Merlin Moncure +CC: Jonathan Ballet , pgsql-performance@postgresql.org +Subject: Re: Performances with new Intel Core* processors +References: <44CDFD44.8080307@multani.info> + +In-Reply-To: +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +X-Antivirus: avast! (VPS 0631-0, 31-07-2006), Outbound message +X-Antivirus-Status: Clean +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.637 tagged_above=0 required=5 tests=AWL, INFO_TLD +X-Spam-Level: +X-Archive-Number: 200607/320 +X-Sequence-Number: 20180 + +On 31-7-2006 17:52, Merlin Moncure wrote: +> On 7/31/06, Jonathan Ballet wrote: +>> Hello, +>> +>> I've read a lot of mails here saying how good is the Opteron with +>> PostgreSQL, +>> and a lot of people seems to recommend it (instead of Xeon). +> +> I am a huge fan of the opteron but intel certainly seems to have a +> winner for workstations. from my research on a per core basis the c2d +> is a stronger chip with the 4mb cache version but it is unclear which +> is a better choice for pg on 4 and 8 core platforms. I have direct +> personal experience with pg on dual (4 core) and quad (8 core) opteron +> and the performance is fantastic, especially on 64 bit o/s with > 2gb +> memory (vs 32 bit xeon). + +As far as I know there is no support for more than two Woodcrest +processors (Core 2 version of the Xeon) in a system. So when using a +scalable application (like postgresql) and you need more than four +cores, Opteron is still the only option in the x86 world. + +The Woodcrest however is faster than a comparably priced Opteron using +Postgresql. In a benchmark we did (and have yet to publish) a Woodcrest +system outperforms a comparable Sun Fire x4200. And even if you'd adjust +it to a clock-by-clock comparison, Woodcrest would still beat the +Opteron. If you'd adjust it to a price/performance comparison (I +configured a HP DL 380G5-system which is similar to what we tested on +their website), the x4200 would loose as well. Mind you a Opteron 280 +2.4Ghz or 285 2.6Ghz costs more than a Woodcrest 5150 2.66Ghz or 5160 +3Ghz (resp.), but the FB-Dimm memory for the Xeons is more expensive +than the DDR or DDR2 ECC REG memory you need in a Opteron. + +> also opteron is 64 bit and mature so i think is a better choice for +> server platform at the moment, especially for databases. my mind +> could be changed but it is too soon right now. consider how long it +> took for the opteron to prove itself in the server world. + +Intel Woodcrest can do 64-bit as well. As can all recent Xeons. Whether +Opteron does a better job at 64-bit than a Xeon, I don't know (our test +was in 64-bit though). I have not seen our Xeon 64-bits production +servers be any less stable than our Opteron 64-bit servers. +For a database system, however, processors hardly ever are the main +bottleneck, are they? So you should probably go for a set of "fast +processors" from your favorite supplier and focus mainly on lots of +memory and fast disks. Whether that employs Opterons or Xeon Woodcrest +(no other Xeons are up to that competition, imho) doesn't really matter. + +We'll be publishing the article in the near future, and I'll give a +pointer to it (even though it will be in Dutch, you can still read the +graphs). + +Best regards, + +Arjen van der Meijden +Tweakers.net + +From pgsql-performance-owner@postgresql.org Mon Jul 31 14:09:43 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 17DF39FB32C + for ; + Mon, 31 Jul 2006 14:09:43 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 08029-07 for + ; + Mon, 31 Jul 2006 14:09:32 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) + by postgresql.org (Postfix) with ESMTP id 978179FB34A + for ; + Mon, 31 Jul 2006 14:09:02 -0300 (ADT) +Received: from osgiliath.mathom.us ([72.66.113.236]) + by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 + (built Sep + 9 2005)) with ESMTPA id <0J3A004WT2AHV2K7@vms044.mailsrvcs.net> for + pgsql-performance@postgresql.org; Mon, 31 Jul 2006 12:08:42 -0500 (CDT) +Received: from localhost (localhost [127.0.0.1]) + by osgiliath.mathom.us (Postfix) with ESMTP id 403476E796; Mon, + 31 Jul 2006 13:08:39 -0400 (EDT) +Received: from osgiliath.mathom.us ([127.0.0.1]) + by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, + port 10024) + with LMTP id hXfY6CWhZRZr; Mon, 31 Jul 2006 13:08:37 -0400 (EDT) +Received: by osgiliath.mathom.us (Postfix, from userid 1000) + id AE94F6FA49; Mon, 31 Jul 2006 13:08:37 -0400 (EDT) +Date: Mon, 31 Jul 2006 13:08:36 -0400 +From: Michael Stone +Subject: Re: directory tree query with big planner variation +In-reply-to: +To: Axel Rau +Cc: pgsql-performance@postgresql.org +Mail-followup-to: Axel Rau , + pgsql-performance@postgresql.org +Message-id: <20060731170833.GH2900@mathom.us> +MIME-version: 1.0 +Content-type: text/plain; charset=us-ascii; format=flowed +Content-disposition: inline +X-Virus-Scanned: Debian amavisd-new at mathom.us +X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> + + <20060731152141.GG2900@mathom.us> + +User-Agent: Mutt/1.5.12-2006-07-14 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.527 tagged_above=0 required=5 tests=AWL, + FORGED_RCVD_HELO, SPF_PASS +X-Spam-Level: * +X-Archive-Number: 200607/321 +X-Sequence-Number: 20181 + +On Mon, Jul 31, 2006 at 05:54:41PM +0200, Axel Rau wrote: +>The file table is the biggest one, because it contains one row per +>backup job and file (see my column description). + +I never saw a column description--that would certainly help. :) I saw a +schema, but not an explanation of what the elements do. From what I can +understand of what you're saying, it is sounding as though the +bacula.file table contains an entry for the subdirectory itself as well +as entries for each file in the subdirectory? And the reason you need to +join back to the filename table is that there may be multiple copies of +the filename from multiple backups? Does the subdirectory itself have an +entry in the filename table? What is the content of the lstat column; can +it be used to distinguish a file from a directory? Similarly for the md5 +column--what would it contain for a directory? + +Mike Stone + +From pgsql-performance-owner@postgresql.org Mon Jul 31 15:49:51 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id DA5F19FB332 + for ; + Mon, 31 Jul 2006 15:49:49 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 18774-02 for + ; + Mon, 31 Jul 2006 15:49:34 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from mail1.chaos1.de (Mail1.Chaos1.de [213.160.12.53]) + by postgresql.org (Postfix) with ESMTP id 978DA9FB334 + for ; + Mon, 31 Jul 2006 15:49:04 -0300 (ADT) +Received: from claudius6.in.chaos1.de ([192.168.220.106]) + by mail1.chaos1.de with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.44) + id 1G7cp4-0000iS-6D; Mon, 31 Jul 2006 20:49:02 +0200 +In-Reply-To: <20060731170833.GH2900@mathom.us> +References: <79BB9B3D-BCE5-46AA-82DF-BB6B1D0FE2A7@Chaos1.DE> + <20060731111540.GE2900@mathom.us> + + <20060731133034.GF2900@mathom.us> + + <20060731152141.GG2900@mathom.us> + + <20060731170833.GH2900@mathom.us> +Mime-Version: 1.0 (Apple Message framework v752.2) +Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed +Message-Id: <42955802-E96D-4199-9129-318F514FCDC6@Chaos1.DE> +Cc: pgsql-performance@postgresql.org +Content-Transfer-Encoding: quoted-printable +From: Axel Rau +Subject: Re: directory tree query with big planner variation +Date: Mon, 31 Jul 2006 20:49:00 +0200 +To: Michael Stone +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=1.152 tagged_above=0 required=5 tests=AWL +X-Spam-Level: * +X-Archive-Number: 200607/322 +X-Sequence-Number: 20182 + + +Am 31.07.2006 um 19:08 schrieb Michael Stone: + +> I never saw a column description--that would certainly help. :) I =20 +> saw a schema, but not an explanation of what the elements do. =46rom =20= + +> what I can understand of what you're saying, it is sounding as =20 +> though the bacula.file table contains an entry for the subdirectory =20= + +> itself as well as entries for each file in the subdirectory? +It is the junction relation between path and filename and job and =20 +describes +1. which files (identified by bacula.filename) are in a directory =20 +(identified by bacula.path) +2. For each of those files they record a snapshot with =20 +characteristics (lstat [base64 encoded], md5-checksum and a backup-=20 +job [via jobid], which itself has backup-time etc.) +> And the reason you need to join back to the filename table is that =20 +> there may be multiple copies of the filename from multiple backups? +One entry per backup(job) for each bacula.path/bacula.filename pair =20 +in bacula.file. +> Does the subdirectory itself have an entry in the filename table? +Yes. Directories reference an entry containing '' in =20 +bacula.filename.name. +> What is the content of the lstat column +File status info -- see stat(2). +> ; can it be used to distinguish a file from a directory? +Yes, the S_IFDIR bit identifies directories, but the whole lstat =20 +column is base64 encoded +> Similarly for the md5 column--what would it contain for a directory? +It seems to contain 0. + +Axel +Axel Rau, =E2=98=80Frankfurt , Germany = ++49-69-951418-0 + + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 16:57:47 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id BA4039FB262 + for ; + Mon, 31 Jul 2006 16:57:46 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 23818-07 for + ; + Mon, 31 Jul 2006 16:57:42 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from momjian.us (momjian.us [70.90.9.53]) + by postgresql.org (Postfix) with ESMTP id C512E9FB332 + for ; + Mon, 31 Jul 2006 16:57:11 -0300 (ADT) +Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id + k6VJv3P29519; + Mon, 31 Jul 2006 15:57:03 -0400 (EDT) +From: Bruce Momjian +Message-Id: <200607311957.k6VJv3P29519@momjian.us> +Subject: Re: Performances with new Intel Core* processors +In-Reply-To: <44CE3023.3020402@tweakers.net> +To: Arjen van der Meijden +Date: Mon, 31 Jul 2006 15:57:03 -0400 (EDT) +CC: Merlin Moncure , Jonathan Ballet , + pgsql-performance@postgresql.org +X-Mailer: ELM [version 2.4ME+ PL122k (25)] +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; charset="US-ASCII" +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.708 tagged_above=0 required=5 tests=AWL, INFO_TLD, + SPF_HELO_PASS, SPF_PASS +X-Spam-Level: +X-Archive-Number: 200607/323 +X-Sequence-Number: 20183 + + +Good to know. We have been waiting for performance comparisons on +the new Intel CPUs. + +--------------------------------------------------------------------------- + +Arjen van der Meijden wrote: +> On 31-7-2006 17:52, Merlin Moncure wrote: +> > On 7/31/06, Jonathan Ballet wrote: +> >> Hello, +> >> +> >> I've read a lot of mails here saying how good is the Opteron with +> >> PostgreSQL, +> >> and a lot of people seems to recommend it (instead of Xeon). +> > +> > I am a huge fan of the opteron but intel certainly seems to have a +> > winner for workstations. from my research on a per core basis the c2d +> > is a stronger chip with the 4mb cache version but it is unclear which +> > is a better choice for pg on 4 and 8 core platforms. I have direct +> > personal experience with pg on dual (4 core) and quad (8 core) opteron +> > and the performance is fantastic, especially on 64 bit o/s with > 2gb +> > memory (vs 32 bit xeon). +> +> As far as I know there is no support for more than two Woodcrest +> processors (Core 2 version of the Xeon) in a system. So when using a +> scalable application (like postgresql) and you need more than four +> cores, Opteron is still the only option in the x86 world. +> +> The Woodcrest however is faster than a comparably priced Opteron using +> Postgresql. In a benchmark we did (and have yet to publish) a Woodcrest +> system outperforms a comparable Sun Fire x4200. And even if you'd adjust +> it to a clock-by-clock comparison, Woodcrest would still beat the +> Opteron. If you'd adjust it to a price/performance comparison (I +> configured a HP DL 380G5-system which is similar to what we tested on +> their website), the x4200 would loose as well. Mind you a Opteron 280 +> 2.4Ghz or 285 2.6Ghz costs more than a Woodcrest 5150 2.66Ghz or 5160 +> 3Ghz (resp.), but the FB-Dimm memory for the Xeons is more expensive +> than the DDR or DDR2 ECC REG memory you need in a Opteron. +> +> > also opteron is 64 bit and mature so i think is a better choice for +> > server platform at the moment, especially for databases. my mind +> > could be changed but it is too soon right now. consider how long it +> > took for the opteron to prove itself in the server world. +> +> Intel Woodcrest can do 64-bit as well. As can all recent Xeons. Whether +> Opteron does a better job at 64-bit than a Xeon, I don't know (our test +> was in 64-bit though). I have not seen our Xeon 64-bits production +> servers be any less stable than our Opteron 64-bit servers. +> For a database system, however, processors hardly ever are the main +> bottleneck, are they? So you should probably go for a set of "fast +> processors" from your favorite supplier and focus mainly on lots of +> memory and fast disks. Whether that employs Opterons or Xeon Woodcrest +> (no other Xeons are up to that competition, imho) doesn't really matter. +> +> We'll be publishing the article in the near future, and I'll give a +> pointer to it (even though it will be in Dutch, you can still read the +> graphs). +> +> Best regards, +> +> Arjen van der Meijden +> Tweakers.net +> +> ---------------------------(end of broadcast)--------------------------- +> TIP 6: explain analyze is your friend + +-- + Bruce Momjian bruce@momjian.us + EnterpriseDB http://www.enterprisedb.com + + + If your life is a hard drive, Christ can be your backup. + + +From pgsql-performance-owner@postgresql.org Mon Jul 31 17:28:01 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id 4D4739FB30A + for ; + Mon, 31 Jul 2006 17:28:00 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 27283-04 for + ; + Mon, 31 Jul 2006 17:27:48 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from exchange.g2switchworks.com (mail.g2switchworks.com + [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id C56C09FB36C + for ; + Mon, 31 Jul 2006 17:27:47 -0300 (ADT) +Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com + ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; + Mon, 31 Jul 2006 20:27:45 +0000 +Received: from state.g2switchworks.com by mail.g2switchworks.com; + 31 Jul 2006 15:27:45 -0500 +Subject: Re: Performances with new Intel Core* processors +From: Scott Marlowe +To: Arjen van der Meijden +Cc: Merlin Moncure , Jonathan Ballet , + pgsql-performance@postgresql.org +In-Reply-To: <44CE3023.3020402@tweakers.net> +References: <44CDFD44.8080307@multani.info> + + <44CE3023.3020402@tweakers.net> +Content-Type: text/plain +Content-Transfer-Encoding: 7bit +Message-Id: <1154377665.6095.16.camel@state.g2switchworks.com> +Mime-Version: 1.0 +X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) +Date: Mon, 31 Jul 2006 15:27:45 -0500 +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Spam-Status: No, hits=0.088 tagged_above=0 required=5 tests=AWL, SPF_PASS, + UNPARSEABLE_RELAY +X-Spam-Level: +X-Archive-Number: 200607/324 +X-Sequence-Number: 20184 + +On Mon, 2006-07-31 at 11:30, Arjen van der Meijden wrote: +> On 31-7-2006 17:52, Merlin Moncure wrote: + +> For a database system, however, processors hardly ever are the main +> bottleneck, are they? So you should probably go for a set of "fast +> processors" from your favorite supplier and focus mainly on lots of +> memory and fast disks. Whether that employs Opterons or Xeon Woodcrest +> (no other Xeons are up to that competition, imho) doesn't really matter. + +Just making a quick comment here. While the CPU core itself nowadays +certainly is not the most common bottleneck for a fast db server, the +ability of the CPU/Memory combo to act as a datapump IS often a limit. + +In that case, you want to go with whichever setup gives you the fastest +access to memory. + +From pgsql-performance-owner@postgresql.org Mon Jul 31 18:05:19 2006 +X-Original-To: pgsql-performance-postgresql.org@postgresql.org +Received: from localhost (mx1.hub.org [200.46.208.251]) + by postgresql.org (Postfix) with ESMTP id E37919FB36E + for ; + Mon, 31 Jul 2006 18:05:18 -0300 (ADT) +Received: from postgresql.org ([200.46.204.71]) + by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) + with ESMTP id 30395-04 for + ; + Mon, 31 Jul 2006 18:05:09 -0300 (ADT) +X-Greylist: from auto-whitelisted by SQLgrey- +Received: from yertle.kcilink.com (yertle.kcilink.com [65.205.34.180]) + by postgresql.org (Postfix) with ESMTP id 2A6369FB30A + for ; + Mon, 31 Jul 2006 18:04:38 -0300 (ADT) +Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) + by yertle.kcilink.com (Postfix) with ESMTP id 9F590B829 + for ; + Mon, 31 Jul 2006 17:04:37 -0400 (EDT) +Mime-Version: 1.0 (Apple Message framework v752.2) +In-Reply-To: <44CE3023.3020402@tweakers.net> +References: <44CDFD44.8080307@multani.info> + + <44CE3023.3020402@tweakers.net> +Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-1--20981746; + protocol="application/pkcs7-signature" +Message-Id: +From: Vivek Khera +Subject: Re: Performances with new Intel Core* processors +Date: Mon, 31 Jul 2006 17:04:37 -0400 +To: "Pgsql-Performance ((E-mail))" +X-Mailer: Apple Mail (2.752.2) +X-Virus-Scanned: Maia Mailguard 1.0.1 +X-Archive-Number: 200607/325 +X-Sequence-Number: 20185 + + +--Apple-Mail-1--20981746 +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=US-ASCII; + delsp=yes; + format=flowed + + +On Jul 31, 2006, at 12:30 PM, Arjen van der Meijden wrote: + +> For a database system, however, processors hardly ever are the main +> bottleneck, are they? So you should probably go for a set of "fast +> processors" from your favorite supplier and focus mainly on lots of +> memory and fast disks. Whether that employs Opterons or Xeon +> Woodcrest (no other Xeons are up to that + +No, but it *does* matter how fast said processor can sling the memory +around, and in my experience, the opterons have been much better at +that due to the efficiency of the memory transport layer. +--Apple-Mail-1--20981746 +Content-Transfer-Encoding: base64 +Content-Type: application/pkcs7-signature; + name=smime.p7s +Content-Disposition: attachment; + filename=smime.p7s + +MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGlDCCAz8w +ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 +ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx +KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 +ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA +dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB +MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg +UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +xKY8VXNV+065yplaHmjAdQRwnd/p/6Me7L3N9VvyGna9fww6YfK/Uc4B1OVQCjDXAmNaLIkVcI7d +yfArhVqqP3FWy688Cwfn8R+RNiQqE88r1fOCdz0Dviv+uxg+B79AgAJk16emu59l0cUqVIUPSAR/ +p7bRPGEEQB5kGXJgt/sCAwEAAaOBlDCBkTASBgNVHRMBAf8ECDAGAQH/AgEAMEMGA1UdHwQ8MDow +OKA2oDSGMmh0dHA6Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVQZXJzb25hbEZyZWVtYWlsQ0EuY3Js +MAsGA1UdDwQEAwIBBjApBgNVHREEIjAgpB4wHDEaMBgGA1UEAxMRUHJpdmF0ZUxhYmVsMi0xMzgw +DQYJKoZIhvcNAQEFBQADgYEASIzRUIPqCy7MDaNmrGcPf6+svsIXoUOWlJ1/TCG4+DYfqi2fNi/A +9BxQIJNwPP2t4WFiw9k6GX6EsZkbAMUaC4J0niVQlGLH2ydxVyWN3amcOY6MIE9lX5Xa9/eH1sYI +Tq726jTlEBpbNU1341YheILcIRk13iSx0x1G/11fZU8wggNNMIICtqADAgECAhA6sDoA4m3lcimf +yUtGSQgmMA0GCSqGSIb3DQEBBAUAMGIxCzAJBgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29u +c3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNz +dWluZyBDQTAeFw0wNjA1MDIxNDEyNDdaFw0wNzA1MDIxNDEyNDdaMIGKMR8wHQYDVQQDExZUaGF3 +dGUgRnJlZW1haWwgTWVtYmVyMR4wHAYJKoZIhvcNAQkBFg92aXZla0BraGVyYS5vcmcxIDAeBgkq +hkiG9w0BCQEWEWtoZXJhQGtjaWxpbmsuY29tMSUwIwYJKoZIhvcNAQkBFhZ2aXZla0BtYWlsZXJt +YWlsZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq+zHKYq9vZ4Dq1itNqT/ +OeJvWDvQ5JdQlRzwsJlvtJBknXsnOaJNabmjnu2s6XFMcP2srBZQ/WPvhsClajLQOcxnarrfB66N +DpMzXTxfYzX6m9TA/fEn64sNn+YnBZL6Dvid9kiAgP9LmqcTOIFdWUya3ZmQS5YTuLB+tkFSL8/h ++inDPN6dcsna8TcM1SAk+3upxOR7kyFM9T3vy25w62Nh1zK7Stp0vUZLU6GzzC1VvHGZHKGticD6 +o3uHaMr2LCFjptoIcfZL75LO/UaR9o7smgboW4yJyW5g9ZasyYQUXyvkitfyZuVWATb8ZSHOkjWJ +872Pyf5+HOevVUI0aQIDAQABo1cwVTBFBgNVHREEPjA8gQ92aXZla0BraGVyYS5vcmeBEWtoZXJh +QGtjaWxpbmsuY29tgRZ2aXZla0BtYWlsZXJtYWlsZXIuY29tMAwGA1UdEwEB/wQCMAAwDQYJKoZI +hvcNAQEEBQADgYEAYpaFKDj47pTQIUQi28MgtjKophopv4QJjvspXmy0qxd8t/M/zc7HuBy3i/9a +PrXDgKyNBzzlFTasTazAY53ntVpqw9k1NOeHmH6o3j/DBVa49bC6bbWfp9UGOwYChlDR0tngQZyC +MDMZEdYv4zpGfBTku5m1jb8Yz/qYqV4FWB4xggMQMIIDDAIBATB2MGIxCzAJBgNVBAYTAlpBMSUw +IwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUgUGVy +c29uYWwgRnJlZW1haWwgSXNzdWluZyBDQQIQOrA6AOJt5XIpn8lLRkkIJjAJBgUrDgMCGgUAoIIB +bzAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0wNjA3MzEyMTA0Mzda +MCMGCSqGSIb3DQEJBDEWBBQnHV9Ddx9H6jDnbqAJTH10Qn5xpDCBhQYJKwYBBAGCNxAEMXgwdjBi +MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoG +A1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElzc3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJ +CCYwgYcGCyqGSIb3DQEJEAILMXigdjBiMQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENv +bnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNvbmFsIEZyZWVtYWlsIElz +c3VpbmcgQ0ECEDqwOgDibeVyKZ/JS0ZJCCYwDQYJKoZIhvcNAQEBBQAEggEAUJOfIDVa4bQojNbp +RslToh5CUu8RJwz8IUwoWCW6lmeGJ2nPOfySnp3uYaMDBwYGpu3FTqXhyD619QAU/mwk2axzUljc +NPzIT2FIfEbSwijOLRfUtBvOMew07TX8TmLNNEUv7bevGOF1kT0TEUdhs7YnCFUwQfWvqQUJ8NGQ +Q5Oj0iucs9C+H+nOK4c+k4yv+NIgWu4ZBsIQE3HCtE2jKXra/WHqliIxU3e6ZNfKHvQTc6+q/FgK +CDql4tlYQjQ1rs2yBenX/cArs1JE9PwP/BxOUzwPG9SxIuTERCwOREO2XCfrQpy9EssPbxkps/8Q +8iIp6q5lLkDYCBM3yZG+DAAAAAAAAA== + +--Apple-Mail-1--20981746-- +